From f39f7b3f7053c644b8b70ab93b2cc5c21446b846 Mon Sep 17 00:00:00 2001 From: Allanis Date: Mon, 10 Mar 2014 01:47:17 +0000 Subject: [PATCH] [Fix] Fixed some bugs with the boarding/fuel stealage. --- src/board.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/board.c b/src/board.c index 0e4fbfa..a9065e9 100644 --- a/src/board.c +++ b/src/board.c @@ -64,6 +64,9 @@ void player_board(void) { pilot_setFlag(p, PILOT_BOARDED); player_message("Boarding ship %s.", p->name); + /* Tweak some values. */ + p->fuel = (double)RNG(100, p->fuel_max); + /* Create the boarding window. */ wdw = window_create("Boarding", -1, -1, BOARDING_WIDTH, BOARDING_HEIGHT); @@ -166,16 +169,15 @@ static void board_stealCargo(unsigned int wdw, char* str) { */ static void board_stealFuel(unsigned int wdw, char* str) { (void)str; - double f; Pilot* p; p = pilot_get(player->target); - if(p->fuel <= 0.) { /* Urgh.. They don't have any fuel. */ + if(player->fuel <= 0.) { /* Urgh.. They don't have any fuel. */ player_message("The ship has no fuel."); return; } - else if(p->fuel == p->fuel_max) { + else if(player->fuel == player->fuel_max) { player_message("Your ship is at maximum fuel capacity."); return; } @@ -183,7 +185,6 @@ static void board_stealFuel(unsigned int wdw, char* str) { if(board_fail(wdw)) return; /* Steal fuel. */ - f = player->fuel; player->fuel += p->fuel; /* Make sure doesn't overflow. */