Merge branch 'DDRace' of github.com:def-/teeworlds into DDRace

This commit is contained in:
def 2013-12-17 14:50:00 +01:00
commit 3f5035fd35
3 changed files with 9 additions and 8 deletions

View file

@ -61,6 +61,7 @@ void CCharacterCore::Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore
{
m_pWorld = pWorld;
m_pCollision = pCollision;
m_pTeleOuts = NULL;
m_pTeams = pTeams;
m_Id = -1;
@ -70,7 +71,7 @@ void CCharacterCore::Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore
m_Jumps = 2;
}
void CCharacterCore::Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore* pTeams, std::map<int, std::vector<vec2> > pTeleOuts)
void CCharacterCore::Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore* pTeams, std::map<int, std::vector<vec2> > *pTeleOuts)
{
m_pWorld = pWorld;
m_pCollision = pCollision;
@ -323,14 +324,14 @@ void CCharacterCore::Tick(bool UseInput)
m_HookState = HOOK_RETRACT_START;
}
if(GoingThroughTele && m_pTeleOuts.size() && m_pTeleOuts[teleNr-1].size())
if(GoingThroughTele && m_pTeleOuts && m_pTeleOuts->size() && (*m_pTeleOuts)[teleNr-1].size())
{
m_TriggeredEvents = 0;
m_HookedPlayer = -1;
m_NewHook = true;
int Num = m_pTeleOuts[teleNr-1].size();
m_HookPos = m_pTeleOuts[teleNr-1][(!Num)?Num:rand() % Num]+TargetDirection*PhysSize*1.5f;
int Num = (*m_pTeleOuts)[teleNr-1].size();
m_HookPos = (*m_pTeleOuts)[teleNr-1][(!Num)?Num:rand() % Num]+TargetDirection*PhysSize*1.5f;
m_HookDir = TargetDirection;
m_HookTeleBase = m_HookPos;
}

View file

@ -183,7 +183,7 @@ class CCharacterCore
{
CWorldCore *m_pWorld;
CCollision *m_pCollision;
std::map<int, std::vector<vec2> > m_pTeleOuts;
std::map<int, std::vector<vec2> > *m_pTeleOuts;
public:
vec2 m_Pos;
vec2 m_Vel;
@ -212,7 +212,7 @@ public:
int m_TriggeredEvents;
void Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore* pTeams);
void Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore* pTeams, std::map<int, std::vector<vec2> > pTeleOuts);
void Init(CWorldCore *pWorld, CCollision *pCollision, CTeamsCore* pTeams, std::map<int, std::vector<vec2> > *pTeleOuts);
void Reset();
void Tick(bool UseInput);
void Move();

View file

@ -71,7 +71,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
m_Pos = Pos;
m_Core.Reset();
m_Core.Init(&GameServer()->m_World.m_Core, GameServer()->Collision(), &((CGameControllerDDRace*)GameServer()->m_pController)->m_Teams.m_Core, ((CGameControllerDDRace*)GameServer()->m_pController)->m_TeleOuts);
m_Core.Init(&GameServer()->m_World.m_Core, GameServer()->Collision(), &((CGameControllerDDRace*)GameServer()->m_pController)->m_Teams.m_Core, &((CGameControllerDDRace*)GameServer()->m_pController)->m_TeleOuts);
m_Core.m_Pos = m_Pos;
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = &m_Core;
@ -676,7 +676,7 @@ void CCharacter::TickDefered()
// advance the dummy
{
CWorldCore TempWorld;
m_ReckoningCore.Init(&TempWorld, GameServer()->Collision(), &((CGameControllerDDRace*)GameServer()->m_pController)->m_Teams.m_Core, ((CGameControllerDDRace*)GameServer()->m_pController)->m_TeleOuts);
m_ReckoningCore.Init(&TempWorld, GameServer()->Collision(), &((CGameControllerDDRace*)GameServer()->m_pController)->m_Teams.m_Core, &((CGameControllerDDRace*)GameServer()->m_pController)->m_TeleOuts);
m_ReckoningCore.m_Id = m_pPlayer->GetCID();
m_ReckoningCore.Tick(false);
m_ReckoningCore.Move();