map descriptions was not stored into saved state during show map: #4

This commit is contained in:
Ondrej Novak 2025-05-01 12:22:02 +02:00
parent d6ecea9121
commit f495364ed8
3 changed files with 13 additions and 1 deletions

View file

@ -1109,3 +1109,9 @@ void free_map_description() {
if (texty_v_mape!=NULL)release_list(texty_v_mape); if (texty_v_mape!=NULL)release_list(texty_v_mape);
texty_v_mape = NULL; texty_v_mape = NULL;
} }
TSTR_LIST swap_map_description(TSTR_LIST new_list) {
TSTR_LIST old = texty_v_mape;
texty_v_mape = new_list;
return old;
}

View file

@ -1402,7 +1402,7 @@ void destroy_all_fly();
void stop_fly(LETICI_VEC *p,char zvuk); void stop_fly(LETICI_VEC *p,char zvuk);
void herni_cas(char *s); void herni_cas(char *s);
typedef char **TSTR_LIST;
//gamesaver //gamesaver
void leave_current_map(void); void leave_current_map(void);
@ -1415,6 +1415,7 @@ int save_game(long game_time,char *gamename, char is_autosave);
void save_map_description(TMPFILE_WR *f); void save_map_description(TMPFILE_WR *f);
void load_map_description(TMPFILE_RD *f); void load_map_description(TMPFILE_RD *f);
void free_map_description(); void free_map_description();
TSTR_LIST swap_map_description(TSTR_LIST new_list);
void wire_save_load(char save); void wire_save_load(char save);
void do_save_dialog(); void do_save_dialog();
char ask_save_dialog(char *name_buffer, size_t name_size, char allow_remove); char ask_save_dialog(char *name_buffer, size_t name_size, char allow_remove);

View file

@ -630,6 +630,7 @@ struct _tag_map_save_state{
TSTENA *_map_sides; TSTENA *_map_sides;
TSECTOR *_map_sectors; TSECTOR *_map_sectors;
TMAP_EDIT_INFO *_map_coord; TMAP_EDIT_INFO *_map_coord;
TSTR_LIST _map_desc;
int _map_size; int _map_size;
int _viewsector; int _viewsector;
int _viewdir; int _viewdir;
@ -647,6 +648,7 @@ static void save_current_map() {
save_state._map_coord = map_coord; save_state._map_coord = map_coord;
save_state._map_sectors = map_sectors; save_state._map_sectors = map_sectors;
save_state._map_size = mapsize; save_state._map_size = mapsize;
save_state._map_desc = swap_map_description(NULL);
save_state._viewsector = viewsector; save_state._viewsector = viewsector;
save_state._viewdir = viewdir; save_state._viewdir = viewdir;
save_state._hash = current_map_hash; save_state._hash = current_map_hash;
@ -661,6 +663,7 @@ static void restore_saved_map() {
free(map_sides); free(map_sides);
free(map_sectors); free(map_sectors);
free(map_coord); free(map_coord);
free_map_description();
mapsize =save_state._map_size; mapsize =save_state._map_size;
map_sides = save_state._map_sides; map_sides = save_state._map_sides;
map_sectors = save_state._map_sectors; map_sectors = save_state._map_sectors;
@ -668,9 +671,11 @@ static void restore_saved_map() {
viewsector = save_state._viewsector; viewsector = save_state._viewsector;
viewdir = save_state._viewdir; viewdir = save_state._viewdir;
current_map_hash = save_state._hash; current_map_hash = save_state._hash;
swap_map_description(save_state._map_desc);
save_state._map_sides = NULL; save_state._map_sides = NULL;
save_state._map_coord = NULL; save_state._map_coord = NULL;
save_state._map_sectors = NULL; save_state._map_sectors = NULL;
save_state._map_desc = NULL;
} }
} }