summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/BlockID.h12
-rw-r--r--src/ChunkMap.cpp4
-rw-r--r--src/World.cpp6
-rw-r--r--src/World.h10
4 files changed, 17 insertions, 15 deletions
diff --git a/src/BlockID.h b/src/BlockID.h
index 1c454cd23..e305e9237 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -852,10 +852,14 @@ enum eExplosionSource
esWitherSkullBlack,
esWitherSkullBlue,
esWitherBirth,
- esPlugin,
-
- // Obsolete constants, kept for compatibility, will be removed after some time:
- esCreeper = esMonster,
+ esPlugin
+} ;
+
+enum eShrapnelLevel
+{
+ slNone,
+ slGravityAffectedOnly,
+ slAll
} ;
// tolua_end
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 867b37ed0..e695f0ab2 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -1834,13 +1834,13 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
}
- else if ((m_World->GetTNTShrapnelLevel() > 0) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
+ else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
{
if (!cBlockInfo::FullyOccupiesVoxel(Block))
{
break;
}
- else if ((m_World->GetTNTShrapnelLevel() == 1) && ((Block != E_BLOCK_SAND) && (Block != E_BLOCK_GRAVEL)))
+ else if ((m_World->GetTNTShrapnelLevel() == slGravityAffectedOnly) && ((Block != E_BLOCK_SAND) && (Block != E_BLOCK_GRAVEL)))
{
break;
}
diff --git a/src/World.cpp b/src/World.cpp
index 22bc406e0..01281625a 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -577,15 +577,15 @@ void cWorld::Start(void)
m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false);
m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", true);
m_ShouldLavaSpawnFire = IniFile.GetValueSetB("Physics", "ShouldLavaSpawnFire", true);
- m_TNTShrapnelLevel = IniFile.GetValueSetI("Physics", "TNTShrapnelLevel", 2);
+ m_TNTShrapnelLevel = (eShrapnelLevel)IniFile.GetValueSetI("Physics", "TNTShrapnelLevel", 2);
m_bCommandBlocksEnabled = IniFile.GetValueSetB("Mechanics", "CommandBlocksEnabled", false);
m_bEnabledPVP = IniFile.GetValueSetB("Mechanics", "PVPEnabled", true);
m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true);
m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true);
m_GameMode = (eGameMode)IniFile.GetValueSetI("General", "Gamemode", m_GameMode);
- if (m_TNTShrapnelLevel > 2)
- m_TNTShrapnelLevel = 2;
+ if (m_TNTShrapnelLevel > slAll)
+ m_TNTShrapnelLevel = slAll;
// Load allowed mobs:
const char * DefaultMonsters = "";
diff --git a/src/World.h b/src/World.h
index 21c6ea01c..46aece18f 100644
--- a/src/World.h
+++ b/src/World.h
@@ -605,8 +605,8 @@ public:
bool AreCommandBlocksEnabled(void) const { return m_bCommandBlocksEnabled; }
void SetCommandBlocksEnabled(bool a_Flag) { m_bCommandBlocksEnabled = a_Flag; }
- unsigned char GetTNTShrapnelLevel(void) const { return m_TNTShrapnelLevel; }
- void SetTNTShrapnelLevel(int a_Flag) { m_TNTShrapnelLevel = a_Flag; }
+ eShrapnelLevel GetTNTShrapnelLevel(void) const { return m_TNTShrapnelLevel; }
+ void SetTNTShrapnelLevel(eShrapnelLevel a_Flag) { m_TNTShrapnelLevel = a_Flag; }
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
@@ -867,11 +867,9 @@ private:
bool m_bUseChatPrefixes;
/** The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities
- 0 = None
- 1 = Only sand and gravel
- 2 = All blocks
+ See the eShrapnelLevel enumeration for details
*/
- int m_TNTShrapnelLevel;
+ eShrapnelLevel m_TNTShrapnelLevel;
cChunkGenerator m_Generator;