mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix switches for 64 teams
This commit is contained in:
parent
39ba649849
commit
a98458a9f3
|
@ -144,7 +144,7 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
|
|
||||||
for (int i = 0; i < m_NumSwitchers+1; ++i)
|
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_Status[j] = true;
|
||||||
m_pSwitchers[i].m_EndTick[j] = 0;
|
m_pSwitchers[i].m_EndTick[j] = 0;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#define GAME_COLLISION_H
|
#define GAME_COLLISION_H
|
||||||
|
|
||||||
#include <base/vmath.h>
|
#include <base/vmath.h>
|
||||||
|
#include <engine/shared/protocol.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
@ -113,9 +114,9 @@ private:
|
||||||
class CDoorTile *m_pDoor;
|
class CDoorTile *m_pDoor;
|
||||||
struct SSwitchers
|
struct SSwitchers
|
||||||
{
|
{
|
||||||
bool m_Status[16];
|
bool m_Status[MAX_CLIENTS];
|
||||||
int m_EndTick[16];
|
int m_EndTick[MAX_CLIENTS];
|
||||||
int m_Type[16];
|
int m_Type[MAX_CLIENTS];
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
||||||
#include "gamecontext.h"
|
#include "gamecontext.h"
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
|
#include <engine/shared/protocol.h>
|
||||||
#include <engine/server/server.h>
|
#include <engine/server/server.h>
|
||||||
#include <game/server/teams.h>
|
#include <game/server/teams.h>
|
||||||
#include <game/server/gamemodes/DDRace.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",
|
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
|
||||||
"You can\'t change teams that fast!");
|
"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",
|
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
|
||||||
"This team is locked using /lock. Only members of the team can unlock it using /lock.");
|
"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];
|
char aBuf[512];
|
||||||
str_format(aBuf, sizeof(aBuf), "This team already has the maximum allowed size of %d players", g_Config.m_SvTeamMaxSize);
|
str_format(aBuf, sizeof(aBuf), "This team already has the maximum allowed size of %d players", g_Config.m_SvTeamMaxSize);
|
||||||
|
|
|
@ -32,9 +32,9 @@ void CDragger::Move()
|
||||||
m_Target = 0;
|
m_Target = 0;
|
||||||
if (m_Target)
|
if (m_Target)
|
||||||
return;
|
return;
|
||||||
CCharacter *Ents[16];
|
CCharacter *Ents[MAX_CLIENTS];
|
||||||
int Num = GameServer()->m_World.FindEntities(m_Pos, LENGTH,
|
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 Id = -1;
|
||||||
int MinLen = 0;
|
int MinLen = 0;
|
||||||
for (int i = 0; i < Num; i++)
|
for (int i = 0; i < Num; i++)
|
||||||
|
|
|
@ -26,17 +26,17 @@ CGun::CGun(CGameWorld *pGameWorld, vec2 Pos, bool Freeze, bool Explosive, int La
|
||||||
|
|
||||||
void CGun::Fire()
|
void CGun::Fire()
|
||||||
{
|
{
|
||||||
CCharacter *Ents[16];
|
CCharacter *Ents[MAX_CLIENTS];
|
||||||
int IdInTeam[16];
|
int IdInTeam[MAX_CLIENTS];
|
||||||
int LenInTeam[16];
|
int LenInTeam[MAX_CLIENTS];
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
IdInTeam[i] = -1;
|
IdInTeam[i] = -1;
|
||||||
LenInTeam[i] = 0;
|
LenInTeam[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Num = -1;
|
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++)
|
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)
|
if(IdInTeam[i] != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -625,7 +625,7 @@ void CGameContext::OnTick()
|
||||||
if(Collision()->m_NumSwitchers > 0)
|
if(Collision()->m_NumSwitchers > 0)
|
||||||
for (int i = 0; i < Collision()->m_NumSwitchers+1; ++i)
|
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)
|
if(Collision()->m_pSwitchers[i].m_EndTick[j] <= Server()->Tick() && Collision()->m_pSwitchers[i].m_Type[j] == TILE_SWITCHTIMEDOPEN)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
TEAM_FLOCK = 0, TEAM_SUPER = 16
|
TEAM_FLOCK = 0, TEAM_SUPER = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTeamsCore
|
class CTeamsCore
|
||||||
|
|
Loading…
Reference in a new issue