From 39e4bd323914143408120fc914fd1c52557baac6 Mon Sep 17 00:00:00 2001 From: "keyboard.osh@gmail.com" Date: Fri, 22 Mar 2013 06:33:10 +0000 Subject: Implemented BroadcastMovementUpdate function. Moved m_Pos,m_Rot,m_Speed to private members and made sure that all classes uses the public functions to access these members. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1294 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Pawn.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'source/Pawn.cpp') diff --git a/source/Pawn.cpp b/source/Pawn.cpp index d0546eccc..c1b8d6683 100644 --- a/source/Pawn.cpp +++ b/source/Pawn.cpp @@ -19,10 +19,6 @@ cPawn::cPawn(eEntityType a_EntityType) : cEntity(a_EntityType, 0, 0, 0) , m_Health(1) , m_MaxHealth(1) - , m_LastPosX( 0.0 ) - , m_LastPosY( 0.0 ) - , m_LastPosZ( 0.0 ) - , m_TimeLastTeleportPacket(0) , m_bBurnable(true) , m_MetaData(NORMAL) { @@ -74,9 +70,9 @@ void cPawn::TakeDamage(eDamageType a_DamageType, cPawn * a_Attacker, int a_RawDa TDI.RawDamage = a_RawDamage; TDI.FinalDamage = a_FinalDamage; Vector3d Heading; - Heading.x = sin(m_Rot.x); + Heading.x = sin(GetRotation()); Heading.y = 0.4; // TODO: adjust the amount of "up" knockback when testing - Heading.z = cos(m_Rot.x); + Heading.z = cos(GetRotation()); TDI.Knockback = Heading * a_KnockbackAmount; DoTakeDamage(TDI); } @@ -134,7 +130,7 @@ void cPawn::KilledBy(cPawn * a_Killer) // Drop loot: cItems Drops; GetDrops(Drops, a_Killer); - m_World->SpawnItemPickups(Drops, m_Pos.x, m_Pos.y, m_Pos.z); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ()); m_World->BroadcastEntityStatus(*this, ENTITY_STATUS_DEAD); } @@ -321,9 +317,9 @@ void cPawn::SetMetaData(MetaData a_MetaData) //----Change Entity MetaData void cPawn::CheckMetaDataBurn() { - BLOCKTYPE Block = GetWorld()->GetBlock((int) m_Pos.x, (int) m_Pos.y, (int) m_Pos.z); - BLOCKTYPE BlockAbove = GetWorld()->GetBlock((int) m_Pos.x, (int) m_Pos.y + 1, (int) m_Pos.z); - BLOCKTYPE BlockBelow = GetWorld()->GetBlock((int) m_Pos.x, (int) m_Pos.y - 1, (int) m_Pos.z); + BLOCKTYPE Block = GetWorld()->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()); + BLOCKTYPE BlockAbove = GetWorld()->GetBlock((int) GetPosX(), (int) GetPosY() + 1, (int) GetPosZ()); + BLOCKTYPE BlockBelow = GetWorld()->GetBlock((int) GetPosX(), (int) GetPosY() - 1, (int) GetPosZ()); if ( (GetMetaData() == BURNING) && @@ -359,8 +355,8 @@ void cPawn::InStateBurning(float a_Dt) return; } - BLOCKTYPE Block = GetWorld()->GetBlock((int)m_Pos.x, (int)m_Pos.y, (int)m_Pos.z); - BLOCKTYPE BlockAbove = GetWorld()->GetBlock((int)m_Pos.x, (int)m_Pos.y + 1, (int)m_Pos.z); + BLOCKTYPE Block = GetWorld()->GetBlock((int)GetPosX(), (int)GetPosY(), (int)GetPosZ()); + BLOCKTYPE BlockAbove = GetWorld()->GetBlock((int)GetPosX(), (int)GetPosY() + 1, (int)GetPosZ()); m_FireDamageInterval = 0; TakeDamage(dtOnFire, NULL, 1, 0); -- cgit v1.2.3