Fix switches for 64 teams

This commit is contained in:
def 2014-01-01 22:34:10 +01:00
parent 39ba649849
commit a98458a9f3
7 changed files with 18 additions and 16 deletions

View file

@ -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;

View file

@ -4,6 +4,7 @@
#define GAME_COLLISION_H
#include <base/vmath.h>
#include <engine/shared/protocol.h>
#include <list>
@ -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:

View file

@ -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 <engine/shared/config.h>
#include <engine/shared/protocol.h>
#include <engine/server/server.h>
#include <game/server/teams.h>
#include <game/server/gamemodes/DDRace.h>
@ -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);

View file

@ -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++)

View file

@ -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)
{

View file

@ -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)
{

View file

@ -6,7 +6,7 @@
enum
{
TEAM_FLOCK = 0, TEAM_SUPER = 16
TEAM_FLOCK = 0, TEAM_SUPER = 64
};
class CTeamsCore