diff options
-rw-r--r-- | source/Bindings.cpp | 76 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/cPlugin.cpp | 6 | ||||
-rw-r--r-- | source/cPlugin.h | 4 | ||||
-rw-r--r-- | source/cPluginManager.cpp | 8 | ||||
-rw-r--r-- | source/cPluginManager.h | 4 | ||||
-rw-r--r-- | source/cPlugin_NewLua.cpp | 12 | ||||
-rw-r--r-- | source/cPlugin_NewLua.h | 4 | ||||
-rw-r--r-- | source/cPlugin_Squirrel.cpp | 12 | ||||
-rw-r--r-- | source/cPlugin_Squirrel.h | 4 | ||||
-rw-r--r-- | source/cWorld.cpp | 6 | ||||
-rw-r--r-- | source/cWorld.h | 3 |
12 files changed, 83 insertions, 58 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 0e5803dd6..f1b850cb8 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 08/29/12 22:33:21. +** Generated automatically by tolua++-1.0.92 on 09/01/12 23:31:58. */ #ifndef __cplusplus @@ -8291,7 +8291,8 @@ static int tolua_AllToLua_cPlugin_OnUpdatedSign00(lua_State* tolua_S) !tolua_iscppstring(tolua_S,7,0,&tolua_err) || !tolua_iscppstring(tolua_S,8,0,&tolua_err) || !tolua_iscppstring(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) + !tolua_isusertype(tolua_S,10,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,11,&tolua_err) ) goto tolua_lerror; else @@ -8306,11 +8307,12 @@ static int tolua_AllToLua_cPlugin_OnUpdatedSign00(lua_State* tolua_S) const AString a_Line2 = ((const AString) tolua_tocppstring(tolua_S,7,0)); const AString a_Line3 = ((const AString) tolua_tocppstring(tolua_S,8,0)); const AString a_Line4 = ((const AString) tolua_tocppstring(tolua_S,9,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,10,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnUpdatedSign'", NULL); #endif { - bool tolua_ret = (bool) self->OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool tolua_ret = (bool) self->OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)a_Line1); tolua_pushcppstring(tolua_S,(const char*)a_Line2); @@ -8343,7 +8345,8 @@ static int tolua_AllToLua_cPlugin_OnUpdatingSign00(lua_State* tolua_S) !tolua_iscppstring(tolua_S,7,0,&tolua_err) || !tolua_iscppstring(tolua_S,8,0,&tolua_err) || !tolua_iscppstring(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) + !tolua_isusertype(tolua_S,10,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,11,&tolua_err) ) goto tolua_lerror; else @@ -8358,11 +8361,12 @@ static int tolua_AllToLua_cPlugin_OnUpdatingSign00(lua_State* tolua_S) AString a_Line2 = ((AString) tolua_tocppstring(tolua_S,7,0)); AString a_Line3 = ((AString) tolua_tocppstring(tolua_S,8,0)); AString a_Line4 = ((AString) tolua_tocppstring(tolua_S,9,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,10,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnUpdatingSign'", NULL); #endif { - bool tolua_ret = (bool) self->OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool tolua_ret = (bool) self->OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)a_Line1); tolua_pushcppstring(tolua_S,(const char*)a_Line2); @@ -8916,7 +8920,7 @@ public: return ( void ) cPlugin:: OnTakeDamage(a_Pawn,a_TakeDamageInfo); }; }; - bool OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4) { + bool OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4, cPlayer* a_Player) { if (push_method("OnUpdatedSign", tolua_AllToLua_cPlugin_OnUpdatedSign00)) { tolua_pushusertype(lua_state, (void*)a_World, "cWorld"); tolua_pushnumber(lua_state, (lua_Number)a_BlockX); @@ -8926,15 +8930,16 @@ public: tolua_pushcppstring(lua_state, (const char*)a_Line2); tolua_pushcppstring(lua_state, (const char*)a_Line3); tolua_pushcppstring(lua_state, (const char*)a_Line4); - ToluaBase::dbcall(lua_state, 9, 1); + tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer"); + ToluaBase::dbcall(lua_state, 10, 1); bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0); lua_pop(lua_state, 1); return tolua_ret; } else { - return ( bool ) cPlugin:: OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + return ( bool ) cPlugin:: OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; }; - bool OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4) { + bool OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4, cPlayer* a_Player) { if (push_method("OnUpdatingSign", tolua_AllToLua_cPlugin_OnUpdatingSign00)) { tolua_pushusertype(lua_state, (void*)a_World, "cWorld"); tolua_pushnumber(lua_state, (lua_Number)a_BlockX); @@ -8944,12 +8949,13 @@ public: tolua_pushcppstring(lua_state, (const char*)a_Line2); tolua_pushcppstring(lua_state, (const char*)a_Line3); tolua_pushcppstring(lua_state, (const char*)a_Line4); - ToluaBase::dbcall(lua_state, 9, 1); + tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer"); + ToluaBase::dbcall(lua_state, 10, 1); bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0); lua_pop(lua_state, 1); return tolua_ret; } else { - return ( bool ) cPlugin:: OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + return ( bool ) cPlugin:: OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; }; bool OnWeatherChanged( cWorld* a_World) { @@ -9029,11 +9035,11 @@ public: void cPlugin__OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo) { return ( void )cPlugin::OnTakeDamage(a_Pawn,a_TakeDamageInfo); }; - bool cPlugin__OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4) { - return ( bool )cPlugin::OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool cPlugin__OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4, cPlayer* a_Player) { + return ( bool )cPlugin::OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; - bool cPlugin__OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4) { - return ( bool )cPlugin::OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool cPlugin__OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4, cPlayer* a_Player) { + return ( bool )cPlugin::OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; bool cPlugin__OnWeatherChanged( cWorld* a_World) { return ( bool )cPlugin::OnWeatherChanged(a_World); @@ -9802,7 +9808,8 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnUpdatedSign00(lua_State* tolua !tolua_iscppstring(tolua_S,7,0,&tolua_err) || !tolua_iscppstring(tolua_S,8,0,&tolua_err) || !tolua_iscppstring(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) + !tolua_isusertype(tolua_S,10,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,11,&tolua_err) ) goto tolua_lerror; else @@ -9817,11 +9824,12 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnUpdatedSign00(lua_State* tolua const AString a_Line2 = ((const AString) tolua_tocppstring(tolua_S,7,0)); const AString a_Line3 = ((const AString) tolua_tocppstring(tolua_S,8,0)); const AString a_Line4 = ((const AString) tolua_tocppstring(tolua_S,9,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,10,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnUpdatedSign'", NULL); #endif { - bool tolua_ret = (bool) self->cPlugin__OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool tolua_ret = (bool) self->cPlugin__OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)a_Line1); tolua_pushcppstring(tolua_S,(const char*)a_Line2); @@ -9854,7 +9862,8 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnUpdatingSign00(lua_State* tolu !tolua_iscppstring(tolua_S,7,0,&tolua_err) || !tolua_iscppstring(tolua_S,8,0,&tolua_err) || !tolua_iscppstring(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) + !tolua_isusertype(tolua_S,10,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,11,&tolua_err) ) goto tolua_lerror; else @@ -9869,11 +9878,12 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnUpdatingSign00(lua_State* tolu AString a_Line2 = ((AString) tolua_tocppstring(tolua_S,7,0)); AString a_Line3 = ((AString) tolua_tocppstring(tolua_S,8,0)); AString a_Line4 = ((AString) tolua_tocppstring(tolua_S,9,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,10,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnUpdatingSign'", NULL); #endif { - bool tolua_ret = (bool) self->cPlugin__OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool tolua_ret = (bool) self->cPlugin__OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)a_Line1); tolua_pushcppstring(tolua_S,(const char*)a_Line2); @@ -10438,7 +10448,7 @@ public: return ( void ) cPlugin_NewLua:: OnTakeDamage(a_Pawn,a_TakeDamageInfo); }; }; - bool OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4) { + bool OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4, cPlayer* a_Player) { if (push_method("OnUpdatedSign", tolua_AllToLua_cPlugin_OnUpdatedSign00)) { tolua_pushusertype(lua_state, (void*)a_World, "cWorld"); tolua_pushnumber(lua_state, (lua_Number)a_BlockX); @@ -10448,15 +10458,16 @@ public: tolua_pushcppstring(lua_state, (const char*)a_Line2); tolua_pushcppstring(lua_state, (const char*)a_Line3); tolua_pushcppstring(lua_state, (const char*)a_Line4); - ToluaBase::dbcall(lua_state, 9, 1); + tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer"); + ToluaBase::dbcall(lua_state, 10, 1); bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0); lua_pop(lua_state, 1); return tolua_ret; } else { - return ( bool ) cPlugin_NewLua:: OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + return ( bool ) cPlugin_NewLua:: OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; }; - bool OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4) { + bool OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4, cPlayer* a_Player) { if (push_method("OnUpdatingSign", tolua_AllToLua_cPlugin_OnUpdatingSign00)) { tolua_pushusertype(lua_state, (void*)a_World, "cWorld"); tolua_pushnumber(lua_state, (lua_Number)a_BlockX); @@ -10466,12 +10477,13 @@ public: tolua_pushcppstring(lua_state, (const char*)a_Line2); tolua_pushcppstring(lua_state, (const char*)a_Line3); tolua_pushcppstring(lua_state, (const char*)a_Line4); - ToluaBase::dbcall(lua_state, 9, 1); + tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer"); + ToluaBase::dbcall(lua_state, 10, 1); bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0); lua_pop(lua_state, 1); return tolua_ret; } else { - return ( bool ) cPlugin_NewLua:: OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + return ( bool ) cPlugin_NewLua:: OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; }; bool OnWeatherChanged( cWorld* a_World) { @@ -10554,11 +10566,11 @@ public: void cPlugin_NewLua__OnTakeDamage( cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo) { return ( void )cPlugin_NewLua::OnTakeDamage(a_Pawn,a_TakeDamageInfo); }; - bool cPlugin_NewLua__OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4) { - return ( bool )cPlugin_NewLua::OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool cPlugin_NewLua__OnUpdatedSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString& a_Line1, const AString& a_Line2, const AString& a_Line3, const AString& a_Line4, cPlayer* a_Player) { + return ( bool )cPlugin_NewLua::OnUpdatedSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; - bool cPlugin_NewLua__OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4) { - return ( bool )cPlugin_NewLua::OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4); + bool cPlugin_NewLua__OnUpdatingSign( cWorld* a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString& a_Line1, AString& a_Line2, AString& a_Line3, AString& a_Line4, cPlayer* a_Player) { + return ( bool )cPlugin_NewLua::OnUpdatingSign(a_World,a_BlockX,a_BlockY,a_BlockZ,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); }; bool cPlugin_NewLua__OnWeatherChanged( cWorld* a_World) { return ( bool )cPlugin_NewLua::OnWeatherChanged(a_World); @@ -11101,7 +11113,8 @@ static int tolua_AllToLua_cWorld_UpdateSign00(lua_State* tolua_S) !tolua_iscppstring(tolua_S,6,0,&tolua_err) || !tolua_iscppstring(tolua_S,7,0,&tolua_err) || !tolua_iscppstring(tolua_S,8,0,&tolua_err) || - !tolua_isnoobj(tolua_S,9,&tolua_err) + !tolua_isusertype(tolua_S,9,"cPlayer",1,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) ) goto tolua_lerror; else @@ -11115,11 +11128,12 @@ static int tolua_AllToLua_cWorld_UpdateSign00(lua_State* tolua_S) const AString a_Line2 = ((const AString) tolua_tocppstring(tolua_S,6,0)); const AString a_Line3 = ((const AString) tolua_tocppstring(tolua_S,7,0)); const AString a_Line4 = ((const AString) tolua_tocppstring(tolua_S,8,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,9,NULL)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'UpdateSign'", NULL); #endif { - self->UpdateSign(a_X,a_Y,a_Z,a_Line1,a_Line2,a_Line3,a_Line4); + self->UpdateSign(a_X,a_Y,a_Z,a_Line1,a_Line2,a_Line3,a_Line4,a_Player); tolua_pushcppstring(tolua_S,(const char*)a_Line1); tolua_pushcppstring(tolua_S,(const char*)a_Line2); tolua_pushcppstring(tolua_S,(const char*)a_Line3); diff --git a/source/Bindings.h b/source/Bindings.h index fe7089222..2af2d69a7 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 08/29/12 22:33:21. +** Generated automatically by tolua++-1.0.92 on 09/01/12 23:31:58. */ /* Exported function */ diff --git a/source/cPlugin.cpp b/source/cPlugin.cpp index 4bdebc859..5fb8057a3 100644 --- a/source/cPlugin.cpp +++ b/source/cPlugin.cpp @@ -237,7 +237,7 @@ void cPlugin::OnTakeDamage(cPawn * a_Pawn, TakeDamageInfo * a_TakeDamageInfo) -bool cPlugin::OnUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +bool cPlugin::OnUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) { UNUSED(a_World); UNUSED(a_BlockX); @@ -247,6 +247,7 @@ bool cPlugin::OnUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_ UNUSED(a_Line2); UNUSED(a_Line3); UNUSED(a_Line4); + UNUSED(a_Player); return false; } @@ -254,7 +255,7 @@ bool cPlugin::OnUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_ -bool cPlugin::OnUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) +bool cPlugin::OnUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) { UNUSED(a_World); UNUSED(a_BlockX); @@ -264,6 +265,7 @@ bool cPlugin::OnUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a UNUSED(a_Line2); UNUSED(a_Line3); UNUSED(a_Line4); + UNUSED(a_Player); return false; } diff --git a/source/cPlugin.h b/source/cPlugin.h index 15029886b..14a415fdb 100644 --- a/source/cPlugin.h +++ b/source/cPlugin.h @@ -58,8 +58,8 @@ public: virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); virtual void OnTakeDamage (cPawn * a_Pawn, TakeDamageInfo * a_TakeDamageInfo ); - virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); - virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); + virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player); + virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player); virtual bool OnWeatherChanged (cWorld * a_World); // Accessors diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp index 788b5e429..13a67ee28 100644 --- a/source/cPluginManager.cpp +++ b/source/cPluginManager.cpp @@ -585,7 +585,7 @@ bool cPluginManager::CallHookWeatherChanged(cWorld * a_World) -bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) +bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) { HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATING_SIGN); if (Plugins == m_Hooks.end()) @@ -594,7 +594,7 @@ bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_ } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnUpdatingSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4)) + if ((*itr)->OnUpdatingSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player)) { return true; } @@ -606,7 +606,7 @@ bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_ -bool cPluginManager::CallHookUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +bool cPluginManager::CallHookUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) { HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATED_SIGN); if (Plugins == m_Hooks.end()) @@ -615,7 +615,7 @@ bool cPluginManager::CallHookUpdatedSign(cWorld * a_World, int a_BlockX, int a_B } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnUpdatedSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4)) + if ((*itr)->OnUpdatedSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player)) { return true; } diff --git a/source/cPluginManager.h b/source/cPluginManager.h index 51d443945..578e84013 100644 --- a/source/cPluginManager.h +++ b/source/cPluginManager.h @@ -112,8 +112,8 @@ public: //tolua_export bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username); bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); - bool CallHookUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); - bool CallHookUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); + bool CallHookUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player); + bool CallHookUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player); bool CallHookWeatherChanged (cWorld * a_World); void RemoveHooks( cPlugin* a_Plugin ); diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp index 7341a572b..dea74540b 100644 --- a/source/cPlugin_NewLua.cpp +++ b/source/cPlugin_NewLua.cpp @@ -555,7 +555,8 @@ bool cPlugin_NewLua::OnWeatherChanged(cWorld * a_World) bool cPlugin_NewLua::OnUpdatingSign( cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, - AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4 + AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, + cPlayer * a_Player ) { cCSLock Lock(m_CriticalSection); @@ -572,8 +573,9 @@ bool cPlugin_NewLua::OnUpdatingSign( tolua_pushstring (m_LuaState, a_Line2.c_str()); tolua_pushstring (m_LuaState, a_Line3.c_str()); tolua_pushstring (m_LuaState, a_Line4.c_str()); + tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer"); - if (!CallFunction(8, 5, "OnUpdatingSign")) + if (!CallFunction(9, 5, "OnUpdatingSign")) { return false; } @@ -605,7 +607,8 @@ bool cPlugin_NewLua::OnUpdatingSign( bool cPlugin_NewLua::OnUpdatedSign( cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, - const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4 + const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, + cPlayer * a_Player ) { cCSLock Lock(m_CriticalSection); @@ -622,8 +625,9 @@ bool cPlugin_NewLua::OnUpdatedSign( tolua_pushstring (m_LuaState, a_Line2.c_str()); tolua_pushstring (m_LuaState, a_Line3.c_str()); tolua_pushstring (m_LuaState, a_Line4.c_str()); + tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer"); - if (!CallFunction(8, 1, "OnUpdatedSign")) + if (!CallFunction(9, 1, "OnUpdatedSign")) { return false; } diff --git a/source/cPlugin_NewLua.h b/source/cPlugin_NewLua.h index ed40bf458..5114889e9 100644 --- a/source/cPlugin_NewLua.h +++ b/source/cPlugin_NewLua.h @@ -42,8 +42,8 @@ public: //tolua_export virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; virtual void OnTakeDamage (cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo ) override; - virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; - virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) override; + virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) override; + virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) override; virtual bool OnWeatherChanged (cWorld * a_World) override; const AString & GetDirectory(void) const {return m_Directory; } diff --git a/source/cPlugin_Squirrel.cpp b/source/cPlugin_Squirrel.cpp index bfd5a7037..8b13718a7 100644 --- a/source/cPlugin_Squirrel.cpp +++ b/source/cPlugin_Squirrel.cpp @@ -337,7 +337,8 @@ bool cPlugin_Squirrel::OnWeatherChanged(cWorld * a_World) bool cPlugin_Squirrel::OnUpdatingSign(
cWorld * a_World,
int a_BlockX, int a_BlockY, int a_BlockZ,
- AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4
+ AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4,
+ cPlayer * a_Player
)
{
cCSLock Lock(m_CriticalSection);
@@ -352,7 +353,8 @@ bool cPlugin_Squirrel::OnUpdatingSign( a_Line1,
a_Line2,
a_Line3,
- a_Line4
+ a_Line4,
+ a_Player
);
}
@@ -363,7 +365,8 @@ bool cPlugin_Squirrel::OnUpdatingSign( bool cPlugin_Squirrel::OnUpdatedSign(
cWorld * a_World,
int a_BlockX, int a_BlockY, int a_BlockZ,
- const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4
+ const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4,
+ cPlayer * a_Player
)
{
cCSLock Lock(m_CriticalSection);
@@ -378,6 +381,7 @@ bool cPlugin_Squirrel::OnUpdatedSign( a_Line1,
a_Line2,
a_Line3,
- a_Line4
+ a_Line4,
+ a_Player
);
}
diff --git a/source/cPlugin_Squirrel.h b/source/cPlugin_Squirrel.h index 802faa76f..9cec0fee8 100644 --- a/source/cPlugin_Squirrel.h +++ b/source/cPlugin_Squirrel.h @@ -38,8 +38,8 @@ public: virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual void OnTakeDamage (cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo ) override;
- virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
- virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) override;
+ virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) override;
+ virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) override;
virtual bool OnWeatherChanged (cWorld * a_World) override;
protected:
diff --git a/source/cWorld.cpp b/source/cWorld.cpp index 776d25732..7b40275ca 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -1911,18 +1911,18 @@ void cWorld::ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -void cWorld::UpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +void cWorld::UpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) { AString Line1(a_Line1); AString Line2(a_Line2); AString Line3(a_Line3); AString Line4(a_Line4); - if (cRoot::Get()->GetPluginManager()->CallHookUpdatingSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4)) + if (cRoot::Get()->GetPluginManager()->CallHookUpdatingSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4, a_Player)) { return; } m_ChunkMap->UpdateSign(a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4); - cRoot::Get()->GetPluginManager()->CallHookUpdatedSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4); + cRoot::Get()->GetPluginManager()->CallHookUpdatedSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4, a_Player); } diff --git a/source/cWorld.h b/source/cWorld.h index df2f3abab..7d4eb0e0e 100644 --- a/source/cWorld.h +++ b/source/cWorld.h @@ -216,7 +216,8 @@ public: /// Marks the chunk as failed-to-load: void ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ); - void UpdateSign(int a_X, int a_Y, int a_Z, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); //tolua_export + /// Updates the sign, askin gplugins for permission forst. a_Player is the player who changed the sign, may be NULL + void UpdateSign(int a_X, int a_Y, int a_Z, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); //tolua_export /// Marks (a_Stay == true) or unmarks (a_Stay == false) chunks as non-unloadable. To be used only by cChunkStay! void ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay = true); |