diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 12 | ||||
-rw-r--r-- | src/Bindings/LuaState.h | 1 | ||||
-rw-r--r-- | src/Bindings/Plugin.h | 4 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 8 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 4 |
7 files changed, 25 insertions, 12 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 64a818a60..a684620f3 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -468,6 +468,18 @@ void cLuaState::Push(cItems * a_Items) +void cLuaState::Push(const cItems & a_Items) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)&a_Items, "cItems"); + m_NumCurrentFunctionArgs += 1; +} + + + + + void cLuaState::Push(cClientHandle * a_Client) { ASSERT(IsValid()); diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index a6c31b6d3..796559b6f 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -165,6 +165,7 @@ public: void Push(cMonster * a_Monster); void Push(cItem * a_Item); void Push(cItems * a_Items); + void Push(const cItems & a_Items); void Push(cClientHandle * a_ClientHandle); void Push(cPickup * a_Pickup); void Push(cChunkDesc * a_ChunkDesc); diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 80356304a..80d9316e4 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -68,8 +68,8 @@ public: virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; - virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) = 0; - virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0; + virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0; + virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) = 0; virtual bool OnPlayerJoined (cPlayer & a_Player) = 0; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0; virtual bool OnPlayerMoved (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 66a60efe8..d8108da54 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -630,14 +630,14 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) -bool cPluginLua::OnPlayerFished(cPlayer & a_Player, cItems & a_Reward) +bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_Reward, cLuaState::Return, res); if (res) { return true; @@ -650,14 +650,14 @@ bool cPluginLua::OnPlayerFished(cPlayer & a_Player, cItems & a_Reward) -bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, cItems & a_Reward) +bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, const cItems & a_Reward) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_Reward, cLuaState::Return, res); if (res) { return true; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index d0cb209f1..ab15279da 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -64,9 +64,9 @@ public: virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) override; - virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; + virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override; + virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) override; virtual bool OnPlayerJoined (cPlayer & a_Player) override; virtual bool OnPlayerMoved (cPlayer & a_Player) override; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index b863a95b5..027b87545 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -694,7 +694,7 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) -bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, cItems a_Reward) +bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems a_Reward) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHED); if (Plugins == m_Hooks.end()) @@ -715,7 +715,7 @@ bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, cItems a_Reward) -bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) +bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, const cItems a_Reward) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHING); if (Plugins == m_Hooks.end()) diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index da867c7b0..c6a8b8b9f 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -170,8 +170,8 @@ public: // tolua_export bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); - bool CallHookPlayerFished (cPlayer & a_Player, cItems a_Reward); - bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward); + bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward); + bool CallHookPlayerFishing (cPlayer & a_Player, const cItems a_Reward); bool CallHookPlayerJoined (cPlayer & a_Player); bool CallHookPlayerMoving (cPlayer & a_Player); bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status); |