diff --git a/CCallback.cpp b/CCallback.cpp index 542b781a1..3b8e099ba 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -365,13 +365,6 @@ void CCallback::unregisterBattleInterface(std::shared_ptr cl->additionalBattleInts[*player] -= battleEvents; } -#if SCRIPTING_ENABLED -scripting::Pool * CBattleCallback::getContextPool() const -{ - return cl->getGlobalContextPool(); -} -#endif - CBattleCallback::CBattleCallback(std::optional player, CClient * C): cl(C), player(player) diff --git a/CCallback.h b/CCallback.h index 33d0c8b99..8acb0d6c5 100644 --- a/CCallback.h +++ b/CCallback.h @@ -134,10 +134,6 @@ public: void onBattleStarted(const IBattleInfo * info); void onBattleEnded(const BattleID & battleID); -#if SCRIPTING_ENABLED - scripting::Pool * getContextPool() const override; -#endif - friend class CCallback; friend class CClient; }; diff --git a/client/Client.cpp b/client/Client.cpp index 96a8a8173..632cc5ef3 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -693,11 +693,6 @@ scripting::Pool * CClient::getGlobalContextPool() const { return clientScripts.get(); } - -scripting::Pool * CClient::getContextPool() const -{ - return clientScripts.get(); -} #endif void CClient::reinitScripting() diff --git a/client/Client.h b/client/Client.h index 6155b9486..d87d8c0c2 100644 --- a/client/Client.h +++ b/client/Client.h @@ -220,7 +220,6 @@ public: #if SCRIPTING_ENABLED scripting::Pool * getGlobalContextPool() const override; - scripting::Pool * getContextPool() const override; #endif private: diff --git a/lib/battle/CPlayerBattleCallback.cpp b/lib/battle/CPlayerBattleCallback.cpp index 4412c9d28..89a2e2861 100644 --- a/lib/battle/CPlayerBattleCallback.cpp +++ b/lib/battle/CPlayerBattleCallback.cpp @@ -22,6 +22,13 @@ CPlayerBattleCallback::CPlayerBattleCallback(const IBattleInfo * battle, PlayerC } +#if SCRIPTING_ENABLED +scripting::Pool * CPlayerBattleCallback::getContextPool() const +{ + return nullptr; //TODO cl->getGlobalContextPool(); +} +#endif + const IBattleInfo * CPlayerBattleCallback::getBattle() const { return battle; diff --git a/lib/battle/CPlayerBattleCallback.h b/lib/battle/CPlayerBattleCallback.h index 60fbbd3d5..27bbb16d3 100644 --- a/lib/battle/CPlayerBattleCallback.h +++ b/lib/battle/CPlayerBattleCallback.h @@ -22,6 +22,10 @@ class DLL_LINKAGE CPlayerBattleCallback : public CBattleInfoCallback public: CPlayerBattleCallback(const IBattleInfo * battle, PlayerColor player); +#if SCRIPTING_ENABLED + scripting::Pool * getContextPool() const override; +#endif + const IBattleInfo * getBattle() const override; std::optional getPlayerID() const override; diff --git a/scripting/lua/LuaScriptingContext.cpp b/scripting/lua/LuaScriptingContext.cpp index 4b3508610..4c41f981f 100644 --- a/scripting/lua/LuaScriptingContext.cpp +++ b/scripting/lua/LuaScriptingContext.cpp @@ -75,7 +75,7 @@ LuaContext::LuaContext(const Script * source, const Environment * env_): S.push(env->game()); lua_setglobal(L, "GAME"); - S.push(env->battle()); + S.push(env->battle(BattleID::NONE)); lua_setglobal(L, "BATTLE"); S.push(env->eventBus()); diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 3ae02b83b..e096a79b1 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -4094,10 +4094,10 @@ scripting::Pool * CGameHandler::getGlobalContextPool() const return serverScripts.get(); } -scripting::Pool * CGameHandler::getContextPool() const -{ - return serverScripts.get(); -} +//scripting::Pool * CGameHandler::getContextPool() const +//{ +// return serverScripts.get(); +//} #endif void CGameHandler::createObject(const int3 & visitablePosition, Obj type, int32_t subtype) diff --git a/server/CGameHandler.h b/server/CGameHandler.h index 75a9cfd3a..47f03e497 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -270,7 +270,7 @@ public: #if SCRIPTING_ENABLED scripting::Pool * getGlobalContextPool() const override; - scripting::Pool * getContextPool() const override; +// scripting::Pool * getContextPool() const override; #endif friend class CVCMIServer;