diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index cef0503..5ecbbfe 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -10045,6 +10045,13 @@ luaFunc(loadXMLTable) return 1; } +luaFunc(worldmap_forgetMap) +{ + const std::string s = getString(L); + bool ok = dsq->continuity.worldMap.forgetMap(s); + luaReturnBool(ok); +} + //-------------------------------------------------------------------------------------------- #define luaRegister(func) {#func, l_##func} @@ -11123,6 +11130,8 @@ static const struct { luaRegister(quadgrid_resetUV), luaRegister(quadgrid_resetPos), + luaRegister(worldmap_forgetMap), + #undef MK_FUNC #undef MK_ALIAS #define MK_FUNC(base, getter, prefix, suffix) luaRegister(prefix##_##suffix), diff --git a/Aquaria/WorldMap.h b/Aquaria/WorldMap.h index b59bf0c..cffcbd8 100644 --- a/Aquaria/WorldMap.h +++ b/Aquaria/WorldMap.h @@ -44,10 +44,11 @@ struct WorldMap WorldMap(); void load(); void save(); - void revealMap(const std::string &name); WorldMapTile *getWorldMapTile(const std::string &name); WorldMapTile *getWorldMapTileByIndex(int index); - void revealMapIndex(int index); + bool revealMap(const std::string &name); + bool revealMapIndex(int index); + bool forgetMap(const std::string &name); int gw, gh; typedef std::vector WorldMapTiles; diff --git a/Aquaria/WorldMapTiles.cpp b/Aquaria/WorldMapTiles.cpp index 1a096df..92766bd 100644 --- a/Aquaria/WorldMapTiles.cpp +++ b/Aquaria/WorldMapTiles.cpp @@ -391,22 +391,36 @@ void WorldMap::save() } } -void WorldMap::revealMap(const std::string &name) +bool WorldMap::revealMap(const std::string &name) { WorldMapTile *t = getWorldMapTile(name); if (t) { t->revealed = true; } + return !!t; } -void WorldMap::revealMapIndex(int index) +bool WorldMap::revealMapIndex(int index) { WorldMapTile *t = getWorldMapTileByIndex(index); if (t) { t->revealed = true; } + return !!t; +} + +bool WorldMap::forgetMap(const std::string &name) +{ + WorldMapTile *t = getWorldMapTile(name); + if (t) + { + t->revealed = false; + t->visited.clear(); + t->dirty = true; + } + return !!t; } WorldMapTile *WorldMap::getWorldMapTile(const std::string &name)