summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--GETTING-STARTED.md121
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua79
-rw-r--r--MCServer/Plugins/APIDump/main.css5
-rw-r--r--MCServer/Plugins/APIDump/main_APIDump.lua18
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua9
-rw-r--r--VC2008/MCServer.vcproj4
-rw-r--r--lib/lua/Makefile54
-rw-r--r--src/Bindings/LuaState.h40
-rw-r--r--src/Bindings/Plugin.h1
-rw-r--r--src/Bindings/PluginLua.cpp18
-rw-r--r--src/Bindings/PluginLua.h1
-rw-r--r--src/Bindings/PluginManager.cpp26
-rw-r--r--src/Bindings/PluginManager.h4
-rw-r--r--src/BlockArea.cpp2
-rw-r--r--src/BlockEntities/BlockEntity.h6
-rw-r--r--src/BlockEntities/BlockEntityWithItems.h1
-rw-r--r--src/BlockEntities/FurnaceEntity.h2
-rw-r--r--src/BlockEntities/JukeboxEntity.h2
-rw-r--r--src/BlockEntities/NoteEntity.h2
-rw-r--r--src/BlockTracer.h25
-rw-r--r--src/Blocks/BlockHandler.h6
-rw-r--r--src/ByteBuffer.cpp7
-rw-r--r--src/ByteBuffer.h2
-rw-r--r--src/Chunk.cpp15
-rw-r--r--src/Chunk.h23
-rw-r--r--src/Chunk.inl.h34
-rw-r--r--src/ChunkDef.h1
-rw-r--r--src/ChunkSender.cpp2
-rw-r--r--src/ClientHandle.cpp1
-rw-r--r--src/CommandOutput.h1
-rw-r--r--src/Entities/Entity.h14
-rw-r--r--src/Entities/Player.cpp4
-rw-r--r--src/Entities/Player.h4
-rw-r--r--src/Entities/ProjectileEntity.h6
-rw-r--r--src/Generating/Trees.cpp49
-rw-r--r--src/Generating/Trees.h3
-rw-r--r--src/Inventory.cpp4
-rw-r--r--src/Items/ItemHandler.h8
-rw-r--r--src/LightingThread.cpp3
-rw-r--r--src/LineBlockTracer.cpp1
-rw-r--r--src/OSSupport/SocketThreads.h3
-rw-r--r--src/Piston.cpp1
-rw-r--r--src/Root.cpp2
-rw-r--r--src/Server.cpp5
-rw-r--r--src/Server.h2
-rw-r--r--src/Simulator/FireSimulator.h2
-rw-r--r--src/Simulator/NoopFluidSimulator.h10
-rw-r--r--src/Simulator/RedstoneSimulator.h4
-rw-r--r--src/Simulator/SandSimulator.h2
-rw-r--r--src/Simulator/Simulator.h9
-rw-r--r--src/WebAdmin.cpp3
-rw-r--r--src/WebAdmin.h15
-rw-r--r--src/World.cpp4
-rw-r--r--src/World.h1
55 files changed, 494 insertions, 178 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index bd6b204a4..150bcf09e 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -19,5 +19,6 @@ SamJBarney
worktycho
Sxw1212
tonibm19
+Diusrex
Please add yourself to this list if you contribute to MCServer.
diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md
new file mode 100644
index 000000000..66318a629
--- /dev/null
+++ b/GETTING-STARTED.md
@@ -0,0 +1,121 @@
+Hello! Thanks for wanting to work on this project :smile:, and I hope that this file will help you somewhat in getting all set up and running. I'll go through the basics of getting the projet environment set up, the code organization and style, and general development practices. I'll also show you some good issues to start off working on to get yourself familiarised with the code.
+
+Minecraft Basics
+----------------
+
+If you don't play Minecraft or don't have a great knowledge of the basic systems, you should get to know them. The [Minecraft Wiki](http://minecraft.gamepedia.com/Minecraft_Wiki) is quite useful for this task, although some youtubers are also fairly good at teaching the basics and just playing is quite good too.
+
+I'd say that the important topics are:
+
+* Differnt types of blocks and how they act.
+* Mobs, what they do and how.
+* Redstone, pistons, and automation.
+* Farming
+* Fighting, health and the hunger system.
+
+Useful Resources
+----------------
+
+ * [Minecraft Wiki](http://minecraft.gamepedia.com/Minecraft_Wiki)
+ * [Minecraft Protocol Wiki](http://wiki.vg)
+ * [Lua API Documentation](http://mc-server.xoft.cz/LuaAPI)
+ * [VS2008 Download](http://stackoverflow.com/questions/15318560/visual-c-2008-express-download-link-dead)
+
+Setting up a Dev Environment
+============================
+
+Requirements
+------------
+
+**Linux/BSD/Solaris/OSX:**
+
+You'll need the basic C++ build tools:
+
+ * gcc (or clang or another C compiler)
+ * g++ (or clang++ or another C++ compiler)
+ * make
+
+You'll also need CMake to generate the makefile to build from.
+
+**Windows:**
+
+If you use Windows, your best bet is the MSVC2008 (available as a free download in the Express edition from MS) or MSVS2013 (ditto), solution files for both are currently in the repo.
+
+Setting up the Repo
+-------------------
+
+Next, you'll need to set up the repo. You can make a fork and work on that then PR in, or I can set you up with membership for the repo so you can work on branches here (still use PRs though, they're great tools and for the first few you'll definitely need some changes). If you want membership to the repo, just create an issue and I can set you up.
+
+Once you've cloned, you need to pull down the submodules:
+
+ git submodule init
+ git submodule update
+
+After that they should come down automatically when you pull but it's not bad to refresh every once in a while.
+
+Repo Arrangement
+---------------------------
+
+The MCServer repo has recently been rearranged for better code separation and other things, but basically it's split into a few areas:
+
+ * `src`
+ This holds all of the MCServer source code, and is where most development takes place.
+ It's split into logical areas for blocks, the protocol handling and other things.
+ * `lib`
+ This holds all the 3rd party libraries for MCServer. You basically don't need to touch these, and we're thinking of switching them into submodules soon.
+ * `MCServer`
+ This folder isn't greatly named, but it contains the default plugins and environment to actually run the server. You'll find the executable (named `MCServer`) here and in the `plugins` subdir the default plugins. The config files are also stored here. Config files with `.example.ini` on the end are generated by the server or source control and should be left alone, instead you should copy them to a file without the `example` in the name which will be prioritised over the generated ones.
+
+Code Styles
+------------------
+
+Mainly follow the code styles in [CONTRIBUTING.md](https://github.com/mc-server/MCServer/blob/master/CONTRIBUTING.md), which is definitely an important read.
+
+
+How to Build
+------------------
+
+**Linux/BSD/Solaris/OSX:**
+
+Follow the instructions in [COMPILING.md](https://github.com/mc-server/MCServer/blob/master/COMPILING.md). You probably want to build in debug mode (when you're developing) for console alerts and debugging capability, even though it's much slower for everyday use.
+
+Basically, the process is:
+
+ cmake . -DCMAKE_BUILD_TYPE=DEBUG && make
+
+**Windows:**
+
+You need to first execute the `src/Bindings/AllToLua.bat` script file, then just open the solution file in your MSVC of choice and build.
+
+How to Run
+----------
+
+The server can be run (on *nix) by a simple `./MCServer` in the `MCServer` directory. On first run it will generate the world and start a server on the default port (configurable in `settings.ini`) so you can connect in minecraft via `localhost`.
+
+Where to Get Started
+-------------------------------
+
+There are a few fairly easy issues for you to get started with, as well as some more difficult but interesting ones.
+
+**Easy**:
+
+ * #288
+ * #385
+ * #402
+ * #388
+ * #380
+ * Clean up some of the compiler warnings. (Check [Travis CI](http://travis-ci.org/mc-server/MCServer) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
+
+**More Difficult**:
+
+ * #17
+ * #418
+ * #398
+
+You may also want to write some plugins. They are written in lua, with excellent API documentation available via [APIDump](http://mc-server.xoft.cz/LuaAPI). The [Core](https://github.com/mc-server/Core) plugin should also help quite a bit here.
+
+Special Things
+---------------------
+
+ * MCServer uses ToLUA for the Lua API, and you'll really have to ask @madmaxoft for how to export stuff and @worktycho for how to add stuff to the auto generated bindings (he just re-worked it with CMake).
+ * Ask questions as much as you like, we're here to help :smiley:
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua b/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
new file mode 100644
index 000000000..0d5b7271e
--- /dev/null
+++ b/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
@@ -0,0 +1,79 @@
+return
+{
+ HOOK_PLUGINS_LOADED =
+ {
+ CalledWhen = "All the enabled plugins have been loaded",
+ DefaultFnName = "OnPluginsLoaded", -- also used as pagename
+ Desc = [[
+ This callback gets called when the server finishes loading and initializing plugins. This is the
+ perfect occasion for a plugin to query other plugins through {{cPluginManager}}:GetPlugin() and
+ possibly start communicating with them using the {{cPlugin}}:Call() function.
+ ]],
+ Params = {},
+ Returns = [[
+ The return value is ignored, all registered callbacks are called.
+ ]],
+ CodeExamples =
+ {
+ {
+ Title = "CoreMessaging",
+ Desc = [[
+ This example shows how to implement the CoreMessaging functionality - messages to players will be
+ sent through the Core plugin, formatted by that plugin. As a fallback for when the Core plugin is
+ not present, the messages are sent directly by this code, unformatted.
+ ]],
+ Code = [[
+-- These are the fallback functions used when the Core is not present:
+local function SendMessageFallback(a_Player, a_Message)
+ a_Player:SendMessage(a_Message);
+end
+
+local function SendMessageSuccessFallback(a_Player, a_Message)
+ a_Player:SendMessage(a_Message);
+end
+
+local function SendMessageFailureFallback(a_Player, a_Message)
+ a_Player:SendMessage(a_Message);
+end
+
+-- These three "variables" will hold the actual functions to call.
+-- By default they are initialized to the Fallback variants, but will be redirected to Core when all plugins load
+SendMessage = SendMessageFallback;
+SendMessageSuccess = SendMessageSuccessFallback;
+SendMessageFailure = SendMessageFailureFallback;
+
+-- The callback tries to connect to the Core, if successful, overwrites the three functions with Core ones
+local function OnPluginsLoaded()
+ local CorePlugin = cPluginManager:Get():GetPlugin("Core");
+ if (CorePlugin == nil) then
+ -- The Core is not loaded, keep the Fallback functions
+ return;
+ end
+
+ -- Overwrite the three functions with Core functionality:
+ SendMessage = function(a_Player, a_Message)
+ CorePlugin:Call("SendMessage", a_Player, a_Message);
+ end
+ SendMessageSuccess = function(a_Player, a_Message)
+ CorePlugin:Call("SendMessageSuccess", a_Player, a_Message);
+ end
+ SendMessageFailure = function(a_Player, a_Message)
+ CorePlugin:Call("SendMessageFailure", a_Player, a_Message);
+ end
+end
+
+-- Global scope, register the callback:
+cPluginManager.AddHook(cPluginManager.HOOK_PLUGINS_LOADED, CoreMessagingPluginsLoaded);
+
+
+-- Usage, anywhere else in the plugin:
+SendMessageFailure(a_Player, "Cannot teleport to player, the destination player " .. PlayerName .. " was not found");
+ ]],
+ },
+ } , -- CodeExamples
+ }, -- HOOK_PLUGINS_LOADED
+}
+
+
+
+
diff --git a/MCServer/Plugins/APIDump/main.css b/MCServer/Plugins/APIDump/main.css
index 797079873..aa26bd186 100644
--- a/MCServer/Plugins/APIDump/main.css
+++ b/MCServer/Plugins/APIDump/main.css
@@ -30,6 +30,11 @@ pre
{
border: 1px solid #ccc;
background-color: #eee;
+ -moz-tab-size: 2;
+ -o-tab-size: 2;
+ -webkit-tab-size: 2;
+ -ms-tab-size: 2;
+ tab-size: 2;
}
body
diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua
index ff837ec4e..b3a95eb22 100644
--- a/MCServer/Plugins/APIDump/main_APIDump.lua
+++ b/MCServer/Plugins/APIDump/main_APIDump.lua
@@ -321,6 +321,7 @@ function DumpAPIHtml()
cFile:CreateFolder("API/Static");
local localFolder = g_Plugin:GetLocalFolder();
for idx, fnam in ipairs(cFile:GetFolderContents(localFolder .. "/Static")) do
+ cFile:Delete("API/Static/" .. fnam);
cFile:Copy(localFolder .. "/Static/" .. fnam, "API/Static/" .. fnam);
end
@@ -428,11 +429,18 @@ function DumpAPIHtml()
WriteClasses(f, API, ClassMenu);
WriteHooks(f, Hooks, UndocumentedHooks, HookNav);
- -- Copy the static files to the output folder (overwrite any existing):
- cFile:Copy(g_Plugin:GetLocalFolder() .. "/main.css", "API/main.css");
- cFile:Copy(g_Plugin:GetLocalFolder() .. "/prettify.js", "API/prettify.js");
- cFile:Copy(g_Plugin:GetLocalFolder() .. "/prettify.css", "API/prettify.css");
- cFile:Copy(g_Plugin:GetLocalFolder() .. "/lang-lua.js", "API/lang-lua.js");
+ -- Copy the static files to the output folder:
+ local StaticFiles =
+ {
+ "main.css",
+ "prettify.js",
+ "prettify.css",
+ "lang-lua.js",
+ };
+ for idx, fnam in ipairs(StaticFiles) do
+ cFile:Delete("API/" .. fnam);
+ cFile:Copy(g_Plugin:GetLocalFolder() .. "/" .. fnam, "API/" .. fnam);
+ end
-- List the documentation problems:
LOG("Listing leftovers...");
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index c9a610f71..8f2fa3682 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -27,6 +27,7 @@ function Initialize(Plugin)
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLUGINS_LOADED, OnPluginsLoaded);
PM = cRoot:Get():GetPluginManager();
PM:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities");
@@ -524,6 +525,14 @@ end
+function OnPluginsLoaded()
+ LOG("All plugins loaded");
+end
+
+
+
+
+
function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
-- Get the topmost block coord:
local Height = a_ChunkDesc:GetHeight(0, 0);
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index cb9867450..491e7740e 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -495,10 +495,6 @@
>
</File>
<File
- RelativePath="..\src\Chunk.inl.h"
- >
- </File>
- <File
RelativePath="..\src\ChunkDef.h"
>
</File>
diff --git a/lib/lua/Makefile b/lib/lua/Makefile
index d23c39cc1..8c8cf168a 100644
--- a/lib/lua/Makefile
+++ b/lib/lua/Makefile
@@ -733,54 +733,6 @@ src/ltm.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltm.c.s
.PHONY : src/ltm.c.s
-src/lua.o: src/lua.c.o
-.PHONY : src/lua.o
-
-# target to build an object file
-src/lua.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lua.c.o
-.PHONY : src/lua.c.o
-
-src/lua.i: src/lua.c.i
-.PHONY : src/lua.i
-
-# target to preprocess a source file
-src/lua.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lua.c.i
-.PHONY : src/lua.c.i
-
-src/lua.s: src/lua.c.s
-.PHONY : src/lua.s
-
-# target to generate assembly for a file
-src/lua.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lua.c.s
-.PHONY : src/lua.c.s
-
-src/luac.o: src/luac.c.o
-.PHONY : src/luac.o
-
-# target to build an object file
-src/luac.c.o:
- cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/luac.c.o
-.PHONY : src/luac.c.o
-
-src/luac.i: src/luac.c.i
-.PHONY : src/luac.i
-
-# target to preprocess a source file
-src/luac.c.i:
- cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/luac.c.i
-.PHONY : src/luac.c.i
-
-src/luac.s: src/luac.c.s
-.PHONY : src/luac.s
-
-# target to generate assembly for a file
-src/luac.c.s:
- cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/luac.c.s
-.PHONY : src/luac.c.s
-
src/lundump.o: src/lundump.c.o
.PHONY : src/lundump.o
@@ -964,12 +916,6 @@ help:
@echo "... src/ltm.o"
@echo "... src/ltm.i"
@echo "... src/ltm.s"
- @echo "... src/lua.o"
- @echo "... src/lua.i"
- @echo "... src/lua.s"
- @echo "... src/luac.o"
- @echo "... src/luac.i"
- @echo "... src/luac.s"
@echo "... src/lundump.o"
@echo "... src/lundump.i"
@echo "... src/lundump.s"
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index 15b0cdeff..a6c31b6d3 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -240,12 +240,33 @@ public:
return CallFunction(0);
}
+ /// Call any 0-param 1-return Lua function in a single line:
+ template<
+ typename FnT, typename RetT1
+ >
+ bool Call(FnT a_FnName, const cRet & a_Mark, RetT1 & a_Ret1)
+ {
+ UNUSED(a_Mark);
+ if (!PushFunction(a_FnName))
+ {
+ return false;
+ }
+ if (!CallFunction(1))
+ {
+ return false;
+ }
+ GetReturn(-1, a_Ret1);
+ lua_pop(m_LuaState, 1);
+ return true;
+ }
+
/// Call any 1-param 1-return Lua function in a single line:
template<
typename FnT, typename ArgT1, typename RetT1
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -266,6 +287,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -287,6 +309,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -309,6 +332,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -332,6 +356,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -357,6 +382,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -383,6 +409,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -410,6 +437,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -438,6 +466,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -467,6 +496,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, ArgT10 a_Arg10, const cRet & a_Mark, RetT1 & a_Ret1)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -496,6 +526,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -517,6 +548,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -540,6 +572,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -564,6 +597,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -589,6 +623,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -616,6 +651,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -644,6 +680,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -673,6 +710,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -703,6 +741,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
@@ -734,6 +773,7 @@ public:
>
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5)
{
+ UNUSED(a_Mark);
if (!PushFunction(a_FnName))
{
return false;
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h
index 9a3c2383e..ee0f8a062 100644
--- a/src/Bindings/Plugin.h
+++ b/src/Bindings/Plugin.h
@@ -82,6 +82,7 @@ public:
virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) = 0;
virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) = 0;
+ virtual bool OnPluginsLoaded (void) = 0;
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) = 0;
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 0e5a66cd6..69e83fb0a 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -910,6 +910,24 @@ bool cPluginLua::OnPlayerUsingItem(cPlayer & a_Player, int a_BlockX, int a_Block
+bool cPluginLua::OnPluginsLoaded(void)
+{
+ cCSLock Lock(m_CriticalSection);
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLUGINS_LOADED];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ bool ret = false;
+ m_LuaState.Call((int)(**itr), cLuaState::Return, ret);
+ res = res || ret;
+ }
+ return res;
+}
+
+
+
+
+
bool cPluginLua::OnPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
{
cCSLock Lock(m_CriticalSection);
diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h
index e1e274c72..1b257285e 100644
--- a/src/Bindings/PluginLua.h
+++ b/src/Bindings/PluginLua.h
@@ -79,6 +79,7 @@ public:
virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
+ virtual bool OnPluginsLoaded (void) override;
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override;
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 832dc4249..ffffe1a23 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -118,7 +118,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
int KeyNum = a_SettingsIni.FindKey("Plugins");
// If it does, how many plugins are there?
- unsigned int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
+ int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
if (KeyNum == -1)
{
@@ -126,7 +126,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
}
else if (NumPlugins > 0)
{
- for(unsigned int i = 0; i < NumPlugins; i++)
+ for (int i = 0; i < NumPlugins; i++)
{
AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
if (ValueName.compare("Plugin") == 0)
@@ -136,7 +136,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
{
if (m_Plugins.find(PluginFile) != m_Plugins.end())
{
- LoadPlugin( PluginFile );
+ LoadPlugin(PluginFile);
}
}
}
@@ -155,6 +155,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
{
LOG("-- Loaded 1 Plugin --");
}
+ CallHookPluginsLoaded();
}
@@ -987,6 +988,25 @@ bool cPluginManager::CallHookPlayerUsingItem(cPlayer & a_Player, int a_BlockX, i
+bool cPluginManager::CallHookPluginsLoaded(void)
+{
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_PLUGINS_LOADED);
+ if (Plugins == m_Hooks.end())
+ {
+ return false;
+ }
+ bool res = false;
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ res = !(*itr)->OnPluginsLoaded() || res;
+ }
+ return res;
+}
+
+
+
+
+
bool cPluginManager::CallHookPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
{
HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING);
diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h
index 04d6470c7..e94421057 100644
--- a/src/Bindings/PluginManager.h
+++ b/src/Bindings/PluginManager.h
@@ -94,6 +94,7 @@ public: // tolua_export
HOOK_PLAYER_USED_ITEM,
HOOK_PLAYER_USING_BLOCK,
HOOK_PLAYER_USING_ITEM,
+ HOOK_PLUGINS_LOADED,
HOOK_POST_CRAFTING,
HOOK_PRE_CRAFTING,
HOOK_SPAWNED_ENTITY,
@@ -181,6 +182,7 @@ public: // tolua_export
bool CallHookPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
bool CallHookPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
bool CallHookPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
+ bool CallHookPluginsLoaded (void);
bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
bool CallHookSpawnedEntity (cWorld & a_World, cEntity & a_Entity);
@@ -271,7 +273,7 @@ private:
bool m_bReloadPlugins;
cPluginManager();
- ~cPluginManager();
+ virtual ~cPluginManager();
/// Reloads all plugins, defaulting to settings.ini for settings location
void ReloadPluginsNow(void);
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 1148908c6..dd8e0da31 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -28,6 +28,8 @@ template<typename Combinator> void InternalMergeBlocks(
Combinator a_Combinator
)
{
+ UNUSED(a_SrcSizeY);
+ UNUSED(a_DstSizeY);
for (int y = 0; y < a_SizeY; y++)
{
int SrcBaseY = (y + a_SrcOffY) * a_SrcSizeX * a_SrcSizeZ;
diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h
index 0d358b556..7c6688f8d 100644
--- a/src/BlockEntities/BlockEntity.h
+++ b/src/BlockEntities/BlockEntity.h
@@ -87,7 +87,11 @@ public:
virtual void SendTo(cClientHandle & a_Client) = 0;
/// Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing.
- virtual bool Tick(float a_Dt, cChunk & a_Chunk) { return false; }
+ virtual bool Tick(float a_Dt, cChunk & /* a_Chunk */)
+ {
+ UNUSED(a_Dt);
+ return false;
+ }
protected:
/// Position in absolute block coordinates
diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h
index f35412e03..bf6289a2f 100644
--- a/src/BlockEntities/BlockEntityWithItems.h
+++ b/src/BlockEntities/BlockEntityWithItems.h
@@ -73,6 +73,7 @@ protected:
// cItemGrid::cListener overrides:
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum)
{
+ UNUSED(a_SlotNum);
ASSERT(a_Grid == &m_Contents);
if (m_World != NULL)
{
diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h
index 8b695d61a..b08187300 100644
--- a/src/BlockEntities/FurnaceEntity.h
+++ b/src/BlockEntities/FurnaceEntity.h
@@ -95,7 +95,7 @@ public:
// tolua_end
- void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = 0; }
+ void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = a_TimeBurned; }
void SetCookTimes(int a_NeedCookTime, int a_TimeCooked) {m_NeedCookTime = a_NeedCookTime; m_TimeCooked = a_TimeCooked; }
protected:
diff --git a/src/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h
index fcafdc479..996de965b 100644
--- a/src/BlockEntities/JukeboxEntity.h
+++ b/src/BlockEntities/JukeboxEntity.h
@@ -45,7 +45,7 @@ public:
// tolua_end
virtual void UsedBy(cPlayer * a_Player) override;
- virtual void SendTo(cClientHandle & a_Client) override { };
+ virtual void SendTo(cClientHandle &) override { };
private:
int m_Record;
diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h
index e2d088f44..cf78aeac6 100644
--- a/src/BlockEntities/NoteEntity.h
+++ b/src/BlockEntities/NoteEntity.h
@@ -52,7 +52,7 @@ public:
// tolua_end
virtual void UsedBy(cPlayer * a_Player) override;
- virtual void SendTo(cClientHandle & a_Client) override { };
+ virtual void SendTo(cClientHandle &) override { };
private:
char m_Pitch;
diff --git a/src/BlockTracer.h b/src/BlockTracer.h
index d0a34811d..40d80da1a 100644
--- a/src/BlockTracer.h
+++ b/src/BlockTracer.h
@@ -36,7 +36,14 @@ public:
/** Called on each block encountered along the path, including the first block (path start), if chunk data is not loaded
When this callback returns true, the tracing is aborted.
*/
- virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace) { return false; }
+ virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace)
+ {
+ UNUSED(a_BlockX);
+ UNUSED(a_BlockY);
+ UNUSED(a_BlockZ);
+ UNUSED(a_EntryFace);
+ return false;
+ }
/** Called when the path goes out of world, either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
The coords specify the exact point at which the path exited the world.
@@ -44,7 +51,13 @@ public:
Note that some paths can go out of the world and come back again (parabola),
in such a case this callback is followed by OnIntoWorld() and further OnNextBlock() calls
*/
- virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) { return false; }
+ virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
+ {
+ UNUSED(a_BlockX);
+ UNUSED(a_BlockY);
+ UNUSED(a_BlockZ);
+ return false;
+ }
/** Called when the path goes into the world, from either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
The coords specify the exact point at which the path entered the world.
@@ -52,7 +65,13 @@ public:
Note that some paths can go out of the world and come back again (parabola),
in such a case this callback is followed by further OnNextBlock() calls
*/
- virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) { return false; }
+ virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
+ {
+ UNUSED(a_BlockX);
+ UNUSED(a_BlockY);
+ UNUSED(a_BlockZ);
+ return false;
+ }
/** Called when the path is sure not to hit any more blocks.
Note that for some shapes this might never happen (line with constant Y)
diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h
index 107d36476..a732aa797 100644
--- a/src/Blocks/BlockHandler.h
+++ b/src/Blocks/BlockHandler.h
@@ -99,7 +99,11 @@ public:
virtual bool DoesIgnoreBuildCollision(void);
/// <summary>Similar to DoesIgnoreBuildCollision(void), but is used for cases where block meta/player item-in-hand is needed to determine collision (thin snow)</summary>
- virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) { return DoesIgnoreBuildCollision(); }
+ virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta)
+ {
+ UNUSED(a_Meta);
+ return DoesIgnoreBuildCollision();
+ }
/// <summary>Returns if this block drops if it gets destroyed by an unsuitable situation. Default: true</summary>
virtual bool DoesDropOnUnsuitable(void);
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index 64c03d0d3..e06f63a0e 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -773,7 +773,7 @@ void cByteBuffer::ReadAll(AString & a_Data)
-bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes)
+bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes)
{
if (!a_Dst.CanWriteBytes(a_NumBytes) || !CanReadBytes(a_NumBytes))
{
@@ -781,9 +781,10 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes)
return false;
}
char buf[1024];
- while (a_NumBytes > 0)
+ // > 0 without generating warnings about unsigned comparisons where size_t is unsigned
+ while (a_NumBytes != 0)
{
- int num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
+ size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
VERIFY(ReadBuf(buf, num));
VERIFY(a_Dst.Write(buf, num));
a_NumBytes -= num;
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index 06c846fa9..cbce119b1 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -110,7 +110,7 @@ public:
void ReadAll(AString & a_Data);
/// Reads the specified number of bytes and writes it into the destinatio bytebuffer. Returns true on success.
- bool ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes);
+ bool ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes);
/// Removes the bytes that have been read from the ringbuffer
void CommitRead(void);
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index c446db9a6..b229a4aff 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -527,9 +527,10 @@ void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner)
// MG TODO : check that "Level" really means Y
+ /*
NIBBLETYPE SkyLight = 0;
-
NIBBLETYPE BlockLight = 0;
+ */
if (IsLightValid())
{
@@ -2324,8 +2325,8 @@ BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const
void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
{
int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
- a_BlockType = cChunkDef::GetBlock (m_BlockTypes, a_RelX, a_RelY, a_RelZ);
- a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, a_RelX, a_RelY, a_RelZ);
+ a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx);
+ a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, Idx);
}
@@ -2897,11 +2898,3 @@ NIBBLETYPE cChunk::GetTimeAlteredLight(NIBBLETYPE a_Skylight) const
-
-#if !C_CHUNK_USE_INLINE
-# include "cChunk.inl.h"
-#endif
-
-
-
-
diff --git a/src/Chunk.h b/src/Chunk.h
index 05a96d419..f0a50c3c4 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -12,19 +12,6 @@
-#define C_CHUNK_USE_INLINE 1
-
-// Do not touch
-#if C_CHUNK_USE_INLINE
- #define __C_CHUNK_INLINE__ inline
-#else
- #define __C_CHUNK_INLINE__
-#endif
-
-
-
-
-
namespace Json
{
class Value;
@@ -436,8 +423,6 @@ private:
void RemoveBlockEntity(cBlockEntity * a_BlockEntity);
void AddBlockEntity (cBlockEntity * a_BlockEntity);
- void SpreadLightOfBlock(NIBBLETYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff);
-
/// Creates a block entity for each block that needs a block entity and doesn't have one in the list
void CreateBlockEntities(void);
@@ -482,11 +467,3 @@ typedef std::list<cChunkPtr> cChunkPtrList;
-
-#if C_CHUNK_USE_INLINE
- #include "Chunk.inl.h"
-#endif
-
-
-
-
diff --git a/src/Chunk.inl.h b/src/Chunk.inl.h
deleted file mode 100644
index fb9c4dad1..000000000
--- a/src/Chunk.inl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#ifndef __C_CHUNK_INL_H__
-#define __C_CHUNK_INL_H__
-
-#ifndef MAX
-# define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-
-
-
-
-__C_CHUNK_INLINE__
-void cChunk::SpreadLightOfBlock(NIBBLETYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff)
-{
- unsigned char CurrentLight = cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z );
- cChunkDef::SetNibble( a_LightBuffer, a_X-1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X-1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
- cChunkDef::SetNibble( a_LightBuffer, a_X+1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X+1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
- cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y-1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y-1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
- cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y+1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y+1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
- cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z-1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z-1 ), MAX(0,CurrentLight-a_Falloff) ) );
- cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z+1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z+1 ), MAX(0,CurrentLight-a_Falloff) ) );
- MarkDirty();
-}
-
-
-
-
-
-#endif
-
-
-
-
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index 8c37e7907..7d727a4d4 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -182,6 +182,7 @@ public:
/// Converts absolute block coords into relative (chunk + block) coords:
inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ )
{
+ UNUSED(a_Y);
BlockToChunk(a_X, a_Z, a_ChunkX, a_ChunkZ);
a_X = a_X - a_ChunkX * Width;
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp
index fe3ee9b42..2425adf18 100644
--- a/src/ChunkSender.cpp
+++ b/src/ChunkSender.cpp
@@ -264,7 +264,7 @@ void cChunkSender::BlockEntity(cBlockEntity * a_Entity)
-void cChunkSender::Entity(cEntity * a_Entity)
+void cChunkSender::Entity(cEntity *)
{
// Nothing needed yet, perhaps in the future when we save entities into chunks we'd like to send them upon load, too ;)
}
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 99df47bfb..17412c265 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1409,6 +1409,7 @@ void cClientHandle::SendData(const char * a_Data, int a_Size)
void cClientHandle::MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket)
{
+ UNUSED(a_World);
ASSERT(m_Player != NULL);
if (a_SendRespawnPacket)
diff --git a/src/CommandOutput.h b/src/CommandOutput.h
index bdf675238..3763d625f 100644
--- a/src/CommandOutput.h
+++ b/src/CommandOutput.h
@@ -38,6 +38,7 @@ class cNullCommandOutputCallback :
virtual void Out(const AString & a_Text) override
{
// Do nothing
+ UNUSED(a_Text);
}
} ;
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 9cb36eb14..2ba1b303d 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -351,10 +351,14 @@ public:
// tolua_end
/// Called when the specified player right-clicks this entity
- virtual void OnRightClicked(cPlayer & a_Player) {};
+ virtual void OnRightClicked(cPlayer &) {};
/// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy().
- virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) {}
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL)
+ {
+ UNUSED(a_Drops);
+ UNUSED(a_Killer);
+ }
protected:
static cCriticalSection m_CSCount;
@@ -420,11 +424,13 @@ protected:
void Dereference( cEntity*& a_EntityPtr );
private:
- // Measured in degrees (MAX 360°)
+ // Measured in degrees, [-180, +180)
double m_HeadYaw;
+
// Measured in meter/second (m/s)
Vector3d m_Speed;
- // Measured in degrees (MAX 360°)
+
+ // Measured in degrees, [-180, +180)
Vector3d m_Rot;
/// Position of the entity's XZ center and Y bottom
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 67d5a47ef..bc92790aa 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -908,8 +908,8 @@ bool cPlayer::IsGameModeSurvival(void) const
bool cPlayer::IsGameModeAdventure(void) const
{
- return (m_GameMode == gmCreative) || // Either the player is explicitly in Adventure
- ((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Adventure
+ return (m_GameMode == gmAdventure) || // Either the player is explicitly in Adventure
+ ((m_GameMode == gmNotSet) && m_World->IsGameModeAdventure()); // or they inherit from the world and the world is Adventure
}
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 66f1c07a7..f9ce950ba 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -45,7 +45,7 @@ public:
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
- virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override { };
+ virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); };
/// Returns the curently equipped weapon; empty item if none
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
@@ -114,7 +114,7 @@ public:
double GetEyeHeight(void) const; // tolua_export
Vector3d GetEyePosition(void) const; // tolua_export
inline bool IsOnGround(void) const {return m_bTouchGround; } // tolua_export
- inline const double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc.
+ inline double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc.
inline cInventory & GetInventory(void) { return m_Inventory; } // tolua_export
inline const cInventory & GetInventory(void) const { return m_Inventory; }
diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h
index 959e81ae5..4721409ee 100644
--- a/src/Entities/ProjectileEntity.h
+++ b/src/Entities/ProjectileEntity.h
@@ -52,7 +52,11 @@ public:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace);
/// Called by the physics blocktracer when the entity hits another entity
- virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) {}
+ virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
+ {
+ UNUSED(a_EntityHit);
+ UNUSED(a_HitPos);
+ }
/// Called by Chunk when the projectile is eligible for player collection
virtual void CollectedBy(cPlayer * a_Dest);
diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp
index fbed57cb6..7e8a3c75f 100644
--- a/src/Generating/Trees.cpp
+++ b/src/Generating/Trees.cpp
@@ -216,7 +216,14 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
break;
}
-
+
+ case biBirchForestM:
+ case biBirchForestHillsM:
+ {
+ GetTallBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ break;
+ }
+
case biRoofedForest:
case biColdTaiga:
case biColdTaigaHills:
@@ -237,8 +244,6 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
case biIcePlainsSpikes:
case biJungleM:
case biJungleEdgeM:
- case biBirchForestM:
- case biBirchForestHillsM:
case biRoofedForestM:
case biColdTaigaM:
case biMegaSpruceTaiga:
@@ -377,6 +382,44 @@ void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois
+void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
+{
+ int Height = 9 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
+
+ // Prealloc, so that we don't realloc too often later:
+ a_LogBlocks.reserve(Height);
+ a_OtherBlocks.reserve(80);
+
+ // The entire trunk, out of logs:
+ for (int i = Height - 1; i >= 0; --i)
+ {
+ a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_BIRCH));
+ }
+ int h = a_BlockY + Height;
+
+ // Top layer - just the Plus:
+ PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
+ a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH)); // There's no log at this layer
+ h--;
+
+ // Second layer - log, Plus and maybe Corners:
+ PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
+ PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
+ h--;
+
+ // Third and fourth layers - BigO2 and maybe 2*Corners:
+ for (int Row = 0; Row < 2; Row++)
+ {
+ PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
+ PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
+ h--;
+ } // for Row - 2*
+}
+
+
+
+
+
void GetConiferTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
{
// Half chance for a spruce, half for a pine:
diff --git a/src/Generating/Trees.h b/src/Generating/Trees.h
index f5148ad6f..514158eb7 100644
--- a/src/Generating/Trees.h
+++ b/src/Generating/Trees.h
@@ -63,6 +63,9 @@ void GetLargeAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a
/// Generates an image of a random birch tree
void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
+/// Generates an image of a random large birch tree
+void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks,sSetBlockVector & a_OtherBlocks);
+
/// Generates an image of a random conifer tree
void GetConiferTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index a9b4ab9c5..a7f77cf6d 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -57,6 +57,8 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, bool a_ConsiderEmptySlo
int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots)
{
+
+ UNUSED(a_ConsiderEmptySlots);
if ((a_BeginSlotNum < 0) || (a_BeginSlotNum >= invNumSlots))
{
LOGWARNING("%s: Bad BeginSlotNum, got %d, there are %d slots; correcting to 0.", __FUNCTION__, a_BeginSlotNum, invNumSlots - 1);
@@ -96,8 +98,6 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
-
-
int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst)
{
cItem ToAdd(a_Item);
diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h
index e39bb054b..db0ffc9db 100644
--- a/src/Items/ItemHandler.h
+++ b/src/Items/ItemHandler.h
@@ -25,7 +25,13 @@ public:
virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir);
/// Called when the client sends the SHOOT status in the lclk packet
- virtual void OnItemShoot(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace) {}
+ virtual void OnItemShoot(cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace)
+ {
+ UNUSED(a_BlockX);
+ UNUSED(a_BlockY);
+ UNUSED(a_BlockZ);
+ UNUSED(a_BlockFace);
+ }
/// Called while the player diggs a block using this item
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace);
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp
index d7e60e458..7c3cc9c76 100644
--- a/src/LightingThread.cpp
+++ b/src/LightingThread.cpp
@@ -189,7 +189,7 @@ void cLightingThread::ChunkReady(int a_ChunkX, int a_ChunkZ)
{
if (
(itr->x - a_ChunkX >= -1) && (itr->x - a_ChunkX <= 1) &&
- (itr->x - a_ChunkX >= -1) && (itr->x - a_ChunkX <= 1)
+ (itr->z - a_ChunkZ >= -1) && (itr->z - a_ChunkZ <= 1)
)
{
// It is a neighbor
@@ -495,6 +495,7 @@ void cLightingThread::CalcLightStep(
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
)
{
+ UNUSED(a_IsSeedIn);
int NumSeedsOut = 0;
for (int i = 0; i < a_NumSeedsIn; i++)
{
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index 9fcbca915..110c6b5dc 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -196,7 +196,6 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
ASSERT((m_CurrentY >= 0) && (m_CurrentY < cChunkDef::Height)); // This should be provided by FixStartAboveWorld() / FixStartBelowWorld()
// This is the actual line tracing loop.
- bool Finished = false;
while (true)
{
// Report the current block through the callbacks:
diff --git a/src/OSSupport/SocketThreads.h b/src/OSSupport/SocketThreads.h
index ecbac3aeb..858729c49 100644
--- a/src/OSSupport/SocketThreads.h
+++ b/src/OSSupport/SocketThreads.h
@@ -61,6 +61,9 @@ public:
class cCallback
{
public:
+ // Force a virtual destructor in all subclasses:
+ virtual ~cCallback() {}
+
/// Called when data is received from the remote party
virtual void DataReceived(const char * a_Data, int a_Size) = 0;
diff --git a/src/Piston.cpp b/src/Piston.cpp
index b15e7d95e..75eeb5e98 100644
--- a/src/Piston.cpp
+++ b/src/Piston.cpp
@@ -238,6 +238,7 @@ bool cPiston::CanPush(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
bool cPiston::CanBreakPush(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
{
+ UNUSED(a_BlockMeta);
return g_BlockPistonBreakable[a_BlockType];
}
diff --git a/src/Root.cpp b/src/Root.cpp
index 798f965be..16a521698 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -596,10 +596,10 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
public:
cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) :
- m_Callback(a_Callback),
m_BestRating(0),
m_NameLength(a_PlayerName.length()),
m_PlayerName(a_PlayerName),
+ m_Callback(a_Callback),
m_BestMatch(NULL),
m_NumMatches(0)
{}
diff --git a/src/Server.cpp b/src/Server.cpp
index a93be9a5b..7dedc3904 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -173,6 +173,7 @@ void cServer::ClientMovedToWorld(const cClientHandle * a_Client)
void cServer::PlayerCreated(const cPlayer * a_Player)
{
+ UNUSED(a_Player);
// To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread
cCSLock Lock(m_CSPlayerCountDiff);
m_PlayerCountDiff += 1;
@@ -184,6 +185,7 @@ void cServer::PlayerCreated(const cPlayer * a_Player)
void cServer::PlayerDestroying(const cPlayer * a_Player)
{
+ UNUSED(a_Player);
// To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread
cCSLock Lock(m_CSPlayerCountDiff);
m_PlayerCountDiff -= 1;
@@ -514,6 +516,7 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac
void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output)
{
+ UNUSED(a_Split);
typedef std::pair<AString, AString> AStringPair;
typedef std::vector<AStringPair> AStringPairs;
@@ -525,6 +528,8 @@ void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback &
virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override
{
+ UNUSED(a_Plugin);
+ UNUSED(a_Permission);
if (!a_HelpString.empty())
{
m_Commands.push_back(AStringPair(a_Command, a_HelpString));
diff --git a/src/Server.h b/src/Server.h
index 0d93469a5..1f94bb3da 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -35,6 +35,8 @@ class cServer // tolua_export
: public cListenThread::cCallback
{ // tolua_export
public: // tolua_export
+
+ virtual ~cServer() {}
bool InitServer(cIniFile & a_SettingsIni);
// tolua_begin
diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h
index 66c31b440..9ccc3ef4f 100644
--- a/src/Simulator/FireSimulator.h
+++ b/src/Simulator/FireSimulator.h
@@ -22,7 +22,7 @@ public:
cFireSimulator(cWorld & a_World, cIniFile & a_IniFile);
~cFireSimulator();
- virtual void Simulate(float a_Dt) override {} // not used
+ virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used
virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
diff --git a/src/Simulator/NoopFluidSimulator.h b/src/Simulator/NoopFluidSimulator.h
index 8f894433f..9113aec3c 100644
--- a/src/Simulator/NoopFluidSimulator.h
+++ b/src/Simulator/NoopFluidSimulator.h
@@ -27,8 +27,14 @@ public:
}
// cSimulator overrides:
- virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override {}
- virtual void Simulate(float a_Dt) override {}
+ virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override
+ {
+ UNUSED(a_BlockX);
+ UNUSED(a_BlockY);
+ UNUSED(a_BlockZ);
+ UNUSED(a_Chunk);
+ }
+ virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);}
} ;
diff --git a/src/Simulator/RedstoneSimulator.h b/src/Simulator/RedstoneSimulator.h
index 60c86a3c5..1080c3f81 100644
--- a/src/Simulator/RedstoneSimulator.h
+++ b/src/Simulator/RedstoneSimulator.h
@@ -19,7 +19,7 @@ public:
cRedstoneSimulator(cWorld & a_World);
~cRedstoneSimulator();
- virtual void Simulate(float a_Dt) override {}; // Not used in this simulator
+ virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used
virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override { return IsRedstone(a_BlockType); }
@@ -271,4 +271,4 @@ private:
default: return false;
}
}
-}; \ No newline at end of file
+};
diff --git a/src/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h
index 6e9ea15ac..6e64aa425 100644
--- a/src/Simulator/SandSimulator.h
+++ b/src/Simulator/SandSimulator.h
@@ -15,7 +15,7 @@ public:
cSandSimulator(cWorld & a_World, cIniFile & a_IniFile);
// cSimulator overrides:
- virtual void Simulate(float a_Dt) override {} // Unused in this simulator
+ virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used
virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h
index 5cd0e8657..a25b7f1b6 100644
--- a/src/Simulator/Simulator.h
+++ b/src/Simulator/Simulator.h
@@ -25,7 +25,14 @@ public:
virtual void Simulate(float a_Dt) = 0;
/// Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available
- virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) {};
+ virtual void SimulateChunk(float a_Dt, int a_ChunkX,
+ int a_ChunkZ, cChunk * a_Chunk)
+ {
+ UNUSED(a_Dt);
+ UNUSED(a_ChunkX);
+ UNUSED(a_ChunkZ);
+ UNUSED(a_Chunk);
+ };
/// Called when a block changes
virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk);
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index a1f0842aa..e6a5a01b3 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -305,6 +305,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque
void cWebAdmin::HandleRootRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request)
{
+ UNUSED(a_Request);
static const char LoginForm[] = \
"<h1>MCServer WebAdmin</h1>" \
"<center>" \
@@ -450,6 +451,7 @@ AString cWebAdmin::GetBaseURL(const AStringVector & a_URLSplit)
void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request)
{
+ UNUSED(a_Connection);
const AString & URL = a_Request.GetURL();
if (
(strncmp(URL.c_str(), "/webadmin", 9) == 0) ||
@@ -473,6 +475,7 @@ void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_
void cWebAdmin::OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size)
{
+ UNUSED(a_Connection);
cRequestData * Data = (cRequestData *)(a_Request.GetUserData());
if (Data == NULL)
{
diff --git a/src/WebAdmin.h b/src/WebAdmin.h
index 0907e7bc3..3eb807640 100644
--- a/src/WebAdmin.h
+++ b/src/WebAdmin.h
@@ -105,7 +105,7 @@ public:
cWebAdmin(void);
- ~cWebAdmin();
+ virtual ~cWebAdmin();
/// Initializes the object. Returns true if successfully initialized and ready to start
bool Init(void);
@@ -169,9 +169,16 @@ protected:
virtual void OnBody(const char * a_Data, int a_Size) override;
// cHTTPFormParser::cCallbacks overrides. Files are ignored:
- virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) override {}
- virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, int a_Size) override {}
- virtual void OnFileEnd(cHTTPFormParser & a_Parser) override {}
+ virtual void OnFileStart(cHTTPFormParser &, const AString & a_FileName) override
+ {
+ UNUSED(a_FileName);
+ }
+ virtual void OnFileData(cHTTPFormParser &, const char * a_Data, int a_Size) override
+ {
+ UNUSED(a_Data);
+ UNUSED(a_Size);
+ }
+ virtual void OnFileEnd(cHTTPFormParser &) override {}
} ;
diff --git a/src/World.cpp b/src/World.cpp
index 28c46c27e..cc543d460 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -723,6 +723,7 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec)
void cWorld::TickWeather(float a_Dt)
{
+ UNUSED(a_Dt);
// There are no weather changes anywhere but in the Overworld:
if (GetDimension() != dimOverworld)
{
@@ -794,7 +795,7 @@ void cWorld::TickMobs(float a_Dt)
cMonster::mfAmbient,
cMonster::mfWater,
} ;
- for (int i = 0; i < ARRAYCOUNT(AllFamilies); i++)
+ for (size_t i = 0; i < ARRAYCOUNT(AllFamilies); i++)
{
cMonster::eFamily Family = AllFamilies[i];
int SpawnDelay = cMonster::GetSpawnDelay(Family);
@@ -1643,6 +1644,7 @@ int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward)
void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec, double a_InitialVelocityCoeff)
{
+ UNUSED(a_InitialVelocityCoeff);
cTNTEntity * TNT = new cTNTEntity(a_X, a_Y, a_Z, a_FuseTimeInSec);
TNT->Initialize(this);
// TODO: Add a bit of speed in horiz and vert axes, based on the a_InitialVelocityCoeff
diff --git a/src/World.h b/src/World.h
index c067252d9..67f1275c0 100644
--- a/src/World.h
+++ b/src/World.h
@@ -78,6 +78,7 @@ public:
class cTask
{
public:
+ virtual ~cTask(){};
virtual void Run(cWorld & a_World) = 0;
} ;