mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 12:36:45 +03:00
Link up MeshInfo with GameLogicScript, adding a m_meshesMapName and implementing AddLuaNameMesh and RemoveLuaNameMesh.
Add GetMeshByName and make GetItemByName take a constant reference. Remove no-longer-used headers.
This commit is contained in:
parent
12dada0145
commit
da5af327e9
2 changed files with 27 additions and 15 deletions
|
@ -65,15 +65,16 @@ GameScript::GameScript(sol::state* lua) : LuaHandler{ lua }
|
|||
makeReadOnlyTable("ObjID", kObjIDs);
|
||||
|
||||
GameScriptItemInfo::Register(m_lua);
|
||||
auto addLuaName = [this](std::string const& str, short num)
|
||||
{
|
||||
return AddLuaName(str, num);
|
||||
};
|
||||
auto removeLuaName = [this](std::string const& str)
|
||||
{
|
||||
return RemoveLuaName(str);
|
||||
};
|
||||
GameScriptItemInfo::SetNameCallbacks(addLuaName, removeLuaName);
|
||||
GameScriptItemInfo::SetNameCallbacks(
|
||||
[this](std::string const& str, short num) { return AddLuaName(str, num); },
|
||||
[this](std::string const& str) { return RemoveLuaName(str); }
|
||||
);
|
||||
|
||||
GameScriptMeshInfo::Register(m_lua);
|
||||
GameScriptMeshInfo::SetNameCallbacks(
|
||||
[this](std::string const& str, MESH_INFO & info) { return AddLuaNameMesh(str, info); },
|
||||
[this](std::string const& str) { return RemoveLuaNameMesh(str); }
|
||||
);
|
||||
|
||||
GameScriptPosition::Register(m_lua);
|
||||
GameScriptRotation::Register(m_lua);
|
||||
|
@ -111,6 +112,16 @@ bool GameScript::AddLuaName(std::string const & luaName, short itemNumber)
|
|||
return m_itemsMapName.insert(std::pair<std::string, short>(luaName, itemNumber)).second;
|
||||
}
|
||||
|
||||
bool GameScript::RemoveLuaNameMesh(std::string const & luaName)
|
||||
{
|
||||
return m_meshesMapName.erase(luaName);
|
||||
}
|
||||
|
||||
bool GameScript::AddLuaNameMesh(std::string const& luaName, MESH_INFO& infoRef)
|
||||
{
|
||||
return m_meshesMapName.insert(std::pair<std::string, MESH_INFO&>(luaName, infoRef)).second;
|
||||
}
|
||||
|
||||
void GameScript::FreeLevelScripts()
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue