1
0

Changed linked world name variables and setters / getters.

Ref.: #1792
Ref.: https://github.com/mc-server/MCServer/pull/1792#discussion_r25946707
This commit is contained in:
Mattes D 2015-03-21 15:20:31 +01:00
parent 7e7527cc43
commit e9b8be25f9
3 changed files with 31 additions and 30 deletions

View File

@ -1263,7 +1263,7 @@ bool cEntity::DetectPortal()
{
if (GetWorld()->GetDimension() == dimOverworld)
{
if (GetWorld()->GetNetherWorldName().empty() && GetWorld()->GetEndWorldName().empty())
if (GetWorld()->GetLinkedNetherWorldName().empty() && GetWorld()->GetLinkedEndWorldName().empty())
{
// Teleportation to either dimension not enabled, don't bother proceeding
return false;
@ -1314,7 +1314,7 @@ bool cEntity::DetectPortal()
}
else
{
if (GetWorld()->GetNetherWorldName().empty())
if (GetWorld()->GetLinkedNetherWorldName().empty())
{
return false;
}
@ -1327,7 +1327,7 @@ bool cEntity::DetectPortal()
((cPlayer *)this)->GetClientHandle()->SendRespawn(dimNether);
}
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetNetherWorldName(), dimNether, GetWorld()->GetName()), false);
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedNetherWorldName(), dimNether, GetWorld()->GetName()), false);
}
}
case E_BLOCK_END_PORTAL:
@ -1358,7 +1358,7 @@ bool cEntity::DetectPortal()
}
else
{
if (GetWorld()->GetEndWorldName().empty())
if (GetWorld()->GetLinkedEndWorldName().empty())
{
return false;
}
@ -1371,7 +1371,7 @@ bool cEntity::DetectPortal()
((cPlayer *)this)->GetClientHandle()->SendRespawn(dimEnd);
}
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetEndWorldName(), dimEnd, GetWorld()->GetName()), false);
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedEndWorldName(), dimEnd, GetWorld()->GetName()), false);
}
}

View File

@ -259,9 +259,9 @@ void cWorld::cTickThread::Execute(void)
////////////////////////////////////////////////////////////////////////////////
// cWorld:
cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AString & a_OverworldName) :
cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AString & a_LinkedOverworldName) :
m_WorldName(a_WorldName),
m_OverworldName(a_OverworldName),
m_LinkedOverworldName(a_LinkedOverworldName),
m_IniFileName(m_WorldName + "/world.ini"),
m_StorageSchema("Default"),
#ifdef __arm__
@ -604,12 +604,12 @@ void cWorld::Start(void)
if (GetDimension() == dimOverworld)
{
m_NetherWorldName = IniFile.GetValueSet("LinkedWorlds", "NetherWorldName", GetName() + "_nether");
m_EndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", GetName() + "_end");
m_LinkedNetherWorldName = IniFile.GetValueSet("LinkedWorlds", "NetherWorldName", GetName() + "_nether");
m_LinkedEndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", GetName() + "_end");
}
else
{
m_OverworldName = IniFile.GetValueSet("LinkedWorlds", "OverworldName", GetLinkedOverworldName());
m_LinkedOverworldName = IniFile.GetValueSet("LinkedWorlds", "OverworldName", GetLinkedOverworldName());
}
// Adjust the enum-backed variables into their respective bounds:
@ -884,18 +884,18 @@ void cWorld::Stop(void)
IniFile.ReadFile(m_IniFileName);
if (GetDimension() == dimOverworld)
{
IniFile.SetValue("LinkedWorlds", "NetherWorldName", m_NetherWorldName);
IniFile.SetValue("LinkedWorlds", "EndWorldName", m_EndWorldName);
IniFile.SetValue("LinkedWorlds", "NetherWorldName", m_LinkedNetherWorldName);
IniFile.SetValue("LinkedWorlds", "EndWorldName", m_LinkedEndWorldName);
}
else
{
IniFile.SetValue("LinkedWorlds", "OverworldName", m_OverworldName);
IniFile.SetValue("LinkedWorlds", "OverworldName", m_LinkedOverworldName);
}
IniFile.SetValueI("Physics", "TNTShrapnelLevel", (int)m_TNTShrapnelLevel);
IniFile.SetValueI("Physics", "TNTShrapnelLevel", static_cast<int>(m_TNTShrapnelLevel));
IniFile.SetValueB("Mechanics", "CommandBlocksEnabled", m_bCommandBlocksEnabled);
IniFile.SetValueB("Mechanics", "UseChatPrefixes", m_bUseChatPrefixes);
IniFile.SetValueB("General", "IsDaylightCycleEnabled", m_IsDaylightCycleEnabled);
IniFile.SetValueI("General", "Weather", (int)m_Weather);
IniFile.SetValueI("General", "Weather", static_cast<int>(m_Weather));
IniFile.SetValueI("General", "TimeInTicks", GetTimeOfDay());
IniFile.WriteFile(m_IniFileName);

View File

@ -674,14 +674,14 @@ public:
bool ShouldBroadcastAchievementMessages(void) const { return m_BroadcastAchievementMessages; }
AString GetNetherWorldName(void) const { return m_NetherWorldName; }
void SetNetherWorldName(const AString & a_Name) { m_NetherWorldName = a_Name; }
AString GetLinkedNetherWorldName(void) const { return m_LinkedNetherWorldName; }
void SetLinkedNetherWorldName(const AString & a_Name) { m_LinkedNetherWorldName = a_Name; }
AString GetEndWorldName(void) const { return m_EndWorldName; }
void SetEndWorldName(const AString & a_Name) { m_EndWorldName = a_Name; }
AString GetLinkedEndWorldName(void) const { return m_LinkedEndWorldName; }
void SetLinkedEndWorldName(const AString & a_Name) { m_LinkedEndWorldName = a_Name; }
AString GetLinkedOverworldName(void) const { return m_OverworldName; }
void SetLinkedOverworldName(const AString & a_Name) { m_OverworldName = a_Name; }
AString GetLinkedOverworldName(void) const { return m_LinkedOverworldName; }
void SetLinkedOverworldName(const AString & a_Name) { m_LinkedOverworldName = a_Name; }
// tolua_end
@ -885,10 +885,9 @@ private:
AString m_WorldName;
/** The name of the world that a portal in this world should link to
Only has effect if this world is a nether or end world, as it is used by entities to see which world to teleport to when in a portal
*/
AString m_OverworldName;
/** The name of the overworld that portals in this world should link to.
Only has effect if this world is a Nether or End world. */
AString m_LinkedOverworldName;
AString m_IniFileName;
@ -981,11 +980,13 @@ private:
/** The maximum view distance that a player can have in this world. */
int m_MaxViewDistance;
/** Name of the nether world */
AString m_NetherWorldName;
/** Name of the nether world - where Nether portals should teleport.
Only used when this world is an Overworld. */
AString m_LinkedNetherWorldName;
/** Name of the end world */
AString m_EndWorldName;
/** Name of the End world - where End portals should teleport.
Only used when this world is an Overworld. */
AString m_LinkedEndWorldName;
cChunkGenerator m_Generator;
@ -1045,7 +1046,7 @@ private:
cSetChunkDataPtrs m_SetChunkDataQueue;
cWorld(const AString & a_WorldName, eDimension a_Dimension = dimOverworld, const AString & a_OverworldName = "");
cWorld(const AString & a_WorldName, eDimension a_Dimension = dimOverworld, const AString & a_LinkedOverworldName = "");
virtual ~cWorld();
void Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec);