diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-12-01 14:43:03 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-12-01 14:43:03 +0100 |
commit | 677dde51bd3a8028dc28b004293b7c1b424ead0a (patch) | |
tree | 23e6e8357a96e0d3920ef00a9c15061f965d822e | |
parent | Merge branch 'master' into MobSpawner (diff) | |
parent | Merge pull request #1624 from mc-server/LuaDeprecating (diff) | |
download | cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.tar cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.tar.gz cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.tar.bz2 cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.tar.lz cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.tar.xz cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.tar.zst cuberite-677dde51bd3a8028dc28b004293b7c1b424ead0a.zip |
-rw-r--r-- | MCServer/Plugins/.gitignore | 2 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 2 | ||||
-rw-r--r-- | src/Bindings/DeprecatedBindings.cpp | 38 | ||||
-rw-r--r-- | src/Generating/DistortedHeightmap.cpp | 2 | ||||
-rw-r--r-- | src/Generating/Noise3DGenerator.cpp | 4 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp | 10 | ||||
-rw-r--r-- | src/Mobs/MonsterTypes.h | 10 |
7 files changed, 46 insertions, 22 deletions
diff --git a/MCServer/Plugins/.gitignore b/MCServer/Plugins/.gitignore index 8553945b5..92424459f 100644 --- a/MCServer/Plugins/.gitignore +++ b/MCServer/Plugins/.gitignore @@ -1,3 +1,3 @@ *.txt *.md -*/ + diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 5a64345ca..ecb8f6226 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2922,7 +2922,7 @@ end StringToDamageType = {Params = "string", Return = "{{Globals#DamageType|DamageType}}", Notes = "Converts a string representation to a {{Globals#DamageType|DamageType}} enumerated value."}, StringToDimension = {Params = "string", Return = "{{Globals#WorldDimension|Dimension}}", Notes = "Converts a string representation to a {{Globals#WorldDimension|Dimension}} enumerated value"}, StringToItem = {Params = "string, {{cItem|cItem}}", Return = "bool", Notes = "Parses the given string and sets the item; returns true if successful"}, - StringToMobType = {Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "Converts a string representation to a {{Globals#MobType|MobType}} enumerated value"}, + StringToMobType = {Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "<b>DEPRECATED!</b> Please use cMonster:StringToMobType(). Converts a string representation to a {{Globals#MobType|MobType}} enumerated value"}, StripColorCodes = {Params = "string", Return = "string", Notes = "Removes all control codes used by MC for colors and styles"}, TrimString = {Params = "string", Return = "string", Notes = "Trims whitespace at both ends of the string"}, md5 = {Params = "string", Return = "string", Notes = "converts a string to an md5 hash"}, diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp index 345ab2a07..0b2539fde 100644 --- a/src/Bindings/DeprecatedBindings.cpp +++ b/src/Bindings/DeprecatedBindings.cpp @@ -225,6 +225,42 @@ static int tolua_get_AllToLua_g_BlockFullyOccupiesVoxel(lua_State* tolua_S) +/* function: StringToMobType */ +static int tolua_AllToLua_StringToMobType00(lua_State* tolua_S) +{ + cLuaState LuaState(tolua_S); + + #ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + #endif + { + const AString a_MobString = tolua_tocppstring(LuaState, 1, 0); + eMonsterType MobType = cMonster::StringToMobType(a_MobString); + tolua_pushnumber(LuaState, (lua_Number) MobType); + tolua_pushcppstring(LuaState, (const char *) a_MobString); + } + + LOGWARNING("Warning in function call 'StringToMobType': StringToMobType() is deprecated. Please use cMonster:StringToMobType()"); + LuaState.LogStackTrace(0); + return 2; + + #ifndef TOLUA_RELEASE +tolua_lerror: + tolua_error(LuaState, "#ferror in function 'StringToMobType'.", &tolua_err); + return 0; + #endif +} + + + + + /** function: cWorld:SetSignLines */ static int tolua_cWorld_SetSignLines(lua_State * tolua_S) { @@ -296,6 +332,8 @@ void DeprecatedBindings::Bind(lua_State * tolua_S) tolua_array(tolua_S, "g_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, nullptr); tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, nullptr); + tolua_function(tolua_S, "StringToMobType", tolua_AllToLua_StringToMobType00); + tolua_beginmodule(tolua_S, "cWorld"); tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines); tolua_endmodule(tolua_S); diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index e1ed9b450..37a51c18e 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -122,6 +122,8 @@ const cDistortedHeightmap::sGenParam cDistortedHeightmap::m_GenParam[256] = cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGenPtr a_BiomeGen) : m_NoiseDistortX(a_Seed + 1000), m_NoiseDistortZ(a_Seed + 2000), + m_CurChunkX(0x7fffffff), // Set impossible coords for the chunk so that it's always considered stale + m_CurChunkZ(0x7fffffff), m_BiomeGen(a_BiomeGen), m_UnderlyingHeiGen(new cHeiGenBiomal(a_Seed, a_BiomeGen)), m_HeightGen(m_UnderlyingHeiGen, 64), diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp index a7af87bac..57e23809e 100644 --- a/src/Generating/Noise3DGenerator.cpp +++ b/src/Generating/Noise3DGenerator.cpp @@ -529,7 +529,9 @@ cBiomalNoise3DComposable::cBiomalNoise3DComposable(int a_Seed, cBiomeGenPtr a_Bi m_DensityNoiseA(a_Seed + 1), m_DensityNoiseB(a_Seed + 2), m_BaseNoise(a_Seed + 3), - m_BiomeGen(a_BiomeGen) + m_BiomeGen(a_BiomeGen), + m_LastChunkX(0x7fffffff), // Set impossible coords for the chunk so that it's always considered stale + m_LastChunkZ(0x7fffffff) { // Generate the weight distribution for summing up neighboring biomes: m_WeightSum = 0; diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 9937e6a95..3011acd85 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -63,16 +63,6 @@ static const struct -eMonsterType StringToMobType(const AString & a_MobString) -{ - LOGWARNING("%s: Function is obsolete, use cMonster::StringToMobType() instead", __FUNCTION__); - return cMonster::StringToMobType(a_MobString); -} - - - - - //////////////////////////////////////////////////////////////////////////////// // cMonster: diff --git a/src/Mobs/MonsterTypes.h b/src/Mobs/MonsterTypes.h index 852eb3446..dc6dd3992 100644 --- a/src/Mobs/MonsterTypes.h +++ b/src/Mobs/MonsterTypes.h @@ -2,6 +2,7 @@ #pragma once /// This identifies individual monster type, as well as their network type-ID + // tolua_begin enum eMonsterType { @@ -38,15 +39,6 @@ enum eMonsterType mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN, } ; - - - - -/** Translates a mob string ("ocelot") to mobtype (mtOcelot). -OBSOLETE, use cMonster::StringToMobType() instead. -Implemented in Monster.cpp. */ -extern eMonsterType StringToMobType(const AString & a_MobString); - // tolua_end |