summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/InfoDump.lua35
-rw-r--r--VC2008/CryptoPP.vcproj3
-rw-r--r--src/Globals.h16
-rw-r--r--src/OSSupport/CriticalSection.h5
-rw-r--r--src/Protocol/Protocol132.cpp13
-rw-r--r--src/Protocol/Protocol132.h14
-rw-r--r--src/Protocol/Protocol14x.cpp13
-rw-r--r--src/Protocol/Protocol17x.h14
-rw-r--r--src/Server.h17
-rw-r--r--src/World.h2
10 files changed, 117 insertions, 15 deletions
diff --git a/MCServer/Plugins/InfoDump.lua b/MCServer/Plugins/InfoDump.lua
index 54d7a6042..df47d566b 100644
--- a/MCServer/Plugins/InfoDump.lua
+++ b/MCServer/Plugins/InfoDump.lua
@@ -53,8 +53,24 @@ lfs = require("lfs");
local function ForumizeString(a_Str)
assert(type(a_Str) == "string");
+ -- Remove the indentation, unless in the code tag:
+ -- Only one code or /code tag per line is supported!
+ local IsInCode = false;
+ local function RemoveIndentIfNotInCode(s)
+ if (IsInCode) then
+ -- we're in code section, check if this line terminates it
+ IsInCode = (s:find("{%%/code}") ~= nil);
+ return s .. "\n";
+ else
+ -- we're not in code section, check if this line starts it
+ IsInCode = (s:find("{%%code}") ~= nil);
+ return s:gsub("^%s*", "") .. "\n";
+ end
+ end
+ a_Str = a_Str:gsub("(.-)\n", RemoveIndentIfNotInCode);
+
-- Replace multiple line ends with {%p} and single line ends with a space,
- -- so that manual word-wrap in the Info.lua file doesn't wrap in the forum
+ -- so that manual word-wrap in the Info.lua file doesn't wrap in the forum.
a_Str = a_Str:gsub("\n\n", "{%%p}");
a_Str = a_Str:gsub("\n", " ");
@@ -146,19 +162,22 @@ end
--- Writes the specified command detailed help array to the output file, in the forum dump format
-local function WriteCommandDetailedHelpForum(a_CmdString, a_DetailedHelp, f)
+local function WriteCommandParameterCombinationsForum(a_CmdString, a_ParameterCombinations, f)
assert(type(a_CmdString) == "string");
- assert(type(a_DetailedHelp) == "table");
+ assert(type(a_ParameterCombinations) == "table");
assert(f ~= nil);
- if (#a_DetailedHelp == 0) then
+ if (#a_ParameterCombinations == 0) then
-- No explicit parameter combinations to write
return;
end
f:write("The following parameter combinations are recognized:\n");
- for idx, combination in ipairs(a_DetailedHelp) do
- f:write("[color=blue]", a_CmdString, "[/color] [color=green]", combination.Params, "[/color] - ", ForumizeString(combination.Help));
+ for idx, combination in ipairs(a_ParameterCombinations) do
+ f:write("[color=blue]", a_CmdString, "[/color] [color=green]", combination.Params, "[/color]");
+ if (combination.Help ~= nil) then
+ f:write(" - ", ForumizeString(combination.Help));
+ end
if (combination.Permission ~= nil) then
f:write(" (Requires permission '[color=red]", combination.Permission, "[/color]')");
end
@@ -194,8 +213,8 @@ local function WriteCommandsCategoryForum(a_Category, f)
if (cmd.Info.DetailedDescription ~= nil) then
f:write(cmd.Info.DetailedDescription);
end
- if (cmd.Info.DetailedHelp ~= nil) then
- WriteCommandDetailedHelpForum(cmd.CommandString, cmd.Info.DetailedHelp, f);
+ if (cmd.Info.ParameterCombinations ~= nil) then
+ WriteCommandParameterCombinationsForum(cmd.CommandString, cmd.Info.ParameterCombinations, f);
end
end
f:write("[/list]\n\n")
diff --git a/VC2008/CryptoPP.vcproj b/VC2008/CryptoPP.vcproj
index a818e9aa1..f44729d8a 100644
--- a/VC2008/CryptoPP.vcproj
+++ b/VC2008/CryptoPP.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="CryptoPP"
ProjectGUID="{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}"
RootNamespace="cryptlib"
@@ -60,6 +60,7 @@
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
+ DisableSpecificWarnings="4702"
/>
<Tool
Name="VCManagedResourceCompilerTool"
diff --git a/src/Globals.h b/src/Globals.h
index 58badf4dd..a761da404 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -14,7 +14,19 @@
#pragma warning(disable:4481)
// Disable some warnings that we don't care about:
- #pragma warning(disable:4100)
+ #pragma warning(disable:4100) // Unreferenced formal parameter
+
+ // Useful warnings from warning level 4:
+ #pragma warning(3 : 4189) // Local variable is initialized but not referenced
+ #pragma warning(3 : 4702) // Unreachable code
+ #pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch
+ #pragma warning(3 : 4389) // Signed/unsigned mismatch
+ #pragma warning(3 : 4701) // Potentially unitialized local variable used
+ #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
+ #pragma warning(3 : 4310) // Cast truncates constant value
+ #pragma warning(3 : 4505) // Unreferenced local function has been removed
+ #pragma warning(3 : 4127) // Conditional expression is constant
+ #pragma warning(3 : 4706) // Assignment within conditional expression
#define OBSOLETE __declspec(deprecated)
@@ -192,7 +204,7 @@ typedef unsigned short UInt16;
#ifdef _DEBUG
#define ASSERT( x ) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), assert(0), 0 ) )
#else
- #define ASSERT(x) ((void)0)
+ #define ASSERT(x) ((void)(x))
#endif
// Pretty much the same as ASSERT() but stays in Release builds
diff --git a/src/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h
index 1bfe81439..73a71f5e1 100644
--- a/src/OSSupport/CriticalSection.h
+++ b/src/OSSupport/CriticalSection.h
@@ -14,9 +14,14 @@ public:
void Lock(void);
void Unlock(void);
+ // IsLocked/IsLockedByCurrentThread are only used in ASSERT statements, but because of the changes with ASSERT they must always be defined
+ // The fake versions (in Release) will not effect the program in any way
#ifdef _DEBUG
bool IsLocked(void);
bool IsLockedByCurrentThread(void);
+ #else
+ bool IsLocked(void) { return false; }
+ bool IsLockedByCurrentThread(void) { return false; }
#endif // _DEBUG
private:
diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp
index 46ac4ef89..ab15509b7 100644
--- a/src/Protocol/Protocol132.cpp
+++ b/src/Protocol/Protocol132.cpp
@@ -5,7 +5,6 @@
#include "Globals.h"
#include "ChunkDataSerializer.h"
-#include "cryptopp/randpool.h"
#include "Protocol132.h"
#include "../Root.h"
#include "../Server.h"
@@ -19,8 +18,20 @@
#include "../WorldStorage/FastNBT.h"
#include "../StringCompression.h"
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable:4127)
+ #pragma warning(disable:4244)
+ #pragma warning(disable:4231)
+ #pragma warning(disable:4189)
+ #pragma warning(disable:4702)
+#endif
+#include "cryptopp/randpool.h"
+#ifdef _MSC_VER
+ #pragma warning(pop)
+#endif
#define HANDLE_PACKET_READ(Proc, Type, Var) \
diff --git a/src/Protocol/Protocol132.h b/src/Protocol/Protocol132.h
index f76272b8d..d36384a88 100644
--- a/src/Protocol/Protocol132.h
+++ b/src/Protocol/Protocol132.h
@@ -10,9 +10,23 @@
#pragma once
#include "Protocol125.h"
+
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable:4127)
+ #pragma warning(disable:4244)
+ #pragma warning(disable:4231)
+ #pragma warning(disable:4189)
+ #pragma warning(disable:4702)
+#endif
+
#include "cryptopp/modes.h"
#include "cryptopp/aes.h"
+#ifdef _MSC_VER
+ #pragma warning(pop)
+#endif
+
diff --git a/src/Protocol/Protocol14x.cpp b/src/Protocol/Protocol14x.cpp
index 28122034c..926fe6ee8 100644
--- a/src/Protocol/Protocol14x.cpp
+++ b/src/Protocol/Protocol14x.cpp
@@ -16,7 +16,6 @@ Implements the 1.4.x protocol classes representing these protocols:
#include "../Root.h"
#include "../Server.h"
#include "../ClientHandle.h"
-#include "cryptopp/randpool.h"
#include "../Item.h"
#include "ChunkDataSerializer.h"
#include "../Entities/Player.h"
@@ -25,8 +24,20 @@ Implements the 1.4.x protocol classes representing these protocols:
#include "../Entities/Pickup.h"
#include "../Entities/FallingBlock.h"
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable:4127)
+ #pragma warning(disable:4244)
+ #pragma warning(disable:4231)
+ #pragma warning(disable:4189)
+ #pragma warning(disable:4702)
+#endif
+#include "cryptopp/randpool.h"
+#ifdef _MSC_VER
+ #pragma warning(pop)
+#endif
#define HANDLE_PACKET_READ(Proc, Type, Var) \
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index cc0eda1e7..23ff2365d 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -16,9 +16,23 @@ Declares the 1.7.x protocol classes:
#include "Protocol.h"
#include "../ByteBuffer.h"
+
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable:4127)
+ #pragma warning(disable:4244)
+ #pragma warning(disable:4231)
+ #pragma warning(disable:4189)
+ #pragma warning(disable:4702)
+#endif
+
#include "cryptopp/modes.h"
#include "cryptopp/aes.h"
+#ifdef _MSC_VER
+ #pragma warning(pop)
+#endif
+
diff --git a/src/Server.h b/src/Server.h
index 1f94bb3da..e62c4c7b7 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -11,9 +11,24 @@
#include "OSSupport/SocketThreads.h"
#include "OSSupport/ListenThread.h"
+
+#include "RCONServer.h"
+
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable:4127)
+ #pragma warning(disable:4244)
+ #pragma warning(disable:4231)
+ #pragma warning(disable:4189)
+ #pragma warning(disable:4702)
+#endif
+
#include "cryptopp/rsa.h"
#include "cryptopp/randpool.h"
-#include "RCONServer.h"
+
+#ifdef _MSC_VER
+ #pragma warning(pop)
+#endif
diff --git a/src/World.h b/src/World.h
index 67f1275c0..f90ddd90f 100644
--- a/src/World.h
+++ b/src/World.h
@@ -146,7 +146,7 @@ public:
// Broadcast respective packets to all clients of the chunk where the event is taking place
// (Please keep these alpha-sorted)
void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
- void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = NULL);
+ void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = NULL); // tolua_export
void BroadcastBlockBreakAnimation(int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = NULL);
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = NULL); // tolua_export