fixed amb1591 - mods like IOS:S which, in listen server mode add bots before the player, caused crashes in SM
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402050
This commit is contained in:
parent
800838d76a
commit
2fbd32cd1a
@ -379,14 +379,14 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
|
||||
/* 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 (client == 0 && !engine->IsDedicatedServer())
|
||||
if (!engine->IsDedicatedServer())
|
||||
{
|
||||
pHook->pf->PushCell(1);
|
||||
} else {
|
||||
pHook->pf->PushCell(client);
|
||||
client = g_Players.ListenClient();
|
||||
}
|
||||
|
||||
pHook->pf->PushCell(client);
|
||||
pHook->pf->PushCell(args);
|
||||
|
||||
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
|
||||
{
|
||||
if (tempres > result)
|
||||
|
@ -134,6 +134,9 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
|
||||
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
|
||||
PostAdminFilter = g_Forwards.CreateForward("OnClientPostAdminFilter", ET_Ignore, 1, p1);
|
||||
|
||||
m_bIsListenServer = !engine->IsDedicatedServer();
|
||||
m_ListenClient = 0;
|
||||
}
|
||||
|
||||
void PlayerManager::OnSourceModShutdown()
|
||||
@ -385,7 +388,9 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
{
|
||||
m_AuthQueue[++m_AuthQueue[0]] = client;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
||||
}
|
||||
|
||||
@ -415,6 +420,13 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
||||
}
|
||||
}
|
||||
|
||||
if (!pPlayer->IsFakeClient()
|
||||
&& m_bIsListenServer
|
||||
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
|
||||
{
|
||||
m_ListenClient = client;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -524,7 +536,9 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||
{
|
||||
m_cldisconnect->PushCell(client);
|
||||
m_cldisconnect->Execute(&res, NULL);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We don't care, prevent a double call */
|
||||
return;
|
||||
}
|
||||
@ -565,6 +579,11 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||
|
||||
m_Players[client].Disconnect();
|
||||
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = 0;
|
||||
|
||||
if (m_ListenClient == client)
|
||||
{
|
||||
m_ListenClient = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
||||
|
@ -161,6 +161,10 @@ public:
|
||||
{
|
||||
return m_PlayerCount;
|
||||
}
|
||||
inline int ListenClient()
|
||||
{
|
||||
return m_ListenClient;
|
||||
}
|
||||
bool CheckSetAdmin(int index, CPlayer *pPlayer, AdminId id);
|
||||
bool CheckSetAdminName(int index, CPlayer *pPlayer, AdminId id);
|
||||
const char *GetPassInfoVar();
|
||||
@ -188,6 +192,8 @@ private:
|
||||
unsigned int *m_AuthQueue;
|
||||
String m_PassInfoVar;
|
||||
bool m_QueryLang;
|
||||
bool m_bIsListenServer;
|
||||
int m_ListenClient;
|
||||
};
|
||||
|
||||
extern PlayerManager g_Players;
|
||||
|
Loading…
Reference in New Issue
Block a user