diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/Bindings.cpp | 70 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/Root.h | 3 | ||||
-rw-r--r-- | source/Server.cpp | 19 |
4 files changed, 92 insertions, 2 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 3826711b5..1c6f25351 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/11/12 15:02:07. +** Generated automatically by tolua++-1.0.92 on 11/20/12 22:18:11. */ #ifndef __cplusplus @@ -15430,6 +15430,71 @@ static int tolua_AllToLua_cRoot_GetWorld00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: GetPrimaryServerVersion of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPrimaryServerVersion00 +static int tolua_AllToLua_cRoot_GetPrimaryServerVersion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cRoot* self = (const cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPrimaryServerVersion'", NULL); +#endif + { + int tolua_ret = (int) self->GetPrimaryServerVersion(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPrimaryServerVersion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPrimaryServerVersion of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_SetPrimaryServerVersion00 +static int tolua_AllToLua_cRoot_SetPrimaryServerVersion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + int a_Version = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPrimaryServerVersion'", NULL); +#endif + { + self->SetPrimaryServerVersion(a_Version); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPrimaryServerVersion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetGroupManager of class cRoot */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetGroupManager00 static int tolua_AllToLua_cRoot_GetGroupManager00(lua_State* tolua_S) @@ -22563,6 +22628,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"E_ITEM_STRAD_DISC",E_ITEM_STRAD_DISC); tolua_constant(tolua_S,"E_ITEM_WARD_DISC",E_ITEM_WARD_DISC); tolua_constant(tolua_S,"E_ITEM_11_DISC",E_ITEM_11_DISC); + tolua_constant(tolua_S,"E_ITEM_WAIT_DISC",E_ITEM_WAIT_DISC); tolua_constant(tolua_S,"E_META_PLANKS_APPLE",E_META_PLANKS_APPLE); tolua_constant(tolua_S,"E_META_PLANKS_CONIFER",E_META_PLANKS_CONIFER); tolua_constant(tolua_S,"E_META_PLANKS_BIRCH",E_META_PLANKS_BIRCH); @@ -23255,6 +23321,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"GetServer",tolua_AllToLua_cRoot_GetServer00); tolua_function(tolua_S,"GetDefaultWorld",tolua_AllToLua_cRoot_GetDefaultWorld00); tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cRoot_GetWorld00); + tolua_function(tolua_S,"GetPrimaryServerVersion",tolua_AllToLua_cRoot_GetPrimaryServerVersion00); + tolua_function(tolua_S,"SetPrimaryServerVersion",tolua_AllToLua_cRoot_SetPrimaryServerVersion00); tolua_function(tolua_S,"GetGroupManager",tolua_AllToLua_cRoot_GetGroupManager00); tolua_function(tolua_S,"GetCraftingRecipes",tolua_AllToLua_cRoot_GetCraftingRecipes00); tolua_function(tolua_S,"GetFurnaceRecipe",tolua_AllToLua_cRoot_GetFurnaceRecipe00); diff --git a/source/Bindings.h b/source/Bindings.h index 85bc844d0..b51c94b8f 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/11/12 15:02:07. +** Generated automatically by tolua++-1.0.92 on 11/20/12 22:18:11. */ /* Exported function */ diff --git a/source/Root.h b/source/Root.h index 3c7dfc19b..482cc3d25 100644 --- a/source/Root.h +++ b/source/Root.h @@ -50,6 +50,9 @@ public: /// Logs chunkstats for each world and totals void LogChunkStats(void); + int GetPrimaryServerVersion(void) const { return m_PrimaryServerVersion; } // tolua_export + void SetPrimaryServerVersion(int a_Version) { m_PrimaryServerVersion = a_Version; } // tolua_export + cMonsterConfig * GetMonsterConfig() { return m_MonsterConfig; } cGroupManager * GetGroupManager (void) { return m_GroupManager; } // tolua_export diff --git a/source/Server.cpp b/source/Server.cpp index 95d5617cb..cc5e2a731 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -548,6 +548,25 @@ void cServer::ServerCommand(const AString & a_Cmd) } #endif + if (split[0].compare("primaryserverversion") == 0) + { + if (split.size() > 1) + { + int Version = atol(split[1].c_str()); + if (Version == 0) + { + LOGWARNING("Cannot parse version \"%s\". Not setting anything."); + return; + } + cRoot::Get()->SetPrimaryServerVersion(Version); + } + LOGINFO("Primary server version: %d (%s)", + cRoot::Get()->m_PrimaryServerVersion, + cProtocolRecognizer::GetVersionTextFromInt(cRoot::Get()->m_PrimaryServerVersion).c_str() + ); + return; + } + if (split.size() > 1) { if (split[0].compare("say") == 0) |