[Add] Show free cargo space in commodity window.

This commit is contained in:
Allanis 2013-03-21 23:02:40 +00:00
parent e256a1a4d0
commit 1ae475fcdf
2 changed files with 25 additions and 19 deletions

View File

@ -89,15 +89,17 @@ static void commodity_exchange(void) {
(BUTTON_WIDTH-20)/2, BUTTON_HEIGHT, "btnCommoditySell",
"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,
"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);
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);
goods = malloc(sizeof(char*)*planet->ncommodities);
@ -126,10 +128,13 @@ static void commodity_update(char* str) {
com = commodity_get(comname);
snprintf(buf, 128,
"%d\n"
"%d Screds/ton\n",
player_cargoOwned(comname),
com->medium);
"%d tons\n"
"%d Scred\n"
"\n"
"%d tons\n",
player_cargoOwned(comname),
com->medium,
player->cargo_free);
window_modifyText(secondary_wid, "txtDInfo", buf);
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_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,
80, 96, 0, "txtSDesc", &gl_smallFont, &cDConsole,

View File

@ -12,9 +12,9 @@
#define HYPERSPACE_ENGINE_DELAY 3000 // Warm up the engines.
#define HYPERSPACE_FLY_DELAY 5000 // Time taken to hyperspace.
#define HYPERSPACE_STARS_BLUR 2000 // Time stars blur.
#define HYPERSPACE_STARS_LENGTH 1000 // Length the stars blur to at max.
#define HYPERSPACE_FADEOUT 1000 // Time fadeout.
#define HYPERSPACE_STARS_BLUR 2000 // Time stars blur.
#define HYPERSPACE_STARS_LENGTH 1000 // Length the stars blur to at max.
#define HYPERSPACE_FADEOUT 1000 // Time fadeout.
// Aproximation for pilot size.
#define PILOT_SIZE_APROX 0.8
@ -30,11 +30,11 @@
// Dynamic.
#define PILOT_HOSTILE (1<<1) // Pilot is hostile to the player.
#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_BEGIN (1<<6) // Pilot is starting engines.
#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_DEAD (1<<10) // Pilot is on it's death bed.
#define PILOT_EXPLODED (1<<11) // Pilot did final death explosion.
@ -57,15 +57,15 @@ typedef struct PilotCommodity_ {
// Primary pilot structure.
typedef struct Pilot_ {
unsigned int id; // Pilots id.
char* name; // Pilot's name (if unique).
unsigned int id; // Pilots id.
char* name; // Pilot's name (if unique).
Faction* faction;
// Object characteristics.
Ship* ship; // Pilots ship.
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;
@ -82,8 +82,8 @@ typedef struct Pilot_ {
// Outfit management.
PilotOutfit* outfits;
int noutfits;
PilotOutfit* secondary; // Secondary weapon.
PilotOutfit* ammo; // Secondary ammo (if needed).
PilotOutfit* secondary; // Secondary weapon.
PilotOutfit* ammo; // Secondary ammo (if needed).
PilotOutfit* afterburner; // Ze afterburner.
// Cargo.