mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-01-24 09:16:48 +00:00
Add worldmap_forgetMap() Lua function
This commit is contained in:
parent
7b8f540c7e
commit
533cd94a57
3 changed files with 28 additions and 4 deletions
|
@ -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),
|
||||
|
|
|
@ -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<WorldMapTile> WorldMapTiles;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue