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:
parent
e9e4d566a5
commit
c188491289
@ -56,7 +56,6 @@ for i in SM.sdkInfo:
|
|||||||
'smn_halflife.cpp',
|
'smn_halflife.cpp',
|
||||||
'PluginSys.cpp',
|
'PluginSys.cpp',
|
||||||
'smn_console.cpp',
|
'smn_console.cpp',
|
||||||
'smn_handles.cpp',
|
|
||||||
'UserMessages.cpp',
|
'UserMessages.cpp',
|
||||||
'Database.cpp',
|
'Database.cpp',
|
||||||
'MenuManager.cpp',
|
'MenuManager.cpp',
|
||||||
|
@ -25,7 +25,7 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC
|
|||||||
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||||
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||||
smn_filesystem.cpp smn_gameconfigs.cpp smn_halflife.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_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \
|
||||||
smn_hudtext.cpp smn_nextmap.cpp
|
smn_hudtext.cpp smn_nextmap.cpp
|
||||||
OBJECTS += ExtensionSys.cpp \
|
OBJECTS += ExtensionSys.cpp \
|
||||||
|
@ -40,6 +40,7 @@ files = [
|
|||||||
'PhraseCollection.cpp',
|
'PhraseCollection.cpp',
|
||||||
'smn_lang.cpp',
|
'smn_lang.cpp',
|
||||||
'smn_string.cpp',
|
'smn_string.cpp',
|
||||||
|
'smn_handles.cpp',
|
||||||
'sm_crc32.cpp'
|
'sm_crc32.cpp'
|
||||||
]
|
]
|
||||||
if AMBuild.target['platform'] == 'windows':
|
if AMBuild.target['platform'] == 'windows':
|
||||||
|
@ -36,6 +36,7 @@ OBJECTS = \
|
|||||||
PhraseCollection.cpp \
|
PhraseCollection.cpp \
|
||||||
smn_lang.cpp \
|
smn_lang.cpp \
|
||||||
smn_string.cpp \
|
smn_string.cpp \
|
||||||
|
smn_handles.cpp \
|
||||||
smn_players.cpp
|
smn_players.cpp
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
@ -42,7 +42,7 @@ using namespace SourceMod;
|
|||||||
* Add 1 to the RHS of this expression to bump the intercom file
|
* Add 1 to the RHS of this expression to bump the intercom file
|
||||||
* This is to prevent mismatching core/logic binaries
|
* This is to prevent mismatching core/logic binaries
|
||||||
*/
|
*/
|
||||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 12)
|
#define SM_LOGIC_MAGIC (0x0F47C0DE - 13)
|
||||||
|
|
||||||
#if defined SM_LOGIC
|
#if defined SM_LOGIC
|
||||||
class IVEngineServer
|
class IVEngineServer
|
||||||
|
@ -29,15 +29,17 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sm_globals.h"
|
#include "common_logic.h"
|
||||||
#include "HandleSys.h"
|
#include <IHandleSys.h>
|
||||||
#include "PluginSys.h"
|
#include <IPluginSys.h>
|
||||||
|
|
||||||
|
using namespace SourceMod;
|
||||||
|
|
||||||
static cell_t sm_IsValidHandle(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_IsValidHandle(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
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
|
if (err != HandleError_Access
|
||||||
&& err != HandleError_None)
|
&& err != HandleError_None)
|
||||||
@ -56,7 +58,7 @@ static cell_t sm_CloseHandle(IPluginContext *pContext, const cell_t *params)
|
|||||||
sec.pIdentity = NULL;
|
sec.pIdentity = NULL;
|
||||||
sec.pOwner = pContext->GetIdentity();
|
sec.pOwner = pContext->GetIdentity();
|
||||||
|
|
||||||
HandleError err = g_HandleSys.FreeHandle(hndl, &sec);
|
HandleError err = handlesys->FreeHandle(hndl, &sec);
|
||||||
|
|
||||||
if (err == HandleError_None)
|
if (err == HandleError_None)
|
||||||
{
|
{
|
||||||
@ -80,7 +82,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
|
|||||||
pNewOwner = pContext->GetIdentity();
|
pNewOwner = pContext->GetIdentity();
|
||||||
} else {
|
} else {
|
||||||
Handle_t hPlugin = static_cast<Handle_t>(params[2]);
|
Handle_t hPlugin = static_cast<Handle_t>(params[2]);
|
||||||
IPlugin *pPlugin = g_PluginSys.PluginFromHandle(hPlugin, &err);
|
IPlugin *pPlugin = pluginsys->PluginFromHandle(hPlugin, &err);
|
||||||
if (!pPlugin)
|
if (!pPlugin)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
|
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();
|
pNewOwner = pPlugin->GetIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
err = g_HandleSys.CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
|
err = handlesys->CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
|
||||||
|
|
||||||
if (err == HandleError_Access)
|
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)
|
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();
|
return pPlugin->GetMyHandle();
|
||||||
}
|
}
|
@ -42,7 +42,7 @@
|
|||||||
#include <sp_vm_api.h>
|
#include <sp_vm_api.h>
|
||||||
|
|
||||||
#define SMINTERFACE_PLUGINSYSTEM_NAME "IPluginManager"
|
#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. */
|
/** Context user slot 3 is used Core for holding an IPluginContext pointer. */
|
||||||
#define SM_CONTEXTVAR_USER 3
|
#define SM_CONTEXTVAR_USER 3
|
||||||
@ -206,6 +206,13 @@ namespace SourceMod
|
|||||||
* @return Plugin's phrase collection.
|
* @return Plugin's phrase collection.
|
||||||
*/
|
*/
|
||||||
virtual IPhraseCollection *GetPhrases() =0;
|
virtual IPhraseCollection *GetPhrases() =0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a plugin's handle.
|
||||||
|
*
|
||||||
|
* @return Plugin's handle.
|
||||||
|
*/
|
||||||
|
virtual Handle_t GetMyHandle() =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user