Can only set sv_test_cmds at start, then it stays, and determines whether gametype is DDRace (no cheats) or TestDDRace (cheats)

This commit is contained in:
def 2013-07-23 00:15:50 +02:00
parent 796548ff65
commit 1cee48f6c1
8 changed files with 18 additions and 4 deletions

View file

@ -144,6 +144,9 @@ function build(settings)
--settings.objdir = Path("objs")
settings.cc.Output = Intermediate_Output
--settings.cc.flags:Add("-m32")
--settings.link.flags:Add("-m32")
cflags = os.getenv("CFLAGS")
if cflags then
settings.cc.flags:Add(cflags)

View file

View file

@ -1532,6 +1532,13 @@ int CServer::Run()
return 0;
}
void CServer::ConTestingCommands(CConsole::IResult *pResult, void *pUser)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Value: %d", g_Config.m_SvTestingCommands);
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
void CServer::ConKick(IConsole::IResult *pResult, void *pUser)
{
if(pResult->NumArguments() > 1)
@ -1810,6 +1817,8 @@ int main(int argc, const char **argv) // ignore_convention
if(argc > 1) // ignore_convention
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
pConsole->Register("sv_test_cmds", "", CFGFLAG_SERVER|CFGFLAG_CLIENT, CServer::ConTestingCommands, pConsole, "Turns testing commands aka cheats on/off");
// restore empty config strings to their defaults
pConfig->RestoreStrings();

View file

@ -229,6 +229,7 @@ public:
void InitRegister(CNetServer *pNetServer, IEngineMasterServer *pMasterServer, IConsole *pConsole);
int Run();
static void ConTestingCommands(IConsole::IResult *pResult, void *pUser);
static void ConKick(IConsole::IResult *pResult, void *pUser);
static void ConStatus(IConsole::IResult *pResult, void *pUser);
static void ConShutdown(IConsole::IResult *pResult, void *pUser);

View file

@ -353,7 +353,7 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID)
if(Result.GetVictim() == CResult::VICTIM_ME)
Result.SetVictim(ClientID);
if(pCommand->m_Flags&CMDFLAG_TEST && (!g_Config.m_SvTestingCommands || g_Config.m_SvRegister))
if(pCommand->m_Flags&CMDFLAG_TEST && !g_Config.m_SvTestingCommands)
return;
if (Result.HasVictim())

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. */
/* Based on Race mod stuff and tweaked by GreYFoX@GTi and others to fit our DDRace needs. */
#include <engine/server.h>
#include <engine/shared/config.h>
#include <game/mapitems.h>
#include <game/server/entities/character.h>
#include <game/server/player.h>
@ -11,7 +12,7 @@
CGameControllerDDRace::CGameControllerDDRace(class CGameContext *pGameServer) :
IGameController(pGameServer), m_Teams(pGameServer)
{
m_pGameType = GAME_NAME;
m_pGameType = g_Config.m_SvTestingCommands ? "TestDDRace" : "DDRace";
InitTeleporter();
}

View file

@ -3,5 +3,5 @@
#ifndef GAME_MODE_H
#define GAME_MODE_H
#define GAME_NAME "TestDDRace"
#define GAME_NAME "DDRace"
#endif

View file

@ -352,7 +352,7 @@ void CGameTeams::OnTeamFinish(CPlayer** Players, unsigned int Size)
CallSaveScore = g_Config.m_SvUseSQL;
#endif
int PlayerCIDs[Size];
int PlayerCIDs[MAX_CLIENTS];
for(unsigned int i = 0; i < Size; i++)
{