forked from Mirrors/openclonk
Network: Disallow re-enabling debug mode via faked control packet
Instead of taking the data parameter of the C4ControlSet packet at face value, ignore it entirely and only allow disabling debug mode.stable-5.4
parent
b67109df8a
commit
8e0535dd7d
|
@ -178,18 +178,17 @@ void C4ControlSet::Execute() const
|
|||
::GraphicsSystem.FlashMessage(FormatString(LoadResStr("IDS_NET_CONTROLRATE"),::Control.ControlRate,Game.FrameCounter).getData());
|
||||
break;
|
||||
|
||||
case C4CVT_AllowDebug: // allow debug mode?
|
||||
case C4CVT_DisableDebug: // force debug mode disabled
|
||||
{
|
||||
bool fSet = !!iData;
|
||||
// disable debug
|
||||
if (!fSet && Game.DebugMode)
|
||||
if (Game.DebugMode)
|
||||
{
|
||||
Game.DebugMode=false;
|
||||
::GraphicsSystem.DeactivateDebugOutput();
|
||||
}
|
||||
// save flag, log
|
||||
Game.Parameters.AllowDebug = fSet;
|
||||
Log(fSet ? "Debug ON" : "Debug OFF");
|
||||
Game.Parameters.AllowDebug = false;
|
||||
C4Client *client = ::Game.Clients.getClientByID(iByClient);
|
||||
LogF("Debug mode forced disabled by %s", client ? client->getName() : "<unknown client>");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -106,7 +106,7 @@ enum C4CtrlValueType
|
|||
{
|
||||
C4CVT_None = -1,
|
||||
C4CVT_ControlRate = 0,
|
||||
C4CVT_AllowDebug = 1,
|
||||
C4CVT_DisableDebug = 1,
|
||||
C4CVT_MaxPlayer = 2,
|
||||
C4CVT_TeamDistribution = 3,
|
||||
C4CVT_TeamColors = 4,
|
||||
|
|
|
@ -729,7 +729,7 @@ bool C4MessageInput::ProcessCommand(const char *szCommand)
|
|||
if (SEqual(szCmdName, "nodebug"))
|
||||
{
|
||||
if (!Game.IsRunning) return false;
|
||||
::Control.DoInput(CID_Set, new C4ControlSet(C4CVT_AllowDebug, false), CDT_Decide);
|
||||
::Control.DoInput(CID_Set, new C4ControlSet(C4CVT_DisableDebug, 0), CDT_Decide);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue