From dca1a33c362f0cbf2c6012af04a79ced6a0e3c09 Mon Sep 17 00:00:00 2001 From: Allanis Date: Fri, 21 Jun 2013 23:30:10 +0100 Subject: [PATCH] [Fix] Problems with system with one unlandable planet. --- src/player.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/player.c b/src/player.c index 73cd44b..006bc05 100644 --- a/src/player.c +++ b/src/player.c @@ -1294,6 +1294,10 @@ void player_land(void) { } planet_target = tp; player_rmFlag(PLAYER_LANDACK); + + // No landable planet. + if(planet_target < 0) return; + player_land(); // Re-run land protocol. } } @@ -1375,7 +1379,7 @@ double player_faceHyperspace(void) { // Activate afterburner. void player_afterburn(void) { // TODO: Fancy effects. - if(player->afterburner != NULL) { + if((player != NULL) && (player->afterburner != NULL)) { player_setFlag(PLAYER_AFTERBURNER); pilot_setFlag(player, PILOT_AFTERBURNER); spfx_shake(player->afterburner->outfit->u.afb.rumble * SHAKE_MAX); @@ -1384,7 +1388,7 @@ void player_afterburn(void) { } void player_afterburnOver(void) { - if(player->afterburner != NULL) { + if((player != NULL) && (player->afterburner != NULL)) { player_rmFlag(PLAYER_AFTERBURNER); pilot_rmFlag(player, PILOT_AFTERBURNER); player_stopSound(); @@ -1393,8 +1397,10 @@ void player_afterburnOver(void) { // Start accelerating. void player_accel(double acc) { - player_acc = acc; - player_playSound(player->ship->sound, 0); + if(player != NULL) { + player_acc = acc; + player_playSound(player->ship->sound, 0); + } } void player_accelOver(void) {