From 756aac2bac1075fc9bae0f54eb731ec10da8afbb Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 5 Jun 2014 20:37:31 +0100
Subject: [PATCH] [Change] Cleaned up a refuel checks. Missed them a long time
 ago.

---
 src/land.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/land.c b/src/land.c
index 3c436de..3ac27db 100644
--- a/src/land.c
+++ b/src/land.c
@@ -512,6 +512,7 @@ static void outfits_buy(unsigned int wid, char* str) {
 
   player->credits -= outfit->price * pilot_addOutfit(player, outfit,
       MIN(q, outfit->max));
+  land_checkAddRefuel();
   outfits_update(wid, NULL);
 }
 
@@ -1346,7 +1347,6 @@ static void land_checkAddRefuel(void) {
 
 /* Land the player. */
 void land(Planet* p) {
-  char buf[32], cred[16];
   glTexture* logo;
   int offset;
 
@@ -1401,19 +1401,9 @@ void land(Planet* p) {
     window_addButton(land_wid, 20, 20 + BUTTON_HEIGHT + 20,
                      BUTTON_WIDTH, BUTTON_HEIGHT, "btnBar",
                      "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;
 
   /* Change the music. */
@@ -1432,6 +1422,9 @@ void land(Planet* p) {
         land_planet->name, cur_system->name);
     visited(VISITED_LAND);
   }
+
+  /* Add fuel button if needed - AFTER missions pay :D. */
+  land_checkAddRefuel();
 }
 
 /* Takeoff from the planet. */