From a98458a9f3da7716169c6cb620edc8d60d6007fb Mon Sep 17 00:00:00 2001 From: def Date: Wed, 1 Jan 2014 22:34:10 +0100 Subject: [PATCH] Fix switches for 64 teams --- src/game/collision.cpp | 2 +- src/game/collision.h | 7 ++++--- src/game/server/ddracechat.cpp | 5 +++-- src/game/server/entities/dragger.cpp | 4 ++-- src/game/server/entities/gun.cpp | 12 ++++++------ src/game/server/gamecontext.cpp | 2 +- src/game/teamscore.h | 2 +- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 72251f7e7..8f49ce73b 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -144,7 +144,7 @@ void CCollision::Init(class CLayers *pLayers) for (int i = 0; i < m_NumSwitchers+1; ++i) { - for (int j = 0; j < 16; ++j) + for (int j = 0; j < MAX_CLIENTS; ++j) { m_pSwitchers[i].m_Status[j] = true; m_pSwitchers[i].m_EndTick[j] = 0; diff --git a/src/game/collision.h b/src/game/collision.h index 87e359a04..55f16a236 100644 --- a/src/game/collision.h +++ b/src/game/collision.h @@ -4,6 +4,7 @@ #define GAME_COLLISION_H #include +#include #include @@ -113,9 +114,9 @@ private: class CDoorTile *m_pDoor; struct SSwitchers { - bool m_Status[16]; - int m_EndTick[16]; - int m_Type[16]; + bool m_Status[MAX_CLIENTS]; + int m_EndTick[MAX_CLIENTS]; + int m_Type[MAX_CLIENTS]; }; public: diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 47e0cc152..4901f7ff2 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -1,6 +1,7 @@ /* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */ #include "gamecontext.h" #include +#include #include #include #include @@ -703,12 +704,12 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData) pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", "You can\'t change teams that fast!"); } - else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < 16 && ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.TeamLocked(pResult->GetInteger(0))) + else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < MAX_CLIENTS && ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.TeamLocked(pResult->GetInteger(0))) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", "This team is locked using /lock. Only members of the team can unlock it using /lock."); } - else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < 16 && ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.Count(pResult->GetInteger(0)) >= g_Config.m_SvTeamMaxSize) + else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < MAX_CLIENTS && ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.Count(pResult->GetInteger(0)) >= g_Config.m_SvTeamMaxSize) { char aBuf[512]; str_format(aBuf, sizeof(aBuf), "This team already has the maximum allowed size of %d players", g_Config.m_SvTeamMaxSize); diff --git a/src/game/server/entities/dragger.cpp b/src/game/server/entities/dragger.cpp index 77b42582d..c58502bf8 100644 --- a/src/game/server/entities/dragger.cpp +++ b/src/game/server/entities/dragger.cpp @@ -32,9 +32,9 @@ void CDragger::Move() m_Target = 0; if (m_Target) return; - CCharacter *Ents[16]; + CCharacter *Ents[MAX_CLIENTS]; int Num = GameServer()->m_World.FindEntities(m_Pos, LENGTH, - (CEntity**) Ents, 16, CGameWorld::ENTTYPE_CHARACTER); + (CEntity**) Ents, 64, CGameWorld::ENTTYPE_CHARACTER); int Id = -1; int MinLen = 0; for (int i = 0; i < Num; i++) diff --git a/src/game/server/entities/gun.cpp b/src/game/server/entities/gun.cpp index 77dbf41c5..f98e2836c 100644 --- a/src/game/server/entities/gun.cpp +++ b/src/game/server/entities/gun.cpp @@ -26,17 +26,17 @@ CGun::CGun(CGameWorld *pGameWorld, vec2 Pos, bool Freeze, bool Explosive, int La void CGun::Fire() { - CCharacter *Ents[16]; - int IdInTeam[16]; - int LenInTeam[16]; - for (int i = 0; i < 16; i++) + CCharacter *Ents[MAX_CLIENTS]; + int IdInTeam[MAX_CLIENTS]; + int LenInTeam[MAX_CLIENTS]; + for (int i = 0; i < MAX_CLIENTS; i++) { IdInTeam[i] = -1; LenInTeam[i] = 0; } int Num = -1; - Num = GameServer()->m_World.FindEntities(m_Pos, g_Config.m_SvPlasmaRange, (CEntity**)Ents, 16, CGameWorld::ENTTYPE_CHARACTER); + Num = GameServer()->m_World.FindEntities(m_Pos, g_Config.m_SvPlasmaRange, (CEntity**)Ents, 64, CGameWorld::ENTTYPE_CHARACTER); for (int i = 0; i < Num; i++) { @@ -57,7 +57,7 @@ void CGun::Fire() } } } - for (int i = 0; i < 16; i++) + for (int i = 0; i < MAX_CLIENTS; i++) { if(IdInTeam[i] != -1) { diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index bc63e1390..bd126c695 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -625,7 +625,7 @@ void CGameContext::OnTick() if(Collision()->m_NumSwitchers > 0) for (int i = 0; i < Collision()->m_NumSwitchers+1; ++i) { - for (int j = 0; j < 16; ++j) + for (int j = 0; j < MAX_CLIENTS; ++j) { if(Collision()->m_pSwitchers[i].m_EndTick[j] <= Server()->Tick() && Collision()->m_pSwitchers[i].m_Type[j] == TILE_SWITCHTIMEDOPEN) { diff --git a/src/game/teamscore.h b/src/game/teamscore.h index 935b58912..a76fe19ff 100644 --- a/src/game/teamscore.h +++ b/src/game/teamscore.h @@ -6,7 +6,7 @@ enum { - TEAM_FLOCK = 0, TEAM_SUPER = 16 + TEAM_FLOCK = 0, TEAM_SUPER = 64 }; class CTeamsCore