summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-30 15:03:29 +0100
committermadmaxoft <github@xoft.cz>2013-11-30 15:03:29 +0100
commit78f9d974598f517b0dd50853b6de4ee1b9292fe6 (patch)
tree945308c37a6df71c501d86205fb8615601eb8115 /src
parentAdded the real tick duration to the OnWorldTick hook. (diff)
downloadcuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.tar
cuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.tar.gz
cuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.tar.bz2
cuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.tar.lz
cuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.tar.xz
cuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.tar.zst
cuberite-78f9d974598f517b0dd50853b6de4ee1b9292fe6.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 03efbdf32..4f315d2af 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -486,30 +486,21 @@ void cWorld::Start(void)
}
} // switch (m_Dimension)
- // Try to find the "SpawnPosition" key in the world configuration
- // Set a boolean value if so
+ // Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition");
- unsigned int NumSpawnPositionKeys = ((KeyNum != -1) ? (IniFile.GetNumValues(KeyNum)) : 0);
-
- if (NumSpawnPositionKeys > 0)
- {
- for (unsigned int i = 0; i < NumSpawnPositionKeys; i++)
- {
- AString ValueName = IniFile.GetValueName(KeyNum, i);
- if (
- (ValueName.compare("X") == 0) ||
- (ValueName.compare("Y") == 0) ||
- (ValueName.compare("Z") == 0)
- )
- {
- m_bSpawnExplicitlySet = true;
- LOGD("Spawnpoint explicitly set!");
- }
- }
- }
+ m_bSpawnExplicitlySet =
+ (
+ (KeyNum >= 0) &&
+ (
+ (IniFile.FindValue(KeyNum, "X") >= 0) ||
+ (IniFile.FindValue(KeyNum, "Y") >= 0) ||
+ (IniFile.FindValue(KeyNum, "Z") >= 0)
+ )
+ );
if (m_bSpawnExplicitlySet)
{
+ LOGD("Spawnpoint explicitly set!");
m_SpawnX = IniFile.GetValueF("SpawnPosition", "X", m_SpawnX);
m_SpawnY = IniFile.GetValueF("SpawnPosition", "Y", m_SpawnY);
m_SpawnZ = IniFile.GetValueF("SpawnPosition", "Z", m_SpawnZ);