From e0bb8731a73e4a71cdad6530096a1e87dd0845ed Mon Sep 17 00:00:00 2001 From: GreYFoXGTi Date: Fri, 21 Jan 2011 19:59:52 +0200 Subject: [PATCH] minor changes --- src/game/collision.cpp | 4 ++-- src/game/server/entities/character.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 5b30f7879..e9dbe6a0b 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -404,14 +404,14 @@ int CCollision::IsSpeedup(int Index) return false; if(m_pSpeedup[Index].m_Force > 0) - return m_pSpeedup[Index].m_Type; + return Index; return 0; } void CCollision::GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed) { - if(Index < 0) + if(Index < 0 || !m_pSpeedup) return; vec2 Direction = vec2(1, 0); float Angle = m_pSpeedup[Index].m_Angle * (pi / 180.0f); diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 826582ddc..58c130a5c 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -95,7 +95,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) if(m_pPlayer->m_RconFreeze) Freeze(-1); GameServer()->m_pController->OnCharacterSpawn(this); - if(GetPlayer()->m_IsUsingDDRaceClient) { + if(GetPlayer()->m_IsUsingDDRaceClient) + { Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID()); } @@ -839,19 +840,20 @@ void CCharacter::Tick() } // handle tiles + int CurrentIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos); std::list < int > Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos); if(!Indices.empty()) for(std::list < int >::iterator i = Indices.begin(); i != Indices.end(); i++) HandleTiles(*i); else - HandleTiles(GameServer()->Collision()->GetPureMapIndex(m_Pos)); + HandleTiles(CurrentIndex); // handle speedup tiles - if(GameServer()->Collision()->IsSpeedup(GameServer()->Collision()->GetPureMapIndex(m_Pos)) == TILE_BOOST) + if(GameServer()->Collision()->IsSpeedup(CurrentIndex)) { vec2 Direction, MaxVel, TempVel = m_Core.m_Vel; int Force, MaxSpeed = 0; float TeeAngle, SpeederAngle, DiffAngle, SpeedLeft, TeeSpeed; - GameServer()->Collision()->GetSpeedup(GameServer()->Collision()->GetPureMapIndex(m_Pos), &Direction, &Force, &MaxSpeed); + GameServer()->Collision()->GetSpeedup(CurrentIndex, &Direction, &Force, &MaxSpeed); if(Force == 255 && MaxSpeed) { m_Core.m_Vel = Direction * (MaxSpeed/5); @@ -916,7 +918,6 @@ void CCharacter::Tick() //dbg_msg("speedup tile end","Direction %f %f, Force %d, Max Speed %d", (Direction).x,(Direction).y, Force, MaxSpeed); } } - // handle Weapons HandleWeapons();