summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCServer/Plugins/InfoDump.lua35
-rw-r--r--src/World.h2
-rw-r--r--src/WorldStorage/WorldStorage.cpp11
3 files changed, 37 insertions, 11 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/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
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp
index 5f4c112d5..6aec525a8 100644
--- a/src/WorldStorage/WorldStorage.cpp
+++ b/src/WorldStorage/WorldStorage.cpp
@@ -117,6 +117,10 @@ void cWorldStorage::WaitForLoadQueueEmpty(void)
m_LoadQueue.BlockTillEmpty();
}
+
+
+
+
void cWorldStorage::WaitForSaveQueueEmpty(void)
{
m_SaveQueue.BlockTillEmpty();
@@ -124,6 +128,8 @@ void cWorldStorage::WaitForSaveQueueEmpty(void)
+
+
size_t cWorldStorage::GetLoadQueueLength(void)
{
return m_LoadQueue.Size();
@@ -144,8 +150,8 @@ size_t cWorldStorage::GetSaveQueueLength(void)
void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate)
{
- m_Event.Set();
m_LoadQueue.EnqueueItemIfNotPresent(sChunkLoad(a_ChunkX, a_ChunkY, a_ChunkZ, a_Generate));
+ m_Event.Set();
}
@@ -154,8 +160,8 @@ void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, boo
void cWorldStorage::QueueSaveChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
- m_Event.Set();
m_SaveQueue.EnqueueItemIfNotPresent(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ));
+ m_Event.Set();
}
@@ -166,6 +172,7 @@ void cWorldStorage::QueueSavedMessage(void)
{
// Pushes a special coord pair into the queue, signalizing a message instead
m_SaveQueue.EnqueueItem(cChunkCoords(0, CHUNK_Y_MESSAGE, 0));
+ m_Event.Set();
}