Fixed amb324 - Client index of host was sometimes passed as 0 on listen server

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40862
This commit is contained in:
Scott Ehlert 2007-05-28 07:25:12 +00:00
parent dd2986d1d8
commit c1c293ccc4

View File

@ -330,7 +330,17 @@ void ConCmdManager::InternalDispatch()
} }
continue; continue;
} }
pHook->pf->PushCell(m_CmdClient);
/* On a listen server, sometimes the server host's client index can be set as 0.
* So index 1 is passed to the command callback to correct this potential problem.
*/
if (m_CmdClient == 0 && !engine->IsDedicatedServer())
{
pHook->pf->PushCell(1);
} else {
pHook->pf->PushCell(m_CmdClient);
}
pHook->pf->PushCell(args); pHook->pf->PushCell(args);
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE) if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
{ {
@ -364,6 +374,12 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
return true; return true;
} }
/* If running listen server, then client 1 is the server host and should have 'root' access */
if (client == 1 && !engine->IsDedicatedServer())
{
return true;
}
CPlayer *player = g_Players.GetPlayerByIndex(client); CPlayer *player = g_Players.GetPlayerByIndex(client);
if (!player) if (!player)
{ {