Fixed merge errors

This commit is contained in:
GreYFoXGTi 2011-02-14 09:43:44 +02:00
parent 40a218b5ee
commit 29c9bf531d
3 changed files with 18 additions and 21 deletions

View file

@ -73,6 +73,10 @@ void IGameController::EvaluateSpawnType(CSpawnEval *pEval, int T)
// get spawn point
for(int i = 0; i < m_aNumSpawnPoints[T]; i++)
{
// check if the position is occupado
if(GameServer()->m_World.FindEntities(m_aaSpawnPoints[T][i], 64, 0, 1, CGameWorld::ENTTYPE_CHARACTER))
continue;
vec2 P = m_aaSpawnPoints[T][i];
float S = EvaluateSpawnPos(pEval, P);
if(!pEval->m_Got || pEval->m_Score > S)
@ -84,25 +88,25 @@ void IGameController::EvaluateSpawnType(CSpawnEval *pEval, int T)
}
}
bool IGameController::CanSpawn(CPlayer *pPlayer, vec2 *pOutPos)
bool IGameController::CanSpawn(int Team, vec2 *pOutPos)
{
CSpawnEval Eval;
// spectators can't spawn
if(pPlayer->GetTeam() == TEAM_SPECTATORS)
if(Team == TEAM_SPECTATORS)
return false;
/*if(IsTeamplay())
{
Eval.m_FriendlyTeam = pPlayer->GetTeam();
Eval.m_FriendlyTeam = Team;
// try first try own team spawn, then normal spawn and then enemy
EvaluateSpawnType(&Eval, 1+(pPlayer->GetTeam()&1));
// first try own team spawn, then normal spawn and then enemy
EvaluateSpawnType(&Eval, 1+(Team&1));
if(!Eval.m_Got)
{
EvaluateSpawnType(&Eval, 0);
if(!Eval.m_Got)
EvaluateSpawnType(&Eval, 1+((pPlayer->GetTeam()+1)&1));
EvaluateSpawnType(&Eval, 1+((Team+1)&1));
}
}
else

View file

@ -130,7 +130,7 @@ public:
//virtual void OnPlayerInfoChange(class CPlayer *pP);
//
virtual bool CanSpawn(class CPlayer *pP, vec2 *pPos);
virtual bool CanSpawn(int Team, vec2 *pPos);
/*
@ -148,4 +148,4 @@ public:
float m_CurrentRecord;
};
#endif
#endif

View file

@ -239,22 +239,15 @@ void CPlayer::TryRespawn()
}
else
{
vec2 SpawnPos = vec2(100.0f, -60.0f);
vec2 SpawnPos;
if(!GameServer()->m_pController->CanSpawn(this, &SpawnPos))
if(!GameServer()->m_pController->CanSpawn(m_Team, &SpawnPos))
return;
// check if the position is occupado
CEntity *apEnts[2] = {0};
int NumEnts = GameServer()->m_World.FindEntities(SpawnPos, 64, apEnts, 2, CGameWorld::ENTTYPE_CHARACTER);
if(NumEnts < 3)
{
m_Spawning = false;
Character = new(m_ClientID) CCharacter(&GameServer()->m_World);
Character->Spawn(this, SpawnPos);
GameServer()->CreatePlayerSpawn(SpawnPos);
}
m_Spawning = false;
Character = new(m_ClientID) CCharacter(&GameServer()->m_World);
Character->Spawn(this, SpawnPos);
GameServer()->CreatePlayerSpawn(SpawnPos);
}
}