diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Bindings/BindingsProcessor.lua | 4 | ||||
-rw-r--r-- | src/Bindings/LuaState.h | 7 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 1 | ||||
-rw-r--r-- | src/Generating/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Generating/PrefabPiecePool.cpp | 29 | ||||
-rw-r--r-- | src/Globals.h | 16 | ||||
-rw-r--r-- | src/WorldStorage/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/WorldStorage/SchematicFileSerializer.cpp | 24 |
8 files changed, 37 insertions, 52 deletions
diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua index fba992082..a398f5026 100644 --- a/src/Bindings/BindingsProcessor.lua +++ b/src/Bindings/BindingsProcessor.lua @@ -98,7 +98,9 @@ local function OutputLuaStateHelpers(a_Package) f:write("// This file expects to be included form inside the cLuaState class definition\n") f:write("\n\n\n\n\n") for _, item in ipairs(types) do - f:write("void Push(" .. item.name .. " * a_Value);\n") + if not(g_HasCustomPushImplementation[item.name]) then + f:write("void Push(" .. item.name .. " * a_Value);\n") + end end for _, item in ipairs(types) do f:write("bool GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal);\n") diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index f6addad11..cc8214646 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -242,13 +242,14 @@ public: // Push a simple value onto the stack (keep alpha-sorted): void Push(bool a_Value); + void Push(cEntity * a_Entity); + void Push(cLuaServerHandle * a_ServerHandle); + void Push(cLuaTCPLink * a_TCPLink); + void Push(cLuaUDPEndpoint * a_UDPEndpoint); void Push(double a_Value); void Push(int a_Value); void Push(void * a_Ptr); void Push(std::chrono::milliseconds a_time); - void Push(cLuaServerHandle * a_ServerHandle); - void Push(cLuaTCPLink * a_TCPLink); - void Push(cLuaUDPEndpoint * a_UDPEndpoint); // GetStackValue() retrieves the value at a_StackPos, if it is a valid type. If not, a_Value is unchanged. // Returns whether value was changed diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 452cc94a5..105765b5f 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -427,6 +427,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_Bl + void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) { // Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this. diff --git a/src/Generating/CMakeLists.txt b/src/Generating/CMakeLists.txt index ebba4cce8..f3fe5c55c 100644 --- a/src/Generating/CMakeLists.txt +++ b/src/Generating/CMakeLists.txt @@ -101,5 +101,5 @@ endif() if(NOT MSVC) add_library(Generating ${SRCS} ${HDRS}) - target_link_libraries(Generating OSSupport Blocks) + target_link_libraries(Generating OSSupport Blocks Bindings) endif() diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp index c98eaaa5e..3f0ec8549 100644 --- a/src/Generating/PrefabPiecePool.cpp +++ b/src/Generating/PrefabPiecePool.cpp @@ -24,33 +24,6 @@ -#if SELF_TEST -static class cPrefabPiecePoolTest -{ -public: - cPrefabPiecePoolTest(void) - { - cSelfTests::Get().Register(cSelfTests::SelfTestFunction(cPrefabPiecePoolTest::TestLoading), "PrefabPiecePool loading test"); - } - - static void TestLoading(void) - { - cPrefabPiecePool test; - auto res = test.LoadFromFile("test.cubeset", true); - if (!res) - { - LOGWARNING("Loading from file \"test.cubeset\" failed."); - return; - } - LOG("Loaded %u pieces and %u starting pieces", static_cast<unsigned>(test.GetAllPiecesCount()), static_cast<unsigned>(test.GetStartingPiecesCount())); - } -} g_Test; -#endif - - - - - /** Returns the map of string => eMergeStrategy used when translating cubeset file merge strategies. */ static std::map<AString, cBlockArea::eMergeStrategy> & GetMergeStrategyMap(void) { @@ -173,6 +146,7 @@ bool cPrefabPiecePool::LoadFromFile(const AString & a_FileName, bool a_LogWarnin cFile f; if (!f.Open(a_FileName, cFile::fmRead)) { + CONDWARNING(a_LogWarnings, "Cannot open file %s for reading", a_FileName.c_str()); return false; } char buf[4096]; @@ -184,6 +158,7 @@ bool cPrefabPiecePool::LoadFromFile(const AString & a_FileName, bool a_LogWarnin { return LoadFromCubesetFile(a_FileName, a_LogWarnings); } + CONDWARNING(a_LogWarnings, "Cannot load prefabs from file %s, unknown file format", a_FileName.c_str()); return false; } diff --git a/src/Globals.h b/src/Globals.h index b787a94da..f0e370d2c 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -261,14 +261,15 @@ template class SizeChecker<UInt8, 1>; +// Common headers (part 1, without macros): +#include "StringUtils.h" +#include "OSSupport/CriticalSection.h" +#include "OSSupport/Event.h" +#include "OSSupport/File.h" +#include "OSSupport/StackTrace.h" + #ifndef TEST_GLOBALS - // Common headers (part 1, without macros): - #include "StringUtils.h" - #include "OSSupport/CriticalSection.h" - #include "OSSupport/Event.h" - #include "OSSupport/File.h" #include "Logger.h" - #include "OSSupport/StackTrace.h" #else // Logging functions void inline LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2); @@ -315,6 +316,9 @@ void inline LOG(const char * a_Format, ...) va_end(argList); } +#define LOGINFO LOG +#define LOGWARN LOGWARNING + #endif diff --git a/src/WorldStorage/CMakeLists.txt b/src/WorldStorage/CMakeLists.txt index 074958191..017d85f27 100644 --- a/src/WorldStorage/CMakeLists.txt +++ b/src/WorldStorage/CMakeLists.txt @@ -14,7 +14,8 @@ SET (SRCS ScoreboardSerializer.cpp StatSerializer.cpp WSSAnvil.cpp - WorldStorage.cpp) + WorldStorage.cpp +) SET (HDRS EnchantmentSerializer.h @@ -26,7 +27,8 @@ SET (HDRS ScoreboardSerializer.h StatSerializer.h WSSAnvil.h - WorldStorage.h) + WorldStorage.h +) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set_source_files_properties(EnchantmentSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast") diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp index 199873968..3e9ed5bef 100644 --- a/src/WorldStorage/SchematicFileSerializer.cpp +++ b/src/WorldStorage/SchematicFileSerializer.cpp @@ -238,27 +238,27 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP } // Copy the block types and metas: - size_t NumBytes = a_BlockArea.GetBlockCount(); - if (a_NBT.GetDataLength(TBlockTypes) < NumBytes) + size_t NumTypeBytes = a_BlockArea.GetBlockCount(); + if (a_NBT.GetDataLength(TBlockTypes) < NumTypeBytes) { - LOG("BlockTypes truncated in the schematic file (exp %d, got %d bytes). Loading partial.", - (int)NumBytes, (int)a_NBT.GetDataLength(TBlockTypes) + LOG("BlockTypes truncated in the schematic file (exp %u, got %u bytes). Loading partial.", + static_cast<unsigned>(NumTypeBytes), static_cast<unsigned>(a_NBT.GetDataLength(TBlockTypes)) ); - NumBytes = a_NBT.GetDataLength(TBlockTypes); + NumTypeBytes = a_NBT.GetDataLength(TBlockTypes); } - memcpy(a_BlockArea.m_BlockTypes, a_NBT.GetData(TBlockTypes), NumBytes); + memcpy(a_BlockArea.m_BlockTypes, a_NBT.GetData(TBlockTypes), NumTypeBytes); if (AreMetasPresent) { - size_t NumBytes = a_BlockArea.GetBlockCount(); - if (a_NBT.GetDataLength(TBlockMetas) < NumBytes) + size_t NumMetaBytes = a_BlockArea.GetBlockCount(); + if (a_NBT.GetDataLength(TBlockMetas) < NumMetaBytes) { - LOG("BlockMetas truncated in the schematic file (exp %d, got %d bytes). Loading partial.", - (int)NumBytes, (int)a_NBT.GetDataLength(TBlockMetas) + LOG("BlockMetas truncated in the schematic file (exp %u, got %u bytes). Loading partial.", + static_cast<unsigned>(NumMetaBytes), static_cast<unsigned>(a_NBT.GetDataLength(TBlockMetas)) ); - NumBytes = a_NBT.GetDataLength(TBlockMetas); + NumMetaBytes = a_NBT.GetDataLength(TBlockMetas); } - memcpy(a_BlockArea.m_BlockMetas, a_NBT.GetData(TBlockMetas), NumBytes); + memcpy(a_BlockArea.m_BlockMetas, a_NBT.GetData(TBlockMetas), NumMetaBytes); } return true; |