diff --git a/core/AMBuilder b/core/AMBuilder index 354291c9..8953811b 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -71,7 +71,6 @@ for i in SM.sdkInfo: 'EventManager.cpp', 'MenuStyle_Radio.cpp', 'sm_autonatives.cpp', - 'smn_datapacks.cpp', 'sm_srvcmds.cpp', 'ConsoleDetours.cpp' ] diff --git a/core/Makefile b/core/Makefile index bdedb0a1..60b82906 100644 --- a/core/Makefile +++ b/core/Makefile @@ -26,7 +26,7 @@ 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_keyvalues.cpp smn_player.cpp \ - smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \ + smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \ smn_hudtext.cpp smn_nextmap.cpp OBJECTS += ExtensionSys.cpp \ ForwardSys.cpp \ diff --git a/core/logic/AMBuilder b/core/logic/AMBuilder index 2b937638..91bdee80 100644 --- a/core/logic/AMBuilder +++ b/core/logic/AMBuilder @@ -41,6 +41,7 @@ files = [ 'smn_lang.cpp', 'smn_string.cpp', 'smn_handles.cpp', + 'smn_datapacks.cpp', 'sm_crc32.cpp' ] if AMBuild.target['platform'] == 'windows': diff --git a/core/logic/Makefile b/core/logic/Makefile index 1e88c623..4b1a1dca 100644 --- a/core/logic/Makefile +++ b/core/logic/Makefile @@ -37,6 +37,7 @@ OBJECTS = \ smn_lang.cpp \ smn_string.cpp \ smn_handles.cpp \ + smn_datapacks.cpp \ smn_players.cpp ############################################## diff --git a/core/smn_datapacks.cpp b/core/logic/smn_datapacks.cpp similarity index 81% rename from core/smn_datapacks.cpp rename to core/logic/smn_datapacks.cpp index 40e5d6b7..21d7e7d6 100644 --- a/core/smn_datapacks.cpp +++ b/core/logic/smn_datapacks.cpp @@ -1,8 +1,8 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ============================================================================= * SourceMod - * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. + * Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved. * ============================================================================= * * This program is free software; you can redistribute it and/or modify it under @@ -29,9 +29,10 @@ * Version: $Id$ */ -#include "sm_globals.h" -#include "HandleSys.h" -#include "CDataPack.h" +#include "common_logic.h" +#include +#include +#include HandleType_t g_DataPackType; @@ -45,35 +46,35 @@ public: HandleAccess hacc; TypeAccess tacc; - g_HandleSys.InitAccessDefaults(&tacc, &hacc); + handlesys->InitAccessDefaults(&tacc, &hacc); tacc.access[HTypeAccess_Create] = true; tacc.access[HTypeAccess_Inherit] = true; tacc.ident = g_pCoreIdent; hacc.access[HandleAccess_Read] = HANDLE_RESTRICT_OWNER; - g_DataPackType = g_HandleSys.CreateType("DataPack", this, 0, &tacc, &hacc, g_pCoreIdent, NULL); + g_DataPackType = handlesys->CreateType("DataPack", this, 0, &tacc, &hacc, g_pCoreIdent, NULL); } void OnSourceModShutdown() { - g_HandleSys.RemoveType(g_DataPackType, g_pCoreIdent); + handlesys->RemoveType(g_DataPackType, g_pCoreIdent); g_DataPackType = 0; } void OnHandleDestroy(HandleType_t type, void *object) { - g_SourceMod.FreeDataPack(reinterpret_cast(object)); + g_pSM->FreeDataPack(reinterpret_cast(object)); } }; static cell_t smn_CreateDataPack(IPluginContext *pContext, const cell_t *params) { - IDataPack *pDataPack = g_SourceMod.CreateDataPack(); + IDataPack *pDataPack = g_pSM->CreateDataPack(); if (!pDataPack) { return 0; } - return g_HandleSys.CreateHandle(g_DataPackType, pDataPack, pContext->GetIdentity(), g_pCoreIdent, NULL); + return handlesys->CreateHandle(g_DataPackType, pDataPack, pContext->GetIdentity(), g_pCoreIdent, NULL); } static cell_t smn_WritePackCell(IPluginContext *pContext, const cell_t *params) @@ -86,7 +87,7 @@ static cell_t smn_WritePackCell(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -107,7 +108,7 @@ static cell_t smn_WritePackFloat(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -129,7 +130,7 @@ static cell_t smn_WritePackString(IPluginContext *pContext, const cell_t *params sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -157,7 +158,7 @@ static cell_t smn_ReadPackCell(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -181,7 +182,7 @@ static cell_t smn_ReadPackFloat(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -205,7 +206,7 @@ static cell_t smn_ReadPackString(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -232,7 +233,7 @@ static cell_t smn_ResetPack(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -257,7 +258,7 @@ static cell_t smn_GetPackPosition(IPluginContext *pContext, const cell_t *params sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -276,7 +277,7 @@ static cell_t smn_SetPackPosition(IPluginContext *pContext, const cell_t *params sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr); @@ -300,7 +301,7 @@ static cell_t smn_IsPackReadable(IPluginContext *pContext, const cell_t *params) sec.pOwner = pContext->GetIdentity(); sec.pIdentity = g_pCoreIdent; - if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) + if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) != HandleError_None) { return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);