1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Add findPathFreeMemory() Lua function

This commit is contained in:
fgenesis 2016-04-09 00:01:38 +02:00
parent 83ce096119
commit 7daf117744
3 changed files with 14 additions and 0 deletions

View file

@ -239,6 +239,11 @@ bool PathFinding::finishFindPath(PathFinding::State *state, VectorPath& path, un
return true;
}
void PathFinding::purgeFindPath(PathFinding::State *state)
{
state->searcher.freeMemory();
}
void PathFinding::getStats(PathFinding::State *state, unsigned& stepsDone, unsigned& nodesExpanded)
{
stepsDone = (unsigned)state->searcher.getStepsDone();

View file

@ -47,6 +47,7 @@ namespace PathFinding
bool updateFindPath(State *state, int limit);
bool finishFindPath(State *state, VectorPath& path, unsigned step = 0);
void getStats(State *state, unsigned& stepsDone, unsigned& nodesExpanded);
void purgeFindPath(PathFinding::State *state);
};
#endif

View file

@ -9034,6 +9034,13 @@ luaFunc(findPathGetStats)
return 2;
}
luaFunc(findPathFreeMemory)
{
PathFinding::State *state = *(PathFinding::State**)luaL_checkudata(L, 1, "pathfinder");
PathFinding::purgeFindPath(state);
luaReturnNil();
}
luaFunc(castLine)
{
Vector v(lua_tonumber(L, 1), lua_tonumber(L, 2));
@ -10100,6 +10107,7 @@ static const struct {
luaRegister(findPathUpdate),
luaRegister(findPathFinish),
luaRegister(findPathGetStats),
luaRegister(findPathFreeMemory),
luaRegister(castLine),
luaRegister(getUserInputString),
luaRegister(getMaxCameraValues),