implemented the recommendations Xoft gave.
This commit is contained in:
parent
db935c4194
commit
020a8b457d
@ -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)
|
void cLuaState::Push(cClientHandle * a_Client)
|
||||||
{
|
{
|
||||||
ASSERT(IsValid());
|
ASSERT(IsValid());
|
||||||
|
@ -165,6 +165,7 @@ public:
|
|||||||
void Push(cMonster * a_Monster);
|
void Push(cMonster * a_Monster);
|
||||||
void Push(cItem * a_Item);
|
void Push(cItem * a_Item);
|
||||||
void Push(cItems * a_Items);
|
void Push(cItems * a_Items);
|
||||||
|
void Push(const cItems & a_Items);
|
||||||
void Push(cClientHandle * a_ClientHandle);
|
void Push(cClientHandle * a_ClientHandle);
|
||||||
void Push(cPickup * a_Pickup);
|
void Push(cPickup * a_Pickup);
|
||||||
void Push(cChunkDesc * a_ChunkDesc);
|
void Push(cChunkDesc * a_ChunkDesc);
|
||||||
|
@ -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 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 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 OnPlayerEating (cPlayer & a_Player) = 0;
|
||||||
virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) = 0;
|
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0;
|
||||||
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0;
|
virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) = 0;
|
||||||
virtual bool OnPlayerJoined (cPlayer & a_Player) = 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 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;
|
virtual bool OnPlayerMoved (cPlayer & a_Player) = 0;
|
||||||
|
@ -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);
|
cCSLock Lock(m_CriticalSection);
|
||||||
bool res = false;
|
bool res = false;
|
||||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED];
|
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED];
|
||||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
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)
|
if (res)
|
||||||
{
|
{
|
||||||
return true;
|
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);
|
cCSLock Lock(m_CriticalSection);
|
||||||
bool res = false;
|
bool res = false;
|
||||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING];
|
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING];
|
||||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
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)
|
if (res)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,9 +64,9 @@ public:
|
|||||||
virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override;
|
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 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 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 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 OnPlayerJoined (cPlayer & a_Player) override;
|
||||||
virtual bool OnPlayerMoved (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;
|
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override;
|
||||||
|
@ -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);
|
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHED);
|
||||||
if (Plugins == m_Hooks.end())
|
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);
|
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHING);
|
||||||
if (Plugins == m_Hooks.end())
|
if (Plugins == m_Hooks.end())
|
||||||
|
@ -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 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 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 CallHookPlayerEating (cPlayer & a_Player);
|
||||||
bool CallHookPlayerFished (cPlayer & a_Player, cItems a_Reward);
|
bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward);
|
||||||
bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward);
|
bool CallHookPlayerFishing (cPlayer & a_Player, const cItems a_Reward);
|
||||||
bool CallHookPlayerJoined (cPlayer & a_Player);
|
bool CallHookPlayerJoined (cPlayer & a_Player);
|
||||||
bool CallHookPlayerMoving (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);
|
bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
|
||||||
|
Loading…
Reference in New Issue
Block a user