mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-12 17:29:54 +00:00
Add findPathFreeMemory() Lua function
This commit is contained in:
parent
83ce096119
commit
7daf117744
3 changed files with 14 additions and 0 deletions
|
@ -239,6 +239,11 @@ bool PathFinding::finishFindPath(PathFinding::State *state, VectorPath& path, un
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathFinding::purgeFindPath(PathFinding::State *state)
|
||||||
|
{
|
||||||
|
state->searcher.freeMemory();
|
||||||
|
}
|
||||||
|
|
||||||
void PathFinding::getStats(PathFinding::State *state, unsigned& stepsDone, unsigned& nodesExpanded)
|
void PathFinding::getStats(PathFinding::State *state, unsigned& stepsDone, unsigned& nodesExpanded)
|
||||||
{
|
{
|
||||||
stepsDone = (unsigned)state->searcher.getStepsDone();
|
stepsDone = (unsigned)state->searcher.getStepsDone();
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace PathFinding
|
||||||
bool updateFindPath(State *state, int limit);
|
bool updateFindPath(State *state, int limit);
|
||||||
bool finishFindPath(State *state, VectorPath& path, unsigned step = 0);
|
bool finishFindPath(State *state, VectorPath& path, unsigned step = 0);
|
||||||
void getStats(State *state, unsigned& stepsDone, unsigned& nodesExpanded);
|
void getStats(State *state, unsigned& stepsDone, unsigned& nodesExpanded);
|
||||||
|
void purgeFindPath(PathFinding::State *state);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9034,6 +9034,13 @@ luaFunc(findPathGetStats)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(findPathFreeMemory)
|
||||||
|
{
|
||||||
|
PathFinding::State *state = *(PathFinding::State**)luaL_checkudata(L, 1, "pathfinder");
|
||||||
|
PathFinding::purgeFindPath(state);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(castLine)
|
luaFunc(castLine)
|
||||||
{
|
{
|
||||||
Vector v(lua_tonumber(L, 1), lua_tonumber(L, 2));
|
Vector v(lua_tonumber(L, 1), lua_tonumber(L, 2));
|
||||||
|
@ -10100,6 +10107,7 @@ static const struct {
|
||||||
luaRegister(findPathUpdate),
|
luaRegister(findPathUpdate),
|
||||||
luaRegister(findPathFinish),
|
luaRegister(findPathFinish),
|
||||||
luaRegister(findPathGetStats),
|
luaRegister(findPathGetStats),
|
||||||
|
luaRegister(findPathFreeMemory),
|
||||||
luaRegister(castLine),
|
luaRegister(castLine),
|
||||||
luaRegister(getUserInputString),
|
luaRegister(getUserInputString),
|
||||||
luaRegister(getMaxCameraValues),
|
luaRegister(getMaxCameraValues),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue