Skip to content

Commit bce0d49

Browse files
committed
Some Eluna class cleanup
Removing some unused stuff, moving some stuff to private that shouldn't be public
1 parent 203dee5 commit bce0d49

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

LuaEngine.h

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ enum MethodFlags : uint32
151151
class ELUNA_GAME_API Eluna
152152
{
153153
public:
154-
typedef std::list<LuaScript> ScriptList;
155-
typedef std::recursive_mutex LockType;
156154

157155
void ReloadEluna() { reload = true; }
158156
bool ExecuteCall(int params, int res);
@@ -184,6 +182,14 @@ class ELUNA_GAME_API Eluna
184182
// Map from map ID -> Lua table ref
185183
std::unordered_map<uint32, int> continentDataRefs;
186184

185+
std::unordered_map<std::underlying_type_t<Hooks::RegisterTypes>, std::unique_ptr<BaseBindingMap>> bindingMaps;
186+
187+
template<typename T>
188+
void CreateBinding(Hooks::RegisterTypes type)
189+
{
190+
bindingMaps[std::underlying_type_t<Hooks::RegisterTypes>(type)] = std::make_unique<BindingMap<T>>(L);
191+
}
192+
187193
void OpenLua();
188194
void CloseLua();
189195
void DestroyBindStores();
@@ -247,27 +253,6 @@ class ELUNA_GAME_API Eluna
247253
QueryCallbackProcessor queryProcessor;
248254
QueryCallbackProcessor& GetQueryProcessor() { return queryProcessor; }
249255
#endif
250-
std::unordered_map<std::underlying_type_t<Hooks::RegisterTypes>, std::unique_ptr<BaseBindingMap>> bindingMaps;
251-
252-
template<typename T>
253-
void CreateBinding(Hooks::RegisterTypes type)
254-
{
255-
bindingMaps[std::underlying_type_t<Hooks::RegisterTypes>(type)] = std::make_unique<BindingMap<T>>(L);
256-
}
257-
258-
template<typename T>
259-
BindingMap<T>* GetBinding(std::underlying_type_t<Hooks::RegisterTypes> type)
260-
{
261-
auto it = bindingMaps.find(type);
262-
if (it == bindingMaps.end()) return nullptr;
263-
return dynamic_cast<BindingMap<T>*>(it->second.get());
264-
}
265-
266-
template<typename T>
267-
BindingMap<T>* GetBinding(Hooks::RegisterTypes type)
268-
{
269-
return GetBinding<T>(static_cast<std::underlying_type_t<Hooks::RegisterTypes>>(type));
270-
}
271256

272257
static int StackTrace(lua_State* _L);
273258
static void Report(lua_State* _L);
@@ -375,6 +360,20 @@ class ELUNA_GAME_API Eluna
375360
return 0;
376361
}
377362

363+
template<typename T>
364+
BindingMap<T>* GetBinding(std::underlying_type_t<Hooks::RegisterTypes> type)
365+
{
366+
auto it = bindingMaps.find(type);
367+
if (it == bindingMaps.end()) return nullptr;
368+
return dynamic_cast<BindingMap<T>*>(it->second.get());
369+
}
370+
371+
template<typename T>
372+
BindingMap<T>* GetBinding(Hooks::RegisterTypes type)
373+
{
374+
return GetBinding<T>(static_cast<std::underlying_type_t<Hooks::RegisterTypes>>(type));
375+
}
376+
378377
Eluna(Map * map);
379378
~Eluna();
380379

0 commit comments

Comments
 (0)