Skip to content

Commit ee9e71a

Browse files
committed
Revert (Controversial) "Fix #418: addCommandHandler returns true when it should return false in certain scenarios (#3017)"
Requires more input and conversation. This reverts commit 5947012.
1 parent 87e3dce commit ee9e71a

File tree

4 files changed

+1
-14
lines changed

4 files changed

+1
-14
lines changed

Client/mods/deathmatch/logic/CRegisteredCommands.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ bool CRegisteredCommands::AddCommand(CLuaMain* pLuaMain, const char* szKey, cons
2727
assert(pLuaMain);
2828
assert(szKey);
2929

30-
if (g_pCore->GetCommands()->Get(szKey))
31-
return false;
32-
3330
// Check if we already have this key and handler
3431
SCommand* pCommand = GetCommand(szKey, pLuaMain);
3532
if (pCommand)

Server/mods/deathmatch/logic/CMainConfig.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,6 @@ bool CMainConfig::LoadExtended()
660660
}
661661
} while (pNode);
662662

663-
RegisterCommands();
664-
665663
// Handle the <resource> nodes
666664
pNode = NULL;
667665
uiCurrentIndex = 0;
@@ -751,11 +749,7 @@ bool CMainConfig::LoadExtended()
751749

752750
CLogger::ProgressDotsEnd();
753751
CLogger::SetMinLogLevel(LOGLEVEL_LOW);
754-
return true;
755-
}
756752

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

830825
bool CMainConfig::Save()

Server/mods/deathmatch/logic/CMainConfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class CMainConfig : public CXMLConfig
4747

4848
bool Load();
4949
bool LoadExtended();
50-
void RegisterCommands();
5150
bool Save();
5251

5352
const std::string& GetServerName() { return m_strServerName; };

Server/mods/deathmatch/logic/CRegisteredCommands.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "CClient.h"
1919
#include "CConsoleClient.h"
2020
#include "CPlayer.h"
21-
#include "CGame.h"
2221

2322
CRegisteredCommands::CRegisteredCommands(CAccessControlListManager* pACLManager)
2423
{
@@ -36,9 +35,6 @@ bool CRegisteredCommands::AddCommand(CLuaMain* pLuaMain, const char* szKey, cons
3635
assert(pLuaMain);
3736
assert(szKey);
3837

39-
if (g_pGame->GetConsole()->GetCommand(szKey))
40-
return false;
41-
4238
// Check if we already have this key and handler
4339
SCommand* pCommand = GetCommand(szKey, pLuaMain);
4440

0 commit comments

Comments
 (0)