Skip to content

Commit

Permalink
Revert (Controversial) "Fix #418: addCommandHandler returns true when…
Browse files Browse the repository at this point in the history
… it should return false in certain scenarios (#3017)"

Requires more input and conversation.

This reverts commit 5947012.
  • Loading branch information
patrikjuvonen committed Jun 12, 2023
1 parent 87e3dce commit ee9e71a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
3 changes: 0 additions & 3 deletions Client/mods/deathmatch/logic/CRegisteredCommands.cpp
Expand Up @@ -27,9 +27,6 @@ bool CRegisteredCommands::AddCommand(CLuaMain* pLuaMain, const char* szKey, cons
assert(pLuaMain);
assert(szKey);

if (g_pCore->GetCommands()->Get(szKey))
return false;

// Check if we already have this key and handler
SCommand* pCommand = GetCommand(szKey, pLuaMain);
if (pCommand)
Expand Down
7 changes: 1 addition & 6 deletions Server/mods/deathmatch/logic/CMainConfig.cpp
Expand Up @@ -660,8 +660,6 @@ bool CMainConfig::LoadExtended()
}
} while (pNode);

RegisterCommands();

// Handle the <resource> nodes
pNode = NULL;
uiCurrentIndex = 0;
Expand Down Expand Up @@ -751,11 +749,7 @@ bool CMainConfig::LoadExtended()

CLogger::ProgressDotsEnd();
CLogger::SetMinLogLevel(LOGLEVEL_LOW);
return true;
}

void CMainConfig::RegisterCommands()
{
// Register the commands
RegisterCommand("start", CConsoleCommands::StartResource, false, "Usage: start <resource-name>\nStart a loaded resource eg: start admin");
RegisterCommand("stop", CConsoleCommands::StopResource, false, "Usage: stop <resource-name>\nStop a resource eg: stop admin");
Expand Down Expand Up @@ -825,6 +819,7 @@ void CMainConfig::RegisterCommands()
RegisterCommand("sfakelag", CConsoleCommands::FakeLag, false,
"Usage: sfakelag <packet loss> <extra ping> <ping variance> [<KBPS limit>]\nOnly available if enabled in the mtaserver.conf file.\nAdds "
"artificial packet loss, ping, jitter and bandwidth limits to the server-client connections.");
return true;
}

bool CMainConfig::Save()
Expand Down
1 change: 0 additions & 1 deletion Server/mods/deathmatch/logic/CMainConfig.h
Expand Up @@ -47,7 +47,6 @@ class CMainConfig : public CXMLConfig

bool Load();
bool LoadExtended();
void RegisterCommands();
bool Save();

const std::string& GetServerName() { return m_strServerName; };
Expand Down
4 changes: 0 additions & 4 deletions Server/mods/deathmatch/logic/CRegisteredCommands.cpp
Expand Up @@ -18,7 +18,6 @@
#include "CClient.h"
#include "CConsoleClient.h"
#include "CPlayer.h"
#include "CGame.h"

CRegisteredCommands::CRegisteredCommands(CAccessControlListManager* pACLManager)
{
Expand All @@ -36,9 +35,6 @@ bool CRegisteredCommands::AddCommand(CLuaMain* pLuaMain, const char* szKey, cons
assert(pLuaMain);
assert(szKey);

if (g_pGame->GetConsole()->GetCommand(szKey))
return false;

// Check if we already have this key and handler
SCommand* pCommand = GetCommand(szKey, pLuaMain);

Expand Down

0 comments on commit ee9e71a

Please sign in to comment.