[Fix] Map will now always close on new/load game.

This commit is contained in:
Allanis 2013-12-31 18:38:38 +00:00
parent 9a60a3d062
commit fae31ac95f
3 changed files with 6 additions and 5 deletions

View File

@ -37,7 +37,6 @@ extern int systems_nstack;
extern int planet_target; extern int planet_target;
extern int hyperspace_target; extern int hyperspace_target;
static void map_close(char* str);
static void map_update(void); static void map_update(void);
static int map_inPath(StarSystem* sys); static int map_inPath(StarSystem* sys);
static void map_render(double bx, double by, double w, double h); static void map_render(double bx, double by, double w, double h);
@ -48,7 +47,7 @@ static void map_selectCur(void);
/* Open the map window. */ /* Open the map window. */
void map_open(void) { void map_open(void) {
if(map_wid) { if(map_wid) {
map_close(NULL); map_close();
return; return;
} }
@ -121,7 +120,7 @@ void map_open(void) {
/* Close button. */ /* Close button. */
window_addButton(map_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, window_addButton(map_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnClose", "Close", map_close); "btnClose", "Close", (void(*)(char*))map_close);
/* The map itself. */ /* The map itself. */
window_addCust(map_wid, 20, -40, MAP_WIDTH, MAP_HEIGHT, window_addCust(map_wid, 20, -40, MAP_WIDTH, MAP_HEIGHT,
@ -142,8 +141,7 @@ void map_open(void) {
map_update(); map_update();
} }
static void map_close(char* str) { void map_close(void) {
(void)str;
if(map_wid) { if(map_wid) {
window_destroy(map_wid); window_destroy(map_wid);
map_wid = 0; map_wid = 0;

View File

@ -3,6 +3,7 @@
/* Open the map window. */ /* Open the map window. */
void map_open(void); void map_open(void);
void map_close(void);
int map_isOpen(void); int map_isOpen(void);
/* Misc. */ /* Misc. */

View File

@ -247,6 +247,7 @@ void player_new(void) {
land_cleanup(); land_cleanup();
diff_clear(); diff_clear();
factions_reset(); factions_reset();
map_close();
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:");
@ -2228,6 +2229,7 @@ int player_load(xmlNodePtr parent) {
player_cleanup(); player_cleanup();
var_cleanup(); var_cleanup();
missions_cleanup(); missions_cleanup();
map_close();
node = parent->xmlChildrenNode; node = parent->xmlChildrenNode;