Replace IConsole::m_Cheated variable with Cheated getter

Interfaces should not have member variables, so the variable is moved to `CConsole`. Only a getter `IConsole::Cheated` is added because the cheated state of the console is never reset.
This commit is contained in:
Robert Müller 2023-11-25 11:27:45 +01:00
parent c216567431
commit e410dd85f8
3 changed files with 7 additions and 3 deletions

View file

@ -126,7 +126,7 @@ public:
// DDRace
bool m_Cheated;
virtual bool Cheated() const = 0;
virtual int FlagMask() const = 0;
virtual void SetFlagMask(int FlagMask) = 0;

View file

@ -191,6 +191,8 @@ class CConsole : public IConsole
void AddCommandSorted(CCommand *pCommand);
CCommand *FindCommand(const char *pName, int FlagMask);
bool m_Cheated;
public:
IConfigManager *ConfigManager() { return m_pConfigManager; }
CConfig *Config() { return m_pConfig; }
@ -228,6 +230,8 @@ public:
static void ConUserCommandStatus(IConsole::IResult *pResult, void *pUser);
bool Cheated() const override { return m_Cheated; }
int FlagMask() const override { return m_FlagMask; }
void SetFlagMask(int FlagMask) override { m_FlagMask = FlagMask; }
};

View file

@ -143,7 +143,7 @@ void CScore::MapInfo(int ClientID, const char *pMapName)
void CScore::SaveScore(int ClientID, float Time, const char *pTimestamp, const float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
{
CConsole *pCon = (CConsole *)GameServer()->Console();
if(pCon->m_Cheated || NotEligible)
if(pCon->Cheated() || NotEligible)
return;
CPlayer *pCurPlayer = GameServer()->m_apPlayers[ClientID];
@ -166,7 +166,7 @@ void CScore::SaveScore(int ClientID, float Time, const char *pTimestamp, const f
void CScore::SaveTeamScore(int *pClientIDs, unsigned int Size, float Time, const char *pTimestamp)
{
CConsole *pCon = (CConsole *)GameServer()->Console();
if(pCon->m_Cheated)
if(pCon->Cheated())
return;
for(unsigned int i = 0; i < Size; i++)
{