Permalink
Browse files

Merge branch 'master' into coverity_scan

  • Loading branch information...
tycho
tycho committed Mar 21, 2015
2 parents 75e04e8 + bd73dce commit dc89d7bcabd0915beb389d8a7f210778d20ce125
Showing with 1,280 additions and 363 deletions.
  1. +2 −0 CMakeLists.txt
  2. +1 −0 CONTRIBUTORS
  3. +43 −8 MCServer/Plugins/APIDump/APIDesc.lua
  4. +10 −0 MCServer/Plugins/APIDump/main_APIDump.lua
  5. +1 −1 MCServer/Plugins/Core
  6. +2 −2 MCServer/README.txt
  7. +1 −1 MCServer/crafting.txt
  8. +2 −0 MCServer/furnace.txt
  9. +1 −1 MCServer/webadmin/template.lua
  10. +1 −1 Tools/ProtoProxy/CMakeLists.txt
  11. +1 −1 app.yml
  12. +1 −1 lib/SQLiteCpp
  13. +1 −1 lib/libevent
  14. +1 −1 lib/polarssl
  15. +5 −6 lib/polarssl.cmake
  16. +1 −1 src/Bindings/CMakeLists.txt
  17. +31 −1 src/Bindings/LuaState.cpp
  18. +4 −0 src/Bindings/LuaState.h
  19. +77 −7 src/Bindings/ManualBindings.cpp
  20. +135 −1 src/BlockArea.cpp
  21. +27 −1 src/BlockArea.h
  22. +1 −0 src/Blocks/BlockHandler.cpp
  23. +1 −1 src/CMakeLists.txt
  24. +101 −2 src/CheckBasicStyle.lua
  25. +0 −1 src/Entities/Entity.cpp
  26. +1 −1 src/Entities/Player.h
  27. +2 −5 src/Mobs/AggressiveMonster.cpp
  28. +2 −0 src/Mobs/CMakeLists.txt
  29. +178 −187 src/Mobs/Monster.cpp
  30. +43 −38 src/Mobs/Monster.h
  31. +389 −0 src/Mobs/Path.cpp
  32. +150 −0 src/Mobs/Path.h
  33. +0 −1 src/Mobs/Pig.cpp
  34. +1 −1 src/Mobs/Sheep.cpp
  35. +1 −20 src/Mobs/Skeleton.cpp
  36. +2 −3 src/Mobs/Skeleton.h
  37. +1 −1 src/Mobs/Villager.cpp
  38. +2 −2 src/Mobs/Wolf.cpp
  39. +0 −23 src/Mobs/Zombie.cpp
  40. +3 −5 src/Mobs/Zombie.h
  41. +6 −1 src/OSSupport/File.h
  42. +1 −1 src/PolarSSL++/CMakeLists.txt
  43. +2 −2 src/Protocol/Protocol17x.cpp
  44. +2 −2 src/Protocol/Protocol18x.cpp
  45. +1 −1 src/Protocol/ProtocolRecognizer.h
  46. +19 −19 src/Server.cpp
  47. +4 −4 src/SetChunkData.cpp
  48. +6 −4 src/SetChunkData.h
  49. +1 −0 src/Vector3.h
  50. +2 −2 src/World.cpp
  51. +1 −1 src/WorldStorage/WSSAnvil.cpp
  52. +9 −0 src/main.cpp
View
@@ -54,11 +54,13 @@ endif()
# This has to be done before any flags have been set up.
if(${BUILD_TOOLS})
message("Building tools")
add_subdirectory(Tools/MCADefrag/)
add_subdirectory(Tools/ProtoProxy/)
endif()
if(${BUILD_UNSTABLE_TOOLS})
message("Building unstable tools")
add_subdirectory(Tools/GeneratorPerformanceTest/)
endif()
View
@@ -20,6 +20,7 @@ mtilden
nesco
p-mcgowan
rs2k
SafwatHalaby (Safwat Halaby)
SamJBarney
Sofapriester
SphinxC0re
@@ -99,6 +99,7 @@ g_APIDesc =
Clear = { Params = "", Return = "", Notes = "Clears the object, resets it to zero size" },
CopyFrom = { Params = "BlockAreaSrc", Return = "", Notes = "Copies contents from BlockAreaSrc into self" },
CopyTo = { Params = "BlockAreaDst", Return = "", Notes = "Copies contents from self into BlockAreaDst." },
CountNonAirBlocks = { Params = "", Return = "number", Notes = "Returns the count of blocks that are not air. Returns 0 if blocktypes not available. Block metas are ignored (if present, air with any meta is still considered air)." },
Create = { Params = "SizeX, SizeY, SizeZ, [DataTypes]", Return = "", Notes = "Initializes this BlockArea to an empty area of the specified size and origin of {0, 0, 0}. Any previous contents are lost." },
Crop = { Params = "AddMinX, SubMaxX, AddMinY, SubMaxY, AddMinZ, SubMaxZ", Return = "", Notes = "Crops the specified number of blocks from each border. Modifies the size of this blockarea object." },
DumpToRawFile = { Params = "FileName", Return = "", Notes = "Dumps the raw data into a file. For debugging purposes only." },
@@ -120,6 +121,7 @@ g_APIDesc =
GetOriginX = { Params = "", Return = "number", Notes = "Returns the origin x-coord" },
GetOriginY = { Params = "", Return = "number", Notes = "Returns the origin y-coord" },
GetOriginZ = { Params = "", Return = "number", Notes = "Returns the origin z-coord" },
GetNonAirCropRelCoords = { Params = "[IgnoreBlockType]", Return = "MinRelX, MinRelY, MinRelZ, MaxRelX, MaxRelY, MaxRelZ", Notes = "Returns the minimum and maximum coords in each direction for the first non-ignored block in each direction. If there are no non-ignored blocks within the area, or blocktypes are not present, the returned values are reverse-ranges (MinX <- m_RangeX, MaxX <- 0 etc.). IgnoreBlockType defaults to air." },
GetRelBlockLight = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the blocklight at the specified relative coords" },
GetRelBlockMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified relative coords" },
GetRelBlockSkyLight = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the skylight at the specified relative coords" },
@@ -197,13 +199,14 @@ g_APIDesc =
baMetas = { Notes = "Operations should work on block metas" },
baLight = { Notes = "Operations should work on block (emissive) light" },
baSkyLight = { Notes = "Operations should work on skylight" },
msDifference = { Notes = "Block becomes air if Src and Dst are the same. Otherwise it becomes the source block." },
msOverwrite = { Notes = "Src overwrites anything in Dst" },
msFillAir = { Notes = "Dst is overwritten by Src only where Src has air blocks" },
msImprint = { Notes = "Src overwrites Dst anywhere where Dst has non-air blocks" },
msDifference = { Notes = "Block becomes air if 'self' and src are the same. Otherwise it becomes the src block." },
msFillAir = { Notes = "'self' is overwritten by Src only where 'self' has air blocks" },
msImprint = { Notes = "Src overwrites 'self' anywhere where 'self' has non-air blocks" },
msLake = { Notes = "Special mode for merging lake images" },
msMask = { Notes = "The blocks that are exactly the same are kept in 'self', all differing blocks are replaced by air"},
msOverwrite = { Notes = "Src overwrites anything in 'self'" },
msSimpleCompare = { Notes = "The blocks that are exactly the same are replaced with air, all differing blocks are replaced by stone"},
msSpongePrint = { Notes = "Similar to msImprint, sponge block doesn't overwrite anything, all other blocks overwrite everything"},
msMask = { Notes = "The blocks that are exactly the same are kept in Dst, all differing blocks are replaced by air"},
},
ConstantGroups =
{
@@ -287,7 +290,7 @@ g_APIDesc =
<table><tbody><tr>
<th colspan="2"> area block </th><th> </th><th> Notes </th>
</tr><tr>
<th> this </th><th> Src </th><th> result </th><th> </th>
<th> self </th><th> Src </th><th> result </th><th> </th>
</tr><tr>
<td> A </td><td> sponge </td><td> A </td><td> Sponge is the NOP block </td>
</tr><tr>
@@ -321,7 +324,7 @@ g_APIDesc =
<table><tbody><tr>
<th colspan="2"> area block </th><th> </th><th> Notes </th>
</tr><tr>
<th> this </th><th> Src </th><th> result </th><th> </th>
<th> self </th><th> Src </th><th> result </th><th> </th>
</tr><tr>
<td> A </td><td> sponge </td><td> A </td><td> Sponge is the NOP block </td>
</tr><tr>
@@ -337,13 +340,45 @@ g_APIDesc =
<table><tbody><tr>
<th colspan="2"> area block </th><th> </th><th> Notes </th>
</tr><tr>
<th> this </th><th> Src </th><th> result </th><th> </th>
<th> self </th><th> Src </th><th> result </th><th> </th>
</tr><tr>
<td> A </td><td> A </td><td> A </td><td> Same blocks are kept </td>
</tr><tr>
<td> A </td><td> non-A </td><td> air </td><td> Differing blocks are replaced with air </td>
</tr>
</tbody></table>
<p>
<strong>msDifference</strong> - the blocks that are the same in both areas are replaced with air, all the
differing blocks are kept from the first area. Meta is used in the comparison, too, two blocks of the
same type but different meta are considered different.
</p>
<table><tbody><tr>
<th colspan="2"> area block </th><th> </th><th> Notes </th>
</tr><tr>
<th> self </th><th> Src </th><th> result </th><th> </th>
</tr><tr>
<td> A </td><td> A </td><td> air </td><td> Same blocks are replaced with air </td>
</tr><tr>
<td> A </td><td> non-A </td><td> A </td><td> Differing blocks are kept from 'self' </td>
</tr>
</tbody></table>
<p>
<strong>msSimpleCompare</strong> - the blocks that are the same in both areas are replaced with air, all the
differing blocks are replaced with stone. Meta is used in the comparison, too, two blocks of the
same type but different meta are considered different.
</p>
<table><tbody><tr>
<th colspan="2"> area block </th><th> </th><th> Notes </th>
</tr><tr>
<th> self </th><th> Src </th><th> result </th><th> </th>
</tr><tr>
<td> A </td><td> A </td><td> air </td><td> Same blocks are replaced with air </td>
</tr><tr>
<td> A </td><td> non-A </td><td> stone </td><td> Differing blocks are replaced with stone </td>
</tr>
</tbody></table>
]],
}, -- Merge strategies
}, -- AdditionalInfo
@@ -1643,6 +1643,15 @@ end
local function HandleCmdApiShow(a_Split, a_EntireCmd)
os.execute("API" .. cFile:GetPathSeparator() .. "index.html")
return true, "Launching the browser to show the API docs..."
end
function Initialize(Plugin)
g_Plugin = Plugin;
g_PluginFolder = Plugin:GetLocalFolder();
@@ -1651,6 +1660,7 @@ function Initialize(Plugin)
-- Bind a console command to dump the API:
cPluginManager:BindConsoleCommand("api", HandleCmdApi, "Dumps the Lua API docs into the API/ subfolder")
cPluginManager:BindConsoleCommand("apishow", HandleCmdApiShow, "Runs the default browser to show the API docs")
-- Add a WebAdmin tab that has a Dump button
g_Plugin:AddWebTab("APIDump", HandleWebAdminDump)
Submodule Core updated from 57a0bd to ea0ab9
View
@@ -16,5 +16,5 @@
| Mail: faketruth@gmail.com |
\============================/
Compatible clients: 1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2, 1.6.3, 1.6.4
Compatible protocol versions: 29, 39, 47, 49, 51, 60, 61, 73, 74, 77, 78
Compatible clients: 1.7.x and 1.8.x
Compatible protocol versions: 4, 5, 47
View
@@ -50,7 +50,7 @@ JunglePlanks, 4 = JungleLog, *
AcaciaPlanks, 4 = AcaciaLog, *
DarkOakPlanks, 4 = DarkOakLog, *
Stick, 4 = Planks^-1, 2:2, 2:3
Torch, 4 = Stick, 1:2 | Coal, 1:1
Torch, 4 = Stick, 1:2 | Coal^-1, 1:1
Workbench = Planks^-1, 1:1, 1:2, 2:1, 2:2
Chest = Planks^-1, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3
TrappedChest = TripWireHook, 1:1 | Chest, 2:1
View
@@ -56,6 +56,7 @@ ClayBlock = HardenedClay
Netherrack = NetherBrickItem
RawFish = CookedFish
Log = CharCoal
DarkOakLog = CharCoal
Cactus = GreenDye
WetSponge = Sponge
Stonebrick = CrackedStonebrick
@@ -87,6 +88,7 @@ RawMutton = CookedMutton
! Jukebox = 300 # -> 15 sec
! Lavabucket = 20000 # -> 1000 sec
! Log = 300 # -> 15 sec
! DarkOakLog = 300 # -> 15 sec
! Sapling = 100 # -> 5 sec
! CoalBlock = 16000 # -> 800 sec
! BlazeRod = 2400 # -> 120 sec
@@ -40,7 +40,7 @@ function GetDefaultPage()
cRoot:Get():ForEachPlayer(
function(a_CBPlayer)
Content = Content .. "<li>" .. Player:GetName() .. "</li>"
Content = Content .. "<li>" .. a_CBPlayer:GetName() .. "</li>"
end
)
@@ -105,5 +105,5 @@ add_executable(ProtoProxy
${SHARED_OSS_HDR}
)
target_link_libraries(ProtoProxy zlib polarssl)
target_link_libraries(ProtoProxy zlib mbedtls)
View
@@ -1,5 +1,5 @@
name: MCServer
image: ubuntu-14-04-x64
image: ubuntu-15-04-x64
config:
#cloud-config
packages:
View
@@ -1,11 +1,10 @@
if(NOT TARGET polarssl)
# This script includes PolarSSL, if not already included.
# It is needed for when multiple projects reference PolarSSL.
if(NOT TARGET mbedtls)
message("including polarssl")
set(ENABLE_TESTING OFF CACHE BOOL "Disable tests")
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable programs")
if (SELF_TEST)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/polarssl/ ${CMAKE_CURRENT_BINARY_DIR}/lib/polarssl)
else()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/polarssl/ ${CMAKE_CURRENT_BINARY_DIR}/lib/polarssl EXCLUDE_FROM_ALL)
endif()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/polarssl/ ${CMAKE_CURRENT_BINARY_DIR}/lib/polarssl EXCLUDE_FROM_ALL)
endif()
@@ -142,5 +142,5 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPER
if(NOT MSVC)
add_library(Bindings ${SRCS} ${HDRS})
target_link_libraries(Bindings lua sqlite tolualib polarssl)
target_link_libraries(Bindings lua sqlite tolualib mbedtls)
endif()
View
@@ -937,6 +937,18 @@ void cLuaState::GetStackValue(int a_StackPos, AString & a_Value)
void cLuaState::GetStackValue(int a_StackPos, BLOCKTYPE & a_ReturnedVal)
{
if (lua_isnumber(m_LuaState, a_StackPos))
{
a_ReturnedVal = static_cast<BLOCKTYPE>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal));
}
}
void cLuaState::GetStackValue(int a_StackPos, bool & a_ReturnedVal)
{
a_ReturnedVal = (tolua_toboolean(m_LuaState, a_StackPos, a_ReturnedVal ? 1 : 0) > 0);
@@ -995,6 +1007,24 @@ void cLuaState::GetStackValue(int a_StackPos, int & a_ReturnedVal)
void cLuaState::GetStackValue(int a_StackPos, pBlockArea & a_ReturnedVal)
{
if (lua_isnil(m_LuaState, a_StackPos))
{
a_ReturnedVal = nullptr;
return;
}
tolua_Error err;
if (tolua_isusertype(m_LuaState, a_StackPos, "cBlockArea", false, &err))
{
a_ReturnedVal = *(reinterpret_cast<cBlockArea **>(lua_touserdata(m_LuaState, a_StackPos)));
}
}
void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
{
if (lua_isnil(m_LuaState, a_StackPos))
@@ -1005,7 +1035,7 @@ void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
tolua_Error err;
if (tolua_isusertype(m_LuaState, a_StackPos, "cBoundingBox", false, &err))
{
a_ReturnedVal = *((cBoundingBox **)lua_touserdata(m_LuaState, a_StackPos));
a_ReturnedVal = *(reinterpret_cast<cBoundingBox **>(lua_touserdata(m_LuaState, a_StackPos)));
}
}
View
@@ -37,6 +37,7 @@ extern "C"
class cBlockArea;
class cBlockEntity;
class cBoundingBox;
class cChunkDesc;
@@ -68,6 +69,7 @@ struct HTTPRequest;
struct HTTPTemplateRequest;
struct TakeDamageInfo;
typedef cBlockArea * pBlockArea;
typedef cBoundingBox * pBoundingBox;
typedef cMapManager * pMapManager;
typedef cPluginManager * pPluginManager;
@@ -244,11 +246,13 @@ class cLuaState
// GetStackValue() retrieves the value at a_StackPos, if it is a valid type. If not, a_Value is unchanged.
// Enum values are clamped to their allowed range.
void GetStackValue(int a_StackPos, AString & a_Value);
void GetStackValue(int a_StackPos, BLOCKTYPE & a_Value);
void GetStackValue(int a_StackPos, bool & a_Value);
void GetStackValue(int a_StackPos, cRef & a_Ref);
void GetStackValue(int a_StackPos, double & a_Value);
void GetStackValue(int a_StackPos, eWeather & a_Value);
void GetStackValue(int a_StackPos, int & a_Value);
void GetStackValue(int a_StackPos, pBlockArea & a_Value);
void GetStackValue(int a_StackPos, pBoundingBox & a_Value);
void GetStackValue(int a_StackPos, pMapManager & a_Value);
void GetStackValue(int a_StackPos, pPluginManager & a_Value);
Oops, something went wrong.

0 comments on commit dc89d7b

Please sign in to comment.