summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp203
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockID.cpp2
-rw-r--r--source/Blocks/BlockFarmland.h44
-rw-r--r--source/CraftingRecipes.cpp4
-rw-r--r--source/Entities/Entity.h8
-rw-r--r--source/FurnaceRecipe.cpp4
-rw-r--r--source/Generating/ChunkDesc.h6
-rw-r--r--source/Generating/ComposableGenerator.cpp2
-rw-r--r--source/GroupManager.cpp8
-rw-r--r--source/PluginManager.cpp10
-rw-r--r--source/Root.cpp53
-rw-r--r--source/Server.cpp3
-rw-r--r--source/Simulator/FireSimulator.cpp22
-rw-r--r--source/World.h10
15 files changed, 274 insertions, 107 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 7895fe16b..d5482d3f7 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/05/13 18:34:12.
+** Generated automatically by tolua++-1.0.92 on 10/06/13 15:12:14.
*/
#ifndef __cplusplus
@@ -13315,6 +13315,134 @@ static int tolua_AllToLua_cWorld_GetWeather00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: IsWeatherSunny of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherSunny00
+static int tolua_AllToLua_cWorld_IsWeatherSunny00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherSunny'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsWeatherSunny();
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'IsWeatherSunny'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsWeatherRain of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherRain00
+static int tolua_AllToLua_cWorld_IsWeatherRain00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherRain'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsWeatherRain();
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'IsWeatherRain'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsWeatherStorm of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherStorm00
+static int tolua_AllToLua_cWorld_IsWeatherStorm00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherStorm'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsWeatherStorm();
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'IsWeatherStorm'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsWeatherWet of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherWet00
+static int tolua_AllToLua_cWorld_IsWeatherWet00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherWet'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsWeatherWet();
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'IsWeatherWet'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: SetNextBlockTick of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetNextBlockTick00
static int tolua_AllToLua_cWorld_SetNextBlockTick00(lua_State* tolua_S)
@@ -18711,6 +18839,38 @@ static int tolua_AllToLua_cWebAdmin_GetPage00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: GetDefaultPage of class cWebAdmin */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetDefaultPage00
+static int tolua_AllToLua_cWebAdmin_GetDefaultPage00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDefaultPage'", NULL);
+#endif
+ {
+ AString tolua_ret = (AString) self->GetDefaultPage();
+ tolua_pushcppstring(tolua_S,(const char*)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetDefaultPage'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: GetBaseURL of class cWebAdmin */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetBaseURL00
static int tolua_AllToLua_cWebAdmin_GetBaseURL00(lua_State* tolua_S)
@@ -26132,41 +26292,6 @@ static int tolua_AllToLua_cChunkDesc_GetChunkZ00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: SetChunkCoords of class cChunkDesc */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetChunkCoords00
-static int tolua_AllToLua_cChunkDesc_SetChunkCoords00(lua_State* tolua_S)
-{
-#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (
- !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
- !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
- !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
-#endif
- {
- cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
- int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0));
- int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0));
-#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetChunkCoords'", NULL);
-#endif
- {
- self->SetChunkCoords(a_ChunkX,a_ChunkZ);
- }
- }
- return 0;
-#ifndef TOLUA_RELEASE
- tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'SetChunkCoords'.",&tolua_err);
- return 0;
-#endif
-}
-#endif //#ifndef TOLUA_DISABLE
-
/* method: FillBlocks of class cChunkDesc */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillBlocks00
static int tolua_AllToLua_cChunkDesc_FillBlocks00(lua_State* tolua_S)
@@ -29906,6 +30031,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"SetWeather",tolua_AllToLua_cWorld_SetWeather00);
tolua_function(tolua_S,"ChangeWeather",tolua_AllToLua_cWorld_ChangeWeather00);
tolua_function(tolua_S,"GetWeather",tolua_AllToLua_cWorld_GetWeather00);
+ tolua_function(tolua_S,"IsWeatherSunny",tolua_AllToLua_cWorld_IsWeatherSunny00);
+ tolua_function(tolua_S,"IsWeatherRain",tolua_AllToLua_cWorld_IsWeatherRain00);
+ tolua_function(tolua_S,"IsWeatherStorm",tolua_AllToLua_cWorld_IsWeatherStorm00);
+ tolua_function(tolua_S,"IsWeatherWet",tolua_AllToLua_cWorld_IsWeatherWet00);
tolua_function(tolua_S,"SetNextBlockTick",tolua_AllToLua_cWorld_SetNextBlockTick00);
tolua_function(tolua_S,"GetMaxSugarcaneHeight",tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00);
tolua_function(tolua_S,"GetMaxCactusHeight",tolua_AllToLua_cWorld_GetMaxCactusHeight00);
@@ -30206,6 +30335,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_beginmodule(tolua_S,"cWebAdmin");
tolua_function(tolua_S,"GetMemoryUsage",tolua_AllToLua_cWebAdmin_GetMemoryUsage00);
tolua_function(tolua_S,"GetPage",tolua_AllToLua_cWebAdmin_GetPage00);
+ tolua_function(tolua_S,"GetDefaultPage",tolua_AllToLua_cWebAdmin_GetDefaultPage00);
tolua_function(tolua_S,"GetBaseURL",tolua_AllToLua_cWebAdmin_GetBaseURL00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cWebPlugin","cWebPlugin","",NULL);
@@ -30522,7 +30652,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_beginmodule(tolua_S,"cChunkDesc");
tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cChunkDesc_GetChunkX00);
tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cChunkDesc_GetChunkZ00);
- tolua_function(tolua_S,"SetChunkCoords",tolua_AllToLua_cChunkDesc_SetChunkCoords00);
tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cChunkDesc_FillBlocks00);
tolua_function(tolua_S,"SetBlockTypeMeta",tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00);
tolua_function(tolua_S,"GetBlockTypeMeta",tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00);
diff --git a/source/Bindings.h b/source/Bindings.h
index 933cd2ffd..2095ecd5e 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/05/13 18:34:12.
+** Generated automatically by tolua++-1.0.92 on 10/06/13 15:12:15.
*/
/* Exported function */
diff --git a/source/BlockID.cpp b/source/BlockID.cpp
index ecdbc0c34..d91524de5 100644
--- a/source/BlockID.cpp
+++ b/source/BlockID.cpp
@@ -603,6 +603,7 @@ public:
g_BlockTransparent[E_BLOCK_FIRE] = true;
g_BlockTransparent[E_BLOCK_FLOWER_POT] = true;
g_BlockTransparent[E_BLOCK_GLASS] = true;
+ g_BlockTransparent[E_BLOCK_GLASS_PANE] = true;
g_BlockTransparent[E_BLOCK_ICE] = true;
g_BlockTransparent[E_BLOCK_IRON_DOOR] = true;
g_BlockTransparent[E_BLOCK_LEAVES] = true;
@@ -646,7 +647,6 @@ public:
g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_OFF] = true;
g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_ON] = true;
g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true;
- g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true;
g_BlockOneHitDig[E_BLOCK_RED_MUSHROOM] = true;
g_BlockOneHitDig[E_BLOCK_RED_ROSE] = true;
g_BlockOneHitDig[E_BLOCK_REEDS] = true;
diff --git a/source/Blocks/BlockFarmland.h b/source/Blocks/BlockFarmland.h
index 6cab1fa38..7bc71f7f3 100644
--- a/source/Blocks/BlockFarmland.h
+++ b/source/Blocks/BlockFarmland.h
@@ -30,30 +30,38 @@ public:
virtual void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- // TODO: Rain hydrates farmland, too. Check world weather, don't search for water if raining.
- // NOTE: The desert biomes do not get precipitation, so another check needs to be made.
+ bool Found = false;
- // Search for water in a close proximity:
- // Ref.: http://www.minecraftwiki.net/wiki/Farmland#Hydrated_Farmland_Tiles
- cBlockArea Area;
- if (!Area.Read(a_World, a_BlockX - 4, a_BlockX + 4, a_BlockY, a_BlockY + 1, a_BlockZ - 4, a_BlockZ + 4))
+ int Biome = a_World->GetBiomeAt(a_BlockX, a_BlockZ);
+ if (a_World->IsWeatherWet() && (Biome != biDesert) && (Biome != biDesertHills))
{
- // Too close to the world edge, cannot check surroudnings; don't tick at all
- return;
+ // Rain hydrates farmland, too, except in Desert biomes.
+ Found = true;
}
- bool Found = false;
- int NumBlocks = Area.GetBlockCount();
- BLOCKTYPE * BlockTypes = Area.GetBlockTypes();
- for (int i = 0; i < NumBlocks; i++)
+ else
{
- if (
- (BlockTypes[i] == E_BLOCK_WATER) ||
- (BlockTypes[i] == E_BLOCK_STATIONARY_WATER)
- )
+ // Search for water in a close proximity:
+ // Ref.: http://www.minecraftwiki.net/wiki/Farmland#Hydrated_Farmland_Tiles
+ cBlockArea Area;
+ if (!Area.Read(a_World, a_BlockX - 4, a_BlockX + 4, a_BlockY, a_BlockY + 1, a_BlockZ - 4, a_BlockZ + 4))
{
- Found = true;
- break;
+ // Too close to the world edge, cannot check surroudnings; don't tick at all
+ return;
}
+
+ int NumBlocks = Area.GetBlockCount();
+ BLOCKTYPE * BlockTypes = Area.GetBlockTypes();
+ for (int i = 0; i < NumBlocks; i++)
+ {
+ if (
+ (BlockTypes[i] == E_BLOCK_WATER) ||
+ (BlockTypes[i] == E_BLOCK_STATIONARY_WATER)
+ )
+ {
+ Found = true;
+ break;
+ }
+ } // for i - BlockTypes[]
}
NIBBLETYPE BlockMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
diff --git a/source/CraftingRecipes.cpp b/source/CraftingRecipes.cpp
index 13a8ac1e0..9dc471781 100644
--- a/source/CraftingRecipes.cpp
+++ b/source/CraftingRecipes.cpp
@@ -310,7 +310,7 @@ void cCraftingRecipes::GetRecipe(const cPlayer * a_Player, const cCraftingGrid &
void cCraftingRecipes::LoadRecipes(void)
{
- LOG("-- Loading crafting recipes from crafting.txt --");
+ LOGD("Loading crafting recipes from crafting.txt...");
ClearRecipes();
// Load the crafting.txt file:
@@ -338,7 +338,7 @@ void cCraftingRecipes::LoadRecipes(void)
}
AddRecipeLine(LineNum, Recipe);
} // for itr - Split[]
- LOG("-- %d crafting recipes loaded from crafting.txt --", m_Recipes.size());
+ LOG("Loaded %d crafting recipes", m_Recipes.size());
}
diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h
index a2c99d2a0..c7c362b40 100644
--- a/source/Entities/Entity.h
+++ b/source/Entities/Entity.h
@@ -234,16 +234,16 @@ public:
/// Returns the curently equipped weapon; empty item if none
virtual cItem GetEquippedWeapon(void) const { return cItem(); }
- /// Returns the currently equipped helmet; empty item if nonte
+ /// Returns the currently equipped helmet; empty item if none
virtual cItem GetEquippedHelmet(void) const { return cItem(); }
- /// Returns the currently equipped chestplate; empty item if nonte
+ /// Returns the currently equipped chestplate; empty item if none
virtual cItem GetEquippedChestplate(void) const { return cItem(); }
- /// Returns the currently equipped leggings; empty item if nonte
+ /// Returns the currently equipped leggings; empty item if none
virtual cItem GetEquippedLeggings(void) const { return cItem(); }
- /// Returns the currently equipped boots; empty item if nonte
+ /// Returns the currently equipped boots; empty item if none
virtual cItem GetEquippedBoots(void) const { return cItem(); }
/// Called when the health drops below zero. a_Killer may be NULL (environmental damage)
diff --git a/source/FurnaceRecipe.cpp b/source/FurnaceRecipe.cpp
index 8b1ee09a2..2e2276981 100644
--- a/source/FurnaceRecipe.cpp
+++ b/source/FurnaceRecipe.cpp
@@ -51,7 +51,7 @@ cFurnaceRecipe::~cFurnaceRecipe()
void cFurnaceRecipe::ReloadRecipes(void)
{
ClearRecipes();
- LOG("-- Loading furnace recipes --");
+ LOGD("Loading furnace recipes...");
std::ifstream f;
char a_File[] = "furnace.txt";
@@ -175,7 +175,7 @@ void cFurnaceRecipe::ReloadRecipes(void)
{
LOGERROR("ERROR: FurnaceRecipe, syntax error" );
}
- LOG("Got %u furnace recipes, and %u fuels.", m_pState->Recipes.size(), m_pState->Fuel.size());
+ LOG("Loaded %u furnace recipes and %u fuels", m_pState->Recipes.size(), m_pState->Fuel.size());
}
diff --git a/source/Generating/ChunkDesc.h b/source/Generating/ChunkDesc.h
index 41b85a814..067d8494a 100644
--- a/source/Generating/ChunkDesc.h
+++ b/source/Generating/ChunkDesc.h
@@ -36,13 +36,13 @@ public:
cChunkDesc(int a_ChunkX, int a_ChunkZ);
~cChunkDesc();
+ void SetChunkCoords(int a_ChunkX, int a_ChunkZ);
+
// tolua_begin
int GetChunkX(void) const { return m_ChunkX; }
int GetChunkZ(void) const { return m_ChunkZ; }
- void SetChunkCoords(int a_ChunkX, int a_ChunkZ);
-
void FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
void SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
void GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta);
@@ -74,7 +74,7 @@ public:
/// Writes the block area into the chunk, with its origin set at the specified relative coords. Area's data overwrite everything in the chunk.
void WriteBlockArea(const cBlockArea & a_BlockArea, int a_RelX, int a_RelY, int a_RelZ, cBlockArea::eMergeStrategy a_MergeStrategy = cBlockArea::msOverwrite);
- /// Reads an area from the chunk into a cBlockArea
+ /// Reads an area from the chunk into a cBlockArea, blocktypes and blockmetas
void ReadBlockArea(cBlockArea & a_Dest, int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ);
/// Returns the maximum height value in the heightmap
diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp
index 0852f559e..e2a8df11b 100644
--- a/source/Generating/ComposableGenerator.cpp
+++ b/source/Generating/ComposableGenerator.cpp
@@ -294,7 +294,7 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
);
CacheSize = 4;
}
- LOGINFO("Using a cache for Heightgen of size %d.", CacheSize);
+ LOGD("Using a cache for Heightgen of size %d.", CacheSize);
m_UnderlyingHeightGen = m_HeightGen;
m_HeightGen = new cHeiGenCache(m_UnderlyingHeightGen, CacheSize);
}
diff --git a/source/GroupManager.cpp b/source/GroupManager.cpp
index cef32dd58..b79fde9dc 100644
--- a/source/GroupManager.cpp
+++ b/source/GroupManager.cpp
@@ -43,7 +43,7 @@ cGroupManager::~cGroupManager()
cGroupManager::cGroupManager()
: m_pState( new sGroupManagerState )
{
- LOG("-- Loading Groups --");
+ LOGD("-- Loading Groups --");
cIniFile IniFile("groups.ini");
if (!IniFile.ReadFile())
{
@@ -57,7 +57,7 @@ cGroupManager::cGroupManager()
std::string KeyName = IniFile.GetKeyName( i );
cGroup* Group = GetGroup( KeyName.c_str() );
- LOG("Loading group: %s", KeyName.c_str() );
+ LOGD("Loading group: %s", KeyName.c_str() );
Group->SetName( KeyName );
char Color = IniFile.GetValue( KeyName, "Color", "-" )[0];
@@ -73,7 +73,6 @@ cGroupManager::cGroupManager()
for( unsigned int i = 0; i < Split.size(); i++)
{
Group->AddCommand( Split[i] );
- //LOG("%s", Split[i].c_str() );
}
}
@@ -84,7 +83,6 @@ cGroupManager::cGroupManager()
for( unsigned int i = 0; i < Split.size(); i++)
{
Group->AddPermission( Split[i] );
- //LOGINFO("Permission: %s", Split[i].c_str() );
}
}
@@ -98,7 +96,7 @@ cGroupManager::cGroupManager()
}
}
}
- LOG("-- Groups Successfully Loaded --");
+ LOGD("-- Groups Successfully Loaded --");
}
diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp
index 68cb6e40b..eb347968a 100644
--- a/source/PluginManager.cpp
+++ b/source/PluginManager.cpp
@@ -95,7 +95,7 @@ void cPluginManager::FindPlugins(void)
void cPluginManager::ReloadPluginsNow(void)
{
- LOG("Loading plugins");
+ LOG("-- Loading Plugins --");
m_bReloadPlugins = false;
UnloadPluginsNow();
@@ -135,11 +135,15 @@ void cPluginManager::ReloadPluginsNow(void)
if (GetNumPlugins() == 0)
{
- LOG("No plugins loaded");
+ LOG("-- No Plugins Loaded --");
+ }
+ else if ((GetNumPlugins() > 1) || (GetNumPlugins() == 0))
+ {
+ LOG("-- Loaded %i Plugins --", GetNumPlugins());
}
else
{
- LOG("Loaded %i plugin(s)", GetNumPlugins());
+ LOG("-- Loaded 1 Plugin --");
}
}
diff --git a/source/Root.cpp b/source/Root.cpp
index 57e5dfcc4..c2b58bd71 100644
--- a/source/Root.cpp
+++ b/source/Root.cpp
@@ -17,6 +17,7 @@
#include "Protocol/ProtocolRecognizer.h" // for protocol version constants
#include "CommandOutput.h"
#include "DeadlockDetect.h"
+#include "OSSupport/Timer.h"
#include "../iniFile/iniFile.h"
@@ -91,6 +92,10 @@ void cRoot::InputThread(void * a_Params)
void cRoot::Start(void)
{
+ cTimer Time;
+
+ long long mseconds = Time.GetNowTime();
+
cDeadlockDetect dd;
delete m_Log;
m_Log = new cMCLogger();
@@ -125,7 +130,7 @@ void cRoot::Start(void)
LOG("Starting server...");
if (!m_Server->InitServer(IniFile))
{
- LOGERROR("Failed to start server, shutting down.");
+ LOGERROR("Failure starting server, aborting...");
return;
}
IniFile.WriteFile();
@@ -134,44 +139,48 @@ void cRoot::Start(void)
m_WebAdmin = new cWebAdmin();
m_WebAdmin->Init();
- LOG("Loading settings...");
+ LOGD("Loading settings...");
m_GroupManager = new cGroupManager();
m_CraftingRecipes = new cCraftingRecipes;
m_FurnaceRecipe = new cFurnaceRecipe();
- LOG("Loading worlds...");
+ LOGD("Loading worlds...");
LoadWorlds();
- LOG("Loading plugin manager...");
+ LOGD("Loading plugin manager...");
m_PluginManager = new cPluginManager();
m_PluginManager->ReloadPluginsNow();
- LOG("Loading MonsterConfig...");
+ LOGD("Loading MonsterConfig...");
m_MonsterConfig = new cMonsterConfig;
// This sets stuff in motion
- LOG("Starting Authenticator...");
+ LOGD("Starting Authenticator...");
m_Authenticator.Start();
- LOG("Starting worlds...");
+ LOGD("Starting worlds...");
StartWorlds();
- LOG("Starting deadlock detector...");
+ LOGD("Starting deadlock detector...");
dd.Start();
- LOG("Starting server...");
+ LOGD("Finalising startup...");
m_Server->Start();
LOG("Starting WebAdmin...");
m_WebAdmin->Start();
#if !defined(ANDROID_NDK)
- LOG("Starting InputThread...");
+ LOGD("Starting InputThread...");
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
m_InputThread->Start( false ); // We should NOT wait? Otherwise we canīt stop the server from other threads than the input thread
#endif
- LOG("Initialization done, server running now.");
+ long long finishmseconds = Time.GetNowTime();
+ finishmseconds -= mseconds;
+
+ LOG("Startup complete, took %i ms!", finishmseconds);
+
while (!m_bStop && !m_bRestart) // These are modified by external threads
{
cSleep::MilliSleep(1000);
@@ -185,37 +194,37 @@ void cRoot::Start(void)
LOG("Shutting down server...");
m_Server->Shutdown();
- LOG("Shutting down deadlock detector...");
+ LOGD("Shutting down deadlock detector...");
dd.Stop();
- LOG("Stopping world threads...");
+ LOGD("Stopping world threads...");
StopWorlds();
- LOG("Stopping authenticator...");
+ LOGD("Stopping authenticator...");
m_Authenticator.Stop();
- LOG("Freeing MonsterConfig...");
+ LOGD("Freeing MonsterConfig...");
delete m_MonsterConfig; m_MonsterConfig = NULL;
- LOG("Stopping WebAdmin...");
+ LOGD("Stopping WebAdmin...");
delete m_WebAdmin; m_WebAdmin = NULL;
- LOG("Unloading recipes...");
+ LOGD("Unloading recipes...");
delete m_FurnaceRecipe; m_FurnaceRecipe = NULL;
delete m_CraftingRecipes; m_CraftingRecipes = NULL;
- LOG("Forgetting groups...");
+ LOGD("Forgetting groups...");
delete m_GroupManager; m_GroupManager = 0;
- LOG("Unloading worlds...");
+ LOGD("Unloading worlds...");
UnloadWorlds();
- LOG("Stopping plugin manager...");
+ LOGD("Stopping plugin manager...");
delete m_PluginManager; m_PluginManager = NULL;
cItemHandler::Deinit();
cBlockHandler::Deinit();
- LOG("Destroying server...");
+ LOG("Cleaning up...");
//delete HeartBeat; HeartBeat = 0;
delete m_Server; m_Server = 0;
- LOG("Shutdown done.");
+ LOG("Shutdown successful!");
}
delete m_Log; m_Log = 0;
diff --git a/source/Server.cpp b/source/Server.cpp
index e73580e79..879bfae5a 100644
--- a/source/Server.cpp
+++ b/source/Server.cpp
@@ -206,7 +206,6 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
return false;
}
- LOG("Starting up server.");
LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
@@ -292,7 +291,7 @@ void cServer::PrepareKeys(void)
// TODO: Save and load key for persistence across sessions
// But generating the key takes only a moment, do we even need that?
- LOG("Generating protocol encryption keypair...");
+ LOGD("Generating protocol encryption keypair...");
time_t CurTime = time(NULL);
CryptoPP::RandomPool rng;
diff --git a/source/Simulator/FireSimulator.cpp b/source/Simulator/FireSimulator.cpp
index 587f45306..da1dc8d15 100644
--- a/source/Simulator/FireSimulator.cpp
+++ b/source/Simulator/FireSimulator.cpp
@@ -234,10 +234,6 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in
return m_BurnStepTimeFuel;
}
}
- if ((a_RelY < cChunkDef::Height - 1) && IsFuel(a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ)))
- {
- return m_BurnStepTimeFuel;
- }
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
{
@@ -251,7 +247,23 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in
}
}
} // for i - gCrossCoords[]
- return m_BurnStepTimeNonfuel;
+
+ if ((a_RelY > 0) && (a_RelY < cChunkDef::Height - 1))
+ {
+ // Checked through everything, nothing was flammable
+ // If block below isn't solid, we can't have fire, otherwise, we have non-fueled fire
+ BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ);
+ if (g_BlockIsSolid[BlockBelow])
+ {
+ return m_BurnStepTimeNonfuel;
+ }
+ else
+ {
+ // SetBlock just to make sure fire doesn't spawn
+ a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0);
+ return 0;
+ }
+ }
}
diff --git a/source/World.h b/source/World.h
index dd856fc72..dcb197bd0 100644
--- a/source/World.h
+++ b/source/World.h
@@ -554,8 +554,16 @@ public:
/// Forces a weather change in the next game tick
void ChangeWeather (void);
- /// Returns the current weather
+ /// Returns the current weather. Instead of comparing values directly to the weather constants, use IsWeatherXXX() functions, if possible
eWeather GetWeather (void) const { return m_Weather; };
+
+ bool IsWeatherSunny(void) const { return (m_Weather == wSunny); }
+ bool IsWeatherRain (void) const { return (m_Weather == wRain); }
+ bool IsWeatherStorm(void) const { return (m_Weather == wStorm); }
+
+ /// Returns true if the current weather has any precipitation - rain or storm
+ bool IsWeatherWet (void) const { return (m_Weather != wSunny); }
+
// tolua_end
cChunkGenerator & GetGenerator(void) { return m_Generator; }