From f0fc0edd21b9340ce48561a5fceee29e4e055dff Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 24 Aug 2012 09:49:00 +0000 Subject: cPickup doesn't use cPackets. Also, Lua API change, OnCollectItem -> OnCollectPickup; first param is cPlayer to match other callbacks. git-svn-id: http://mc-server.googlecode.com/svn/trunk@786 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPluginManager.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'source/cPluginManager.cpp') diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp index 041180818..788b5e429 100644 --- a/source/cPluginManager.cpp +++ b/source/cPluginManager.cpp @@ -198,22 +198,6 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...) switch( a_Hook ) { - case HOOK_COLLECT_ITEM: - { - if( a_NumArgs != 2 ) break; - va_list argptr; - va_start( argptr, a_NumArgs); - cPickup* Pickup = va_arg(argptr, cPickup* ); - cPlayer* Player = va_arg(argptr, cPlayer* ); - va_end (argptr); - for( PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr ) - { - if( (*itr)->OnCollectItem( Pickup, Player ) ) - return true; - } - break; - } - case HOOK_PLAYER_JOIN: { if( a_NumArgs != 1 ) break; @@ -451,6 +435,27 @@ bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int +bool cPluginManager::CallHookCollectPickup(cPlayer * a_Player, cPickup & a_Pickup) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_COLLECT_PICKUP); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnCollectPickup(a_Player, &a_Pickup)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PRE_CRAFTING); -- cgit v1.2.3