diff --git a/src/dusk/rpg/overworld/map.c b/src/dusk/rpg/overworld/map.c index baaffe16..a0b16ca6 100644 --- a/src/dusk/rpg/overworld/map.c +++ b/src/dusk/rpg/overworld/map.c @@ -15,6 +15,7 @@ #include "rpg/entity/global/entityglobal.h" #include "rpg/entity/item/entityitem.h" #include "rpg/overworld/maparea.h" +#include "save/save.h" map_t MAP; @@ -48,6 +49,10 @@ errorret_t mapSetMap(const char_t *map) { memoryZero(&MAP, sizeof(map_t)); stringCopy(MAP.name, map, MAP_NAME_MAX); + // Keep the current save slot's cached map name in sync so whichever map + // is active gets persisted next time the slot is actually saved. + stringCopy(SAVE.slot.cachedData.mapName, MAP.name, MAP_NAME_MAX); + chunkindex_t i = 0; for(chunkunit_t z = 0; z < MAP_CHUNK_DEPTH; z++) { for(chunkunit_t y = 0; y < MAP_CHUNK_HEIGHT; y++) {