[Change] Cleaned up a refuel checks. Missed them a long time ago.

This commit is contained in:
Allanis 2014-06-05 20:37:31 +01:00
parent e45909e9aa
commit 756aac2bac

View File

@ -512,6 +512,7 @@ static void outfits_buy(unsigned int wid, char* str) {
player->credits -= outfit->price * pilot_addOutfit(player, outfit, player->credits -= outfit->price * pilot_addOutfit(player, outfit,
MIN(q, outfit->max)); MIN(q, outfit->max));
land_checkAddRefuel();
outfits_update(wid, NULL); outfits_update(wid, NULL);
} }
@ -1346,7 +1347,6 @@ static void land_checkAddRefuel(void) {
/* Land the player. */ /* Land the player. */
void land(Planet* p) { void land(Planet* p) {
char buf[32], cred[16];
glTexture* logo; glTexture* logo;
int offset; int offset;
@ -1401,19 +1401,9 @@ void land(Planet* p) {
window_addButton(land_wid, 20, 20 + BUTTON_HEIGHT + 20, window_addButton(land_wid, 20, 20 + BUTTON_HEIGHT + 20,
BUTTON_WIDTH, BUTTON_HEIGHT, "btnBar", BUTTON_WIDTH, BUTTON_HEIGHT, "btnBar",
"Spaceport Bar", (void(*)(unsigned int,char*))spaceport_bar_open); "Spaceport Bar", (void(*)(unsigned int,char*))spaceport_bar_open);
if(player->fuel < player->fuel_max) {
credits2str(cred, refuel_price(), 2);
snprintf(buf, 32, "Refuel %s", cred);
window_addButton(land_wid, -20, 20+2*(BUTTON_HEIGHT+20),
BUTTON_WIDTH, BUTTON_HEIGHT, "btnRefuel",
buf, spaceport_refuel);
if(player->credits < refuel_price()) /* Not enough memory. */
window_disableButton(land_wid, "btnRefuel");
}
} }
/* Player is now officailly landed. */
landed = 1; landed = 1;
/* Change the music. */ /* Change the music. */
@ -1432,6 +1422,9 @@ void land(Planet* p) {
land_planet->name, cur_system->name); land_planet->name, cur_system->name);
visited(VISITED_LAND); visited(VISITED_LAND);
} }
/* Add fuel button if needed - AFTER missions pay :D. */
land_checkAddRefuel();
} }
/* Takeoff from the planet. */ /* Takeoff from the planet. */