1
0

Fix failed merge and other issues

This commit is contained in:
Tiger Wang 2014-07-18 20:12:27 +01:00
parent 37140ae578
commit 719551c31f
14 changed files with 28 additions and 77 deletions

View File

@ -2375,9 +2375,9 @@ void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effec
void cClientHandle::SendRespawn(eDimension a_Dimension) void cClientHandle::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{ {
m_Protocol->SendRespawn(a_Dimension); m_Protocol->SendRespawn(a_Dimension, a_ShouldIgnoreDimensionChecks);
} }

View File

@ -161,7 +161,7 @@ public:
void SendPlayerSpawn (const cPlayer & a_Player); void SendPlayerSpawn (const cPlayer & a_Player);
void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp
void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID); void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
void SendRespawn (eDimension a_Dimension); void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false);
void SendExperience (void); void SendExperience (void);
void SendExperienceOrb (const cExpOrb & a_ExpOrb); void SendExperienceOrb (const cExpOrb & a_ExpOrb);
void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);

View File

@ -1028,7 +1028,7 @@ void cEntity::DetectCacti(void)
void cEntity::DetectPortal() void cEntity::DetectPortal()
{ {
if (!GetWorld()->AreNetherPortalsEnabled() && !GetWorld()->AreEndPortalsEnabled()) if (!GetWorld()->GetNetherWorldName().empty() && !GetWorld()->GetEndWorldName().empty())
{ {
return; return;
} }
@ -1040,7 +1040,7 @@ void cEntity::DetectPortal()
{ {
case E_BLOCK_NETHER_PORTAL: case E_BLOCK_NETHER_PORTAL:
{ {
if (!GetWorld()->AreNetherPortalsEnabled() || m_PortalCooldownData.second) if (GetWorld()->GetNetherWorldName().empty() || m_PortalCooldownData.second)
{ {
return; return;
} }
@ -1085,7 +1085,7 @@ void cEntity::DetectPortal()
} }
case E_BLOCK_END_PORTAL: case E_BLOCK_END_PORTAL:
{ {
if (!GetWorld()->AreEndPortalsEnabled() || m_PortalCooldownData.second) if (GetWorld()->GetNetherWorldName().empty() || m_PortalCooldownData.second)
{ {
return; return;
} }

View File

@ -1695,12 +1695,7 @@ void cPlayer::LoadPermissionsFromDisk()
<<<<<<< HEAD
bool cPlayer::LoadFromDisk(cWorldPtr & a_World) bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
=======
bool cPlayer::LoadFromDisk(void)
>>>>>>> master
{ {
a_World = cRoot::Get()->GetWorld(GetLoadedWorldName()); a_World = cRoot::Get()->GetWorld(GetLoadedWorldName());
if (a_World == NULL) if (a_World == NULL)
@ -1711,7 +1706,7 @@ bool cPlayer::LoadFromDisk(void)
LoadPermissionsFromDisk(); LoadPermissionsFromDisk();
// Load from the UUID file: // Load from the UUID file:
if (LoadFromFile(GetUUIDFileName(m_UUID))) if (LoadFromFile(GetUUIDFileName(m_UUID), a_World))
{ {
return true; return true;
} }
@ -1720,7 +1715,7 @@ bool cPlayer::LoadFromDisk(void)
AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName()); AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData()) if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData())
{ {
if (LoadFromFile(GetUUIDFileName(OfflineUUID))) if (LoadFromFile(GetUUIDFileName(OfflineUUID), a_World))
{ {
return true; return true;
} }
@ -1730,7 +1725,7 @@ bool cPlayer::LoadFromDisk(void)
if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData()) if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData())
{ {
AString OldStyleFileName = Printf("players/%s.json", GetName().c_str()); AString OldStyleFileName = Printf("players/%s.json", GetName().c_str());
if (LoadFromFile(OldStyleFileName)) if (LoadFromFile(OldStyleFileName, a_World))
{ {
// Save in new format and remove the old file // Save in new format and remove the old file
if (SaveToDisk()) if (SaveToDisk())
@ -1752,7 +1747,7 @@ bool cPlayer::LoadFromDisk(void)
bool cPlayer::LoadFromFile(const AString & a_FileName) bool cPlayer::LoadFromFile(const AString & a_FileName, cWorld * a_World)
{ {
// Load the data from the file: // Load the data from the file:
cFile f; cFile f;
@ -1860,28 +1855,6 @@ bool cPlayer::SaveToDisk()
cEnderChestEntity::SaveToJson(JSON_EnderChestInventory, m_EnderChestContents); cEnderChestEntity::SaveToJson(JSON_EnderChestInventory, m_EnderChestContents);
Json::Value root; Json::Value root;
<<<<<<< HEAD
root["position"] = JSON_PlayerPosition;
root["rotation"] = JSON_PlayerRotation;
root["inventory"] = JSON_Inventory;
root["health"] = m_Health;
root["xpTotal"] = m_LifetimeTotalXp;
root["xpCurrent"] = m_CurrentXp;
root["air"] = m_AirLevel;
root["food"] = m_FoodLevel;
root["foodSaturation"] = m_FoodSaturationLevel;
root["foodTickTimer"] = m_FoodTickTimer;
root["foodExhaustion"] = m_FoodExhaustionLevel;
root["world"] = GetWorld()->GetName();
root["isflying"] = IsFlying();
root["SpawnX"] = GetLastBedPos().x;
root["SpawnY"] = GetLastBedPos().y;
root["SpawnZ"] = GetLastBedPos().z;
if (m_GameMode == GetWorld()->GetGameMode())
{
root["gamemode"] = (int) eGameMode_NotSet;
=======
root["position"] = JSON_PlayerPosition; root["position"] = JSON_PlayerPosition;
root["rotation"] = JSON_PlayerRotation; root["rotation"] = JSON_PlayerRotation;
root["inventory"] = JSON_Inventory; root["inventory"] = JSON_Inventory;
@ -1896,6 +1869,10 @@ bool cPlayer::SaveToDisk()
root["foodExhaustion"] = m_FoodExhaustionLevel; root["foodExhaustion"] = m_FoodExhaustionLevel;
root["isflying"] = IsFlying(); root["isflying"] = IsFlying();
root["lastknownname"] = GetName(); root["lastknownname"] = GetName();
root["SpawnX"] = GetLastBedPos().x;
root["SpawnY"] = GetLastBedPos().y;
root["SpawnZ"] = GetLastBedPos().z;
if (m_World != NULL) if (m_World != NULL)
{ {
root["world"] = m_World->GetName(); root["world"] = m_World->GetName();
@ -1907,7 +1884,6 @@ bool cPlayer::SaveToDisk()
{ {
root["gamemode"] = (int) m_GameMode; root["gamemode"] = (int) m_GameMode;
} }
>>>>>>> master
} }
else else
{ {

View File

@ -328,11 +328,6 @@ public:
void Respawn(void); // tolua_export void Respawn(void); // tolua_export
void SetVisible(bool a_bVisible); // tolua_export
bool IsVisible(void) const { return m_bVisible; } // tolua_export
void Respawn(void); // tolua_export
void SetVisible( bool a_bVisible ); // tolua_export void SetVisible( bool a_bVisible ); // tolua_export
bool IsVisible(void) const { return m_bVisible; } // tolua_export bool IsVisible(void) const { return m_bVisible; } // tolua_export
@ -352,7 +347,7 @@ Takes a (NULL) cWorld pointer which it will assign a value to based on either th
/** Loads the player data from the specified file. /** Loads the player data from the specified file.
Returns true on success, false on failure. */ Returns true on success, false on failure. */
bool LoadFromFile(const AString & a_FileName); bool LoadFromFile(const AString & a_FileName, cWorld * a_World);
void LoadPermissionsFromDisk(void); // tolua_export void LoadPermissionsFromDisk(void); // tolua_export
@ -544,8 +539,6 @@ protected:
cStatManager m_Stats; cStatManager m_Stats;
<<<<<<< HEAD
=======
/** Flag representing whether the player is currently in a bed /** Flag representing whether the player is currently in a bed
Set by a right click on unoccupied bed, unset by a time fast forward or teleport */ Set by a right click on unoccupied bed, unset by a time fast forward or teleport */
bool m_bIsInBed; bool m_bIsInBed;
@ -563,8 +556,6 @@ protected:
If no ClientHandle is given, the UUID is initialized to empty. */ If no ClientHandle is given, the UUID is initialized to empty. */
AString m_UUID; AString m_UUID;
>>>>>>> master
/** Sets the speed and sends it to the client, so that they are forced to move so. */ /** Sets the speed and sends it to the client, so that they are forced to move so. */
virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override; virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override;

View File

@ -100,7 +100,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0; virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) = 0; virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) = 0;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) = 0; virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) = 0;
virtual void SendRespawn (eDimension a_Dimension) = 0; virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) = 0;
virtual void SendExperience (void) = 0; virtual void SendExperience (void) = 0;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) = 0; virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) = 0;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) = 0; virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) = 0;

View File

@ -836,7 +836,7 @@ void cProtocol125::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
void cProtocol125::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) void cProtocol125::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{ {
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);
if ((m_LastSentDimension == a_World.GetDimension()) && !a_ShouldIgnoreDimensionChecks) if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
{ {
// Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do (unless we are respawning from death) // Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do (unless we are respawning from death)
return; return;

View File

@ -72,7 +72,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override; virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override; virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override; virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendExperience (void) override; virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override; virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;

View File

@ -42,7 +42,7 @@ protected:
virtual void SendGameMode (eGameMode a_GameMode) override; virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override; virtual void SendHealth (void) override;
virtual void SendPlayerMaxSpeed(void) override; virtual void SendPlayerMaxSpeed(void) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override; virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendWindowOpen (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override;
virtual int ParseEntityAction (void) override; virtual int ParseEntityAction (void) override;

View File

@ -988,7 +988,7 @@ void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
void cProtocol172::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) void cProtocol172::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{ {
if ((m_LastSentDimension == a_World.GetDimension()) && !a_ShouldIgnoreDimensionChecks) if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
{ {
// Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do (unless we are respawning from death) // Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do (unless we are respawning from death)
return; return;

View File

@ -104,7 +104,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override; virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override; virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override; virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override; virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
virtual void SendExperience (void) override; virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;

View File

@ -107,7 +107,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override; virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override; virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false) override; virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendExperience (void) override; virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override; virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;

View File

@ -527,7 +527,7 @@ void cWorld::Start(bool a_WasDimensionSet)
AString Dimension = IniFile.GetValueSet("General", "Dimension", a_WasDimensionSet ? DimensionToString(GetDimension()) : "Overworld"); AString Dimension = IniFile.GetValueSet("General", "Dimension", a_WasDimensionSet ? DimensionToString(GetDimension()) : "Overworld");
m_Dimension = StringToDimension(Dimension); m_Dimension = StringToDimension(Dimension);
m_OverworldName = IniFile.GetValue("General", "OverworldName", a_WasDimensionSet ? m_OverworldName : ""); m_OverworldName = IniFile.GetValue("LinkedWorlds", "OverworldName", a_WasDimensionSet ? m_OverworldName : "");
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found // Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition"); int KeyNum = IniFile.FindKey("SpawnPosition");
@ -577,10 +577,8 @@ void cWorld::Start(bool a_WasDimensionSet)
if ((GetDimension() != dimNether) && (GetDimension() != dimEnd)) if ((GetDimension() != dimNether) && (GetDimension() != dimEnd))
{ {
m_bNetherPortalsEnabled = IniFile.GetValueSetB("General", "NetherPortalsEnabled", true); m_NetherWorldName = IniFile.GetValueSet("LinkedWorlds", "NetherWorldName", DEFAULT_NETHER_NAME);
m_NetherWorldName = IniFile.GetValueSet("General", "NetherWorldName", DEFAULT_NETHER_NAME); m_EndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", DEFAULT_END_NAME);
m_bEndPortalsEnabled = IniFile.GetValueSetB("General", "EndPortalsEnabled", true);
m_EndWorldName = IniFile.GetValueSet("General", "EndWorldName", DEFAULT_END_NAME);
} }
// Adjust the enum-backed variables into their respective bounds: // Adjust the enum-backed variables into their respective bounds:
@ -757,14 +755,12 @@ void cWorld::Stop(void)
IniFile.ReadFile(m_IniFileName); IniFile.ReadFile(m_IniFileName);
if ((GetDimension() != dimNether) && (GetDimension() != dimEnd)) if ((GetDimension() != dimNether) && (GetDimension() != dimEnd))
{ {
IniFile.SetValueB("General", "NetherPortalsEnabled", m_bNetherPortalsEnabled); IniFile.SetValue("LinkedWorlds", "NetherWorldName", m_NetherWorldName);
IniFile.SetValue("General", "NetherWorldName", m_NetherWorldName); IniFile.SetValue("LinkedWorlds", "EndWorldName", m_EndWorldName);
IniFile.SetValueB("General", "EndPortalsEnabled", m_bEndPortalsEnabled);
IniFile.SetValue("General", "EndWorldName", m_EndWorldName);
} }
else else
{ {
IniFile.SetValue("General", "OverworldName", m_OverworldName); IniFile.SetValue("LinkedWorlds", "OverworldName", m_OverworldName);
} }
IniFile.SetValueI("Physics", "TNTShrapnelLevel", (int)m_TNTShrapnelLevel); IniFile.SetValueI("Physics", "TNTShrapnelLevel", (int)m_TNTShrapnelLevel);
IniFile.SetValueB("Mechanics", "CommandBlocksEnabled", m_bCommandBlocksEnabled); IniFile.SetValueB("Mechanics", "CommandBlocksEnabled", m_bCommandBlocksEnabled);

View File

@ -630,12 +630,6 @@ public:
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; } bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; } void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
bool AreNetherPortalsEnabled(void) const { return m_bNetherPortalsEnabled; }
void SetNetherPortalsEnabled(bool a_Flag) { m_bNetherPortalsEnabled = a_Flag; }
bool AreEndPortalsEnabled(void) const { return m_bEndPortalsEnabled; }
void SetEndPortalsEnabled(bool a_Flag) { m_bEndPortalsEnabled = a_Flag; }
AString GetNetherWorldName(void) const { return m_NetherWorldName; } AString GetNetherWorldName(void) const { return m_NetherWorldName; }
void SetNetherWorldName(const AString & a_Name) { m_NetherWorldName = a_Name; } void SetNetherWorldName(const AString & a_Name) { m_NetherWorldName = a_Name; }
@ -938,12 +932,6 @@ private:
*/ */
eShrapnelLevel m_TNTShrapnelLevel; eShrapnelLevel m_TNTShrapnelLevel;
/** Whether nether portals teleport entities */
bool m_bNetherPortalsEnabled;
/** Whether end portals teleport entities */
bool m_bEndPortalsEnabled;
/** Name of the nether world */ /** Name of the nether world */
AString m_NetherWorldName; AString m_NetherWorldName;