mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-01-24 17:26:41 +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;
|
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}
|
#define luaRegister(func) {#func, l_##func}
|
||||||
|
@ -11123,6 +11130,8 @@ static const struct {
|
||||||
luaRegister(quadgrid_resetUV),
|
luaRegister(quadgrid_resetUV),
|
||||||
luaRegister(quadgrid_resetPos),
|
luaRegister(quadgrid_resetPos),
|
||||||
|
|
||||||
|
luaRegister(worldmap_forgetMap),
|
||||||
|
|
||||||
#undef MK_FUNC
|
#undef MK_FUNC
|
||||||
#undef MK_ALIAS
|
#undef MK_ALIAS
|
||||||
#define MK_FUNC(base, getter, prefix, suffix) luaRegister(prefix##_##suffix),
|
#define MK_FUNC(base, getter, prefix, suffix) luaRegister(prefix##_##suffix),
|
||||||
|
|
|
@ -44,10 +44,11 @@ struct WorldMap
|
||||||
WorldMap();
|
WorldMap();
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
void revealMap(const std::string &name);
|
|
||||||
WorldMapTile *getWorldMapTile(const std::string &name);
|
WorldMapTile *getWorldMapTile(const std::string &name);
|
||||||
WorldMapTile *getWorldMapTileByIndex(int index);
|
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;
|
int gw, gh;
|
||||||
typedef std::vector<WorldMapTile> WorldMapTiles;
|
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);
|
WorldMapTile *t = getWorldMapTile(name);
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
t->revealed = true;
|
t->revealed = true;
|
||||||
}
|
}
|
||||||
|
return !!t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldMap::revealMapIndex(int index)
|
bool WorldMap::revealMapIndex(int index)
|
||||||
{
|
{
|
||||||
WorldMapTile *t = getWorldMapTileByIndex(index);
|
WorldMapTile *t = getWorldMapTileByIndex(index);
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
t->revealed = true;
|
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)
|
WorldMapTile *WorldMap::getWorldMapTile(const std::string &name)
|
||||||
|
|
Loading…
Reference in a new issue