From 178d78ef729b5cf5b12f3c23c03b6373d91962fd Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 8 Sep 2026 12:49:13 -0500 Subject: [PATCH] Persist the current map name in the save slot mapSetMap() now keeps SAVE.slot.cachedData.mapName in sync with the active map, so whichever map is loaded gets written out next time the slot is actually saved. --- src/dusk/rpg/overworld/map.c | 5 +++++ 1 file changed, 5 insertions(+) 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++) {