[Add] Show free cargo space in commodity window.
This commit is contained in:
parent
e256a1a4d0
commit
1ae475fcdf
24
src/land.c
24
src/land.c
@ -89,15 +89,17 @@ static void commodity_exchange(void) {
|
|||||||
(BUTTON_WIDTH-20)/2, BUTTON_HEIGHT, "btnCommoditySell",
|
(BUTTON_WIDTH-20)/2, BUTTON_HEIGHT, "btnCommoditySell",
|
||||||
"Sell", commodity_sell);
|
"Sell", commodity_sell);
|
||||||
|
|
||||||
window_addText(secondary_wid, -20, -40, BUTTON_WIDTH, 20, 0,
|
window_addText(secondary_wid, -20, -40, BUTTON_WIDTH, 60, 0,
|
||||||
"txtSInfo", &gl_smallFont, &cDConsole,
|
"txtSInfo", &gl_smallFont, &cDConsole,
|
||||||
"You have:\n"
|
"You have:\n"
|
||||||
"Market price:\n");
|
"Market price:\n"
|
||||||
|
"\n"
|
||||||
|
"Free Space:\n");
|
||||||
|
|
||||||
window_addText(secondary_wid, -20, -40, BUTTON_WIDTH/2, 20, 0,
|
window_addText(secondary_wid, -20, -40, BUTTON_WIDTH/2, 60, 0,
|
||||||
"txtDInfo", &gl_smallFont, &cBlack, NULL);
|
"txtDInfo", &gl_smallFont, &cBlack, NULL);
|
||||||
|
|
||||||
window_addText(secondary_wid, -40, -80, BUTTON_WIDTH-20,
|
window_addText(secondary_wid, -40, -100, BUTTON_WIDTH-20,
|
||||||
BUTTON_WIDTH, 0, "txtDesc", &gl_smallFont, &cBlack, NULL);
|
BUTTON_WIDTH, 0, "txtDesc", &gl_smallFont, &cBlack, NULL);
|
||||||
|
|
||||||
goods = malloc(sizeof(char*)*planet->ncommodities);
|
goods = malloc(sizeof(char*)*planet->ncommodities);
|
||||||
@ -126,10 +128,13 @@ static void commodity_update(char* str) {
|
|||||||
com = commodity_get(comname);
|
com = commodity_get(comname);
|
||||||
|
|
||||||
snprintf(buf, 128,
|
snprintf(buf, 128,
|
||||||
"%d\n"
|
"%d tons\n"
|
||||||
"%d Screds/ton\n",
|
"%d Scred\n"
|
||||||
player_cargoOwned(comname),
|
"\n"
|
||||||
com->medium);
|
"%d tons\n",
|
||||||
|
player_cargoOwned(comname),
|
||||||
|
com->medium,
|
||||||
|
player->cargo_free);
|
||||||
|
|
||||||
window_modifyText(secondary_wid, "txtDInfo", buf);
|
window_modifyText(secondary_wid, "txtDInfo", buf);
|
||||||
window_modifyText(secondary_wid, "txtDesc", com->description);
|
window_modifyText(secondary_wid, "txtDesc", com->description);
|
||||||
@ -201,7 +206,8 @@ static void outfits(void) {
|
|||||||
window_addImage(secondary_wid, -20-128, -50-128, "imgOutfit", NULL);
|
window_addImage(secondary_wid, -20-128, -50-128, "imgOutfit", NULL);
|
||||||
|
|
||||||
window_addCust(secondary_wid, -40-BUTTON_WIDTH, 60+2*BUTTON_HEIGHT,
|
window_addCust(secondary_wid, -40-BUTTON_WIDTH, 60+2*BUTTON_HEIGHT,
|
||||||
BUTTON_WIDTH, BUTTON_HEIGHT, "cstMod", 0, outfits_renderMod, NULL);
|
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||||
|
"cstMod", 0, outfits_renderMod, NULL);
|
||||||
|
|
||||||
window_addText(secondary_wid, 40+200+20, -60,
|
window_addText(secondary_wid, 40+200+20, -60,
|
||||||
80, 96, 0, "txtSDesc", &gl_smallFont, &cDConsole,
|
80, 96, 0, "txtSDesc", &gl_smallFont, &cDConsole,
|
||||||
|
20
src/pilot.h
20
src/pilot.h
@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
#define HYPERSPACE_ENGINE_DELAY 3000 // Warm up the engines.
|
#define HYPERSPACE_ENGINE_DELAY 3000 // Warm up the engines.
|
||||||
#define HYPERSPACE_FLY_DELAY 5000 // Time taken to hyperspace.
|
#define HYPERSPACE_FLY_DELAY 5000 // Time taken to hyperspace.
|
||||||
#define HYPERSPACE_STARS_BLUR 2000 // Time stars blur.
|
#define HYPERSPACE_STARS_BLUR 2000 // Time stars blur.
|
||||||
#define HYPERSPACE_STARS_LENGTH 1000 // Length the stars blur to at max.
|
#define HYPERSPACE_STARS_LENGTH 1000 // Length the stars blur to at max.
|
||||||
#define HYPERSPACE_FADEOUT 1000 // Time fadeout.
|
#define HYPERSPACE_FADEOUT 1000 // Time fadeout.
|
||||||
|
|
||||||
// Aproximation for pilot size.
|
// Aproximation for pilot size.
|
||||||
#define PILOT_SIZE_APROX 0.8
|
#define PILOT_SIZE_APROX 0.8
|
||||||
@ -30,11 +30,11 @@
|
|||||||
// Dynamic.
|
// Dynamic.
|
||||||
#define PILOT_HOSTILE (1<<1) // Pilot is hostile to the player.
|
#define PILOT_HOSTILE (1<<1) // Pilot is hostile to the player.
|
||||||
#define PILOT_COMBAT (1<<2) // Pilot is engaged in combat.
|
#define PILOT_COMBAT (1<<2) // Pilot is engaged in combat.
|
||||||
#define PILOT_AFTERBURNER (1<<3) // Pilot has her afterburner activated.
|
#define PILOT_AFTERBURNER (1<<3) // Pilot has her afterburner activated.
|
||||||
#define PILOT_HYP_PREP (1<<5) // Pilot is getting ready for hyperspace.
|
#define PILOT_HYP_PREP (1<<5) // Pilot is getting ready for hyperspace.
|
||||||
#define PILOT_HYP_BEGIN (1<<6) // Pilot is starting engines.
|
#define PILOT_HYP_BEGIN (1<<6) // Pilot is starting engines.
|
||||||
#define PILOT_HYPERSPACE (1<<7) // Pilot is in hyperspace.
|
#define PILOT_HYPERSPACE (1<<7) // Pilot is in hyperspace.
|
||||||
#define PILOT_BOARDED (1<<8) // Pilot has been boarded already!
|
#define PILOT_BOARDED (1<<8) // Pilot has been boarded already!
|
||||||
#define PILOT_DISABLED (1<<9) // Pilot is disabled.
|
#define PILOT_DISABLED (1<<9) // Pilot is disabled.
|
||||||
#define PILOT_DEAD (1<<10) // Pilot is on it's death bed.
|
#define PILOT_DEAD (1<<10) // Pilot is on it's death bed.
|
||||||
#define PILOT_EXPLODED (1<<11) // Pilot did final death explosion.
|
#define PILOT_EXPLODED (1<<11) // Pilot did final death explosion.
|
||||||
@ -57,15 +57,15 @@ typedef struct PilotCommodity_ {
|
|||||||
|
|
||||||
// Primary pilot structure.
|
// Primary pilot structure.
|
||||||
typedef struct Pilot_ {
|
typedef struct Pilot_ {
|
||||||
unsigned int id; // Pilots id.
|
unsigned int id; // Pilots id.
|
||||||
char* name; // Pilot's name (if unique).
|
char* name; // Pilot's name (if unique).
|
||||||
|
|
||||||
Faction* faction;
|
Faction* faction;
|
||||||
|
|
||||||
// Object characteristics.
|
// Object characteristics.
|
||||||
Ship* ship; // Pilots ship.
|
Ship* ship; // Pilots ship.
|
||||||
Solid* solid; // Associated solid (physics).
|
Solid* solid; // Associated solid (physics).
|
||||||
int tsx, tsy; // Current sprite, calculated on update.
|
int tsx, tsy; // Current sprite, calculated on update.
|
||||||
|
|
||||||
double thrust, turn, speed;
|
double thrust, turn, speed;
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ typedef struct Pilot_ {
|
|||||||
// Outfit management.
|
// Outfit management.
|
||||||
PilotOutfit* outfits;
|
PilotOutfit* outfits;
|
||||||
int noutfits;
|
int noutfits;
|
||||||
PilotOutfit* secondary; // Secondary weapon.
|
PilotOutfit* secondary; // Secondary weapon.
|
||||||
PilotOutfit* ammo; // Secondary ammo (if needed).
|
PilotOutfit* ammo; // Secondary ammo (if needed).
|
||||||
PilotOutfit* afterburner; // Ze afterburner.
|
PilotOutfit* afterburner; // Ze afterburner.
|
||||||
|
|
||||||
// Cargo.
|
// Cargo.
|
||||||
|
Loading…
Reference in New Issue
Block a user