experimental fix for amb1586 - team native crash

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402044
This commit is contained in:
Borja Ferrer 2008-04-12 01:35:45 +00:00
parent c42a26bb66
commit a483ec5dc5
7 changed files with 36 additions and 2 deletions

View File

@ -46,6 +46,7 @@
#include <inetchannel.h>
#include <iclient.h>
#include "GameConfigs.h"
#include "systems/ExtensionSys.h"
PlayerManager g_Players;
bool g_OnMapStarted = false;
@ -206,6 +207,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
g_NumPlayersToAuth = &m_AuthQueue[0];
}
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, clientMax);
m_onActivate->Execute(NULL);
m_onActivate2->Execute(NULL);

View File

@ -1369,3 +1369,15 @@ IExtension *CExtensionManager::LoadExternal(IExtensionInterface *pInterface,
return pExt;
}
void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax)
{
List<CExtension *>::iterator iter;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
if (SMINTERFACE_EXTENSIONAPI_VERSION > 3)
{
(*iter)->GetAPI()->OnCoreMapStart(pEdictList, edictCount, clientMax);
}
}
}

View File

@ -178,6 +178,7 @@ public:
void AddLibrary(IExtension *pSource, const char *library);
bool LibraryExists(const char *library);
void OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives);
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
public:
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
void Shutdown();

View File

@ -71,6 +71,7 @@ public: //public SDKExtension
virtual bool QueryRunning(char *error, size_t maxlength);
virtual bool QueryInterfaceDrop(SMInterface *pInterface);
virtual void NotifyInterfaceDrop(SMInterface *pInterface);
virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
public:
#if defined SMEXT_CONF_METAMOD
virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);

View File

@ -64,7 +64,7 @@ bool FindTeamEntities(SendTable *pTable, const char *name)
return false;
}
void SDKTools::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
void SDKTools::OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax)
{
g_Teams.clear();
g_Teams.resize(1);

View File

@ -210,6 +210,7 @@ native GetClientAimTarget(client, bool:only_clients=true);
/**
* Returns the total number of teams in a game.
* Note: This native should not be called before OnMapStart.
*
* @return Total number of teams.
*/
@ -217,6 +218,7 @@ native GetTeamCount();
/**
* Retrieves the team name based on a team index.
* Note: This native should not be called before OnMapStart.
*
* @param index Team index.
* @param name Buffer to store string in.
@ -228,6 +230,7 @@ native GetTeamName(index, String:name[], maxlength);
/**
* Returns the score of a team based on a team index.
* Note: This native should not be called before OnMapStart.
*
* @param index Team index.
* @return Score.
@ -237,6 +240,7 @@ native GetTeamScore(index);
/**
* Sets the score of a team based on a team index.
* Note: This native should not be called before OnMapStart.
*
* @param index Team index.
* @param value New score value.
@ -247,6 +251,7 @@ native SetTeamScore(index, value);
/**
* Retrieves the number of players in a certain team.
* Note: This native should not be called before OnMapStart.
*
* @param index Team index.
* @return Number of players in the team.

View File

@ -40,6 +40,8 @@
* @brief Defines the interface for loading/unloading/managing extensions.
*/
struct edict_t;
namespace SourceMod
{
class IExtensionInterface;
@ -131,7 +133,7 @@ namespace SourceMod
* Note: This is bumped when IShareSys is changed, because IShareSys
* itself is not versioned.
*/
#define SMINTERFACE_EXTENSIONAPI_VERSION 3
#define SMINTERFACE_EXTENSIONAPI_VERSION 4
/**
* @brief The interface an extension must expose.
@ -289,6 +291,17 @@ namespace SourceMod
* @return String containing the compilation date.
*/
virtual const char *GetExtensionDateString() =0;
/**
* @brief Called on server activation before plugins receive the OnServerLoad forward.
*
* @param pEdictList Edicts list.
* @param edictCount Number of edicts in the list.
* @param clientMax Maximum number of clients allowed in the server.
*/
virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax)
{
}
};
/**