diff options
| author | oy <Tom_Adams@web.de> | 2011-02-10 12:05:55 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-10 12:05:55 +0100 |
| commit | 3f05289328dfaeb67a344de0b553e31cbb11ea36 (patch) | |
| tree | 3d41ec1d9a54c5f3a7add26d4be8ebe4572586cd /src/game/server/gamecontroller.cpp | |
| parent | 0698243c6b79a224582c8c37f9951af0672516b3 (diff) | |
| download | zcatch-3f05289328dfaeb67a344de0b553e31cbb11ea36.tar.gz zcatch-3f05289328dfaeb67a344de0b553e31cbb11ea36.zip | |
fixed a possible problem with occupied spawn points and cleaned up spawn code a bit
Diffstat (limited to 'src/game/server/gamecontroller.cpp')
| -rw-r--r-- | src/game/server/gamecontroller.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index f4b6d33c..d3de11e7 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -62,6 +62,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) @@ -73,25 +77,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 |