diff --git a/GNUmakefile b/GNUmakefile
index e0e606d90..c8cdd35e1 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -47,8 +47,8 @@ ifeq ($(release),1)
# release build - fastest run-time, no gdb support
################
-CC_OPTIONS = -O3 -DNDEBUG
-CXX_OPTIONS = -O3 -DNDEBUG
+CC_OPTIONS = -O3 -DNDEBUG -DLUA_USE_DLOPEN
+CXX_OPTIONS = -O3 -DNDEBUG -DLUA_USE_DLOPEN
LNK_OPTIONS = -pthread -O3
BUILDDIR = build/release/
@@ -59,8 +59,8 @@ ifeq ($(profile),1)
# profile build - a release build with symbols and profiling engine built in
################
-CC_OPTIONS = -g -ggdb -O3 -pg -DNDEBUG
-CXX_OPTIONS = -g -ggdb -O3 -pg -DNDEBUG
+CC_OPTIONS = -g -ggdb -O3 -pg -DNDEBUG -DLUA_USE_DLOPEN
+CXX_OPTIONS = -g -ggdb -O3 -pg -DNDEBUG -DLUA_USE_DLOPEN
LNK_OPTIONS = -pthread -ggdb -O3 -pg
BUILDDIR = build/profile/
@@ -71,8 +71,8 @@ else
# Since C code is used only for supporting libraries (zlib, lua), it is still Ofast-optimized
################
-CC_OPTIONS = -ggdb -g -D_DEBUG -O3
-CXX_OPTIONS = -ggdb -g -D_DEBUG -O1
+CC_OPTIONS = -ggdb -g -D_DEBUG -O3 -DLUA_USE_DLOPEN
+CXX_OPTIONS = -ggdb -g -D_DEBUG -O1 -DLUA_USE_DLOPEN
LNK_OPTIONS = -pthread -g -ggdb -O1
BUILDDIR = build/debug/
@@ -111,6 +111,14 @@ endif
+###################################################
+# Export all symbols from the executable, so that LuaRocks may bind to Lua routines:
+LNK_OPTIONS += -rdynamic
+
+
+
+
+
###################################################
# 32-bit build override in 64-bit build environments
diff --git a/Install/Zip2008.list b/Install/Zip2008.list
index fbfc06e0c..b118ccbf9 100644
--- a/Install/Zip2008.list
+++ b/Install/Zip2008.list
@@ -1,4 +1,5 @@
..\MCServer\MCServer.exe
+..\MCServer\*.dll
..\MCServer\Plugins
..\MCServer\webadmin
..\MCServer\crafting.txt
diff --git a/MCServer/.gitignore b/MCServer/.gitignore
index c03bcbe99..1fed134fe 100644
--- a/MCServer/.gitignore
+++ b/MCServer/.gitignore
@@ -1,4 +1,7 @@
*.exe
+*.dll
+*.exp
+*.lib
*.ini
MCServer
logs
@@ -20,3 +23,4 @@ valgrind.log
motd.txt
*.deuser
*.dmp
+*.xml
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua
index d767b449d..de9b3662c 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua
@@ -21,6 +21,9 @@ return
{ Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
{ Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
{ Name = "BlockFace", Type = "number", Notes = "Face of the block upon which the player interacted. One of the BLOCK_FACE_ constants" },
+ { Name = "CursorX", Type = "number", Notes = "X-coord of the mouse crosshair on the block" },
+ { Name = "CursorY", Type = "number", Notes = "Y-coord of the mouse crosshair on the block" },
+ { Name = "CursorZ", Type = "number", Notes = "Z-coord of the mouse crosshair on the block" },
},
Returns = [[
If the function returns false or no value, MCServer calls other plugins' callbacks and finally sends
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 385caa2ce..0b49859cb 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -260,6 +260,9 @@ void cConnection::Log(const char * a_Format, ...)
// Log to file:
cCSLock Lock(m_CSLog);
fputs(FullMsg.c_str(), m_LogFile);
+ #ifdef _DEBUG
+ fflush(m_LogFile);
+ #endif // _DEBUG
// Log to screen:
// std::cout << FullMsg;
@@ -2678,15 +2681,20 @@ bool cConnection::ParseMetadata(cByteBuffer & a_Buffer, AString & a_Metadata)
case 1: Length = 2; break; // short
case 2: Length = 4; break; // int
case 3: Length = 4; break; // float
- case 4: // string16
+ case 4: // UTF-8 string with VarInt length
{
- short Len = 0;
- if (!a_Buffer.ReadBEShort(Len))
+ UInt32 Len;
+ int rs = a_Buffer.GetReadableSpace();
+ if (!a_Buffer.ReadVarInt(Len))
{
return false;
}
- short NetLen = htons(Len);
- a_Metadata.append((char *)&NetLen, 2);
+ rs = rs - a_Buffer.GetReadableSpace();
+ cByteBuffer LenBuf(8);
+ LenBuf.WriteVarInt(Len);
+ AString VarLen;
+ LenBuf.ReadAll(VarLen);
+ a_Metadata.append(VarLen);
Length = Len;
break;
}
@@ -2766,11 +2774,21 @@ void cConnection::LogMetadata(const AString & a_Metadata, size_t a_IndentCount)
pos += 4;
break;
}
- case 4: // string16
+ case 4: // UTF-8 string with VarInt length
{
- short Length = (a_Metadata[pos + 1] << 8) | a_Metadata[pos + 2];
- Log("%sstring[%d] = \"%*s\"", Indent.c_str(), Index, Length, a_Metadata.c_str() + pos + 3);
- pos += Length + 2;
+ cByteBuffer bb(10);
+ int RestLen = (int)a_Metadata.size() - pos - 1;
+ if (RestLen > 8)
+ {
+ RestLen = 8;
+ }
+ bb.Write(a_Metadata.data() + pos + 1, RestLen);
+ UInt32 Length;
+ int rs = bb.GetReadableSpace();
+ bb.ReadVarInt(Length);
+ rs = rs - bb.GetReadableSpace();
+ Log("%sstring[%d] = \"%*s\"", Indent.c_str(), Index, Length, a_Metadata.c_str() + pos + rs + 1);
+ pos += Length + rs + 2;
break;
}
case 5:
diff --git a/VC2008/.gitignore b/VC2008/.gitignore
index 27d2f5ebe..e31475ed0 100644
--- a/VC2008/.gitignore
+++ b/VC2008/.gitignore
@@ -1,5 +1,6 @@
Debug/
Debug profiled/
+Debug_LuaStatic/
Release/
Release profiled/
*.user
diff --git a/VC2008/CryptoPP.vcproj b/VC2008/CryptoPP.vcproj
index 530467eeb..a818e9aa1 100644
--- a/VC2008/CryptoPP.vcproj
+++ b/VC2008/CryptoPP.vcproj
@@ -159,6 +159,74 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -514,6 +591,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -570,6 +656,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -626,6 +721,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -686,6 +790,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -742,6 +855,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -798,6 +920,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -854,6 +985,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -914,6 +1054,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -978,6 +1127,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1034,6 +1192,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1090,6 +1257,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1154,6 +1330,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1210,6 +1395,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1268,6 +1462,16 @@
UsePrecompiledHeader="0"
/>
+
+
+
@@ -1328,6 +1532,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1388,6 +1601,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1446,6 +1668,16 @@
PreprocessorDefinitions=""
/>
+
+
+
+
+
+
@@ -1562,6 +1803,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1624,6 +1874,16 @@
PreprocessorDefinitions=""
/>
+
+
+
+
+
+
@@ -1740,6 +2009,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1796,6 +2074,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1852,6 +2139,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1912,6 +2208,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -1968,6 +2273,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2024,6 +2338,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2080,6 +2403,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2136,6 +2468,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2192,6 +2533,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2248,6 +2598,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2304,6 +2663,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2363,6 +2731,16 @@
UsePrecompiledHeader="0"
/>
+
+
+
@@ -2423,6 +2801,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2479,6 +2866,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2535,6 +2931,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2591,6 +2996,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2647,6 +3061,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2703,6 +3126,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2759,6 +3191,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2815,6 +3256,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2871,6 +3321,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2927,6 +3386,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -2983,6 +3451,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3039,6 +3516,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3097,6 +3583,16 @@
UsePrecompiledHeader="1"
/>
+
+
+
@@ -3157,6 +3653,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3213,6 +3718,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3273,6 +3787,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3329,6 +3852,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3385,6 +3917,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3441,6 +3982,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3497,6 +4047,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3553,6 +4112,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3609,6 +4177,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3665,6 +4242,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3721,6 +4307,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3777,6 +4372,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3833,6 +4437,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3893,6 +4506,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -3949,6 +4571,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4005,6 +4636,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4061,6 +4701,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4117,6 +4766,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4173,6 +4831,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4229,6 +4896,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4285,6 +4961,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4341,6 +5026,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4397,6 +5091,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4453,6 +5156,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4509,6 +5221,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4569,6 +5290,15 @@
PreprocessorDefinitions=""
/>
+
+
+
@@ -4625,6 +5355,15 @@
PreprocessorDefinitions=""
/>
+
+
+
diff --git a/VC2008/JsonCpp.vcproj b/VC2008/JsonCpp.vcproj
index 8b35f170b..6fae46445 100644
--- a/VC2008/JsonCpp.vcproj
+++ b/VC2008/JsonCpp.vcproj
@@ -266,6 +266,68 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VC2008/Lua.vcproj b/VC2008/Lua.vcproj
index 326ba6411..d08d738ea 100644
--- a/VC2008/Lua.vcproj
+++ b/VC2008/Lua.vcproj
@@ -20,7 +20,7 @@
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)\Lua"
IntermediateDirectory="$(ConfigurationName)\Lua"
- ConfigurationType="4"
+ ConfigurationType="2"
CharacterSet="1"
>
+
@@ -73,6 +78,9 @@
+
@@ -81,7 +89,7 @@
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)\Lua"
IntermediateDirectory="$(ConfigurationName)\Lua"
- ConfigurationType="4"
+ ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -104,7 +112,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -121,11 +129,15 @@
Name="VCPreLinkEventTool"
/>
+
@@ -135,6 +147,9 @@
+
@@ -143,7 +158,7 @@
Name="Release profiled|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)\Lua"
IntermediateDirectory="$(ConfigurationName)\Lua"
- ConfigurationType="4"
+ ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -166,7 +181,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;LUA_BUILD_AS_DLL"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -183,11 +198,15 @@
Name="VCPreLinkEventTool"
/>
+
@@ -197,6 +216,9 @@
+
@@ -205,6 +227,74 @@
Name="Debug profiled|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)\Lua"
IntermediateDirectory="$(ConfigurationName)\Lua"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -375,10 +465,6 @@
RelativePath="..\lib\lua\src\ltm.c"
>
-
-
diff --git a/VC2008/MCServer.sln b/VC2008/MCServer.sln
index aeabaf252..a36150483 100644
--- a/VC2008/MCServer.sln
+++ b/VC2008/MCServer.sln
@@ -25,6 +25,7 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug profiled|Win32 = Debug profiled|Win32
+ Debug_LuaStatic|Win32 = Debug_LuaStatic|Win32
Debug|Win32 = Debug|Win32
Release profiled|Win32 = Release profiled|Win32
Release|Win32 = Release|Win32
@@ -32,6 +33,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{32012054-0C96-4C43-AB27-174FF8E72D66}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32
{32012054-0C96-4C43-AB27-174FF8E72D66}.Debug profiled|Win32.Build.0 = Debug profiled|Win32
+ {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {32012054-0C96-4C43-AB27-174FF8E72D66}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{32012054-0C96-4C43-AB27-174FF8E72D66}.Debug|Win32.ActiveCfg = Debug|Win32
{32012054-0C96-4C43-AB27-174FF8E72D66}.Debug|Win32.Build.0 = Debug|Win32
{32012054-0C96-4C43-AB27-174FF8E72D66}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
@@ -40,6 +43,8 @@ Global
{32012054-0C96-4C43-AB27-174FF8E72D66}.Release|Win32.Build.0 = Release|Win32
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug profiled|Win32.Build.0 = Debug profiled|Win32
+ {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug|Win32.ActiveCfg = Debug|Win32
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Debug|Win32.Build.0 = Debug|Win32
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
@@ -48,6 +53,8 @@ Global
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}.Release|Win32.Build.0 = Release|Win32
{5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32
{5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug profiled|Win32.Build.0 = Debug profiled|Win32
+ {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug|Win32.ActiveCfg = Debug|Win32
{5AAA90B9-946D-4034-83F3-676B06A6E326}.Debug|Win32.Build.0 = Debug|Win32
{5AAA90B9-946D-4034-83F3-676B06A6E326}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
@@ -56,6 +63,8 @@ Global
{5AAA90B9-946D-4034-83F3-676B06A6E326}.Release|Win32.Build.0 = Release|Win32
{082E8185-7B3A-4945-8C82-9132341A329D}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32
{082E8185-7B3A-4945-8C82-9132341A329D}.Debug profiled|Win32.Build.0 = Debug profiled|Win32
+ {082E8185-7B3A-4945-8C82-9132341A329D}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {082E8185-7B3A-4945-8C82-9132341A329D}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{082E8185-7B3A-4945-8C82-9132341A329D}.Debug|Win32.ActiveCfg = Debug|Win32
{082E8185-7B3A-4945-8C82-9132341A329D}.Debug|Win32.Build.0 = Debug|Win32
{082E8185-7B3A-4945-8C82-9132341A329D}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
@@ -64,6 +73,8 @@ Global
{082E8185-7B3A-4945-8C82-9132341A329D}.Release|Win32.Build.0 = Release|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug profiled|Win32.Build.0 = Debug profiled|Win32
+ {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug|Win32.ActiveCfg = Debug|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug|Win32.Build.0 = Debug|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
@@ -72,6 +83,8 @@ Global
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release|Win32.Build.0 = Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug profiled|Win32.ActiveCfg = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug profiled|Win32.Build.0 = Debug|Win32
+ {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release profiled|Win32.ActiveCfg = Release|Win32
@@ -80,6 +93,8 @@ Global
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.Build.0 = Release|Win32
{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug profiled|Win32.ActiveCfg = Debug|Win32
{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug profiled|Win32.Build.0 = Debug|Win32
+ {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug_LuaStatic|Win32.ActiveCfg = Debug_LuaStatic|Win32
+ {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug_LuaStatic|Win32.Build.0 = Debug_LuaStatic|Win32
{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug|Win32.ActiveCfg = Debug|Win32
{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Debug|Win32.Build.0 = Debug|Win32
{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}.Release profiled|Win32.ActiveCfg = Release|Win32
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index 95e10ba40..c5dedb677 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -327,6 +327,82 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -549,6 +625,14 @@
UsePrecompiledHeader="1"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1742,6 +1897,17 @@
Outputs="Bindings.cpp"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VC2008/expat.vcproj b/VC2008/expat.vcproj
index a02549192..b92b95737 100644
--- a/VC2008/expat.vcproj
+++ b/VC2008/expat.vcproj
@@ -139,6 +139,67 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VC2008/zlib.vcproj b/VC2008/zlib.vcproj
index 1e07afc4c..cdc5bab8c 100644
--- a/VC2008/zlib.vcproj
+++ b/VC2008/zlib.vcproj
@@ -266,6 +266,68 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h
index 0db2f60c4..bce5064bc 100644
--- a/src/Blocks/BlockFluid.h
+++ b/src/Blocks/BlockFluid.h
@@ -54,3 +54,84 @@ public:
+
+class cBlockLavaHandler :
+ public cBlockFluidHandler
+{
+ typedef cBlockFluidHandler super;
+public:
+
+ cBlockLavaHandler(BLOCKTYPE a_BlockType) :
+ super(a_BlockType)
+ {
+ }
+
+
+ /// Called to tick the block
+ virtual void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ {
+ if (a_Chunk.GetWorld()->ShouldLavaSpawnFire())
+ {
+ // Try to start up to 5 fires:
+ for (int i = 0; i < 5; i++)
+ {
+ TryStartFireNear(a_RelX, a_RelY, a_RelZ, a_Chunk);
+ }
+ }
+ }
+
+
+ /// Tries to start a fire near the lava at given coords. Returns true if fire started.
+ static bool TryStartFireNear(int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
+ {
+ // Pick a block next to this lava block:
+ int rnd = a_Chunk.GetWorld()->GetTickRandomNumber(cChunkDef::NumBlocks * 8) / 7;
+ int x = (rnd % 3) - 1; // -1 .. 1
+ int y = ((rnd / 4) % 4) - 1; // -1 .. 2
+ int z = ((rnd / 16) % 3) - 1; // -1 .. 1
+
+ // Check if it's fuel:
+ BLOCKTYPE BlockType;
+ if (
+ !a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) ||
+ !cFireSimulator::IsFuel(BlockType)
+ )
+ {
+ return false;
+ }
+
+ // Try to set it on fire:
+ static struct
+ {
+ int x, y, z;
+ } CrossCoords[] =
+ {
+ {-1, 0, 0},
+ { 1, 0, 0},
+ { 0, -1, 0},
+ { 0, 1, 0},
+ { 0, 0, -1},
+ { 0, 0, 1},
+ } ;
+ int RelX = a_RelX + x;
+ int RelY = a_RelY + y;
+ int RelZ = a_RelZ + z;
+ for (size_t i = 0; i < ARRAYCOUNT(CrossCoords); i++)
+ {
+ if (
+ a_Chunk.UnboundedRelGetBlockType(RelX + CrossCoords[i].x, RelY + CrossCoords[i].y, RelZ + CrossCoords[i].z, BlockType) &&
+ (BlockType == E_BLOCK_AIR)
+ )
+ {
+ // This is an air block next to a fuel next to lava, light it up:
+ a_Chunk.UnboundedRelSetBlock(RelX + CrossCoords[i].x, RelY + CrossCoords[i].y, RelZ + CrossCoords[i].z, E_BLOCK_FIRE, 0);
+ return true;
+ }
+ } // for i - CrossCoords[]
+ return false;
+ }
+} ;
+
+
+
+
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 7bb35efeb..4a6d49449 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -144,6 +144,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType);
case E_BLOCK_IRON_DOOR: return new cBlockDoorHandler (a_BlockType);
case E_BLOCK_IRON_ORE: return new cBlockOreHandler (a_BlockType);
+ case E_BLOCK_JACK_O_LANTERN: return new cBlockPumpkinHandler (a_BlockType);
case E_BLOCK_JUKEBOX: return new cBlockEntityHandler (a_BlockType);
case E_BLOCK_JUNGLE_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_LADDER: return new cBlockLadderHandler (a_BlockType);
@@ -157,18 +158,17 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType);
case E_BLOCK_MYCELIUM: return new cBlockMyceliumHandler (a_BlockType);
case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
+ case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType);
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler ( );
case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType);
- case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType);
+ case E_BLOCK_POTATOES: return new cBlockCropsHandler (a_BlockType);
+ case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType);
- case E_BLOCK_JACK_O_LANTERN: return new cBlockPumpkinHandler (a_BlockType);
case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType);
case E_BLOCK_QUARTZ_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
- case E_BLOCK_POTATOES: return new cBlockCropsHandler (a_BlockType);
- case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler(a_BlockType);
@@ -184,8 +184,8 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_SIGN_POST: return new cBlockSignHandler (a_BlockType);
case E_BLOCK_SNOW: return new cBlockSnowHandler (a_BlockType);
case E_BLOCK_SPRUCE_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
- case E_BLOCK_STATIONARY_LAVA: return new cBlockFluidHandler (a_BlockType);
- case E_BLOCK_STATIONARY_WATER: return new cBlockFluidHandler (a_BlockType);
+ case E_BLOCK_STATIONARY_LAVA: return new cBlockLavaHandler (a_BlockType);
+ case E_BLOCK_STATIONARY_WATER: return new cBlockLavaHandler (a_BlockType);
case E_BLOCK_STICKY_PISTON: return new cBlockPistonHandler (a_BlockType);
case E_BLOCK_STONE: return new cBlockStoneHandler (a_BlockType);
case E_BLOCK_STONE_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index a6be09ad3..29f3afbfc 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -26,7 +26,9 @@
(defined(_WIN32) && defined(__ARM__) && defined(_MSC_VER)) \
)
#define IS_LITTLE_ENDIAN
-#elif defined (__ARMEB__)
+#elif ( \
+ defined (__ARMEB__) || defined(__sparc) \
+)
#define IS_BIG_ENDIAN
#else
#error Cannot determine endianness of this platform
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index a9dd7f5ea..95c690203 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -123,7 +123,7 @@ protected:
int m_BufferSize; // Total size of the ringbuffer
#ifdef _DEBUG
- unsigned long m_ThreadID; // Thread that is currently accessing the object, checked via cSingleThreadAccessChecker
+ volatile unsigned long m_ThreadID; // Thread that is currently accessing the object, checked via cSingleThreadAccessChecker
#endif // _DEBUG
int m_DataStart; // Where the data starts in the ringbuffer
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 45825a30f..5c9eb892b 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -641,7 +641,7 @@ void cChunk::TickBlock(int a_RelX, int a_RelY, int a_RelZ)
}
cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
- Handler->OnUpdate(*this, a_RelX + m_PosX * Width, a_RelY, a_RelZ + m_PosZ * Width);
+ Handler->OnUpdate(*this, a_RelX, a_RelY, a_RelZ);
}
@@ -794,7 +794,7 @@ void cChunk::TickBlocks(void)
unsigned int Index = MakeIndexNoCheck(m_BlockTickX, m_BlockTickY, m_BlockTickZ);
cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
- Handler->OnUpdate(*this, m_BlockTickX + m_PosX * Width, m_BlockTickY, m_BlockTickZ + m_PosZ * Width);
+ Handler->OnUpdate(*this, m_BlockTickX, m_BlockTickY, m_BlockTickZ);
} // for i - tickblocks
}
diff --git a/src/World.cpp b/src/World.cpp
index bed5d6701..7982924ae 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -522,6 +522,7 @@ void cWorld::Start(void)
m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false);
m_bEnabledPVP = IniFile.GetValueSetB("PVP", "Enabled", true);
m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", false);
+ m_ShouldLavaSpawnFire = IniFile.GetValueSetB("Physics", "ShouldLavaSpawnFire", true);
m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode);
diff --git a/src/World.h b/src/World.h
index a6b61f2e2..ea0db53e6 100644
--- a/src/World.h
+++ b/src/World.h
@@ -129,6 +129,8 @@ public:
bool IsPVPEnabled(void) const { return m_bEnabledPVP; }
bool IsDeepSnowEnabled(void) const { return m_IsDeepSnowEnabled; }
+ bool ShouldLavaSpawnFire(void) const { return m_ShouldLavaSpawnFire; }
+
eDimension GetDimension(void) const { return m_Dimension; }
/// Returns the world height at the specified coords; waits for the chunk to get loaded / generated
@@ -654,6 +656,7 @@ private:
eGameMode m_GameMode;
bool m_bEnabledPVP;
bool m_IsDeepSnowEnabled;
+ bool m_ShouldLavaSpawnFire;
// The cRedstone class simulates redstone and needs access to m_RSList
// friend class cRedstone;