Fixed bugs amb352 and amb274
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40922
This commit is contained in:
		
							parent
							
								
									d4bc20d32b
								
							
						
					
					
						commit
						be6335c91a
					
				| @ -321,6 +321,18 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername | |||||||
| 	m_clputinserver->Execute(&res, NULL); | 	m_clputinserver->Execute(&res, NULL); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void PlayerManager::OnSourceModLevelEnd() | ||||||
|  | { | ||||||
|  | 	/* Disconnect all bots still in game */ | ||||||
|  | 	for (int i=1; i<=m_maxClients; i++) | ||||||
|  | 	{ | ||||||
|  | 		if (m_Players[i].IsConnected() && m_Players[i].IsFakeClient()) | ||||||
|  | 		{ | ||||||
|  | 			OnClientDisconnect(m_Players[i].GetEdict()); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void PlayerManager::OnClientDisconnect(edict_t *pEntity) | void PlayerManager::OnClientDisconnect(edict_t *pEntity) | ||||||
| { | { | ||||||
| 	cell_t res; | 	cell_t res; | ||||||
|  | |||||||
| @ -75,6 +75,7 @@ public: | |||||||
| public: //SMGlobalClass
 | public: //SMGlobalClass
 | ||||||
| 	void OnSourceModAllInitialized(); | 	void OnSourceModAllInitialized(); | ||||||
| 	void OnSourceModShutdown(); | 	void OnSourceModShutdown(); | ||||||
|  | 	void OnSourceModLevelEnd(); | ||||||
| public: | public: | ||||||
| 	CPlayer *GetPlayerByIndex(int client) const; | 	CPlayer *GetPlayerByIndex(int client) const; | ||||||
| 	void RunAuthChecks(); | 	void RunAuthChecks(); | ||||||
|  | |||||||
| @ -108,6 +108,13 @@ public: | |||||||
| 	{ | 	{ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when the level ends. | ||||||
|  | 	 */ | ||||||
|  | 	virtual void OnSourceModLevelEnd() | ||||||
|  | 	{ | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called after plugins are loaded on mapchange. | 	 * @brief Called after plugins are loaded on mapchange. | ||||||
| 	 */ | 	 */ | ||||||
|  | |||||||
| @ -256,6 +256,7 @@ void SourceModBase::StartSourceMod(bool late) | |||||||
| 	g_Loaded = true; | 	g_Loaded = true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static bool g_LevelEndBarrier = false; | ||||||
| bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) | bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) | ||||||
| { | { | ||||||
| 	/* If we're not loaded... */ | 	/* If we're not loaded... */ | ||||||
| @ -306,6 +307,8 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch | |||||||
| 		g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL); | 		g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	g_LevelEndBarrier = true; | ||||||
|  | 
 | ||||||
| 	RETURN_META_VALUE(MRES_IGNORED, true); | 	RETURN_META_VALUE(MRES_IGNORED, true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -405,6 +408,17 @@ void SourceModBase::GameFrame(bool simulating) | |||||||
| 
 | 
 | ||||||
| void SourceModBase::LevelShutdown() | void SourceModBase::LevelShutdown() | ||||||
| { | { | ||||||
|  | 	if (g_LevelEndBarrier) | ||||||
|  | 	{ | ||||||
|  | 		SMGlobalClass *next = SMGlobalClass::head; | ||||||
|  | 		while (next) | ||||||
|  | 		{ | ||||||
|  | 			next->OnSourceModLevelEnd(); | ||||||
|  | 			next = next->m_pGlobalClassNext; | ||||||
|  | 		} | ||||||
|  | 		g_LevelEndBarrier = false; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	if (g_pOnMapEnd && m_ExecOnMapEnd) | 	if (g_pOnMapEnd && m_ExecOnMapEnd) | ||||||
| 	{ | 	{ | ||||||
| 		g_pOnMapEnd->Execute(NULL); | 		g_pOnMapEnd->Execute(NULL); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user