[Fix] Fixed diffs getting wiped when loading and some cleanup on planet landing.

This commit is contained in:
Allanis 2013-12-12 23:14:10 +00:00
parent a2d313a08c
commit 313e3a7488
3 changed files with 26 additions and 2 deletions

View File

@ -1284,6 +1284,7 @@ void takeoff(void) {
/* Cleanup. */ /* Cleanup. */
save_all(); /* Must be before cleaning up planet. Duh! */ save_all(); /* Must be before cleaning up planet. Duh! */
land_cleanup(); /* Cleanup stuff. */
land_planet = NULL; land_planet = NULL;
window_destroy(land_wid); window_destroy(land_wid);
if(gfx_exterior != NULL) { if(gfx_exterior != NULL) {
@ -1303,3 +1304,25 @@ void takeoff(void) {
mission_ncomputer = 0; mission_ncomputer = 0;
} }
/**
* @fn
*/
void land_cleanup(void) {
/* Clean up default stuff. */
land_planet = NULL;
landed = 0;
land_visited = 0;
/* Clean up window. */
if(land_wid != 0) {
window_destroy(land_wid);
land_wid = 0;
}
/* Clean up possible stray graphic. */
if(gfx_exterior != NULL) {
gl_freeTexture(gfx_exterior);
gfx_exterior = NULL;
}
}

View File

@ -6,4 +6,5 @@ extern Planet* land_planet;
void land(Planet* p); void land(Planet* p);
void takeoff(void); void takeoff(void);
void land_cleanup(void);

View File

@ -238,10 +238,11 @@ void player_new(void) {
/* Cleanup player stuff if we'll be re-creating. */ /* Cleanup player stuff if we'll be re-creating. */
player_cleanup(); player_cleanup();
var_cleanup(); var_cleanup();
missions_cleanup(); missions_cleanup();
space_clearKnown(); space_clearKnown();
land_cleanup();
diff_clear();
player_name = dialogue_input("Player Name", 3, 20, player_name = dialogue_input("Player Name", 3, 20,
"Please tell me your name:"); "Please tell me your name:");
@ -548,7 +549,6 @@ void player_cleanup(void) {
int i; int i;
player_clear(); player_clear();
diff_clear();
/* Clean up name. */ /* Clean up name. */
if(player_name != NULL) free(player_name); if(player_name != NULL) free(player_name);