summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-11-08 17:41:46 +0100
committerMattes D <github@xoft.cz>2013-11-08 17:41:46 +0100
commitd33112b6b1d4f36daeae63d6aa81864254ed9135 (patch)
treee18debe737314c0eb9014add419069be0e015495
parentMerge pull request #322 from tonibm19/master (diff)
parentAdded hardcore client effect (diff)
downloadcuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.tar
cuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.tar.gz
cuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.tar.bz2
cuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.tar.lz
cuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.tar.xz
cuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.tar.zst
cuberite-d33112b6b1d4f36daeae63d6aa81864254ed9135.zip
-rw-r--r--source/Protocol/Protocol17x.cpp8
-rw-r--r--source/Root.cpp5
2 files changed, 8 insertions, 5 deletions
diff --git a/source/Protocol/Protocol17x.cpp b/source/Protocol/Protocol17x.cpp
index 306b86987..d45528c5f 100644
--- a/source/Protocol/Protocol17x.cpp
+++ b/source/Protocol/Protocol17x.cpp
@@ -420,7 +420,7 @@ void cProtocol172::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
{
cPacketizer Pkt(*this, 0x01); // Join Game packet
Pkt.WriteInt(a_Player.GetUniqueID());
- Pkt.WriteByte((Byte)a_Player.GetEffectiveGameMode());
+ Pkt.WriteByte((Byte)a_Player.GetEffectiveGameMode() | (cRoot::Get()->GetServer()->IsHardcore() ? 0x08 : 0)); // Hardcore flag bit 4
Pkt.WriteChar((char)a_World.GetDimension());
Pkt.WriteByte(2); // TODO: Difficulty (set to Normal)
Pkt.WriteByte(cRoot::Get()->GetServer()->GetMaxPlayers());
@@ -447,7 +447,7 @@ void cProtocol172::SendPickupSpawn(const cPickup & a_Pickup)
{
{
cPacketizer Pkt(*this, 0x0e); // Spawn Object packet
- Pkt.WriteInt(a_Pickup.GetUniqueID());
+ Pkt.WriteVarInt(a_Pickup.GetUniqueID());
Pkt.WriteByte(2); // Type = Pickup
Pkt.WriteFPInt(a_Pickup.GetPosX());
Pkt.WriteFPInt(a_Pickup.GetPosY());
@@ -616,7 +616,7 @@ void cProtocol172::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_Src
void cProtocol172::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock)
{
cPacketizer Pkt(*this, 0x0e); // Spawn Object packet
- Pkt.WriteInt(a_FallingBlock.GetUniqueID());
+ Pkt.WriteVarInt(a_FallingBlock.GetUniqueID());
Pkt.WriteByte(70); // Falling block
Pkt.WriteFPInt(a_FallingBlock.GetPosX());
Pkt.WriteFPInt(a_FallingBlock.GetPosY());
@@ -681,7 +681,7 @@ void cProtocol172::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType,
void cProtocol172::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType)
{
cPacketizer Pkt(*this, 0xe); // Spawn Object packet
- Pkt.WriteInt(a_Vehicle.GetUniqueID());
+ Pkt.WriteVarInt(a_Vehicle.GetUniqueID());
Pkt.WriteByte(a_VehicleType);
Pkt.WriteFPInt(a_Vehicle.GetPosX());
Pkt.WriteFPInt(a_Vehicle.GetPosY());
diff --git a/source/Root.cpp b/source/Root.cpp
index 8ec94629b..4760c3ef1 100644
--- a/source/Root.cpp
+++ b/source/Root.cpp
@@ -285,7 +285,10 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
if (!FoundAdditionalWorlds)
{
- IniFile.AddKeyComment("Worlds", " World=secondworld");
+ if (IniFile.GetKeyComment("Worlds", 0) != " World=secondworld")
+ {
+ IniFile.AddKeyComment("Worlds", " World=secondworld");
+ }
}
}