Moved handle natives from core to logic (bug 4406 part 9, r=ds).

--HG--
rename : core/smn_handles.cpp => core/logic/smn_handles.cpp
This commit is contained in:
David Anderson 2010-05-14 21:06:06 -07:00
parent e9e4d566a5
commit c188491289
7 changed files with 22 additions and 12 deletions

View File

@ -56,7 +56,6 @@ for i in SM.sdkInfo:
'smn_halflife.cpp',
'PluginSys.cpp',
'smn_console.cpp',
'smn_handles.cpp',
'UserMessages.cpp',
'Database.cpp',
'MenuManager.cpp',

View File

@ -25,7 +25,7 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
smn_filesystem.cpp smn_gameconfigs.cpp smn_halflife.cpp \
smn_handles.cpp smn_keyvalues.cpp smn_player.cpp \
smn_keyvalues.cpp smn_player.cpp \
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \
smn_hudtext.cpp smn_nextmap.cpp
OBJECTS += ExtensionSys.cpp \

View File

@ -40,6 +40,7 @@ files = [
'PhraseCollection.cpp',
'smn_lang.cpp',
'smn_string.cpp',
'smn_handles.cpp',
'sm_crc32.cpp'
]
if AMBuild.target['platform'] == 'windows':

View File

@ -36,6 +36,7 @@ OBJECTS = \
PhraseCollection.cpp \
smn_lang.cpp \
smn_string.cpp \
smn_handles.cpp \
smn_players.cpp
##############################################

View File

@ -42,7 +42,7 @@ using namespace SourceMod;
* Add 1 to the RHS of this expression to bump the intercom file
* This is to prevent mismatching core/logic binaries
*/
#define SM_LOGIC_MAGIC (0x0F47C0DE - 12)
#define SM_LOGIC_MAGIC (0x0F47C0DE - 13)
#if defined SM_LOGIC
class IVEngineServer

View File

@ -29,15 +29,17 @@
* Version: $Id$
*/
#include "sm_globals.h"
#include "HandleSys.h"
#include "PluginSys.h"
#include "common_logic.h"
#include <IHandleSys.h>
#include <IPluginSys.h>
using namespace SourceMod;
static cell_t sm_IsValidHandle(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError err = g_HandleSys.ReadHandle(hndl, 0, NULL, NULL);
HandleError err = handlesys->ReadHandle(hndl, 0, NULL, NULL);
if (err != HandleError_Access
&& err != HandleError_None)
@ -56,7 +58,7 @@ static cell_t sm_CloseHandle(IPluginContext *pContext, const cell_t *params)
sec.pIdentity = NULL;
sec.pOwner = pContext->GetIdentity();
HandleError err = g_HandleSys.FreeHandle(hndl, &sec);
HandleError err = handlesys->FreeHandle(hndl, &sec);
if (err == HandleError_None)
{
@ -80,7 +82,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
pNewOwner = pContext->GetIdentity();
} else {
Handle_t hPlugin = static_cast<Handle_t>(params[2]);
IPlugin *pPlugin = g_PluginSys.PluginFromHandle(hPlugin, &err);
IPlugin *pPlugin = pluginsys->PluginFromHandle(hPlugin, &err);
if (!pPlugin)
{
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
@ -88,7 +90,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
pNewOwner = pPlugin->GetIdentity();
}
err = g_HandleSys.CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
err = handlesys->CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
if (err == HandleError_Access)
{
@ -102,7 +104,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
static cell_t sm_GetMyHandle(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
return pPlugin->GetMyHandle();
}

View File

@ -42,7 +42,7 @@
#include <sp_vm_api.h>
#define SMINTERFACE_PLUGINSYSTEM_NAME "IPluginManager"
#define SMINTERFACE_PLUGINSYSTEM_VERSION 4
#define SMINTERFACE_PLUGINSYSTEM_VERSION 5
/** Context user slot 3 is used Core for holding an IPluginContext pointer. */
#define SM_CONTEXTVAR_USER 3
@ -206,6 +206,13 @@ namespace SourceMod
* @return Plugin's phrase collection.
*/
virtual IPhraseCollection *GetPhrases() =0;
/**
* @brief Returns a plugin's handle.
*
* @return Plugin's handle.
*/
virtual Handle_t GetMyHandle() =0;
};