mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-29 16:27:59 +03:00
Move Inventory functions into their own file.
This commit is contained in:
parent
dbbcd7b6d7
commit
4573db873d
7 changed files with 27 additions and 86 deletions
|
@ -4,9 +4,10 @@
|
|||
#include "Flow/FlowHandler.h"
|
||||
#include "Objects/ObjectsHandler.h"
|
||||
#include "Strings/StringsHandler.h"
|
||||
#include "Inventory/InventoryHandler.h"
|
||||
#include "ReservedScriptNames.h"
|
||||
|
||||
static sol::state g_solState;
|
||||
static sol::state s_solState;
|
||||
static sol::table s_rootTable;
|
||||
|
||||
int lua_exception_handler(lua_State* L, sol::optional<std::exception const &> maybe_exception, sol::string_view description)
|
||||
|
@ -16,30 +17,33 @@ int lua_exception_handler(lua_State* L, sol::optional<std::exception const &> ma
|
|||
|
||||
ScriptInterfaceGame* ScriptInterfaceState::CreateGame()
|
||||
{
|
||||
return new LogicHandler(&g_solState, s_rootTable);
|
||||
return new LogicHandler(&s_solState, s_rootTable);
|
||||
}
|
||||
|
||||
ScriptInterfaceFlowHandler* ScriptInterfaceState::CreateFlow()
|
||||
{
|
||||
return new FlowHandler(&g_solState, s_rootTable);
|
||||
return new FlowHandler(&s_solState, s_rootTable);
|
||||
}
|
||||
|
||||
ScriptInterfaceObjectsHandler* ScriptInterfaceState::CreateObjectsHandler()
|
||||
{
|
||||
return new ObjectsHandler(&g_solState, s_rootTable);
|
||||
return new ObjectsHandler(&s_solState, s_rootTable);
|
||||
}
|
||||
|
||||
ScriptInterfaceStringsHandler* ScriptInterfaceState::CreateStringsHandler()
|
||||
{
|
||||
return new StringsHandler(&g_solState, s_rootTable);
|
||||
return new StringsHandler(&s_solState, s_rootTable);
|
||||
}
|
||||
|
||||
void ScriptInterfaceState::Init()
|
||||
{
|
||||
g_solState.open_libraries(sol::lib::base, sol::lib::math);
|
||||
g_solState.set_exception_handler(lua_exception_handler);
|
||||
s_solState.open_libraries(sol::lib::base, sol::lib::math);
|
||||
s_solState.set_exception_handler(lua_exception_handler);
|
||||
|
||||
s_rootTable = sol::table{ g_solState.lua_state(), sol::create };
|
||||
g_solState.set(ScriptReserved_TEN, s_rootTable);
|
||||
s_rootTable = sol::table{ s_solState.lua_state(), sol::create };
|
||||
s_solState.set(ScriptReserved_TEN, s_rootTable);
|
||||
|
||||
// Misc handlers not assigned above
|
||||
InventoryHandler::Register(&s_solState, s_rootTable);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue