mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
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:
parent
796548ff65
commit
1cee48f6c1
3
bam.lua
3
bam.lua
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
#ifndef GAME_MODE_H
|
||||
#define GAME_MODE_H
|
||||
|
||||
#define GAME_NAME "TestDDRace"
|
||||
#define GAME_NAME "DDRace"
|
||||
#endif
|
||||
|
|
|
@ -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++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue