[Change] Save when taking off or quitting, instead of when landing as we need to save purchased ships etc.
This commit is contained in:
parent
c1058cb7a5
commit
7b509e4e08
@ -979,7 +979,6 @@ void land(Planet* p) {
|
||||
// TODO: mission check.
|
||||
visited(VISITED_LAND);
|
||||
}
|
||||
save_all();
|
||||
}
|
||||
|
||||
// Takeoff from the planet.
|
||||
@ -1017,6 +1016,8 @@ void takeoff(void) {
|
||||
|
||||
space_init(NULL);
|
||||
|
||||
// Cleanup.
|
||||
save_all(); // Must be before cleaning up planet. Duh!
|
||||
land_planet = NULL;
|
||||
window_destroy(land_wid);
|
||||
landed = 0;
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "mission.h"
|
||||
#include "ltime.h"
|
||||
#include "save.h"
|
||||
#include "land.h"
|
||||
#include "rng.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define MAIN_WIDTH 130
|
||||
@ -152,6 +154,12 @@ static void edit_options(void) {
|
||||
|
||||
// Exit the game.
|
||||
static void exit_game(void) {
|
||||
// If landed we must save anyways.
|
||||
if(landed) {
|
||||
// Increment time to match takeoff.
|
||||
ltime_inc(RNG(2*LTIME_UNIT_LENGTH, 3*LTIME_UNIT_LENGTH));
|
||||
save_all();
|
||||
}
|
||||
SDL_Event quit;
|
||||
quit.type = SDL_QUIT;
|
||||
SDL_PushEvent(&quit);
|
||||
|
Loading…
Reference in New Issue
Block a user