summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-14 19:30:37 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-14 19:30:37 +0200
commit0f39e9b10b80efadc82e0329c977c9fe00112489 (patch)
treef8d262c4f4bf3a31ad3eea57cdd4cf8b79d1f658
parentRemoved recipes.txt from nightbuild packing list (diff)
downloadcuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.tar
cuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.tar.gz
cuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.tar.bz2
cuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.tar.lz
cuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.tar.xz
cuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.tar.zst
cuberite-0f39e9b10b80efadc82e0329c977c9fe00112489.zip
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp56
-rw-r--r--source/Bindings.h2
-rw-r--r--source/cChunkGenerator.cpp2
-rw-r--r--source/cPlugin.h2
-rw-r--r--source/cPluginManager.cpp43
-rw-r--r--source/cPluginManager.h7
-rw-r--r--source/cPlugin_NewLua.cpp3
-rw-r--r--source/cPlugin_NewLua.h2
8 files changed, 65 insertions, 52 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 040ca67a3..72fc08859 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on Thu Jun 14 14:20:17 2012.
+** Generated automatically by tolua++-1.0.92 on 06/14/12 19:28:15.
*/
#ifndef __cplusplus
@@ -7863,24 +7863,26 @@ static int tolua_AllToLua_cPlugin_OnChunkGenerating00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
- !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,4,"cLuaChunk",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,5,&tolua_err)
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,5,"cLuaChunk",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
- int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0));
- int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0));
- cLuaChunk* a_pLuaChunk = ((cLuaChunk*) tolua_tousertype(tolua_S,4,0));
+ cWorld* a_Wordl = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_ChunkX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_ChunkZ = ((int) tolua_tonumber(tolua_S,4,0));
+ cLuaChunk* a_pLuaChunk = ((cLuaChunk*) tolua_tousertype(tolua_S,5,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnChunkGenerating'", NULL);
#endif
{
- bool tolua_ret = (bool) self->OnChunkGenerating(a_ChunkX,a_ChunkZ,a_pLuaChunk);
+ bool tolua_ret = (bool) self->OnChunkGenerating(a_Wordl,a_ChunkX,a_ChunkZ,a_pLuaChunk);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
@@ -8472,17 +8474,18 @@ public:
return ( void ) cPlugin:: OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
};
};
- bool OnChunkGenerating( int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
+ bool OnChunkGenerating( cWorld* a_Wordl, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
if (push_method("OnChunkGenerating", tolua_AllToLua_cPlugin_OnChunkGenerating00)) {
+ tolua_pushusertype(lua_state, (void*)a_Wordl, "cWorld");
tolua_pushnumber(lua_state, (lua_Number)a_ChunkX);
tolua_pushnumber(lua_state, (lua_Number)a_ChunkZ);
tolua_pushusertype(lua_state, (void*)a_pLuaChunk, "cLuaChunk");
- ToluaBase::dbcall(lua_state, 4, 1);
+ ToluaBase::dbcall(lua_state, 5, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin:: OnChunkGenerating(a_ChunkX,a_ChunkZ,a_pLuaChunk);
+ return ( bool ) cPlugin:: OnChunkGenerating(a_Wordl,a_ChunkX,a_ChunkZ,a_pLuaChunk);
};
};
bool OnPreCrafting( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
@@ -8584,8 +8587,8 @@ public:
void cPlugin__OnChunkGenerated( cWorld* a_World, int a_ChunkX, int a_ChunkZ) {
return ( void )cPlugin::OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
};
- bool cPlugin__OnChunkGenerating( int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
- return ( bool )cPlugin::OnChunkGenerating(a_ChunkX,a_ChunkZ,a_pLuaChunk);
+ bool cPlugin__OnChunkGenerating( cWorld* a_Wordl, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
+ return ( bool )cPlugin::OnChunkGenerating(a_Wordl,a_ChunkX,a_ChunkZ,a_pLuaChunk);
};
bool cPlugin__OnPreCrafting( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
return ( bool )cPlugin::OnPreCrafting(a_Player,a_Grid,a_Recipe);
@@ -9132,24 +9135,26 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnChunkGenerating00(lua_State* t
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Lua__cPlugin",0,&tolua_err) ||
- !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,4,"cLuaChunk",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,5,&tolua_err)
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,5,"cLuaChunk",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Lua__cPlugin* self = (Lua__cPlugin*) tolua_tousertype(tolua_S,1,0);
- int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0));
- int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0));
- cLuaChunk* a_pLuaChunk = ((cLuaChunk*) tolua_tousertype(tolua_S,4,0));
+ cWorld* a_Wordl = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_ChunkX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_ChunkZ = ((int) tolua_tonumber(tolua_S,4,0));
+ cLuaChunk* a_pLuaChunk = ((cLuaChunk*) tolua_tousertype(tolua_S,5,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnChunkGenerating'", NULL);
#endif
{
- bool tolua_ret = (bool) self->cPlugin__OnChunkGenerating(a_ChunkX,a_ChunkZ,a_pLuaChunk);
+ bool tolua_ret = (bool) self->cPlugin__OnChunkGenerating(a_Wordl,a_ChunkX,a_ChunkZ,a_pLuaChunk);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
@@ -9702,17 +9707,18 @@ public:
return ( void ) cPlugin_NewLua:: OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
};
};
- bool OnChunkGenerating( int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
+ bool OnChunkGenerating( cWorld* a_Wordl, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
if (push_method("OnChunkGenerating", tolua_AllToLua_cPlugin_OnChunkGenerating00)) {
+ tolua_pushusertype(lua_state, (void*)a_Wordl, "cWorld");
tolua_pushnumber(lua_state, (lua_Number)a_ChunkX);
tolua_pushnumber(lua_state, (lua_Number)a_ChunkZ);
tolua_pushusertype(lua_state, (void*)a_pLuaChunk, "cLuaChunk");
- ToluaBase::dbcall(lua_state, 4, 1);
+ ToluaBase::dbcall(lua_state, 5, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
lua_pop(lua_state, 1);
return tolua_ret;
} else {
- return ( bool ) cPlugin_NewLua:: OnChunkGenerating(a_ChunkX,a_ChunkZ,a_pLuaChunk);
+ return ( bool ) cPlugin_NewLua:: OnChunkGenerating(a_Wordl,a_ChunkX,a_ChunkZ,a_pLuaChunk);
};
};
bool OnPreCrafting( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
@@ -9817,8 +9823,8 @@ public:
void cPlugin_NewLua__OnChunkGenerated( cWorld* a_World, int a_ChunkX, int a_ChunkZ) {
return ( void )cPlugin_NewLua::OnChunkGenerated(a_World,a_ChunkX,a_ChunkZ);
};
- bool cPlugin_NewLua__OnChunkGenerating( int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
- return ( bool )cPlugin_NewLua::OnChunkGenerating(a_ChunkX,a_ChunkZ,a_pLuaChunk);
+ bool cPlugin_NewLua__OnChunkGenerating( cWorld* a_Wordl, int a_ChunkX, int a_ChunkZ, cLuaChunk* a_pLuaChunk) {
+ return ( bool )cPlugin_NewLua::OnChunkGenerating(a_Wordl,a_ChunkX,a_ChunkZ,a_pLuaChunk);
};
bool cPlugin_NewLua__OnPreCrafting( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
return ( bool )cPlugin_NewLua::OnPreCrafting(a_Player,a_Grid,a_Recipe);
diff --git a/source/Bindings.h b/source/Bindings.h
index ab12fc8fa..ed41f5dd4 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on Thu Jun 14 14:20:17 2012.
+** Generated automatically by tolua++-1.0.92 on 06/14/12 19:28:15.
*/
/* Exported function */
diff --git a/source/cChunkGenerator.cpp b/source/cChunkGenerator.cpp
index bed9d5cb8..e323ed549 100644
--- a/source/cChunkGenerator.cpp
+++ b/source/cChunkGenerator.cpp
@@ -485,7 +485,7 @@ void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
cBlockEntityList BlockEntities;
cLuaChunk LuaChunk( BlockTypes, BlockMeta, HeightMap, BiomeMap );
- if( cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_CHUNK_GENERATING, 3, a_ChunkX, a_ChunkZ, &LuaChunk ) )
+ if( cRoot::Get()->GetPluginManager()->CallHookChunkGenerating(m_World, a_ChunkX, a_ChunkZ, &LuaChunk ) )
{
// A plugin interrupted generation, handle something plugin specific
if( LuaChunk.IsUsingDefaultBiomes() )
diff --git a/source/cPlugin.h b/source/cPlugin.h
index 4d32396e8..40f2b302e 100644
--- a/source/cPlugin.h
+++ b/source/cPlugin.h
@@ -60,7 +60,7 @@ public:
virtual void OnTakeDamage (cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo ) { (void)a_Pawn; (void)a_TakeDamageInfo; }
virtual bool OnKilled (cPawn* a_Killed, cEntity* a_Killer ) { (void)a_Killed; (void)a_Killer; return false; }
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) {}
- virtual bool OnChunkGenerating (int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) { return false; }
+ virtual bool OnChunkGenerating (cWorld * a_Wordl, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) { return false; }
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) {return false; }
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) {return false; }
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) {return false; }
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp
index c686c9976..77b8402c8 100644
--- a/source/cPluginManager.cpp
+++ b/source/cPluginManager.cpp
@@ -390,28 +390,6 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
break;
}
- case HOOK_CHUNK_GENERATING:
- {
- if (a_NumArgs != 3)
- {
- break;
- }
- va_list argptr;
- va_start( argptr, a_NumArgs);
- int ChunkX = va_arg(argptr, int);
- int ChunkZ = va_arg(argptr, int);
- cLuaChunk * LuaChunk = va_arg(argptr, cLuaChunk *);
- va_end (argptr);
- for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
- {
- if ((*itr)->OnChunkGenerating(ChunkX, ChunkZ, LuaChunk))
- {
- return true;
- }
- }
- break;
- }
-
default:
{
LOGWARNING("cPluginManager: Calling Unknown hook: %i", a_Hook );
@@ -426,6 +404,27 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
+bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_LuaChunk)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATING);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnChunkGenerating(a_World, a_ChunkX, a_ChunkZ, a_LuaChunk))
+ {
+ 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);
diff --git a/source/cPluginManager.h b/source/cPluginManager.h
index e9010ebd9..9f9e41e8b 100644
--- a/source/cPluginManager.h
+++ b/source/cPluginManager.h
@@ -8,6 +8,12 @@ class cLuaCommandBinder;
class cPlugin;
class cPlugin_Lua;
+// fwd: cWorld.h
+class cWorld;
+
+// fwd: cLuaChunk.h
+class cLuaChunk;
+
// fwd: cPlayer.h
class cPlayer;
@@ -87,6 +93,7 @@ public: //tolua_export
bool CallHook( PluginHook a_Hook, unsigned int a_NumArgs, ... );
+ bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_Chunk);
bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool CallHookCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp
index 92764a368..dd6b61b9b 100644
--- a/source/cPlugin_NewLua.cpp
+++ b/source/cPlugin_NewLua.cpp
@@ -388,12 +388,13 @@ void cPlugin_NewLua::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_Chun
-bool cPlugin_NewLua::OnChunkGenerating( int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk )
+bool cPlugin_NewLua::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk)
{
cCSLock Lock(m_CriticalSection);
if (!PushFunction("OnChunkGenerating"))
return false;
+ tolua_pushusertype(m_LuaState, a_World, "cWorld");
tolua_pushnumber (m_LuaState, a_ChunkX);
tolua_pushnumber (m_LuaState, a_ChunkZ);
tolua_pushusertype(m_LuaState, a_pLuaChunk, "cLuaChunk");
diff --git a/source/cPlugin_NewLua.h b/source/cPlugin_NewLua.h
index e66c26e3f..ffcd107d3 100644
--- a/source/cPlugin_NewLua.h
+++ b/source/cPlugin_NewLua.h
@@ -37,7 +37,7 @@ public: //tolua_export
virtual void OnTakeDamage (cPawn* a_Pawn, TakeDamageInfo* a_TakeDamageInfo ) override;
virtual bool OnKilled (cPawn* a_Killed, cEntity* a_Killer ) override;
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
- virtual bool OnChunkGenerating (int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
+ virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;