Merge pull request #112 from Arkshine/deduplicate-files
Deduplicate a number of files used by modules by moving them to the public directory
This commit is contained in:
commit
204004b90e
|
@ -247,6 +247,7 @@ class AMXXConfig(object):
|
|||
cfg.defines += ['AMBUILD']
|
||||
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
|
||||
cfg.includes += [os.path.join(builder.sourcePath, 'public')]
|
||||
cfg.includes += [os.path.join(builder.sourcePath, 'public', 'sdk')]
|
||||
cfg.includes += [os.path.join(builder.sourcePath, 'public', 'amtl')]
|
||||
cfg.includes += [os.path.join(builder.sourcePath, 'public', 'memtools')]
|
||||
return
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include <ITextParsers.h>
|
||||
#include <am-vector.h>
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
/**
|
||||
* @param void * IN: Stream pointer
|
||||
* @param char * IN/OUT: Stream buffer
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public;..\..\public\sdk;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;_CRT_SECURE_NO_DEPRECATE;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -143,7 +143,7 @@
|
|||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public;..\..\public\sdk;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32;_CRT_SECURE_NO_DEPRECATE;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
|
||||
<StringPooling>true</StringPooling>
|
||||
|
@ -192,8 +192,8 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\multiplayer\common;$(HLSDK)\multiplayer\engine;$(HLSDK)\multiplayer\dlls;$(HLSDK)\multiplayer\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;BINLOG_ENABLED;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public;..\..\public\sdk;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;BINLOG_ENABLED;_CRT_SECURE_NO_DEPRECATE;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
|
@ -243,8 +243,8 @@
|
|||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\multiplayer\common;$(HLSDK)\multiplayer\engine;$(HLSDK)\multiplayer\dlls;$(HLSDK)\multiplayer\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32;BINLOG_ENABLED;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\public;..\..\public\sdk;..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;HAVE_STDINT_H;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32;BINLOG_ENABLED;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -342,7 +342,7 @@
|
|||
<ClCompile Include="..\vault.cpp" />
|
||||
<ClCompile Include="..\vector.cpp" />
|
||||
<ClCompile Include="..\datastructs.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\public\sdk\amxxmodule.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='JITDebugBinLog|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='JITDebug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='JITReleaseBinLog|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -396,8 +396,8 @@
|
|||
<ClInclude Include="..\trie_natives.h" />
|
||||
<ClInclude Include="..\zlib\zconf.h" />
|
||||
<ClInclude Include="..\zlib\zlib.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\public\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\..\public\sdk\moduleconfig.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc" />
|
||||
|
|
|
@ -162,9 +162,6 @@
|
|||
<ClCompile Include="..\vector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<Filter>SDK</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\datastructs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -183,6 +180,9 @@
|
|||
<ClCompile Include="..\textparse.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>SDK</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\amx.h">
|
||||
|
@ -314,12 +314,6 @@
|
|||
<ClInclude Include="..\zlib\zlib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<Filter>SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<Filter>SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CDataPack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -329,6 +323,12 @@
|
|||
<ClInclude Include="..\textparse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sdk\moduleconfig.h">
|
||||
<Filter>SDK</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc">
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "amxmodx.h"
|
||||
#include "trie_natives.h"
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
TrieHandles<CellTrie> g_TrieHandles;
|
||||
TrieHandles<TrieSnapshot> g_TrieSnapshotHandles;
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include <sm_memtable.h>
|
||||
#include "CVector.h"
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
enum EntryType
|
||||
{
|
||||
EntryType_Cell,
|
||||
|
|
|
@ -8,7 +8,7 @@ binary.compiler.defines += [
|
|||
]
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../../public/sdk/amxxmodule.cpp',
|
||||
'amxx_api.cpp',
|
||||
'CstrikePlayer.cpp',
|
||||
'CstrikeNatives.cpp',
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include "CDetour/detours.h"
|
||||
#include <sm_stringhashmap.h>
|
||||
|
||||
using namespace SourceMod; // hashmap
|
||||
|
||||
void CtrlDetours_ClientCommand(bool set);
|
||||
void CtrlDetours_BuyCommands(bool set);
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ void *UTIL_FindAddressFromEntry(const char *entry, bool isHidden, const char *li
|
|||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
|
||||
Dl_info info;
|
||||
void *handle = NULL;
|
||||
|
||||
if (dladdr(addressInBase, &info) != 0)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../../hlsdk
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,10 +15,8 @@ MM_ROOT = ../../../../metamod/metamod
|
|||
|
||||
PROJECT = cstrike
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp amxx_api.cpp CstrikePlayer.cpp CstrikeNatives.cpp CstrikeHacks.cpp CstrikeUtils.cpp \
|
||||
../../../public/memtools/MemoryUtils.cpp \
|
||||
../../../public/memtools/CDetour/detours.cpp \
|
||||
../../../public/memtools/CDetour/asm/asm.c
|
||||
OBJECTS = amxxmodule.cpp amxx_api.cpp CstrikePlayer.cpp CstrikeNatives.cpp CstrikeHacks.cpp CstrikeUtils.cpp \
|
||||
MemoryUtils.cpp detours.cpp asm.c
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -32,8 +31,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I../../../public -I../../../public/amtl -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/memtools -I$(PUBLIC_ROOT)/memtools/CDetour -I$(PUBLIC_ROOT)/memtools/CDetour/asm -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -108,7 +108,10 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
ln -sf $(PUBLIC_ROOT)/memtools/MemoryUtils.cpp
|
||||
ln -sf $(PUBLIC_ROOT)/memtools/CDetour/detours.cpp
|
||||
ln -sf $(PUBLIC_ROOT)/memtools/CDetour/asm/asm.c
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -121,6 +124,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
0
dlls/cstrike/cstrike/sdk/moduleconfig.h → dlls/cstrike/cstrike/moduleconfig.h
Executable file → Normal file
0
dlls/cstrike/cstrike/sdk/moduleconfig.h → dlls/cstrike/cstrike/moduleconfig.h
Executable file → Normal file
|
@ -62,8 +62,8 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public; ..\..\..\..\public\amtl;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
|
@ -105,7 +105,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public; ..\..\..\..\public\amtl;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -143,7 +143,7 @@
|
|||
<ClCompile Include="..\CstrikeNatives.cpp" />
|
||||
<ClCompile Include="..\CstrikePlayer.cpp" />
|
||||
<ClCompile Include="..\CstrikeUtils.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\public\memtools\CDetour\asm\asm.h" />
|
||||
|
@ -152,8 +152,8 @@
|
|||
<ClInclude Include="..\..\..\..\public\memtools\MemoryUtils.h" />
|
||||
<ClInclude Include="..\CstrikeDatas.h" />
|
||||
<ClInclude Include="..\CstrikePlayer.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\CstrikeUtils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
<ClCompile Include="..\CstrikePlayer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\amxx_api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -56,17 +53,14 @@
|
|||
<ClCompile Include="..\CstrikeUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CstrikePlayer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CstrikeDatas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -85,6 +79,12 @@
|
|||
<ClInclude Include="..\CstrikeUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\..\plugins\include\cstrike.inc">
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@ import os.path
|
|||
binary = AMXX.MetaModule(builder, 'csx')
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../../public/sdk/amxxmodule.cpp',
|
||||
'CRank.cpp',
|
||||
'CMisc.cpp',
|
||||
'meta_api.cpp',
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
###########################################
|
||||
|
||||
HLSDK = ../../../../hlsdk
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
MM_ROOT = ../../../../metamod-am/metamod
|
||||
PUBLIC_ROOT = ../../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../../metamod/metamod
|
|||
|
||||
PROJECT = csx
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp CRank.cpp CMisc.cpp meta_api.cpp rank.cpp usermsg.cpp
|
||||
OBJECTS = amxxmodule.cpp CRank.cpp CMisc.cpp meta_api.cpp rank.cpp usermsg.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -29,8 +30,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -105,7 +107,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -118,6 +120,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,7 +50,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk; ..\..\..\..\..\public\amtl;..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
|
@ -69,7 +69,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk; ..\..\..\..\..\public\amtl;..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
|
|
0
dlls/cstrike/csx/sdk/moduleconfig.h → dlls/cstrike/csx/moduleconfig.h
Executable file → Normal file
0
dlls/cstrike/csx/sdk/moduleconfig.h → dlls/cstrike/csx/moduleconfig.h
Executable file → Normal file
|
@ -63,7 +63,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -104,7 +104,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -139,15 +139,14 @@
|
|||
<ClCompile Include="..\meta_api.cpp" />
|
||||
<ClCompile Include="..\rank.cpp" />
|
||||
<ClCompile Include="..\usermsg.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CMisc.h" />
|
||||
<ClInclude Include="..\CRank.h" />
|
||||
<ClInclude Include="..\rank.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\csstats.inc" />
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<ClCompile Include="..\usermsg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -49,13 +49,10 @@
|
|||
<ClInclude Include="..\rank.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@ import os.path
|
|||
binary = AMXX.MetaModule(builder, 'dodfun')
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../../public/sdk/amxxmodule.cpp',
|
||||
'NBase.cpp',
|
||||
'CMisc.cpp',
|
||||
'NPD.cpp',
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../../hlsdk
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../../metamod/metamod
|
|||
|
||||
PROJECT = dodfun
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp NBase.cpp CMisc.cpp NPD.cpp Utils.cpp usermsg.cpp moduleconfig.cpp
|
||||
OBJECTS = amxxmodule.cpp NBase.cpp CMisc.cpp NPD.cpp Utils.cpp usermsg.cpp moduleconfig.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -29,8 +30,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -105,7 +107,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -118,6 +120,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
0
dlls/dod/dodfun/sdk/moduleconfig.h → dlls/dod/dodfun/moduleconfig.h
Executable file → Normal file
0
dlls/dod/dodfun/sdk/moduleconfig.h → dlls/dod/dodfun/moduleconfig.h
Executable file → Normal file
|
@ -62,7 +62,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>dodfun_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -103,7 +103,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;dodfun_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -139,14 +139,13 @@
|
|||
<ClCompile Include="..\NPD.cpp" />
|
||||
<ClCompile Include="..\usermsg.cpp" />
|
||||
<ClCompile Include="..\Utils.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CMisc.h" />
|
||||
<ClInclude Include="..\dodfun.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\..\plugins\include\dodconst.inc" />
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<ClCompile Include="..\Utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -49,13 +49,10 @@
|
|||
<ClInclude Include="..\dodfun.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@ import os.path
|
|||
binary = AMXX.MetaModule(builder, 'dodx')
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../../public/sdk/amxxmodule.cpp',
|
||||
'CRank.cpp',
|
||||
'CMisc.cpp',
|
||||
'NBase.cpp',
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../../hlsdk
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../../metamod/metamod
|
|||
|
||||
PROJECT = dodx
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp CRank.cpp CMisc.cpp NBase.cpp NRank.cpp usermsg.cpp Utils.cpp moduleconfig.cpp
|
||||
OBJECTS = amxxmodule.cpp CRank.cpp CMisc.cpp NBase.cpp NRank.cpp usermsg.cpp Utils.cpp moduleconfig.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -29,8 +30,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -105,7 +107,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -118,6 +120,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
0
dlls/dod/dodx/sdk/moduleconfig.h → dlls/dod/dodx/moduleconfig.h
Executable file → Normal file
0
dlls/dod/dodx/sdk/moduleconfig.h → dlls/dod/dodx/moduleconfig.h
Executable file → Normal file
|
@ -62,7 +62,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>dodx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -103,7 +103,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;dodx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -140,15 +140,14 @@
|
|||
<ClCompile Include="..\NRank.cpp" />
|
||||
<ClCompile Include="..\usermsg.cpp" />
|
||||
<ClCompile Include="..\Utils.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CMisc.h" />
|
||||
<ClInclude Include="..\CRank.h" />
|
||||
<ClInclude Include="..\dodx.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\..\plugins\include\dodconst.inc" />
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<ClCompile Include="..\Utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -55,13 +55,10 @@
|
|||
<ClInclude Include="..\dodx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<ClInclude Include="..\..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3,8 +3,12 @@ import os.path
|
|||
|
||||
binary = AMXX.MetaModule(builder, 'engine')
|
||||
|
||||
binary.compiler.defines += [
|
||||
'HAVE_STDINT_H',
|
||||
]
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'amxxapi.cpp',
|
||||
'engine.cpp',
|
||||
'entity.cpp',
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../metamod/metamod
|
|||
|
||||
PROJECT = engine
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp amxxapi.cpp engine.cpp entity.cpp globals.cpp forwards.cpp
|
||||
OBJECTS = amxxmodule.cpp amxxapi.cpp engine.cpp entity.cpp globals.cpp forwards.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -29,8 +30,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/pm_shared -I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -105,7 +107,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -118,6 +120,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ void ClearHooks()
|
|||
{
|
||||
size_t i;
|
||||
|
||||
for (i=0; i<Touches.size(); i++)
|
||||
for (i=0; i<Touches.length(); i++)
|
||||
delete Touches[i];
|
||||
for (i=0; i<Impulses.size(); i++)
|
||||
for (i=0; i<Impulses.length(); i++)
|
||||
delete Impulses[i];
|
||||
for (i=0; i<Thinks.size(); i++)
|
||||
for (i=0; i<Thinks.length(); i++)
|
||||
delete Thinks[i];
|
||||
|
||||
Touches.clear();
|
||||
|
|
|
@ -43,11 +43,11 @@ static cell AMX_NATIVE_CALL register_think(AMX *amx, cell *params)
|
|||
|
||||
EntClass *p = new EntClass;
|
||||
const char *clsname = MF_GetAmxString(amx, params[1], 0, &len);
|
||||
p->Class.assign(clsname);
|
||||
p->Class = clsname;
|
||||
|
||||
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_DONE);
|
||||
|
||||
Thinks.push_back(p);
|
||||
Thinks.append(p);
|
||||
|
||||
if (!g_pFunctionTable->pfnThink)
|
||||
g_pFunctionTable->pfnThink=Think;
|
||||
|
@ -64,7 +64,7 @@ static cell AMX_NATIVE_CALL register_impulse(AMX *amx, cell *params)
|
|||
|
||||
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_DONE);
|
||||
|
||||
Impulses.push_back(p);
|
||||
Impulses.append(p);
|
||||
|
||||
if (!g_pFunctionTable->pfnCmdStart)
|
||||
g_pFunctionTable->pfnCmdStart=CmdStart;
|
||||
|
@ -82,19 +82,19 @@ static cell AMX_NATIVE_CALL register_touch(AMX *amx, cell *params)
|
|||
Touch *p = new Touch;
|
||||
|
||||
if (!strlen(Toucher) || strcmp(Toucher, "*")==0) {
|
||||
p->Toucher.assign("");
|
||||
p->Toucher.setVoid();
|
||||
} else {
|
||||
p->Toucher.assign(Toucher);
|
||||
p->Toucher = Toucher;
|
||||
}
|
||||
if (!strlen(Touched) || strcmp(Touched, "*")==0) {
|
||||
p->Touched.assign("");
|
||||
p->Touched.setVoid();
|
||||
} else {
|
||||
p->Touched.assign(Touched);
|
||||
p->Touched = Touched;
|
||||
}
|
||||
|
||||
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[3], 2, &len), FP_CELL, FP_CELL, FP_DONE);
|
||||
|
||||
Touches.push_back(p);
|
||||
Touches.append(p);
|
||||
|
||||
if (!g_pFunctionTable->pfnTouch)
|
||||
g_pFunctionTable->pfnTouch=pfnTouch;
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
#include <string.h>
|
||||
#include <meta_api.h>
|
||||
#include <sdk_util.h>
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include <usercmd.h>
|
||||
#include "entity.h"
|
||||
#include "gpglobals.h"
|
||||
#include "entity_state.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
|
||||
extern DLL_FUNCTIONS *g_pFunctionTable;
|
||||
extern DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
|
@ -140,8 +140,8 @@ class Touch
|
|||
{
|
||||
public:
|
||||
int Forward;
|
||||
String Toucher;
|
||||
String Touched;
|
||||
ke::AString Toucher;
|
||||
ke::AString Touched;
|
||||
~Touch()
|
||||
{
|
||||
if (Forward != -1)
|
||||
|
@ -153,7 +153,7 @@ class EntClass
|
|||
{
|
||||
public:
|
||||
int Forward;
|
||||
String Class;
|
||||
ke::AString Class;
|
||||
~EntClass()
|
||||
{
|
||||
if (Forward != -1)
|
||||
|
@ -226,9 +226,9 @@ extern struct PlayerInfo plinfo[33];
|
|||
extern struct GlobalInfo glinfo;
|
||||
extern AMX_NATIVE_INFO engine_Natives[];
|
||||
extern AMX_NATIVE_INFO engine_NewNatives[];
|
||||
extern CVector<Impulse *> Impulses;
|
||||
extern CVector<EntClass *> Thinks;
|
||||
extern CVector<Touch *> Touches;
|
||||
extern ke::Vector<Impulse *> Impulses;
|
||||
extern ke::Vector<EntClass *> Thinks;
|
||||
extern ke::Vector<Touch *> Touches;
|
||||
|
||||
#endif //_ENGINE_INCLUDE_H
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ int CmdStartForward = 0;
|
|||
int StartFrameForward = 0;
|
||||
int VexdTouchForward = 0;
|
||||
int VexdServerForward = 0;
|
||||
CVector<Impulse *> Impulses;
|
||||
CVector<EntClass *> Thinks;
|
||||
CVector<Touch *> Touches;
|
||||
ke::Vector<Impulse *> Impulses;
|
||||
ke::Vector<EntClass *> Thinks;
|
||||
ke::Vector<Touch *> Touches;
|
||||
KeyValueData *g_pkvd;
|
||||
bool g_inKeyValue=false;
|
||||
bool g_precachedStuff = false;
|
||||
|
@ -139,7 +139,7 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
|
|||
edict_t *pEntity = (edict_t *)player;
|
||||
g_cmd = (struct usercmd_s *)_cmd;
|
||||
int origImpulse = g_cmd->impulse; // incase a plugin alters it
|
||||
for (i=0; i<Impulses.size(); i++)
|
||||
for (i=0; i<Impulses.length(); i++)
|
||||
{
|
||||
if (Impulses[i]->Check == g_cmd->impulse)
|
||||
{
|
||||
|
@ -251,11 +251,11 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
|
|||
int ptrIndex = ENTINDEX(pToucher);
|
||||
int ptdIndex = ENTINDEX(pTouched);
|
||||
META_RES res=MRES_IGNORED;
|
||||
for (i=0; i<Touches.size(); i++)
|
||||
for (i=0; i<Touches.length(); i++)
|
||||
{
|
||||
if (Touches[i]->Toucher.size() == 0)
|
||||
if (Touches[i]->Toucher.length() == 0)
|
||||
{
|
||||
if (Touches[i]->Touched.size() == 0)
|
||||
if (Touches[i]->Touched.length() == 0)
|
||||
{
|
||||
retVal = MF_ExecuteForward(Touches[i]->Forward, (cell)ptrIndex, (cell)ptdIndex);
|
||||
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||
|
@ -270,7 +270,7 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
|
|||
res=MRES_SUPERCEDE;
|
||||
}
|
||||
} else if (Touches[i]->Toucher.compare(ptrClass)==0) {
|
||||
if (Touches[i]->Touched.size() == 0)
|
||||
if (Touches[i]->Touched.length() == 0)
|
||||
{
|
||||
retVal = MF_ExecuteForward(Touches[i]->Forward, (cell)ptrIndex, (cell)ptdIndex);
|
||||
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||
|
@ -307,7 +307,7 @@ void Think(edict_t *pent)
|
|||
const char *cls = STRING(pent->v.classname);
|
||||
META_RES res=MRES_IGNORED;
|
||||
int retVal=0;
|
||||
for (i=0; i<Thinks.size(); i++)
|
||||
for (i=0; i<Thinks.length(); i++)
|
||||
{
|
||||
if (Thinks[i]->Class.compare(cls)==0)
|
||||
{
|
||||
|
|
0
dlls/engine/sdk/moduleconfig.h → dlls/engine/moduleconfig.h
Executable file → Normal file
0
dlls/engine/sdk/moduleconfig.h → dlls/engine/moduleconfig.h
Executable file → Normal file
|
@ -52,8 +52,8 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -74,8 +74,8 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
|
@ -99,17 +99,14 @@
|
|||
<ClCompile Include="..\entity.cpp" />
|
||||
<ClCompile Include="..\forwards.cpp" />
|
||||
<ClCompile Include="..\globals.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\engine.h" />
|
||||
<ClInclude Include="..\entity.h" />
|
||||
<ClInclude Include="..\gpglobals.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\CString.h" />
|
||||
<ClInclude Include="..\sdk\CVector.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\engine.inc" />
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
<Filter Include="Module SDK">
|
||||
<UniqueIdentifier>{fb945ae1-3977-41e3-a51b-04242aff8c78}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Module SDK\AMXX STL">
|
||||
<UniqueIdentifier>{a7c79424-2a0f-459d-a4f9-0ccbeb06dd3e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Module SDK\SDK Base">
|
||||
<UniqueIdentifier>{aad49737-4d0e-4276-a471-dc77365bf9e0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -38,7 +35,7 @@
|
|||
<ClCompile Include="..\globals.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -52,19 +49,10 @@
|
|||
<ClInclude Include="..\gpglobals.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CString.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CVector.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,367 +0,0 @@
|
|||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef _INCLUDE_CSTRING_H
|
||||
#define _INCLUDE_CSTRING_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//by David "BAILOPAN" Anderson
|
||||
class String
|
||||
{
|
||||
public:
|
||||
String()
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
//assign("");
|
||||
}
|
||||
|
||||
~String()
|
||||
{
|
||||
if (v)
|
||||
delete [] v;
|
||||
}
|
||||
|
||||
String(const char *src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src);
|
||||
}
|
||||
|
||||
const char * _fread(FILE *fp)
|
||||
{
|
||||
Grow(512, false);
|
||||
char *ret = fgets(v, 511, fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String(const String &src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
const char *c_str() { return v?v:""; }
|
||||
|
||||
const char *c_str() const { return v?v:""; }
|
||||
|
||||
void append(const char *t)
|
||||
{
|
||||
Grow(size() + strlen(t) + 1);
|
||||
strcat(v, t);
|
||||
}
|
||||
|
||||
void append(const char c)
|
||||
{
|
||||
size_t len = size();
|
||||
Grow(len + 2);
|
||||
v[len] = c;
|
||||
v[len + 1] = '\0';
|
||||
}
|
||||
|
||||
void append(String &d)
|
||||
{
|
||||
append(d.c_str());
|
||||
}
|
||||
|
||||
void assign(const String &src)
|
||||
{
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
void assign(const char *d)
|
||||
{
|
||||
if (!d)
|
||||
{
|
||||
clear();
|
||||
} else {
|
||||
size_t len = strlen(d);
|
||||
Grow(len + 1, false);
|
||||
memcpy(v, d, len);
|
||||
v[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
if (v)
|
||||
v[0] = '\0';
|
||||
}
|
||||
|
||||
int compare (const char *d) const
|
||||
{
|
||||
if (!v)
|
||||
return strcmp("", d);
|
||||
else
|
||||
return strcmp(v, d);
|
||||
}
|
||||
|
||||
//Added this for amxx inclusion
|
||||
bool empty()
|
||||
{
|
||||
if (!v)
|
||||
return true;
|
||||
|
||||
if (v[0] == '\0')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
if (v)
|
||||
return strlen(v);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find(const char c, int index = 0)
|
||||
{
|
||||
int len = static_cast<int>(size());
|
||||
if (len < 1)
|
||||
return npos;
|
||||
if (index >= len || index < 0)
|
||||
return npos;
|
||||
int i = 0;
|
||||
for (i=index; i<len; i++)
|
||||
{
|
||||
if (v[i] == c)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return npos;
|
||||
}
|
||||
|
||||
bool is_space(int c)
|
||||
{
|
||||
if (c == '\f' || c == '\n' ||
|
||||
c == '\t' || c == '\r' ||
|
||||
c == '\v' || c == ' ')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void trim()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
size_t len = strlen(v);
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[i]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char c0 = v[0];
|
||||
|
||||
if (is_space(c0))
|
||||
{
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==len-1)))
|
||||
{
|
||||
erase(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len = strlen(v);
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_space(v[len-1]))
|
||||
{
|
||||
for (i=len-1; i<len; i--)
|
||||
{
|
||||
if (!is_space(v[i])
|
||||
|| (is_space(v[i]) && i==0))
|
||||
{
|
||||
erase(i+1, j);
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[0]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void erase(unsigned int start, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = size();
|
||||
//check for bounds
|
||||
if (num == npos || start+num > len-start)
|
||||
num = len - start;
|
||||
//do the erasing
|
||||
bool copyflag = false;
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (i>=start && i<start+num)
|
||||
{
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
copyflag = true;
|
||||
} else if (copyflag) {
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
len -= num;
|
||||
v[len] = 0;
|
||||
}
|
||||
|
||||
String substr(unsigned int index, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
{
|
||||
String b("");
|
||||
return b;
|
||||
}
|
||||
|
||||
String ns;
|
||||
|
||||
size_t len = size();
|
||||
|
||||
if (index >= len || !v)
|
||||
return ns;
|
||||
|
||||
if (num == npos)
|
||||
{
|
||||
num = len - index;
|
||||
} else if (index+num >= len) {
|
||||
num = len - index;
|
||||
}
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int nslen = num + 2;
|
||||
|
||||
ns.Grow(nslen);
|
||||
|
||||
for (i=index; i<index+num; i++)
|
||||
ns.append(v[i]);
|
||||
|
||||
return ns;
|
||||
}
|
||||
|
||||
void toLower()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = strlen(v);
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (v[i] >= 65 && v[i] <= 90)
|
||||
v[i] &= ~(1<<5);
|
||||
}
|
||||
}
|
||||
|
||||
String & operator = (const String &src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
String & operator = (const char *src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
char operator [] (unsigned int index)
|
||||
{
|
||||
if (index > size() || !v)
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
return v[index];
|
||||
}
|
||||
}
|
||||
|
||||
int at(int a)
|
||||
{
|
||||
if (a < 0 || a >= (int)size() || !v)
|
||||
return -1;
|
||||
|
||||
return v[a];
|
||||
}
|
||||
|
||||
bool at(int at, char c)
|
||||
{
|
||||
if (at < 0 || at >= (int)size() || !v)
|
||||
return false;
|
||||
|
||||
v[at] = c;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
void Grow(unsigned int d, bool copy=true)
|
||||
{
|
||||
if (d <= a_size)
|
||||
return;
|
||||
char *n = new char[d + 1];
|
||||
if (copy && v)
|
||||
strcpy(n, v);
|
||||
if (v)
|
||||
delete [] v;
|
||||
else
|
||||
strcpy(n, "");
|
||||
v = n;
|
||||
a_size = d + 1;
|
||||
}
|
||||
|
||||
char *v;
|
||||
unsigned int a_size;
|
||||
public:
|
||||
static const int npos = -1;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CSTRING_H
|
|
@ -1,480 +0,0 @@
|
|||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef __CVECTOR_H__
|
||||
#define __CVECTOR_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
for (size_t i=0; i<m_CurrentUsedSize; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
{
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
protected:
|
||||
T *m_Ptr;
|
||||
public:
|
||||
// constructors / destructors
|
||||
iterator()
|
||||
{
|
||||
m_Ptr = NULL;
|
||||
}
|
||||
|
||||
iterator(T * ptr)
|
||||
{
|
||||
m_Ptr = ptr;
|
||||
}
|
||||
|
||||
// member functions
|
||||
T * base()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
const T * base() const
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
// operators
|
||||
T & operator*()
|
||||
{
|
||||
return *m_Ptr;
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(T * right) const
|
||||
{
|
||||
return (m_Ptr == right);
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr == right.m_Ptr);
|
||||
}
|
||||
|
||||
bool operator!=(T * right) const
|
||||
{
|
||||
return (m_Ptr != right);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr != right.m_Ptr);
|
||||
}
|
||||
|
||||
iterator & operator+=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator+(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
const T & operator[](size_t offset) const
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
bool operator<(const iterator & right) const
|
||||
{
|
||||
return m_Ptr < right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>(const iterator & right) const
|
||||
{
|
||||
return m_Ptr > right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator<=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr <= right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr >= right.m_Ptr;
|
||||
}
|
||||
|
||||
size_t operator-(const iterator & right) const
|
||||
{
|
||||
return m_Ptr - right.m_Ptr;
|
||||
}
|
||||
};
|
||||
|
||||
// constructors / destructors
|
||||
CVector<T>()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
m_Data = NULL;
|
||||
}
|
||||
|
||||
CVector<T>(const CVector<T> & other)
|
||||
{
|
||||
// copy data
|
||||
m_Data = new T [other.m_CurrentUsedSize];
|
||||
m_Size = other.m_CurrentUsedSize;
|
||||
m_CurrentUsedSize = other.m_CurrentUsedSize;
|
||||
for (size_t i=0; i<other.m_CurrentUsedSize; i++)
|
||||
m_Data[i] = other.m_Data[i];
|
||||
}
|
||||
|
||||
~CVector<T>()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
// interface
|
||||
size_t size() const
|
||||
{
|
||||
return m_CurrentUsedSize;
|
||||
}
|
||||
|
||||
size_t capacity() const
|
||||
{
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
|
||||
iterator iterAt(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
assert(0);
|
||||
return iterator(m_Data + pos);
|
||||
}
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pop_back()
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return (m_CurrentUsedSize == 0);
|
||||
}
|
||||
|
||||
T & at(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
const T & at(size_t pos) const
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
T & operator[](size_t pos)
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
const T & operator[](size_t pos) const
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
T & front()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
const T & front() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
T & back()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
const T & back() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __CVECTOR_H__
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3,8 +3,12 @@ import os.path
|
|||
|
||||
binary = AMXX.MetaModule(builder, 'fakemeta')
|
||||
|
||||
binary.compiler.defines += [
|
||||
'HAVE_STDINT_H',
|
||||
]
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'dllfunc.cpp',
|
||||
'engfunc.cpp',
|
||||
'fakemeta_amxx.cpp',
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../metamod/metamod
|
|||
|
||||
PROJECT = fakemeta
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp dllfunc.cpp engfunc.cpp fakemeta_amxx.cpp pdata.cpp forward.cpp \
|
||||
OBJECTS = amxxmodule.cpp dllfunc.cpp engfunc.cpp fakemeta_amxx.cpp pdata.cpp forward.cpp \
|
||||
fm_tr.cpp pev.cpp glb.cpp fm_tr2.cpp misc.cpp
|
||||
|
||||
##############################################
|
||||
|
@ -30,8 +31,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/pm_shared -I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared \
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -107,7 +109,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -120,6 +122,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
|
@ -14,16 +14,17 @@
|
|||
#ifndef _FAKEMETA_INCLUDE_H
|
||||
#define _FAKEMETA_INCLUDE_H
|
||||
|
||||
#include "sdk/amxxmodule.h"
|
||||
#include "amxxmodule.h"
|
||||
#include <entity_state.h>
|
||||
#include <usercmd.h>
|
||||
#include "CVector.h"
|
||||
#include "engfunc.h"
|
||||
#include "dllfunc.h"
|
||||
#include "pev.h"
|
||||
#include "forward.h"
|
||||
#include "fm_tr.h"
|
||||
#include "glb.h"
|
||||
#include <am-string.h>
|
||||
#include <am-vector.h>
|
||||
|
||||
extern edict_t *g_player_edicts[33];
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#ifndef _INCLUDE_TR_H
|
||||
#define _INCLUDE_TR_H
|
||||
|
||||
#include "CString.h"
|
||||
#include <am-string.h>
|
||||
|
||||
extern TraceResult *gfm_tr;
|
||||
|
||||
|
@ -31,9 +31,9 @@ extern usercmd_t *g_uc_hook;
|
|||
struct KVD_Wrapper
|
||||
{
|
||||
KeyValueData *kvd;
|
||||
String cls;
|
||||
String key;
|
||||
String val;
|
||||
ke::AString cls;
|
||||
ke::AString key;
|
||||
ke::AString val;
|
||||
};
|
||||
|
||||
extern KVD_Wrapper g_kvd_glb;
|
||||
|
|
|
@ -290,22 +290,22 @@ static cell AMX_NATIVE_CALL set_kvd(AMX *amx, cell *params)
|
|||
}
|
||||
case KV_ClassName:
|
||||
{
|
||||
kvdw->cls.assign(MF_GetAmxString(amx, params[3], 0, &len));
|
||||
kvd->szClassName = const_cast<char *>(kvdw->cls.c_str());
|
||||
kvdw->cls = MF_GetAmxString(amx, params[3], 0, &len);
|
||||
kvd->szClassName = const_cast<char *>(kvdw->cls.chars());
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case KV_KeyName:
|
||||
{
|
||||
kvdw->key.assign(MF_GetAmxString(amx, params[3], 0, &len));
|
||||
kvd->szKeyName = const_cast<char *>(kvdw->key.c_str());
|
||||
kvdw->key = MF_GetAmxString(amx, params[3], 0, &len);
|
||||
kvd->szKeyName = const_cast<char *>(kvdw->key.chars());
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case KV_Value:
|
||||
{
|
||||
kvdw->val.assign(MF_GetAmxString(amx, params[3], 0, &len));
|
||||
kvd->szValue = const_cast<char *>(kvdw->val.c_str());
|
||||
kvdw->val = MF_GetAmxString(amx, params[3], 0, &len);
|
||||
kvd->szValue = const_cast<char *>(kvdw->val.chars());
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include "fakemeta_amxx.h"
|
||||
|
||||
CVector<int> Engine[ENGFUNC_NUM+10];
|
||||
CVector<int> EnginePost[ENGFUNC_NUM+10];
|
||||
ke::Vector<int> Engine[ENGFUNC_NUM+10];
|
||||
ke::Vector<int> EnginePost[ENGFUNC_NUM + 10];
|
||||
void *EngineAddrs[ENGFUNC_NUM+10];
|
||||
void *EngineAddrsPost[ENGFUNC_NUM+10];
|
||||
cell mCellResult;
|
||||
|
@ -838,7 +838,7 @@ static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params)
|
|||
|
||||
void *patchAddr = NULL;
|
||||
|
||||
CVector<int> *peng = NULL;
|
||||
ke::Vector<int> *peng = NULL;
|
||||
if (post)
|
||||
{
|
||||
peng = &(EnginePost[func]);
|
||||
|
@ -847,17 +847,12 @@ static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params)
|
|||
peng = &(Engine[func]);
|
||||
patchAddr = EngineAddrs[func];
|
||||
}
|
||||
|
||||
CVector<int>::iterator begin, end=peng->end();
|
||||
|
||||
for (begin=peng->begin(); begin!=end; begin++)
|
||||
for (size_t i = 0; i < peng->length(); ++i)
|
||||
{
|
||||
if ((*begin) == func_id)
|
||||
if (peng->at(i) == func_id)
|
||||
{
|
||||
peng->erase(begin);
|
||||
if (!peng->size()
|
||||
&& patchAddr != NULL
|
||||
&& func != FM_ServerDeactivate)
|
||||
peng->remove(i);
|
||||
if (!peng->length() && patchAddr != NULL && func != FM_ServerDeactivate)
|
||||
{
|
||||
/* Clear out this forward if we no longer need it */
|
||||
*(void **)patchAddr = NULL;
|
||||
|
@ -1519,9 +1514,9 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
|
|||
|
||||
if (post)
|
||||
{
|
||||
EnginePost[func].push_back(fId);
|
||||
EnginePost[func].append(fId);
|
||||
} else {
|
||||
Engine[func].push_back(fId);
|
||||
Engine[func].append(fId);
|
||||
}
|
||||
|
||||
return fId;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#ifndef _INCLUDE_FORWARD_H
|
||||
#define _INCLUDE_FORWARD_H
|
||||
|
||||
#include <am-vector.h>
|
||||
|
||||
#define ENGFUNC_NUM FM_LAST_DONT_USE_ME // 131
|
||||
|
||||
#define FMV_STRING 1
|
||||
|
@ -181,8 +183,8 @@ enum {
|
|||
FM_LAST_DONT_USE_ME
|
||||
};
|
||||
|
||||
extern CVector<int> Engine[];
|
||||
extern CVector<int> EnginePost[];
|
||||
extern ke::Vector<int> Engine[];
|
||||
extern ke::Vector<int> EnginePost[];
|
||||
extern void *EngineAddrs[ENGFUNC_NUM+10];
|
||||
extern void *EngineAddrsPost[ENGFUNC_NUM+10];
|
||||
extern cell mCellResult;
|
||||
|
|
|
@ -924,7 +924,7 @@
|
|||
register unsigned int i = 0; \
|
||||
clfm(); \
|
||||
int fmres = FMRES_IGNORED; \
|
||||
for (i=0; i<Engine[pfnCall].size(); i++) \
|
||||
for (i=0; i<Engine[pfnCall].length(); i++) \
|
||||
{ \
|
||||
fmres = MF_ExecuteForward pfnArgs; \
|
||||
if (fmres >= lastFmRes) { \
|
||||
|
@ -941,7 +941,7 @@
|
|||
register unsigned int i = 0; \
|
||||
clfm(); \
|
||||
int fmres = FMRES_IGNORED; \
|
||||
for (i=0; i<EnginePost[pfnCall].size(); i++) \
|
||||
for (i=0; i<EnginePost[pfnCall].length(); i++) \
|
||||
{ \
|
||||
fmres = MF_ExecuteForward pfnArgs; \
|
||||
if (fmres >= lastFmRes) { \
|
||||
|
|
0
dlls/fakemeta/sdk/moduleconfig.h → dlls/fakemeta/moduleconfig.h
Executable file → Normal file
0
dlls/fakemeta/sdk/moduleconfig.h → dlls/fakemeta/moduleconfig.h
Executable file → Normal file
|
@ -52,8 +52,8 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -73,8 +73,8 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
|
@ -102,22 +102,21 @@
|
|||
<ClCompile Include="..\pev.cpp" />
|
||||
<ClCompile Include="..\forward.cpp" />
|
||||
<ClCompile Include="..\glb.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\fakemeta_amxx.h" />
|
||||
<ClInclude Include="..\fm_tr.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\dllfunc.h" />
|
||||
<ClInclude Include="..\engfunc.h" />
|
||||
<CustomBuildStep Include="pev.h" />
|
||||
<ClInclude Include="..\forward.h" />
|
||||
<ClInclude Include="..\forwardmacros.h" />
|
||||
<ClInclude Include="..\glb.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\CString.h" />
|
||||
<ClInclude Include="..\sdk\CVector.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\fakemeta.inc" />
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<ClCompile Include="..\glb.cpp">
|
||||
<Filter>Globals</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -76,9 +76,6 @@
|
|||
<ClInclude Include="..\fm_tr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dllfunc.h">
|
||||
<Filter>Engine Funcs</Filter>
|
||||
</ClInclude>
|
||||
|
@ -94,16 +91,16 @@
|
|||
<ClInclude Include="..\glb.h">
|
||||
<Filter>Globals</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CString.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CVector.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,391 +0,0 @@
|
|||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef _INCLUDE_CSTRING_H
|
||||
#define _INCLUDE_CSTRING_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//by David "BAILOPAN" Anderson
|
||||
class String
|
||||
{
|
||||
public:
|
||||
String()
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
//assign("");
|
||||
}
|
||||
|
||||
~String()
|
||||
{
|
||||
if (v)
|
||||
delete [] v;
|
||||
}
|
||||
|
||||
String(const char *src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src);
|
||||
}
|
||||
|
||||
const char * _fread(FILE *fp)
|
||||
{
|
||||
Grow(512, false);
|
||||
char *ret = fgets(v, 511, fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String(const String &src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
const char *c_str() { return v?v:""; }
|
||||
|
||||
const char *c_str() const { return v?v:""; }
|
||||
|
||||
void append(const char *t)
|
||||
{
|
||||
Grow(size() + strlen(t) + 1);
|
||||
strcat(v, t);
|
||||
}
|
||||
|
||||
void append(const char c)
|
||||
{
|
||||
size_t len = size();
|
||||
Grow(len + 2);
|
||||
v[len] = c;
|
||||
v[len + 1] = '\0';
|
||||
}
|
||||
|
||||
void append(String &d)
|
||||
{
|
||||
append(d.c_str());
|
||||
}
|
||||
|
||||
void assign(const String &src)
|
||||
{
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
void assign(const char *d)
|
||||
{
|
||||
if (!d)
|
||||
{
|
||||
clear();
|
||||
} else {
|
||||
size_t len = strlen(d);
|
||||
Grow(len + 1, false);
|
||||
memcpy(v, d, len);
|
||||
v[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
if (v)
|
||||
v[0] = '\0';
|
||||
}
|
||||
|
||||
int compare (const char *d) const
|
||||
{
|
||||
if (!v)
|
||||
return strcmp("", d);
|
||||
else
|
||||
return strcmp(v, d);
|
||||
}
|
||||
|
||||
//Added this for amxx inclusion
|
||||
bool empty()
|
||||
{
|
||||
if (!v)
|
||||
return true;
|
||||
|
||||
if (v[0] == '\0')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
if (v)
|
||||
return strlen(v);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find(const char c, int index = 0)
|
||||
{
|
||||
int len = static_cast<int>(size());
|
||||
if (len < 1)
|
||||
return npos;
|
||||
if (index >= len || index < 0)
|
||||
return npos;
|
||||
int i = 0;
|
||||
for (i=index; i<len; i++)
|
||||
{
|
||||
if (v[i] == c)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return npos;
|
||||
}
|
||||
|
||||
bool is_space(int c)
|
||||
{
|
||||
if (c == '\f' || c == '\n' ||
|
||||
c == '\t' || c == '\r' ||
|
||||
c == '\v' || c == ' ')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void reparse_newlines()
|
||||
{
|
||||
size_t len = size();
|
||||
int offs = 0;
|
||||
char c;
|
||||
if (!len)
|
||||
return;
|
||||
for (size_t i=0; i<len; i++)
|
||||
{
|
||||
c = v[i];
|
||||
if (c == '^' && (i != len-1))
|
||||
{
|
||||
c = v[++i];
|
||||
if (c == 'n')
|
||||
c = '\n';
|
||||
else if (c == 't')
|
||||
c = '\t';
|
||||
offs++;
|
||||
}
|
||||
v[i-offs] = c;
|
||||
}
|
||||
v[len-offs] = '\0';
|
||||
}
|
||||
|
||||
void trim()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
size_t len = strlen(v);
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[i]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char c0 = v[0];
|
||||
|
||||
if (is_space(c0))
|
||||
{
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==len-1)))
|
||||
{
|
||||
erase(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len = strlen(v);
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_space(v[len-1]))
|
||||
{
|
||||
for (i=len-1; i<len; i--)
|
||||
{
|
||||
if (!is_space(v[i])
|
||||
|| (is_space(v[i]) && i==0))
|
||||
{
|
||||
erase(i+1, j);
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[0]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void erase(unsigned int start, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = size();
|
||||
//check for bounds
|
||||
if (num == npos || start+num > len-start)
|
||||
num = len - start;
|
||||
//do the erasing
|
||||
bool copyflag = false;
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (i>=start && i<start+num)
|
||||
{
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
copyflag = true;
|
||||
} else if (copyflag) {
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
len -= num;
|
||||
v[len] = 0;
|
||||
}
|
||||
|
||||
String substr(unsigned int index, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
{
|
||||
String b("");
|
||||
return b;
|
||||
}
|
||||
|
||||
String ns;
|
||||
|
||||
size_t len = size();
|
||||
|
||||
if (index >= len || !v)
|
||||
return ns;
|
||||
|
||||
if (num == npos)
|
||||
{
|
||||
num = len - index;
|
||||
} else if (index+num >= len) {
|
||||
num = len - index;
|
||||
}
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int nslen = num + 2;
|
||||
|
||||
ns.Grow(nslen);
|
||||
|
||||
for (i=index; i<index+num; i++)
|
||||
ns.append(v[i]);
|
||||
|
||||
return ns;
|
||||
}
|
||||
|
||||
void toLower()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = strlen(v);
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (v[i] >= 65 && v[i] <= 90)
|
||||
v[i] &= ~(1<<5);
|
||||
}
|
||||
}
|
||||
|
||||
String & operator = (const String &src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
String & operator = (const char *src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
char operator [] (unsigned int index)
|
||||
{
|
||||
if (index > size() || !v)
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
return v[index];
|
||||
}
|
||||
}
|
||||
|
||||
int at(int a)
|
||||
{
|
||||
if (a < 0 || a >= (int)size() || !v)
|
||||
return -1;
|
||||
|
||||
return v[a];
|
||||
}
|
||||
|
||||
bool at(int at, char c)
|
||||
{
|
||||
if (at < 0 || at >= (int)size() || !v)
|
||||
return false;
|
||||
|
||||
v[at] = c;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
void Grow(unsigned int d, bool copy=true)
|
||||
{
|
||||
if (d <= a_size)
|
||||
return;
|
||||
char *n = new char[d + 1];
|
||||
if (copy && v)
|
||||
strcpy(n, v);
|
||||
if (v)
|
||||
delete [] v;
|
||||
else
|
||||
strcpy(n, "");
|
||||
v = n;
|
||||
a_size = d + 1;
|
||||
}
|
||||
|
||||
char *v;
|
||||
unsigned int a_size;
|
||||
public:
|
||||
static const int npos = -1;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CSTRING_H
|
|
@ -1,480 +0,0 @@
|
|||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef __CVECTOR_H__
|
||||
#define __CVECTOR_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
for (size_t i=0; i<m_CurrentUsedSize; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
{
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
protected:
|
||||
T *m_Ptr;
|
||||
public:
|
||||
// constructors / destructors
|
||||
iterator()
|
||||
{
|
||||
m_Ptr = NULL;
|
||||
}
|
||||
|
||||
iterator(T * ptr)
|
||||
{
|
||||
m_Ptr = ptr;
|
||||
}
|
||||
|
||||
// member functions
|
||||
T * base()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
const T * base() const
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
// operators
|
||||
T & operator*()
|
||||
{
|
||||
return *m_Ptr;
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(T * right) const
|
||||
{
|
||||
return (m_Ptr == right);
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr == right.m_Ptr);
|
||||
}
|
||||
|
||||
bool operator!=(T * right) const
|
||||
{
|
||||
return (m_Ptr != right);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr != right.m_Ptr);
|
||||
}
|
||||
|
||||
iterator & operator+=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator+(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
const T & operator[](size_t offset) const
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
bool operator<(const iterator & right) const
|
||||
{
|
||||
return m_Ptr < right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>(const iterator & right) const
|
||||
{
|
||||
return m_Ptr > right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator<=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr <= right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr >= right.m_Ptr;
|
||||
}
|
||||
|
||||
size_t operator-(const iterator & right) const
|
||||
{
|
||||
return m_Ptr - right.m_Ptr;
|
||||
}
|
||||
};
|
||||
|
||||
// constructors / destructors
|
||||
CVector<T>()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
m_Data = NULL;
|
||||
}
|
||||
|
||||
CVector<T>(const CVector<T> & other)
|
||||
{
|
||||
// copy data
|
||||
m_Data = new T [other.m_CurrentUsedSize];
|
||||
m_Size = other.m_CurrentUsedSize;
|
||||
m_CurrentUsedSize = other.m_CurrentUsedSize;
|
||||
for (size_t i=0; i<other.m_CurrentUsedSize; i++)
|
||||
m_Data[i] = other.m_Data[i];
|
||||
}
|
||||
|
||||
~CVector<T>()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
// interface
|
||||
size_t size() const
|
||||
{
|
||||
return m_CurrentUsedSize;
|
||||
}
|
||||
|
||||
size_t capacity() const
|
||||
{
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
|
||||
iterator iterAt(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
assert(0);
|
||||
return iterator(m_Data + pos);
|
||||
}
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pop_back()
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return (m_CurrentUsedSize == 0);
|
||||
}
|
||||
|
||||
T & at(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
const T & at(size_t pos) const
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
T & operator[](size_t pos)
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
const T & operator[](size_t pos) const
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
T & front()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
const T & front() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
T & back()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
const T & back() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __CVECTOR_H__
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,219 +0,0 @@
|
|||
/* ======== SourceMM ========
|
||||
* Copyright (C) 2004-2005 Metamod:Source Development Team
|
||||
* No warranties of any kind
|
||||
*
|
||||
* License: zlib/libpng
|
||||
*
|
||||
* Author(s): Pavol "PM OnoTo" Marko
|
||||
* ============================
|
||||
*/
|
||||
|
||||
#ifndef __SH_STACK_H__
|
||||
#define __SH_STACK_H__
|
||||
|
||||
#define SH_STACK_DEFAULT_SIZE 4
|
||||
|
||||
//namespace SourceHook
|
||||
//{/
|
||||
// Vector
|
||||
template <class T> class CStack
|
||||
{
|
||||
T *m_Elements;
|
||||
size_t m_AllocatedSize;
|
||||
size_t m_UsedSize;
|
||||
public:
|
||||
friend class iterator;
|
||||
class iterator
|
||||
{
|
||||
CStack<T> *m_pParent;
|
||||
size_t m_Index;
|
||||
public:
|
||||
iterator(CStack<T> *pParent, size_t id) : m_pParent(pParent), m_Index(id)
|
||||
{
|
||||
}
|
||||
|
||||
iterator(CStack<T> *pParent) : m_pParent(pParent), m_Index(0)
|
||||
{
|
||||
}
|
||||
|
||||
iterator() : m_pParent(NULL), m_Index(0)
|
||||
{
|
||||
}
|
||||
|
||||
T &operator *()
|
||||
{
|
||||
return m_pParent->m_Elements[m_Index];
|
||||
}
|
||||
const T &operator *() const
|
||||
{
|
||||
return m_pParent->m_Elements[m_Index];
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_pParent->m_Elements + m_Index;
|
||||
}
|
||||
|
||||
const T * operator->() const
|
||||
{
|
||||
return m_pParent->m_Elements + m_Index;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Index;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Index;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_pParent == right.m_pParent && m_Index == right.m_Index);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return !(*this == right);
|
||||
}
|
||||
};
|
||||
CStack() : m_Elements(new T[SH_STACK_DEFAULT_SIZE]),
|
||||
m_AllocatedSize(SH_STACK_DEFAULT_SIZE),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
}
|
||||
CStack(size_t size) : m_Elements(new T[size]),
|
||||
m_AllocatedSize(size),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
CStack(const CStack &other) : m_Elements(NULL),
|
||||
m_AllocatedSize(0),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
reserve(other.m_AllocatedSize);
|
||||
m_UsedSize = other.m_UsedSize;
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
m_Elements[i] = other.m_Elements[i];
|
||||
}
|
||||
|
||||
~CStack()
|
||||
{
|
||||
if (m_Elements)
|
||||
delete [] m_Elements;
|
||||
}
|
||||
|
||||
void operator=(const CStack &other)
|
||||
{
|
||||
if (m_AllocatedSize < other.m_AllocatedSize)
|
||||
{
|
||||
if (m_Elements)
|
||||
delete [] m_Elements;
|
||||
m_Elements = new T[other.m_AllocatedSize];
|
||||
m_AllocatedSize = other.m_AllocatedSize;
|
||||
}
|
||||
m_UsedSize = other.m_UsedSize;
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
m_Elements[i] = other.m_Elements[i];
|
||||
}
|
||||
|
||||
bool push(const T &val)
|
||||
{
|
||||
if (m_UsedSize + 1 == m_AllocatedSize)
|
||||
{
|
||||
// zOHNOES! REALLOCATE!
|
||||
m_AllocatedSize *= 2;
|
||||
T *newElements = new T[m_AllocatedSize];
|
||||
if (!newElements)
|
||||
{
|
||||
m_AllocatedSize /= 2;
|
||||
return false;
|
||||
}
|
||||
if (m_Elements)
|
||||
{
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
newElements[i] = m_Elements[i];
|
||||
delete [] m_Elements;
|
||||
}
|
||||
m_Elements = newElements;
|
||||
}
|
||||
m_Elements[m_UsedSize++] = val;
|
||||
return true;
|
||||
}
|
||||
void pop()
|
||||
{
|
||||
--m_UsedSize;
|
||||
}
|
||||
|
||||
T &front()
|
||||
{
|
||||
return m_Elements[m_UsedSize - 1];
|
||||
}
|
||||
|
||||
const T &front() const
|
||||
{
|
||||
return m_Elements[m_UsedSize - 1];
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(this, 0);
|
||||
}
|
||||
iterator end()
|
||||
{
|
||||
return iterator(this, m_UsedSize);
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
return m_UsedSize;
|
||||
}
|
||||
size_t capacity()
|
||||
{
|
||||
return m_AllocatedSize;
|
||||
}
|
||||
bool empty()
|
||||
{
|
||||
return m_UsedSize == 0 ? true : false;
|
||||
}
|
||||
bool reserve(size_t size)
|
||||
{
|
||||
if (size > m_AllocatedSize)
|
||||
{
|
||||
T *newElements = new T[size];
|
||||
if (!newElements)
|
||||
return false;
|
||||
if (m_Elements)
|
||||
{
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
newElements[i] = m_Elements[i];
|
||||
delete [] m_Elements;
|
||||
}
|
||||
m_Elements = newElements;
|
||||
m_AllocatedSize = size;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//}; //namespace SourceHook
|
||||
|
||||
#endif
|
|
@ -4,7 +4,7 @@ import os.path
|
|||
binary = AMXX.MetaModule(builder, 'fun')
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'fun.cpp',
|
||||
]
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../metamod/metamod
|
|||
|
||||
PROJECT = fun
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp fun.cpp
|
||||
OBJECTS = amxxmodule.cpp fun.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -29,8 +30,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -105,7 +107,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -118,6 +120,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
0
dlls/fun/sdk/moduleconfig.h → dlls/fun/moduleconfig.h
Executable file → Normal file
0
dlls/fun/sdk/moduleconfig.h → dlls/fun/moduleconfig.h
Executable file → Normal file
|
@ -63,7 +63,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -104,7 +104,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -136,13 +136,12 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\fun.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\fun.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\fun.inc" />
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<ClCompile Include="..\fun.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -31,13 +31,10 @@
|
|||
<ClInclude Include="..\fun.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,7 @@ binary.compiler.defines += [
|
|||
]
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'GeoIP2/maxminddb.cpp',
|
||||
'geoip_main.cpp',
|
||||
'geoip_natives.cpp',
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../metamod/metamod
|
|||
|
||||
PROJECT = geoip
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp GeoIP2/maxminddb.cpp geoip_main.cpp geoip_natives.cpp geoip_util.cpp
|
||||
OBJECTS = amxxmodule.cpp GeoIP2/maxminddb.cpp geoip_main.cpp geoip_natives.cpp geoip_util.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
@ -29,8 +30,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -109,7 +111,7 @@ $(BIN_DIR)/%.o: %.c
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -122,6 +124,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
0
dlls/geoip/sdk/moduleconfig.h → dlls/geoip/moduleconfig.h
Executable file → Normal file
0
dlls/geoip/sdk/moduleconfig.h → dlls/geoip/moduleconfig.h
Executable file → Normal file
|
@ -52,7 +52,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
|
@ -75,7 +75,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<ClCompile Include="..\geoip_main.cpp" />
|
||||
<ClCompile Include="..\geoip_natives.cpp" />
|
||||
<ClCompile Include="..\geoip_util.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GeoIP2\maxminddb-compat-util.h" />
|
||||
|
@ -108,8 +108,8 @@
|
|||
<ClInclude Include="..\geoip_main.h" />
|
||||
<ClInclude Include="..\geoip_natives.h" />
|
||||
<ClInclude Include="..\geoip_util.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\geoip.inc" />
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GeoIP2\maxminddb.cpp">
|
||||
<Filter>GeoIP2</Filter>
|
||||
</ClCompile>
|
||||
|
@ -38,14 +35,11 @@
|
|||
<ClCompile Include="..\geoip_natives.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GeoIP2\maxminddb.h">
|
||||
<Filter>GeoIP2</Filter>
|
||||
</ClInclude>
|
||||
|
@ -64,6 +58,12 @@
|
|||
<ClInclude Include="..\geoip_main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\geoip.inc">
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,7 @@ binary.compiler.defines += [
|
|||
]
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'amxx_api.cpp',
|
||||
'config_parser.cpp',
|
||||
'hook_callbacks.cpp',
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
#include <sh_stack.h>
|
||||
#include "DataHandler.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
CStack< Data * > ReturnStack;
|
||||
CStack< Data * > OrigReturnStack;
|
||||
CStack< CVector< Data * > * > ParamStack;
|
||||
CStack< ke::Vector< Data * > * > ParamStack;
|
||||
CStack< int * > ReturnStatus;
|
||||
#define CHECK_STACK(__STACK__) \
|
||||
if ( ( __STACK__ ).size() <= 0) \
|
||||
|
@ -180,10 +180,10 @@ static cell AMX_NATIVE_CALL SetHamReturnString(AMX *amx, cell *params)
|
|||
static cell AMX_NATIVE_CALL SetHamParamInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
@ -200,10 +200,10 @@ static cell AMX_NATIVE_CALL SetHamParamTraceResult(AMX *amx, cell *params)
|
|||
return 0;
|
||||
}
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
@ -214,10 +214,10 @@ static cell AMX_NATIVE_CALL SetHamParamTraceResult(AMX *amx, cell *params)
|
|||
static cell AMX_NATIVE_CALL SetHamParamFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1] || params[1] < 1)
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1] || params[1] < 1)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
@ -228,10 +228,10 @@ static cell AMX_NATIVE_CALL SetHamParamFloat(AMX *amx, cell *params)
|
|||
static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
@ -242,10 +242,10 @@ static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
|
|||
static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
@ -256,10 +256,10 @@ static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
|
|||
static cell AMX_NATIVE_CALL SetHamParamString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec=ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
@ -277,11 +277,11 @@ static cell AMX_NATIVE_CALL SetHamParamItemInfo(AMX *amx, cell *params)
|
|||
}
|
||||
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec = ParamStack.front();
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#define RETURNHANDLER_H
|
||||
|
||||
#include "ham_utils.h"
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
#include <sh_stack.h>
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
return -1;
|
||||
}
|
||||
|
||||
String *str=reinterpret_cast<String *>(m_data);
|
||||
ke::AString *str=reinterpret_cast<ke::AString *>(m_data);
|
||||
|
||||
cell *i=data;
|
||||
size_t len=0;
|
||||
|
@ -203,7 +203,7 @@ public:
|
|||
/* nothing */
|
||||
}
|
||||
|
||||
str->assign(temp);
|
||||
*str = temp;
|
||||
|
||||
delete[] temp;
|
||||
|
||||
|
@ -330,7 +330,7 @@ public:
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
const char *i=(reinterpret_cast<String *>(m_data)->c_str());
|
||||
const char *i=(reinterpret_cast<ke::AString *>(m_data)->chars());
|
||||
|
||||
while (len-- &&
|
||||
(*data++=*i++)!='\0')
|
||||
|
@ -369,6 +369,6 @@ public:
|
|||
|
||||
extern CStack< Data * > ReturnStack;
|
||||
extern CStack< Data * > OrigReturnStack;
|
||||
extern CStack< CVector< Data * > * > ParamStack;
|
||||
extern CStack< ke::Vector< Data * > * > ParamStack;
|
||||
extern CStack< int * > ReturnStatus;
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -14,7 +15,7 @@ MM_ROOT = ../../../metamod/metamod
|
|||
|
||||
PROJECT = hamsandwich
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp amxx_api.cpp config_parser.cpp hook_callbacks.cpp hook_native.cpp \
|
||||
OBJECTS = amxxmodule.cpp amxx_api.cpp config_parser.cpp hook_callbacks.cpp hook_native.cpp \
|
||||
srvcmd.cpp call_funcs.cpp hook_create.cpp DataHandler.cpp pdata.cpp hook_specialbot.cpp
|
||||
|
||||
##############################################
|
||||
|
@ -30,8 +31,9 @@ CPP_OSX = clang
|
|||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/pm_shared -I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
|
@ -106,7 +108,7 @@ $(BIN_DIR)/%.o: %.cpp
|
|||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
|
@ -119,6 +121,5 @@ default: all
|
|||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <extdll.h>
|
||||
|
||||
#include "NEW_Util.h"
|
||||
#include "CVector.h"
|
||||
#include <am-vector.h>
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
#include "ham_const.h"
|
||||
|
@ -28,7 +28,7 @@
|
|||
edict_t *NEW_FirstEdict;
|
||||
bool NEW_Initialized;
|
||||
|
||||
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern CHamSpecialBotHandler SpecialbotHandler;
|
||||
|
||||
extern AMX_NATIVE_INFO RegisterNatives[];
|
||||
|
@ -106,17 +106,11 @@ void HamCommand(void);
|
|||
|
||||
void OnPluginsUnloaded(void)
|
||||
{
|
||||
|
||||
CVector <Hook *>::iterator end;
|
||||
for (int i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
for (size_t i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook*>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
for (size_t j = 0; j < hooks[i].length(); ++j)
|
||||
{
|
||||
delete (*j);
|
||||
delete hooks[i].at(j);
|
||||
}
|
||||
hooks[i].clear();
|
||||
}
|
||||
|
|
|
@ -16,13 +16,12 @@
|
|||
#include "offsets.h"
|
||||
#include "ham_utils.h"
|
||||
#include "hooklist.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
#include "CString.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
|
||||
extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
void FailPlugin(AMX *amx, int id, int err, const char *reason);
|
||||
|
||||
|
@ -34,13 +33,9 @@ inline void *GetFunction(void *pthis, int id, bool &istramp)
|
|||
void *func=GetVTableEntry(pthis, hooklist[id].vtid, Offsets.GetBase());
|
||||
|
||||
// Check to see if it's a trampoline
|
||||
CVector<Hook *>::iterator end=hooks[id].end();
|
||||
|
||||
for (CVector<Hook *>::iterator i=hooks[id].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[id].length(); ++i)
|
||||
{
|
||||
if (func==(*i)->tramp)
|
||||
if (func == hooks[id].at(i)->tramp)
|
||||
{
|
||||
istramp=true;
|
||||
return func;
|
||||
|
@ -57,17 +52,13 @@ inline void *_GetFunction(void *pthis, int id)
|
|||
void *func=ivtbl[hooklist[id].vtid];
|
||||
|
||||
// Iterate through the hooks for the id, see if the function is found
|
||||
CVector<Hook *>::iterator end=hooks[id].end();
|
||||
|
||||
for (CVector<Hook *>::iterator i=hooks[id].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[id].length(); ++i)
|
||||
{
|
||||
// If the function points to a trampoline, then return the original
|
||||
// function.
|
||||
if (func==(*i)->tramp)
|
||||
if (func == hooks[id].at(i)->tramp)
|
||||
{
|
||||
return (*i)->func;
|
||||
return hooks[id].at(i)->func;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "forward.h"
|
||||
#include "Trampolines.h"
|
||||
#include <am-vector.h>
|
||||
|
||||
#define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1))
|
||||
|
||||
|
@ -25,8 +26,8 @@
|
|||
class Hook
|
||||
{
|
||||
public:
|
||||
CVector<Forward *> pre; // pre forwards
|
||||
CVector<Forward *> post; // post forwards
|
||||
ke::Vector<Forward *> pre; // pre forwards
|
||||
ke::Vector<Forward *> post; // post forwards
|
||||
void *func; // original function
|
||||
void **vtable; // vtable of the original location
|
||||
int entry; // vtable entry of the function
|
||||
|
@ -86,21 +87,16 @@ public:
|
|||
|
||||
delete[] ent;
|
||||
|
||||
CVector<Forward *>::iterator end=pre.end();
|
||||
for (size_t i = 0; i < pre.length(); ++i)
|
||||
{
|
||||
delete pre.at(i);
|
||||
}
|
||||
|
||||
for (CVector<Forward *>::iterator i=pre.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < post.length(); ++i)
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
end=post.end();
|
||||
for (CVector<Forward *>::iterator i=post.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
delete (*i);
|
||||
delete post.at(i);
|
||||
}
|
||||
|
||||
pre.clear();
|
||||
post.clear();
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
#include <sh_stack.h>
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
|
@ -48,29 +48,28 @@ extern bool gDoForwards;
|
|||
// Parameter value pushes
|
||||
#define MAKE_VECTOR() \
|
||||
int iThis=PrivateToIndex(pthis); \
|
||||
CVector<Data *> *__vec=new CVector<Data *>; \
|
||||
ke::Vector<Data *> *__vec=new ke::Vector<Data *>; \
|
||||
ParamStack.push(__vec); \
|
||||
P_CBASE(pthis, iThis)
|
||||
|
||||
#define P_BOOL(___PARAM) __vec->push_back(new Data(RET_BOOL, (void *) & (___PARAM)));
|
||||
#define P_INT(___PARAM) __vec->push_back(new Data(RET_INTEGER, (void *) & (___PARAM)));
|
||||
#define P_SHORT(___PARAM) __vec->push_back(new Data(RET_SHORT, (void *) & (___PARAM)));
|
||||
#define P_FLOAT(___PARAM) __vec->push_back(new Data(RET_FLOAT, (void *) & (___PARAM)));
|
||||
#define P_VECTOR(___PARAM) __vec->push_back(new Data(RET_VECTOR, (void *) & (___PARAM)));
|
||||
#define P_STR(___PARAM) __vec->push_back(new Data(RET_STRING, (void *) & (___PARAM)));
|
||||
#define P_CBASE(__PARAM, __INDEX) __vec->push_back(new Data(RET_CBASE, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_ENTVAR(__PARAM, __INDEX) __vec->push_back(new Data(RET_ENTVAR, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_EDICT(__PARAM, __INDEX) __vec->push_back(new Data(RET_EDICT, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_TRACE(__PARAM) __vec->push_back(new Data(RET_TRACE, (void *) (__PARAM)));
|
||||
#define P_PTRVECTOR(__PARAM) __vec->push_back(new Data(RET_VECTOR, (void *) (__PARAM)));
|
||||
#define P_PTRFLOAT(__PARAM) __vec->push_back(new Data(RET_FLOAT, (void *) (__PARAM)));
|
||||
#define P_ITEMINFO(__PARAM) __vec->push_back(new Data(RET_ITEMINFO, (void *) & (__PARAM)));
|
||||
#define P_BOOL(___PARAM) __vec->append(new Data(RET_BOOL, (void *) & (___PARAM)));
|
||||
#define P_INT(___PARAM) __vec->append(new Data(RET_INTEGER, (void *) & (___PARAM)));
|
||||
#define P_SHORT(___PARAM) __vec->append(new Data(RET_SHORT, (void *) & (___PARAM)));
|
||||
#define P_FLOAT(___PARAM) __vec->append(new Data(RET_FLOAT, (void *) & (___PARAM)));
|
||||
#define P_VECTOR(___PARAM) __vec->append(new Data(RET_VECTOR, (void *) & (___PARAM)));
|
||||
#define P_STR(___PARAM) __vec->append(new Data(RET_STRING, (void *) & (___PARAM)));
|
||||
#define P_CBASE(__PARAM, __INDEX) __vec->append(new Data(RET_CBASE, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_ENTVAR(__PARAM, __INDEX) __vec->append(new Data(RET_ENTVAR, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_EDICT(__PARAM, __INDEX) __vec->append(new Data(RET_EDICT, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_TRACE(__PARAM) __vec->append(new Data(RET_TRACE, (void *) (__PARAM)));
|
||||
#define P_PTRVECTOR(__PARAM) __vec->append(new Data(RET_VECTOR, (void *) (__PARAM)));
|
||||
#define P_PTRFLOAT(__PARAM) __vec->append(new Data(RET_FLOAT, (void *) (__PARAM)));
|
||||
#define P_ITEMINFO(__PARAM) __vec->append(new Data(RET_ITEMINFO, (void *) & (__PARAM)));
|
||||
|
||||
#define KILL_VECTOR() \
|
||||
CVector<Data *>::iterator end=__vec->end(); \
|
||||
for (CVector<Data *>::iterator i=__vec->begin(); i!=end; ++i) \
|
||||
for (size_t i = 0; i < __vec->length(); ++i) \
|
||||
{ \
|
||||
delete (*i); \
|
||||
delete __vec->at(i); \
|
||||
} \
|
||||
delete __vec; \
|
||||
ParamStack.pop();
|
||||
|
@ -83,12 +82,11 @@ extern bool gDoForwards;
|
|||
int thisresult=HAM_UNSET; \
|
||||
if (DoForwards) \
|
||||
{ \
|
||||
CVector<Forward*>::iterator end=hook->pre.end(); \
|
||||
for (CVector<Forward*>::iterator i=hook->pre.begin(); i!=end; i++) \
|
||||
for (size_t i = 0; i < hook->pre.length(); ++i) \
|
||||
{ \
|
||||
if ((*i)->state == FSTATE_OK) \
|
||||
if (hook->pre.at(i)->state == FSTATE_OK) \
|
||||
{ \
|
||||
thisresult=MF_ExecuteForward((*i)->id,iThis
|
||||
thisresult = MF_ExecuteForward(hook->pre.at(i)->id, iThis
|
||||
|
||||
#define PRE_END() \
|
||||
); \
|
||||
|
@ -106,12 +104,11 @@ extern bool gDoForwards;
|
|||
} \
|
||||
if (DoForwards) \
|
||||
{ \
|
||||
CVector<Forward*>::iterator end=hook->post.end(); \
|
||||
for (CVector<Forward*>::iterator i=hook->post.begin(); i!=end; i++) \
|
||||
for (size_t i = 0; i < hook->post.length(); ++i) \
|
||||
{ \
|
||||
if ((*i)->state == FSTATE_OK) \
|
||||
if (hook->post.at(i)->state == FSTATE_OK) \
|
||||
{ \
|
||||
MF_ExecuteForward((*i)->id,iThis
|
||||
MF_ExecuteForward(hook->post.at(i)->id, iThis
|
||||
|
||||
#define POST_END() \
|
||||
); \
|
||||
|
@ -130,7 +127,7 @@ extern bool gDoForwards;
|
|||
#define CHECK_RETURN_STR() \
|
||||
if (thisresult < HAM_OVERRIDE) \
|
||||
{ \
|
||||
return origret.c_str(); \
|
||||
return origret.chars(); \
|
||||
}
|
||||
#define CHECK_RETURN_VEC() \
|
||||
if (thisresult < HAM_OVERRIDE) \
|
||||
|
@ -434,7 +431,7 @@ int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i
|
|||
int origret=0;
|
||||
PUSH_INT()
|
||||
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -443,16 +440,16 @@ int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i
|
|||
P_INT(i2)
|
||||
|
||||
PRE_START()
|
||||
,i1, a.c_str(), i2
|
||||
,i1, a.chars(), i2
|
||||
PRE_END()
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, int, const char *, int)>(hook->func)(pthis, 0, i1, a.c_str(), i2);
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, int, const char *, int)>(hook->func)(pthis, 0, i1, a.chars(), i2);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, int, const char *, int)>(hook->func)(pthis, i1, a.c_str(), i2);
|
||||
origret=reinterpret_cast<int (*)(void*, int, const char *, int)>(hook->func)(pthis, i1, a.chars(), i2);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
,i1, a.c_str(), i2
|
||||
,i1, a.chars(), i2
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -467,7 +464,7 @@ int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, i
|
|||
int origret = 0;
|
||||
PUSH_INT()
|
||||
|
||||
String a = sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -477,16 +474,16 @@ int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, i
|
|||
P_INT(i3)
|
||||
|
||||
PRE_START()
|
||||
, i1, a.c_str(), i2, i3
|
||||
, i1, a.chars(), i2, i3
|
||||
PRE_END()
|
||||
#if defined(_WIN32)
|
||||
origret = reinterpret_cast<int(__fastcall*)(void*, int, int, const char *, int, int)>(hook->func)(pthis, 0, i1, a.c_str(), i2, i3);
|
||||
origret = reinterpret_cast<int(__fastcall*)(void*, int, int, const char *, int, int)>(hook->func)(pthis, 0, i1, a.chars(), i2, i3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret = reinterpret_cast<int(*)(void*, int, const char *, int, int)>(hook->func)(pthis, i1, a.c_str(), i2, i3);
|
||||
origret = reinterpret_cast<int(*)(void*, int, const char *, int, int)>(hook->func)(pthis, i1, a.chars(), i2, i3);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, i1, a.c_str(), i2, i3
|
||||
, i1, a.chars(), i2, i3
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -815,8 +812,8 @@ void Hook_Void_Float_Vector_Trace_Int(Hook *hook, void *pthis, float f1, Vector
|
|||
|
||||
const char *Hook_Str_Void(Hook *hook, void *pthis)
|
||||
{
|
||||
String ret;
|
||||
String origret;
|
||||
ke::AString ret;
|
||||
ke::AString origret;
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -825,9 +822,9 @@ const char *Hook_Str_Void(Hook *hook, void *pthis)
|
|||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret.assign(reinterpret_cast<const char *(__fastcall*)(void*, int)>(hook->func)(pthis, 0));
|
||||
origret = reinterpret_cast<const char *(__fastcall*)(void*, int)>(hook->func)(pthis, 0);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret.assign(reinterpret_cast<const char *(*)(void*)>(hook->func)(pthis));
|
||||
origret = reinterpret_cast<const char *(*)(void*)>(hook->func)(pthis);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
|
@ -837,7 +834,7 @@ const char *Hook_Str_Void(Hook *hook, void *pthis)
|
|||
POP()
|
||||
CHECK_RETURN_STR();
|
||||
|
||||
return ret.c_str();
|
||||
return ret.chars();
|
||||
}
|
||||
|
||||
void *Hook_Cbase_Void(Hook *hook, void *pthis)
|
||||
|
@ -1402,7 +1399,7 @@ int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2)
|
|||
void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -1412,17 +1409,17 @@ void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, f
|
|||
P_FLOAT(f3)
|
||||
|
||||
PRE_START()
|
||||
,a.c_str(), f1, f2, f3
|
||||
,a.chars(), f1, f2, f3
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float)>(hook->func)(pthis, 0, a.c_str(), f1, f2, f3);
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float)>(hook->func)(pthis, 0, a.chars(), f1, f2, f3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float)>(hook->func)(pthis, a.c_str(), f1, f2, f3);
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float)>(hook->func)(pthis, a.chars(), f1, f2, f3);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
,a.c_str(), f1, f2, f3
|
||||
,a.chars(), f1, f2, f3
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -1433,7 +1430,7 @@ void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const ch
|
|||
{
|
||||
PUSH_VOID()
|
||||
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
int iEnt=PrivateToIndex(cb);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
@ -1446,17 +1443,17 @@ void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const ch
|
|||
P_CBASE(cb, iEnt)
|
||||
|
||||
PRE_START()
|
||||
,a.c_str(), f1, f2, f3, i1, iEnt
|
||||
,a.chars(), f1, f2, f3, i1, iEnt
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float, int, void *)>(hook->func)(pthis, 0, a.c_str(), f1, f2, f3, i1, cb);
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float, int, void *)>(hook->func)(pthis, 0, a.chars(), f1, f2, f3, i1, cb);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float, int, void *)>(hook->func)(pthis, a.c_str(), f1, f2, f3, i1, cb);
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float, int, void *)>(hook->func)(pthis, a.chars(), f1, f2, f3, i1, cb);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
,a.c_str(), f1, f2, f3, i1, iEnt
|
||||
,a.chars(), f1, f2, f3, i1, iEnt
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -1644,23 +1641,23 @@ int Hook_Int_Str(Hook *hook, void *pthis, const char *sz1)
|
|||
int origret=0;
|
||||
|
||||
PUSH_INT()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
P_STR(a)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.c_str());
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, const char *)>(hook->func)(pthis, a.c_str());
|
||||
origret=reinterpret_cast<int (*)(void*, const char *)>(hook->func)(pthis, a.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -1758,7 +1755,7 @@ void Hook_Void_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2)
|
|||
void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -1766,17 +1763,17 @@ void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2)
|
|||
P_BOOL(b2)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), b2
|
||||
, a.chars(), b2
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, bool)>(hook->func)(pthis, 0, a.c_str(), b2);
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, bool)>(hook->func)(pthis, 0, a.chars(), b2);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<void (*)(void*, const char *, bool)>(hook->func)(pthis, a.c_str(), b2);
|
||||
reinterpret_cast<void (*)(void*, const char *, bool)>(hook->func)(pthis, a.chars(), b2);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), b2
|
||||
, a.chars(), b2
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -1858,7 +1855,8 @@ int Hook_Int_Int_Int_Float_Int(Hook *hook, void *pthis, int i1, int i2, float f1
|
|||
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -1866,17 +1864,17 @@ void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2)
|
|||
P_INT(i2)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), i2
|
||||
, a.chars(), i2
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, int)>(hook->func)(pthis, 0, a.c_str(), i2);
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, int)>(hook->func)(pthis, 0, a.chars(), i2);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<void (*)(void*, const char *, int)>(hook->func)(pthis, a.c_str(), i2);
|
||||
reinterpret_cast<void (*)(void*, const char *, int)>(hook->func)(pthis, a.chars(), i2);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), i2
|
||||
, a.chars(), i2
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -1914,24 +1912,24 @@ void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
|
|||
void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
P_STR(a)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.c_str());
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<void (*)(void*, const char *)>(hook->func)(pthis, a.c_str());
|
||||
reinterpret_cast<void (*)(void*, const char *)>(hook->func)(pthis, a.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -1970,8 +1968,8 @@ int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2,
|
|||
|
||||
PUSH_INT()
|
||||
|
||||
String a=sz1;
|
||||
String b=sz2;
|
||||
ke::AString a(sz1);
|
||||
ke::AString b(sz2);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -1980,17 +1978,17 @@ int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2,
|
|||
P_STR(b)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.c_str()
|
||||
, a.chars(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, Vector, const char *)>(hook->func)(pthis, 0, a.c_str(), v2, b.c_str());
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, Vector, const char *)>(hook->func)(pthis, 0, a.chars(), v2, b.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, Vector, const char *)>(hook->func)(pthis, a.c_str(), v2, b.c_str());
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, Vector, const char *)>(hook->func)(pthis, a.chars(), v2, b.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.c_str()
|
||||
, a.chars(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -2007,8 +2005,8 @@ int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2)
|
|||
|
||||
PUSH_INT()
|
||||
|
||||
String a=sz1;
|
||||
String b=sz2;
|
||||
ke::AString a(sz1);
|
||||
ke::AString b(sz2);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -2016,17 +2014,17 @@ int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2)
|
|||
P_STR(b)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), b.c_str()
|
||||
, a.chars(), b.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *)>(hook->func)(pthis, 0, a.c_str(), b.c_str());
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *)>(hook->func)(pthis, 0, a.chars(), b.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, const char *)>(hook->func)(pthis, a.c_str(), b.c_str());
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, const char *)>(hook->func)(pthis, a.chars(), b.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), b.c_str()
|
||||
, a.chars(), b.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -2066,8 +2064,8 @@ void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char
|
|||
{
|
||||
PUSH_VOID()
|
||||
|
||||
String a=sz1;
|
||||
String b=sz2;
|
||||
ke::AString a(sz1);
|
||||
ke::AString b(sz2);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -2076,17 +2074,17 @@ void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char
|
|||
P_INT(i3)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), b.c_str(), i3
|
||||
, a.chars(), b.chars(), i3
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *, int)>(hook->func)(pthis, 0, a.c_str(), b.c_str(), i3);
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *, int)>(hook->func)(pthis, 0, a.chars(), b.chars(), i3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<int (*)(void*, const char *, const char *, int)>(hook->func)(pthis, a.c_str(), b.c_str(), i3);
|
||||
reinterpret_cast<int (*)(void*, const char *, const char *, int)>(hook->func)(pthis, a.chars(), b.chars(), i3);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), b.c_str(), i3
|
||||
, a.chars(), b.chars(), i3
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
|
@ -2746,9 +2744,9 @@ void Hook_Vector_Vector_Vector_Vector(Hook *hook, Vector *out, void *pthis, Vect
|
|||
|
||||
const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str)
|
||||
{
|
||||
String ret;
|
||||
String origret;
|
||||
String a = str;
|
||||
ke::AString ret;
|
||||
ke::AString origret;
|
||||
ke::AString a(str);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
|
@ -2757,24 +2755,24 @@ const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str)
|
|||
P_STR(a)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret.assign(reinterpret_cast<const char *(__fastcall*)(void*, int, const char*)>(hook->func)(pthis, 0, a.c_str() ));
|
||||
origret = reinterpret_cast<const char *(__fastcall*)(void*, int, const char*)>(hook->func)(pthis, 0, a.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret.assign(reinterpret_cast<const char *(*)(void*, const char*)>(hook->func)(pthis, a.c_str()));
|
||||
origret = reinterpret_cast<const char *(*)(void*, const char*)>(hook->func)(pthis, a.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
POP()
|
||||
CHECK_RETURN_STR();
|
||||
|
||||
return ret.c_str();
|
||||
return ret.chars();
|
||||
}
|
||||
|
||||
void Hook_Void_Short(Hook *hook, void *pthis, short i1)
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
#include "hook_callbacks.h"
|
||||
|
@ -31,12 +28,13 @@
|
|||
#include "hooklist.h"
|
||||
#include "ham_utils.h"
|
||||
#include "hook_specialbot.h"
|
||||
#include <am-vector.h>
|
||||
|
||||
OffsetManager Offsets;
|
||||
|
||||
bool gDoForwards=true;
|
||||
|
||||
CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
CHamSpecialBotHandler SpecialbotHandler;
|
||||
|
||||
#define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, RT_##__STUFF__, RB_##__STUFF__, PC_##__STUFF__, reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__
|
||||
|
@ -596,22 +594,19 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
|
|||
|
||||
// Check the list of this function's hooks, see if the function we have is a hook
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[func].length(); ++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
if (hooks[func].at(i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
hooks[func].at(i)->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
hooks[func].at(i)->pre.append(pfwd);
|
||||
}
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
|
@ -619,16 +614,16 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
|
|||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
hooks[func].append(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
hook->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
hook->pre.append(pfwd);
|
||||
}
|
||||
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
|
@ -687,22 +682,19 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
|
|||
|
||||
// Check the list of this function's hooks, see if the function we have is a hook
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[func].length(); ++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
if (hooks[func].at(i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
hooks[func].at(i)->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
hooks[func].at(i)->pre.append(pfwd);
|
||||
}
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
|
@ -716,16 +708,16 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
|
|||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
hooks[func].append(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
hook->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
hook->pre.append(pfwd);
|
||||
}
|
||||
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "hooklist.h"
|
||||
#include "hook.h"
|
||||
|
||||
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern hook_t hooklist[];
|
||||
|
||||
|
||||
|
@ -61,12 +61,11 @@ void CHamSpecialBotHandler::CheckClientKeyValue(int &clientIndex, char *infobuff
|
|||
if(m_RHP_list.empty())
|
||||
return;
|
||||
|
||||
CVector<CRegisterHamParams*>::iterator i = m_RHP_list.begin();
|
||||
CVector<CRegisterHamParams*>::iterator end = m_RHP_list.end();
|
||||
for(; i!=end; i++)
|
||||
for (size_t i = 0; i < m_RHP_list.length(); ++i)
|
||||
{
|
||||
RegisterChecked((*i)->amx, (*i)->func, (*i)->function, (*i)->post, (*i)->fwd);
|
||||
delete *i;
|
||||
CRegisterHamParams *item = m_RHP_list.at(i);
|
||||
RegisterChecked(item->amx, item->func, item->function, item->post, item->fwd);
|
||||
delete item;
|
||||
}
|
||||
|
||||
m_RHP_list.clear();
|
||||
|
@ -76,7 +75,7 @@ void CHamSpecialBotHandler::RegisterHamSpecialBot(AMX *amx, int &func, const cha
|
|||
{
|
||||
if(m_specialbot_vtable == NULL)
|
||||
{
|
||||
m_RHP_list.push_back( new CRegisterHamParams(amx, func, function, post, fwd) );
|
||||
m_RHP_list.append( new CRegisterHamParams(amx, func, function, post, fwd) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -90,22 +89,19 @@ void CHamSpecialBotHandler::RegisterChecked(AMX *amx, int &func, const char *fun
|
|||
|
||||
void *vfunction=(void *)ivtable[hooklist[func].vtid];
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[func].length(); ++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
if (hooks[func].at(i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
Forward *pfwd = new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
hooks[func].at(i)->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
hooks[func].at(i)->pre.append(pfwd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -115,15 +111,15 @@ void CHamSpecialBotHandler::RegisterChecked(AMX *amx, int &func, const char *fun
|
|||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
hooks[func].append(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
hook->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
hook->pre.append(pfwd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define HOOK_SPECIALBOT_H
|
||||
|
||||
#include "ham_utils.h"
|
||||
#include "CVector.h"
|
||||
#include <am-vector.h>
|
||||
|
||||
class CRegisterHamParams
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
private:
|
||||
void RegisterChecked(AMX *amx, int &func, const char *function, int &post, int &fwd);
|
||||
|
||||
CVector<CRegisterHamParams*> m_RHP_list;
|
||||
ke::Vector<CRegisterHamParams*> m_RHP_list;
|
||||
void **m_specialbot_vtable;
|
||||
};
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<ClCompile Include="..\hook_create.cpp" />
|
||||
<ClCompile Include="..\hook_native.cpp" />
|
||||
<ClCompile Include="..\hook_specialbot.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\config_parser.cpp" />
|
||||
<ClCompile Include="..\DataHandler.cpp" />
|
||||
<ClCompile Include="..\pdata.cpp" />
|
||||
|
@ -118,11 +118,8 @@
|
|||
<ClInclude Include="..\hook_specialbot.h" />
|
||||
<ClInclude Include="..\typetocell.h" />
|
||||
<ClInclude Include="..\Trampolines.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\sdk\CString.h" />
|
||||
<ClInclude Include="..\sdk\CVector.h" />
|
||||
<ClInclude Include="..\sdk\sh_stack.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\DataHandler.h" />
|
||||
<ClInclude Include="..\ham_const.h" />
|
||||
<ClInclude Include="..\ham_utils.h" />
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
<Filter Include="Module SDK\SDK Base">
|
||||
<UniqueIdentifier>{4fb419c2-3177-4389-9713-a7b032b57c1c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Module SDK\AMXX STL">
|
||||
<UniqueIdentifier>{a97b8a80-4ea7-4972-ab41-235e19831dff}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config File">
|
||||
<UniqueIdentifier>{f626de6a-9bea-468b-97e9-4f5d62307d78}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -47,9 +44,6 @@
|
|||
<ClCompile Include="..\hook_native.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\config_parser.cpp">
|
||||
<Filter>Config File</Filter>
|
||||
</ClCompile>
|
||||
|
@ -68,6 +62,9 @@
|
|||
<ClCompile Include="..\hook_specialbot.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\call_funcs.h">
|
||||
|
@ -94,21 +91,6 @@
|
|||
<ClInclude Include="..\Trampolines.h">
|
||||
<Filter>Hooks\Trampolines</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CString.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CVector.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\sh_stack.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\DataHandler.h">
|
||||
<Filter>Data Handler</Filter>
|
||||
</ClInclude>
|
||||
|
@ -127,6 +109,12 @@
|
|||
<ClInclude Include="..\hook_specialbot.h">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\ham_const.inc">
|
||||
|
|
|
@ -1,391 +0,0 @@
|
|||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef _INCLUDE_CSTRING_H
|
||||
#define _INCLUDE_CSTRING_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//by David "BAILOPAN" Anderson
|
||||
class String
|
||||
{
|
||||
public:
|
||||
String()
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
//assign("");
|
||||
}
|
||||
|
||||
~String()
|
||||
{
|
||||
if (v)
|
||||
delete [] v;
|
||||
}
|
||||
|
||||
String(const char *src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src);
|
||||
}
|
||||
|
||||
const char * _fread(FILE *fp)
|
||||
{
|
||||
Grow(512, false);
|
||||
char *ret = fgets(v, 511, fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String(const String &src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
const char *c_str() { return v?v:""; }
|
||||
|
||||
const char *c_str() const { return v?v:""; }
|
||||
|
||||
void append(const char *t)
|
||||
{
|
||||
Grow(size() + strlen(t) + 1);
|
||||
strcat(v, t);
|
||||
}
|
||||
|
||||
void append(const char c)
|
||||
{
|
||||
size_t len = size();
|
||||
Grow(len + 2);
|
||||
v[len] = c;
|
||||
v[len + 1] = '\0';
|
||||
}
|
||||
|
||||
void append(String &d)
|
||||
{
|
||||
append(d.c_str());
|
||||
}
|
||||
|
||||
void assign(const String &src)
|
||||
{
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
void assign(const char *d)
|
||||
{
|
||||
if (!d)
|
||||
{
|
||||
clear();
|
||||
} else {
|
||||
size_t len = strlen(d);
|
||||
Grow(len + 1, false);
|
||||
memcpy(v, d, len);
|
||||
v[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
if (v)
|
||||
v[0] = '\0';
|
||||
}
|
||||
|
||||
int compare (const char *d) const
|
||||
{
|
||||
if (!v)
|
||||
return strcmp("", d);
|
||||
else
|
||||
return strcmp(v, d);
|
||||
}
|
||||
|
||||
//Added this for amxx inclusion
|
||||
bool empty() const
|
||||
{
|
||||
if (!v)
|
||||
return true;
|
||||
|
||||
if (v[0] == '\0')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
if (v)
|
||||
return strlen(v);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find(const char c, int index = 0)
|
||||
{
|
||||
int len = static_cast<int>(size());
|
||||
if (len < 1)
|
||||
return npos;
|
||||
if (index >= len || index < 0)
|
||||
return npos;
|
||||
int i = 0;
|
||||
for (i=index; i<len; i++)
|
||||
{
|
||||
if (v[i] == c)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return npos;
|
||||
}
|
||||
|
||||
bool is_space(int c)
|
||||
{
|
||||
if (c == '\f' || c == '\n' ||
|
||||
c == '\t' || c == '\r' ||
|
||||
c == '\v' || c == ' ')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void reparse_newlines()
|
||||
{
|
||||
size_t len = size();
|
||||
int offs = 0;
|
||||
char c;
|
||||
if (!len)
|
||||
return;
|
||||
for (size_t i=0; i<len; i++)
|
||||
{
|
||||
c = v[i];
|
||||
if (c == '^' && (i != len-1))
|
||||
{
|
||||
c = v[++i];
|
||||
if (c == 'n')
|
||||
c = '\n';
|
||||
else if (c == 't')
|
||||
c = '\t';
|
||||
offs++;
|
||||
}
|
||||
v[i-offs] = c;
|
||||
}
|
||||
v[len-offs] = '\0';
|
||||
}
|
||||
|
||||
void trim()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
size_t len = strlen(v);
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[i]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char c0 = v[0];
|
||||
|
||||
if (is_space(c0))
|
||||
{
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==len-1)))
|
||||
{
|
||||
erase(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len = strlen(v);
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_space(v[len-1]))
|
||||
{
|
||||
for (i=len-1; i<len; i--)
|
||||
{
|
||||
if (!is_space(v[i])
|
||||
|| (is_space(v[i]) && i==0))
|
||||
{
|
||||
erase(i+1, j);
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[0]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void erase(unsigned int start, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = size();
|
||||
//check for bounds
|
||||
if (num == npos || start+num > len-start)
|
||||
num = len - start;
|
||||
//do the erasing
|
||||
bool copyflag = false;
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (i>=start && i<start+num)
|
||||
{
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
copyflag = true;
|
||||
} else if (copyflag) {
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
len -= num;
|
||||
v[len] = 0;
|
||||
}
|
||||
|
||||
String substr(unsigned int index, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
{
|
||||
String b("");
|
||||
return b;
|
||||
}
|
||||
|
||||
String ns;
|
||||
|
||||
size_t len = size();
|
||||
|
||||
if (index >= len || !v)
|
||||
return ns;
|
||||
|
||||
if (num == npos)
|
||||
{
|
||||
num = len - index;
|
||||
} else if (index+num >= len) {
|
||||
num = len - index;
|
||||
}
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int nslen = num + 2;
|
||||
|
||||
ns.Grow(nslen);
|
||||
|
||||
for (i=index; i<index+num; i++)
|
||||
ns.append(v[i]);
|
||||
|
||||
return ns;
|
||||
}
|
||||
|
||||
void toLower()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = strlen(v);
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (v[i] >= 65 && v[i] <= 90)
|
||||
v[i] &= ~(1<<5);
|
||||
}
|
||||
}
|
||||
|
||||
String & operator = (const String &src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
String & operator = (const char *src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
char operator [] (unsigned int index)
|
||||
{
|
||||
if (index > size() || !v)
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
return v[index];
|
||||
}
|
||||
}
|
||||
|
||||
int at(int a)
|
||||
{
|
||||
if (a < 0 || a >= (int)size() || !v)
|
||||
return -1;
|
||||
|
||||
return v[a];
|
||||
}
|
||||
|
||||
bool at(int at, char c)
|
||||
{
|
||||
if (at < 0 || at >= (int)size() || !v)
|
||||
return false;
|
||||
|
||||
v[at] = c;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
void Grow(unsigned int d, bool copy=true)
|
||||
{
|
||||
if (d <= a_size)
|
||||
return;
|
||||
char *n = new char[d + 1];
|
||||
if (copy && v)
|
||||
strcpy(n, v);
|
||||
if (v)
|
||||
delete [] v;
|
||||
else
|
||||
strcpy(n, "");
|
||||
v = n;
|
||||
a_size = d + 1;
|
||||
}
|
||||
|
||||
char *v;
|
||||
unsigned int a_size;
|
||||
public:
|
||||
static const int npos = -1;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CSTRING_H
|
|
@ -1,480 +0,0 @@
|
|||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef __CVECTOR_H__
|
||||
#define __CVECTOR_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
for (size_t i=0; i<m_CurrentUsedSize; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
{
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
protected:
|
||||
T *m_Ptr;
|
||||
public:
|
||||
// constructors / destructors
|
||||
iterator()
|
||||
{
|
||||
m_Ptr = NULL;
|
||||
}
|
||||
|
||||
iterator(T * ptr)
|
||||
{
|
||||
m_Ptr = ptr;
|
||||
}
|
||||
|
||||
// member functions
|
||||
T * base()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
const T * base() const
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
// operators
|
||||
T & operator*()
|
||||
{
|
||||
return *m_Ptr;
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(T * right) const
|
||||
{
|
||||
return (m_Ptr == right);
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr == right.m_Ptr);
|
||||
}
|
||||
|
||||
bool operator!=(T * right) const
|
||||
{
|
||||
return (m_Ptr != right);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr != right.m_Ptr);
|
||||
}
|
||||
|
||||
iterator & operator+=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator+(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
const T & operator[](size_t offset) const
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
bool operator<(const iterator & right) const
|
||||
{
|
||||
return m_Ptr < right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>(const iterator & right) const
|
||||
{
|
||||
return m_Ptr > right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator<=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr <= right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr >= right.m_Ptr;
|
||||
}
|
||||
|
||||
size_t operator-(const iterator & right) const
|
||||
{
|
||||
return m_Ptr - right.m_Ptr;
|
||||
}
|
||||
};
|
||||
|
||||
// constructors / destructors
|
||||
CVector<T>()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
m_Data = NULL;
|
||||
}
|
||||
|
||||
CVector<T>(const CVector<T> & other)
|
||||
{
|
||||
// copy data
|
||||
m_Data = new T [other.m_CurrentUsedSize];
|
||||
m_Size = other.m_CurrentUsedSize;
|
||||
m_CurrentUsedSize = other.m_CurrentUsedSize;
|
||||
for (size_t i=0; i<other.m_CurrentUsedSize; i++)
|
||||
m_Data[i] = other.m_Data[i];
|
||||
}
|
||||
|
||||
~CVector<T>()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
// interface
|
||||
size_t size() const
|
||||
{
|
||||
return m_CurrentUsedSize;
|
||||
}
|
||||
|
||||
size_t capacity() const
|
||||
{
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
|
||||
iterator iterAt(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
assert(0);
|
||||
return iterator(m_Data + pos);
|
||||
}
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pop_back()
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return (m_CurrentUsedSize == 0);
|
||||
}
|
||||
|
||||
T & at(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
const T & at(size_t pos) const
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
T & operator[](size_t pos)
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
const T & operator[](size_t pos) const
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
T & front()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
const T & front() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
T & back()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
const T & back() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __CVECTOR_H__
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,219 +0,0 @@
|
|||
/* ======== SourceMM ========
|
||||
* Copyright (C) 2004-2005 Metamod:Source Development Team
|
||||
* No warranties of any kind
|
||||
*
|
||||
* License: zlib/libpng
|
||||
*
|
||||
* Author(s): Pavol "PM OnoTo" Marko
|
||||
* ============================
|
||||
*/
|
||||
|
||||
#ifndef __SH_STACK_H__
|
||||
#define __SH_STACK_H__
|
||||
|
||||
#define SH_STACK_DEFAULT_SIZE 4
|
||||
|
||||
//namespace SourceHook
|
||||
//{/
|
||||
// Vector
|
||||
template <class T> class CStack
|
||||
{
|
||||
T *m_Elements;
|
||||
size_t m_AllocatedSize;
|
||||
size_t m_UsedSize;
|
||||
public:
|
||||
friend class iterator;
|
||||
class iterator
|
||||
{
|
||||
CStack<T> *m_pParent;
|
||||
size_t m_Index;
|
||||
public:
|
||||
iterator(CStack<T> *pParent, size_t id) : m_pParent(pParent), m_Index(id)
|
||||
{
|
||||
}
|
||||
|
||||
iterator(CStack<T> *pParent) : m_pParent(pParent), m_Index(0)
|
||||
{
|
||||
}
|
||||
|
||||
iterator() : m_pParent(NULL), m_Index(0)
|
||||
{
|
||||
}
|
||||
|
||||
T &operator *()
|
||||
{
|
||||
return m_pParent->m_Elements[m_Index];
|
||||
}
|
||||
const T &operator *() const
|
||||
{
|
||||
return m_pParent->m_Elements[m_Index];
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_pParent->m_Elements + m_Index;
|
||||
}
|
||||
|
||||
const T * operator->() const
|
||||
{
|
||||
return m_pParent->m_Elements + m_Index;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Index;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Index;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_pParent == right.m_pParent && m_Index == right.m_Index);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return !(*this == right);
|
||||
}
|
||||
};
|
||||
CStack() : m_Elements(new T[SH_STACK_DEFAULT_SIZE]),
|
||||
m_AllocatedSize(SH_STACK_DEFAULT_SIZE),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
}
|
||||
CStack(size_t size) : m_Elements(new T[size]),
|
||||
m_AllocatedSize(size),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
CStack(const CStack &other) : m_Elements(NULL),
|
||||
m_AllocatedSize(0),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
reserve(other.m_AllocatedSize);
|
||||
m_UsedSize = other.m_UsedSize;
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
m_Elements[i] = other.m_Elements[i];
|
||||
}
|
||||
|
||||
~CStack()
|
||||
{
|
||||
if (m_Elements)
|
||||
delete [] m_Elements;
|
||||
}
|
||||
|
||||
void operator=(const CStack &other)
|
||||
{
|
||||
if (m_AllocatedSize < other.m_AllocatedSize)
|
||||
{
|
||||
if (m_Elements)
|
||||
delete [] m_Elements;
|
||||
m_Elements = new T[other.m_AllocatedSize];
|
||||
m_AllocatedSize = other.m_AllocatedSize;
|
||||
}
|
||||
m_UsedSize = other.m_UsedSize;
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
m_Elements[i] = other.m_Elements[i];
|
||||
}
|
||||
|
||||
bool push(const T &val)
|
||||
{
|
||||
if (m_UsedSize + 1 == m_AllocatedSize)
|
||||
{
|
||||
// zOHNOES! REALLOCATE!
|
||||
m_AllocatedSize *= 2;
|
||||
T *newElements = new T[m_AllocatedSize];
|
||||
if (!newElements)
|
||||
{
|
||||
m_AllocatedSize /= 2;
|
||||
return false;
|
||||
}
|
||||
if (m_Elements)
|
||||
{
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
newElements[i] = m_Elements[i];
|
||||
delete [] m_Elements;
|
||||
}
|
||||
m_Elements = newElements;
|
||||
}
|
||||
m_Elements[m_UsedSize++] = val;
|
||||
return true;
|
||||
}
|
||||
void pop()
|
||||
{
|
||||
--m_UsedSize;
|
||||
}
|
||||
|
||||
T &front()
|
||||
{
|
||||
return m_Elements[m_UsedSize - 1];
|
||||
}
|
||||
|
||||
const T &front() const
|
||||
{
|
||||
return m_Elements[m_UsedSize - 1];
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(this, 0);
|
||||
}
|
||||
iterator end()
|
||||
{
|
||||
return iterator(this, m_UsedSize);
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
return m_UsedSize;
|
||||
}
|
||||
size_t capacity()
|
||||
{
|
||||
return m_AllocatedSize;
|
||||
}
|
||||
bool empty()
|
||||
{
|
||||
return m_UsedSize == 0 ? true : false;
|
||||
}
|
||||
bool reserve(size_t size)
|
||||
{
|
||||
if (size > m_AllocatedSize)
|
||||
{
|
||||
T *newElements = new T[size];
|
||||
if (!newElements)
|
||||
return false;
|
||||
if (m_Elements)
|
||||
{
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
newElements[i] = m_Elements[i];
|
||||
delete [] m_Elements;
|
||||
}
|
||||
m_Elements = newElements;
|
||||
m_AllocatedSize = size;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//}; //namespace SourceHook
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user