[Fix] Fixed some bugs with the boarding/fuel stealage.
This commit is contained in:
parent
4e3c85f369
commit
f39f7b3f70
@ -64,6 +64,9 @@ void player_board(void) {
|
|||||||
pilot_setFlag(p, PILOT_BOARDED);
|
pilot_setFlag(p, PILOT_BOARDED);
|
||||||
player_message("Boarding ship %s.", p->name);
|
player_message("Boarding ship %s.", p->name);
|
||||||
|
|
||||||
|
/* Tweak some values. */
|
||||||
|
p->fuel = (double)RNG(100, p->fuel_max);
|
||||||
|
|
||||||
/* Create the boarding window. */
|
/* Create the boarding window. */
|
||||||
wdw = window_create("Boarding", -1, -1, BOARDING_WIDTH, BOARDING_HEIGHT);
|
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) {
|
static void board_stealFuel(unsigned int wdw, char* str) {
|
||||||
(void)str;
|
(void)str;
|
||||||
double f;
|
|
||||||
Pilot* p;
|
Pilot* p;
|
||||||
|
|
||||||
p = pilot_get(player->target);
|
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.");
|
player_message("The ship has no fuel.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(p->fuel == p->fuel_max) {
|
else if(player->fuel == player->fuel_max) {
|
||||||
player_message("Your ship is at maximum fuel capacity.");
|
player_message("Your ship is at maximum fuel capacity.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,7 +185,6 @@ static void board_stealFuel(unsigned int wdw, char* str) {
|
|||||||
if(board_fail(wdw)) return;
|
if(board_fail(wdw)) return;
|
||||||
|
|
||||||
/* Steal fuel. */
|
/* Steal fuel. */
|
||||||
f = player->fuel;
|
|
||||||
player->fuel += p->fuel;
|
player->fuel += p->fuel;
|
||||||
|
|
||||||
/* Make sure doesn't overflow. */
|
/* Make sure doesn't overflow. */
|
||||||
|
Loading…
Reference in New Issue
Block a user