From d6de11da07af96c9989d9a80a4ee69dad7e9380e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 20 Dec 2013 16:39:20 +0100 Subject: Sorted a few constructors to remove warnings. --- src/Entities/Entity.cpp | 10 ++++----- src/Entities/Entity.h | 2 +- src/Entities/Player.cpp | 43 ++++++++++++++++++++------------------- src/Entities/Player.h | 9 +++++--- src/Entities/ProjectileEntity.cpp | 4 ++-- 5 files changed, 36 insertions(+), 32 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 32ee7f2bd..37fdc38ee 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -33,23 +33,19 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d , m_Attachee(NULL) , m_Referencers(new cReferenceManager(cReferenceManager::RFMNGR_REFERENCERS)) , m_References(new cReferenceManager(cReferenceManager::RFMNGR_REFERENCES)) - , m_HeadYaw( 0.0 ) - , m_Rot(0.0, 0.0, 0.0) - , m_Pos(a_X, a_Y, a_Z) - , m_Mass (0.001) //Default 1g , m_bDirtyHead(true) , m_bDirtyOrientation(true) , m_bDirtyPosition(true) , m_bDirtySpeed(true) , m_bOnGround( false ) , m_Gravity( -9.81f ) - , m_IsInitialized(false) , m_LastPosX( 0.0 ) , m_LastPosY( 0.0 ) , m_LastPosZ( 0.0 ) , m_TimeLastTeleportPacket(0) , m_TimeLastMoveReltPacket(0) , m_TimeLastSpeedPacket(0) + , m_IsInitialized(false) , m_EntityType(a_EntityType) , m_World(NULL) , m_TicksSinceLastBurnDamage(0) @@ -57,6 +53,10 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d , m_TicksSinceLastFireDamage(0) , m_TicksSinceLastVoidDamage(0) , m_TicksLeftBurning(0) + , m_HeadYaw( 0.0 ) + , m_Rot(0.0, 0.0, 0.0) + , m_Pos(a_X, a_Y, a_Z) + , m_Mass (0.001) //Default 1g , m_WaterSpeed(0, 0, 0) , m_Width(a_Width) , m_Height(a_Height) diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 7107a4a13..9cb36eb14 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -387,7 +387,7 @@ protected: double m_LastPosX, m_LastPosY, m_LastPosZ; // This variables keep track of the last time a packet was sent - Int64 m_TimeLastTeleportPacket,m_TimeLastMoveReltPacket,m_TimeLastSpeedPacket; // In ticks + Int64 m_TimeLastTeleportPacket, m_TimeLastMoveReltPacket, m_TimeLastSpeedPacket; // In ticks bool m_IsInitialized; // Is set to true when it's initialized, until it's destroyed (Initialize() till Destroy() ) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index ca0d625e2..8f30cd4cc 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -36,43 +36,44 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) : super(etPlayer, 0.6, 1.8) - , m_GameMode(eGameMode_NotSet) - , m_IP("") - , m_LastBlockActionTime( 0 ) - , m_LastBlockActionCnt( 0 ) , m_AirLevel( MAX_AIR_LEVEL ) - , m_AirTickTimer( DROWNING_TICKS ) - , m_bVisible( true ) - , m_LastGroundHeight( 0 ) - , m_bTouchGround( false ) - , m_Stance( 0.0 ) - , m_Inventory(*this) - , m_CurrentWindow(NULL) - , m_InventoryWindow(NULL) - , m_TimeLastPickupCheck( 0.f ) - , m_Color('-') - , m_ClientHandle( a_Client ) + , m_AirTickTimer(DROWNING_TICKS) + , m_bVisible(true) , m_FoodLevel(MAX_FOOD_LEVEL) , m_FoodSaturationLevel(5) , m_FoodTickTimer(0) , m_FoodExhaustionLevel(0) , m_FoodPoisonedTicksRemaining(0) + , m_LastJumpHeight(0) + , m_LastGroundHeight(0) + , m_bTouchGround(false) + , m_Stance(0.0) + , m_Inventory(*this) + , m_CurrentWindow(NULL) + , m_InventoryWindow(NULL) + , m_TimeLastPickupCheck(0.f) + , m_Color('-') + , m_LastBlockActionTime(0) + , m_LastBlockActionCnt(0) + , m_GameMode(eGameMode_NotSet) + , m_IP("") + , m_ClientHandle(a_Client) , m_NormalMaxSpeed(0.1) , m_SprintingMaxSpeed(0.13) , m_IsCrouched(false) , m_IsSprinting(false) + , m_IsFlying(false) , m_IsSwimming(false) , m_IsSubmerged(false) - , m_IsFlying(false) - , m_CanFly(false) , m_IsFishing(false) - , m_FloaterID(-1) + , m_CanFly(false) , m_EatingFinishTick(-1) - , m_IsChargingBow(false) - , m_BowCharge(0) - , m_CurrentXp(0) , m_LifetimeTotalXp(0) + , m_CurrentXp(0) , m_bDirtyExperience(false) + , m_IsChargingBow(false) + , m_BowCharge(0) + , m_FloaterID(-1) { LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d", a_PlayerName.c_str(), a_Client->GetIPString().c_str(), diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 74da857e8..c0ad9eeac 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -407,9 +407,6 @@ protected: float m_TimeLastPickupCheck; - void ResolvePermissions(); - - void ResolveGroups(); char m_Color; float m_LastBlockActionTime; @@ -417,6 +414,7 @@ protected: eGameMode m_GameMode; std::string m_IP; + /// The item being dragged by the cursor while in a UI window cItem m_DraggingItem; long long m_LastPlayerListTime; @@ -456,6 +454,11 @@ protected: int m_FloaterID; + + + void ResolvePermissions(void); + void ResolveGroups(void); + virtual void Destroyed(void); /// Filters out damage for creative mode diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 1d49c2445..e6355c788 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -396,9 +396,9 @@ cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a m_DamageCoeff(2), m_IsCritical(false), m_Timer(0), + m_HitGroundTimer(0), m_bIsCollected(false), - m_HitBlockPos(Vector3i(0, 0, 0)), - m_HitGroundTimer(0) + m_HitBlockPos(Vector3i(0, 0, 0)) { SetSpeed(a_Speed); SetMass(0.1); -- cgit v1.2.3 From 8570d08eb4f9f3e1b30fe7758e8b136213e6bf48 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 20 Dec 2013 17:11:51 +0100 Subject: More reordering fixes. --- src/Entities/Entity.cpp | 4 ++-- src/Entities/Floater.cpp | 15 ++++++++++++--- src/Entities/ProjectileEntity.cpp | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 37fdc38ee..8fcdcc82f 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -51,13 +51,13 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d , m_TicksSinceLastBurnDamage(0) , m_TicksSinceLastLavaDamage(0) , m_TicksSinceLastFireDamage(0) - , m_TicksSinceLastVoidDamage(0) , m_TicksLeftBurning(0) + , m_TicksSinceLastVoidDamage(0) , m_HeadYaw( 0.0 ) , m_Rot(0.0, 0.0, 0.0) , m_Pos(a_X, a_Y, a_Z) - , m_Mass (0.001) //Default 1g , m_WaterSpeed(0, 0, 0) + , m_Mass (0.001) // Default 1g , m_Width(a_Width) , m_Height(a_Height) { diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index 1aa0413d9..bd7c952a8 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -1,14 +1,19 @@ + #include "Globals.h" #include "Floater.h" #include "Player.h" #include "../ClientHandle.h" + + + + cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID) : cEntity(etFloater, a_X, a_Y, a_Z, 0.98, 0.98), + m_PickupCountDown(0), m_PlayerID(a_PlayerID), - m_CanPickupItem(false), - m_PickupCountDown(0) + m_CanPickupItem(false) { SetSpeed(a_Speed); } @@ -55,4 +60,8 @@ void cFloater::Tick(float a_Dt, cChunk & a_Chunk) } } BroadcastMovementUpdate(); -} \ No newline at end of file +} + + + + diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index e6355c788..9e5069ba6 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -420,9 +420,9 @@ cArrowEntity::cArrowEntity(cPlayer & a_Player, double a_Force) : m_DamageCoeff(2), m_IsCritical((a_Force >= 1)), m_Timer(0), + m_HitGroundTimer(0), m_bIsCollected(false), - m_HitBlockPos(0, 0, 0), - m_HitGroundTimer(0) + m_HitBlockPos(0, 0, 0) { } -- cgit v1.2.3 From af98fc61703d719fe4dbff08a3d342c8053c3603 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 20 Dec 2013 18:34:08 +0100 Subject: Fixed bug where the floater could pop in the water while you could already get a fish. --- src/Entities/Floater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index bd7c952a8..0eefa9c54 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -36,7 +36,7 @@ void cFloater::Tick(float a_Dt, cChunk & a_Chunk) HandlePhysics(a_Dt, a_Chunk); if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()))) { - if (m_World->GetTickRandomNumber(100) == 0) + if ((!m_CanPickupItem) && (m_World->GetTickRandomNumber(100) == 0)) { SetPosY(GetPosY() - 1); m_CanPickupItem = true; @@ -45,7 +45,7 @@ void cFloater::Tick(float a_Dt, cChunk & a_Chunk) } else { - SetSpeedY(1); + SetSpeedY(0.7); } } SetSpeedX(GetSpeedX() * 0.95); -- cgit v1.2.3 From 8efde94e4e25dadbe8083c755bfbc780f1540b48 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 21 Dec 2013 14:07:32 +0100 Subject: Fixed bug where you could get fish from non-source blocks. --- src/Entities/Floater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index 0eefa9c54..52089b776 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -34,7 +34,7 @@ void cFloater::SpawnOn(cClientHandle & a_Client) void cFloater::Tick(float a_Dt, cChunk & a_Chunk) { HandlePhysics(a_Dt, a_Chunk); - if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()))) + if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())) && m_World->GetBlockMeta((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()) != 0) { if ((!m_CanPickupItem) && (m_World->GetTickRandomNumber(100) == 0)) { -- cgit v1.2.3 From 128de10a2f7246b059f9ce41539c91dbcd30844a Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 21 Dec 2013 14:11:21 +0100 Subject: You could now only get fish from non-source blocks. Fixed it. --- src/Entities/Floater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index 52089b776..ac7a82f91 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -34,7 +34,7 @@ void cFloater::SpawnOn(cClientHandle & a_Client) void cFloater::Tick(float a_Dt, cChunk & a_Chunk) { HandlePhysics(a_Dt, a_Chunk); - if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())) && m_World->GetBlockMeta((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()) != 0) + if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())) && m_World->GetBlockMeta((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()) == 0) { if ((!m_CanPickupItem) && (m_World->GetTickRandomNumber(100) == 0)) { -- cgit v1.2.3