Obsolete due to update
This commit is contained in:
parent
58415dcfb9
commit
4457b0d879
|
@ -1,108 +0,0 @@
|
||||||
# Microsoft Developer Studio Project File - Name="Array" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
|
||||||
|
|
||||||
CFG=ARRAY - WIN32 RELEASE
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "Array.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "Array.mak" CFG="ARRAY - WIN32 RELEASE"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "Array - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
|
||||||
# PROP Scc_LocalPath ""
|
|
||||||
CPP=cl.exe
|
|
||||||
MTL=midl.exe
|
|
||||||
RSC=rc.exe
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "Release"
|
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 2
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "Release"
|
|
||||||
# PROP Intermediate_Dir "Release"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /YX /FD /c
|
|
||||||
# ADD CPP /nologo /MD /W3 /vmg /vms /GX /ZI /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /U "DLLEXPORT" /FR /YX /FD /c
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
|
||||||
# ADD LINK32 /nologo /dll /machine:I386
|
|
||||||
# SUBTRACT LINK32 /incremental:yes
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "Array - Win32 Release"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\amxxmodule.cpp
|
|
||||||
# SUBTRACT CPP /Z<none>
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\array.cpp
|
|
||||||
# SUBTRACT CPP /Z<none> /u
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\amxxmodule.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\CArray.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\CHashtable.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\CKeytable.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\element.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\moduleconfig.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Resource Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE="..\module\Judy-1.0.1\src\Judy.lib"
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
Binary file not shown.
|
@ -1,18 +0,0 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Array", "Array.vcproj", "{11B6F2E4-A603-4559-8E64-FFBF9541E238}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
|
||||||
Release = Release
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
|
||||||
{11B6F2E4-A603-4559-8E64-FFBF9541E238}.Release.ActiveCfg = Release|Win32
|
|
||||||
{11B6F2E4-A603-4559-8E64-FFBF9541E238}.Release.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
|
@ -1,151 +0,0 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="7.10"
|
|
||||||
Name="Array"
|
|
||||||
SccProjectName=""
|
|
||||||
SccLocalPath=""
|
|
||||||
Keyword="MFCProj">
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"/>
|
|
||||||
</Platforms>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="2"
|
|
||||||
UseOfMFC="2"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
|
||||||
CharacterSet="2">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="/vmg /vms"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;ARRAY_EXPORTS"
|
|
||||||
StringPooling="TRUE"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="TRUE"
|
|
||||||
UsePrecompiledHeader="2"
|
|
||||||
PrecompiledHeaderFile=".\Release/Array.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
BrowseInformation="1"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="TRUE"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
UndefinePreprocessorDefinitions="DLLEXPORT"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/array_amxx.dll"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="TRUE"
|
|
||||||
ProgramDatabaseFile=".\Release/Array.pdb"
|
|
||||||
ImportLibrary=".\Release/Array.lib"
|
|
||||||
TargetMachine="1"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
MkTypLibCompatible="TRUE"
|
|
||||||
SuppressStartupBanner="TRUE"
|
|
||||||
TargetEnvironment="1"
|
|
||||||
TypeLibraryName=".\Release/Array.tlb"
|
|
||||||
HeaderFileName=""/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1033"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
|
||||||
<File
|
|
||||||
RelativePath="amxxmodule.cpp">
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="/vmg /vms /vmg /vms"
|
|
||||||
Optimization="2"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BrowseInformation="1"
|
|
||||||
DebugInformationFormat="0"
|
|
||||||
UndefinePreprocessorDefinitions=""/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="array.cpp">
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="/vmg /vms /vmg /vms"
|
|
||||||
Optimization="2"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BrowseInformation="1"
|
|
||||||
DebugInformationFormat="0"
|
|
||||||
UndefinePreprocessorDefinitions=""/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl">
|
|
||||||
<File
|
|
||||||
RelativePath="amxxmodule.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="CArray.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="CHashtable.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="CKeytable.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="element.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="moduleconfig.h">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Resource Files"
|
|
||||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
|
||||||
<File
|
|
||||||
RelativePath=".\Judy-1.0.1\src\Judy.lib">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\osdefs.h">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,734 +0,0 @@
|
||||||
Pvoid_t MasterArray = (Pvoid_t) NULL; //Create the control array
|
|
||||||
|
|
||||||
//Create an array that stores whether or not indices are used.
|
|
||||||
Pvoid_t MasterArray_Binary = (Pvoid_t) NULL;
|
|
||||||
|
|
||||||
void DeleteMasterArray(void);
|
|
||||||
|
|
||||||
Word_t NewArray(Word_t Index, Word_t reserve = 0);
|
|
||||||
PPvoid_t Find_Array(Word_t Index, Word_t disable_check = 1, AMX *amx = 0);
|
|
||||||
void DeleteArray(Word_t Index);
|
|
||||||
void ClearArray(Word_t Index);
|
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
void Array_Set(PPvoid_t Array, char* Index, Type value);
|
|
||||||
|
|
||||||
PPvoid_t Array_Get(AMX* amx, PPvoid_t Array, Word_t Index, int ignore_error = 0);
|
|
||||||
void DeleteCell(Pvoid_t* Array, Word_t Index);
|
|
||||||
|
|
||||||
void Delete_MasterArray(void)
|
|
||||||
{
|
|
||||||
Word_t
|
|
||||||
Index = 0,
|
|
||||||
success = 0;
|
|
||||||
J1F(success, MasterArray_Binary, Index);
|
|
||||||
while( success )
|
|
||||||
{
|
|
||||||
DeleteArray( Index ); //Delete array.
|
|
||||||
J1F(success, MasterArray_Binary, Index); //Get next array
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Word_t NewArray(Word_t Index, Word_t reserve)
|
|
||||||
{
|
|
||||||
Word_t success; //Dummy for macros.
|
|
||||||
J1T(success, MasterArray_Binary, Index); //Check if bit is already set.
|
|
||||||
|
|
||||||
if (success && reserve)
|
|
||||||
return Index; //If the bit is set but it's 'reserved', return the index.
|
|
||||||
|
|
||||||
//Only do this if the bit is not set.
|
|
||||||
J1FE(success, MasterArray_Binary, Index);
|
|
||||||
J1S(success, MasterArray_Binary, Index);
|
|
||||||
|
|
||||||
PPvoid_t Array = JudyLIns(&MasterArray, Index, PJE0);
|
|
||||||
*Array = (PWord_t) NULL;
|
|
||||||
|
|
||||||
return Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
PPvoid_t Find_Array(Word_t Index, Word_t disable_check, AMX *amx)
|
|
||||||
{
|
|
||||||
Word_t success;
|
|
||||||
J1T(success, MasterArray_Binary, Index);
|
|
||||||
if (success || disable_check)
|
|
||||||
{ //Bit is valid
|
|
||||||
if(!success)
|
|
||||||
NewArray(Index);
|
|
||||||
|
|
||||||
return JudyLGet( MasterArray, Index, PJE0);
|
|
||||||
}
|
|
||||||
MF_LogError(amx,AMX_ERR_NATIVE,"Array %d is invalid", Index);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeleteArray(Word_t Index)
|
|
||||||
{
|
|
||||||
int success;
|
|
||||||
J1T(success, MasterArray_Binary, Index);
|
|
||||||
if (success)
|
|
||||||
{ //If the bit is set, clear and delete array.
|
|
||||||
ClearArray(Index);
|
|
||||||
J1U(success, MasterArray_Binary, Index);
|
|
||||||
JudyLDel(&MasterArray, Index, PJE0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearArray(Word_t Index)
|
|
||||||
{
|
|
||||||
int success;
|
|
||||||
J1T(success, MasterArray_Binary, Index);
|
|
||||||
if (success) //dont bother with unset arrays.
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(Index);
|
|
||||||
Word_t index = 0;
|
|
||||||
PPvoid_t PValue = JudyLFirst(*Array, &index, PJE0);
|
|
||||||
while (PValue != NULL)
|
|
||||||
{
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
elem_value.delete_element();
|
|
||||||
PValue = JudyLNext(*Array, &index, PJE0);
|
|
||||||
}
|
|
||||||
JudyLFreeArray(Array, PJE0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL new_array(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
return NewArray(params[1], params[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Type> //This will support input char*, Vector*, int, and cell_real*.
|
|
||||||
void Array_Set(PPvoid_t Array, int Index, Type value)
|
|
||||||
{
|
|
||||||
PPvoid_t PValue; // pointer to array element value
|
|
||||||
PValue = JudyLIns(Array, Index, PJE0);
|
|
||||||
*PValue = reinterpret_cast<void*>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
PPvoid_t Array_Get(AMX* amx, PPvoid_t Array, int Index, int ignore_error = 0)
|
|
||||||
{
|
|
||||||
PPvoid_t PValue = JudyLGet( *Array, Index, PJE0 );
|
|
||||||
if (PValue == NULL && !ignore_error)
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Array index %d is invalid", Index);
|
|
||||||
return PValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeleteCell(PPvoid_t Array, Word_t Index)
|
|
||||||
{
|
|
||||||
JudyLDel(Array, Index, PJE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL delete_array(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
DeleteArray( params[1] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL clear_array(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
ClearArray( params[1] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_Save(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
int filename_length;
|
|
||||||
char *file = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
|
||||||
file = MF_BuildPathname("%s", file);
|
|
||||||
unlink(file);
|
|
||||||
FILE *ArrayDB = fopen(file,"w");
|
|
||||||
if (!ArrayDB)
|
|
||||||
return 0;
|
|
||||||
Word_t Index = 0;
|
|
||||||
PPvoid_t PValue = JudyLFirst(*Array, &Index, PJE0);
|
|
||||||
element elem = NULL;
|
|
||||||
char elem_type = 0;
|
|
||||||
|
|
||||||
int error;
|
|
||||||
|
|
||||||
REAL vector_data[3] = { 0.0, 0.0, 0.0 };
|
|
||||||
while (PValue)
|
|
||||||
{
|
|
||||||
elem = *reinterpret_cast<element*>(*PValue);
|
|
||||||
elem_type = elem.get_type();
|
|
||||||
|
|
||||||
if (elem_type < elem_type_int || elem_type > elem_type_vector)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fwrite(&Index, sizeof(int), 1, ArrayDB);
|
|
||||||
fwrite(&elem_type, sizeof(char), 1, ArrayDB);
|
|
||||||
if (elem_type == elem_type_int)
|
|
||||||
{
|
|
||||||
int int_buffer = elem.get_int(error);
|
|
||||||
fwrite(&int_buffer, sizeof(int), 1, ArrayDB);
|
|
||||||
}
|
|
||||||
else if (elem_type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL flo_buffer = elem.get_flo(error);
|
|
||||||
fwrite(&flo_buffer, sizeof(REAL), 1, ArrayDB);
|
|
||||||
}
|
|
||||||
else if (elem_type == elem_type_char)
|
|
||||||
{
|
|
||||||
const char* str_buffer = elem.get_str(error);
|
|
||||||
short buf_len = strlen(str_buffer);
|
|
||||||
fwrite(&buf_len, sizeof(short), 1, ArrayDB);
|
|
||||||
fwrite(str_buffer, sizeof(char), buf_len, ArrayDB);
|
|
||||||
}
|
|
||||||
else if (elem_type == elem_type_vector)
|
|
||||||
{
|
|
||||||
const Vector* vec_buffer = elem.get_vec(error);
|
|
||||||
fwrite(vec_buffer, sizeof(Vector), 1, ArrayDB);
|
|
||||||
}
|
|
||||||
PValue = JudyLNext(*Array, &Index, PJE0);
|
|
||||||
}
|
|
||||||
fclose(ArrayDB);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_Load(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: file
|
|
||||||
int filename_length;
|
|
||||||
char *file = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
|
||||||
file = MF_BuildPathname("%s", file);
|
|
||||||
FILE *ArrayDB = fopen(file, "a+");
|
|
||||||
if (!ArrayDB)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
//params[2]: array to create (optional index supplied)
|
|
||||||
int ArrayIndex = NewArray(params[2], params[3]);
|
|
||||||
ClearArray(ArrayIndex); //make sure the array is empty.
|
|
||||||
PPvoid_t Array = Find_Array(ArrayIndex);
|
|
||||||
while(!feof(ArrayDB))
|
|
||||||
{
|
|
||||||
int index = 0; char type = 0;
|
|
||||||
element *elem_value = NULL;
|
|
||||||
fread(&index, sizeof(int), 1, ArrayDB);
|
|
||||||
if (feof(ArrayDB) || ferror(ArrayDB))
|
|
||||||
break;
|
|
||||||
|
|
||||||
fread(&type, sizeof(char), 1, ArrayDB);
|
|
||||||
|
|
||||||
if (type < elem_type_int || type > elem_type_vector)
|
|
||||||
{
|
|
||||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading array database \"%s\" into array %d. Bad file.", file, ArrayIndex);
|
|
||||||
return ArrayIndex;
|
|
||||||
}
|
|
||||||
else if (type == elem_type_int)
|
|
||||||
{
|
|
||||||
int value = 0; fread(&value, sizeof(int), 1, ArrayDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL value = 0; fread(&value, sizeof(REAL), 1, ArrayDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_char)
|
|
||||||
{
|
|
||||||
short length; fread(&length, sizeof(short), 1, ArrayDB);
|
|
||||||
char* value = new char[length+1]; fgets(value, length+1, ArrayDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
delete(value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_vector)
|
|
||||||
{
|
|
||||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, ArrayDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
}
|
|
||||||
Array_Set(Array,index,elem_value);
|
|
||||||
}
|
|
||||||
fclose(ArrayDB);
|
|
||||||
return ArrayIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_Save_ASCII(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: file
|
|
||||||
int filename_length;
|
|
||||||
char *inputfile = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
|
||||||
inputfile = MF_BuildPathname("%s", inputfile);
|
|
||||||
FILE *ArrayDB = fopen(inputfile, "a+");
|
|
||||||
if (!ArrayDB)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
char *outputfile = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
|
||||||
outputfile = MF_BuildPathname("%s", outputfile);
|
|
||||||
FILE *ReadableDB = fopen(outputfile, "w");
|
|
||||||
|
|
||||||
char *buffer = "\0";
|
|
||||||
char *buffer_two = "\0";
|
|
||||||
|
|
||||||
while(!feof(ArrayDB))
|
|
||||||
{
|
|
||||||
Word_t index = 0; char type = 0;
|
|
||||||
fread(&index, sizeof(int), 1, ArrayDB);
|
|
||||||
if (feof(ArrayDB) || ferror(ArrayDB))
|
|
||||||
break;
|
|
||||||
|
|
||||||
fread(&type, sizeof(char), 1, ArrayDB);
|
|
||||||
|
|
||||||
sprintf(buffer, "Index % 11d\tType %7s,", index, elem_types[type]);
|
|
||||||
if (type < elem_type_int || type > elem_type_vector)
|
|
||||||
{
|
|
||||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading array database \"%s\" into readable format. Bad file.", inputfile);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if (type == elem_type_int)
|
|
||||||
{
|
|
||||||
int value = 0; fread(&value, sizeof(int), 1, ArrayDB);
|
|
||||||
sprintf(buffer, "%s\t\t\tValue: %d\n", buffer, value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL value = 0; fread(&value, sizeof(REAL), 1, ArrayDB);
|
|
||||||
sprintf(buffer, "%s\t\t\tValue: %f\n", buffer, value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_char)
|
|
||||||
{
|
|
||||||
short length; fread(&length, sizeof(short), 1, ArrayDB);
|
|
||||||
char* value = new char[length+1]; fgets(value, length+1, ArrayDB);
|
|
||||||
sprintf(buffer, "%s Length: %d\tValue: \"%s\"\n", buffer, length, value);
|
|
||||||
delete value;
|
|
||||||
}
|
|
||||||
else if (type == elem_type_vector)
|
|
||||||
{
|
|
||||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, ArrayDB);
|
|
||||||
sprintf(buffer, "%s\t\t\tValue: {%f,%f,%f}\n", buffer, (*value).x, (*value).y, (*value).z);
|
|
||||||
delete value;
|
|
||||||
}
|
|
||||||
fwrite(buffer, sizeof(char), strlen(buffer), ReadableDB);
|
|
||||||
}
|
|
||||||
fclose(ArrayDB);
|
|
||||||
fclose(ReadableDB);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_SetVector(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
Vector *value = new Vector(
|
|
||||||
amx_ctof(input_vec[0]),
|
|
||||||
amx_ctof(input_vec[1]),
|
|
||||||
amx_ctof(input_vec[2])
|
|
||||||
);
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_vec(value);
|
|
||||||
}
|
|
||||||
Array_Set(Array,Index,elem_value);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_GetVector(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
int Index = params[2];
|
|
||||||
PPvoid_t PValue = Array_Get(amx, Array, Index, params[4]);
|
|
||||||
|
|
||||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) {
|
|
||||||
vAmx[0] = amx_ftoc(0);
|
|
||||||
vAmx[1] = amx_ftoc(0);
|
|
||||||
vAmx[2] = amx_ftoc(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
int error = 0;
|
|
||||||
const Vector retr_vec = *elem_value.get_vec(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
vAmx[0] = amx_ftoc(retr_vec.x);
|
|
||||||
vAmx[1] = amx_ftoc(retr_vec.y);
|
|
||||||
vAmx[2] = amx_ftoc(retr_vec.z);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_SetString(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
//params[3]: value
|
|
||||||
int iLen = 0;
|
|
||||||
char *value = MF_GetAmxString(amx,params[3],1,&iLen);
|
|
||||||
|
|
||||||
//element that is stored at index
|
|
||||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_str(value);
|
|
||||||
}
|
|
||||||
Array_Set(Array,Index,elem_value);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_GetString(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[5], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
Pvoid_t * PValue = Array_Get(amx, Array, Index, params[5]);
|
|
||||||
|
|
||||||
//params[3] and params[4] are the return string and length respectively.
|
|
||||||
|
|
||||||
if( PValue == NULL ) return MF_SetAmxString( amx , params[3] , "dne", params[4] );
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
const char* str_out = elem_value.get_str(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return MF_SetAmxString( amx , params[3] , str_out, params[4] );
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_SetFloat(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
//params[3]: value
|
|
||||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(amx_ctof(params[3]));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_flo(amx_ctof(params[3]));
|
|
||||||
}
|
|
||||||
Array_Set(Array,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_GetFloat(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
PPvoid_t PValue = Array_Get(amx, Array, Index, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) return amx_ftoc(0.0);
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
cell retr_float = amx_ftoc(elem_value.get_flo(error));
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return retr_float;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_SetInt(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(params[3]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_int(params[3]);
|
|
||||||
}
|
|
||||||
Array_Set(Array,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_GetInt(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
int Index = params[2];
|
|
||||||
|
|
||||||
Pvoid_t * PValue = Array_Get(amx, Array, Index, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) return 0;
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
cell retr_int = elem_value.get_int(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return retr_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_size(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
Pvoid_t * Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
return JudyLCount( *Array, params[2], params[3],PJE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_count(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
return JudyLCount( MasterArray, params[1], params[2],PJE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_memory(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
Pvoid_t * Array = Find_Array(params[1],params[2],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
return JudyLMemUsed(*Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL delete_cell(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
Pvoid_t * Array = Find_Array(params[1]);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
DeleteCell( Array, params[2] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_next(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = Word_t(params[2]);
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLNext(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
*success = (pointer == NULL) ? 0 : 1;
|
|
||||||
return cell(Index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_prev(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = Word_t(params[2]);
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLPrev(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
*success = (pointer == NULL) ? 0 : 1;
|
|
||||||
return cell(Index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_first(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = Word_t(params[2]);
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLFirst(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
*success = (pointer == NULL) ? 0 : 1;
|
|
||||||
return cell(Index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_last(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = Word_t(params[2]);
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLLast(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
*success = (pointer == NULL) ? 0 : 1;
|
|
||||||
return cell(Index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_nextempty(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = (Word_t)params[2];
|
|
||||||
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
*success = JudyLNextEmpty(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
return (cell)Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_prevempty(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = (Word_t)params[2];
|
|
||||||
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
*success = JudyLPrevEmpty(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
return (cell)Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_firstempty(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = (Word_t)params[2];
|
|
||||||
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
*success = JudyLFirstEmpty(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
return (cell)Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_lastempty(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = (Word_t)params[2];
|
|
||||||
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
*success = JudyLLastEmpty(*Array, &Index, PJE0);
|
|
||||||
|
|
||||||
return (cell)Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_isempty(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[3],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLGet(*Array, params[2], PJE0);
|
|
||||||
|
|
||||||
return (pointer == NULL) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL array_isfilled(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: array
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[3],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: index
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLGet(*Array, params[2], PJE0);
|
|
||||||
|
|
||||||
return (pointer != NULL) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Array_ByCount(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
Word_t Index = Word_t(params[3]);
|
|
||||||
cell *success = MF_GetAmxAddr(amx, params[4]);
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudyLByCount(*Array, params[2], &Index, PJE0);
|
|
||||||
|
|
||||||
*success = (pointer == NULL) ? 0 : 1;
|
|
||||||
return cell(Index);
|
|
||||||
}
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO array_exports[] = {
|
|
||||||
{ "array_set_string", Array_SetString },
|
|
||||||
{ "array_get_string", Array_GetString },
|
|
||||||
|
|
||||||
{ "array_set_int", Array_SetInt },
|
|
||||||
{ "array_get_int", Array_GetInt },
|
|
||||||
|
|
||||||
{ "array_set_float", Array_SetFloat },
|
|
||||||
{ "array_get_float", Array_GetFloat },
|
|
||||||
|
|
||||||
{ "array_set_vector", Array_SetVector },
|
|
||||||
{ "array_get_vector", Array_GetVector },
|
|
||||||
|
|
||||||
{ "array_isempty", array_isempty },
|
|
||||||
{ "array_isfilled", array_isfilled },
|
|
||||||
|
|
||||||
{ "array_remove", delete_cell },
|
|
||||||
|
|
||||||
{ "array_create", new_array },
|
|
||||||
{ "array_delete", delete_array },
|
|
||||||
{ "array_clear", clear_array },
|
|
||||||
|
|
||||||
{ "array_size", array_size },
|
|
||||||
{ "array_count", array_count },
|
|
||||||
{ "array_memory", array_memory },
|
|
||||||
|
|
||||||
{ "array_nextempty", array_nextempty },
|
|
||||||
{ "array_prevempty", array_prevempty },
|
|
||||||
{ "array_firstempty", array_firstempty },
|
|
||||||
{ "array_lastempty", array_lastempty },
|
|
||||||
{ "array_next", array_next },
|
|
||||||
{ "array_prev", array_prev },
|
|
||||||
{ "array_first", array_first },
|
|
||||||
{ "array_last", array_last },
|
|
||||||
|
|
||||||
{ "array_save", Array_Save },
|
|
||||||
{ "array_load", Array_Load },
|
|
||||||
|
|
||||||
{ "array_get_nth", Array_ByCount },
|
|
||||||
|
|
||||||
{ "array_save_ascii", Array_Save_ASCII },
|
|
||||||
|
|
||||||
{ NULL, NULL }
|
|
||||||
};
|
|
|
@ -1,375 +0,0 @@
|
||||||
#if !defined _JUDYHS_ENABLED_
|
|
||||||
#define _JUDYHS_ENABLED_
|
|
||||||
|
|
||||||
Pvoid_t MasterHashtable = (Pvoid_t) NULL; //Create the new array
|
|
||||||
|
|
||||||
//Create an array that stores whether or not indices are used.
|
|
||||||
Pvoid_t MasterHashtable_Binary = (Pvoid_t) NULL;
|
|
||||||
|
|
||||||
void Delete_MasterHashtable(void);
|
|
||||||
|
|
||||||
Word_t New_Hashtable(Word_t Index, Word_t reserve = 0);
|
|
||||||
Pvoid_t* Find_Hashtable(Word_t Index, Word_t disable_check = 1, AMX *amx = 0);
|
|
||||||
void Delete_Hashtable(Word_t Index);
|
|
||||||
void Clear_Hashtable(Word_t Index);
|
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
void Hashtable_Set(PPvoid_t Hashtable, char *Index, Word_t Length, Type value);
|
|
||||||
|
|
||||||
PPvoid_t Hashtable_Get(AMX* amx, Pvoid_t Hashtable, char *Index, int ignore_error = 0);
|
|
||||||
|
|
||||||
void Delete_MasterHashtable(void)
|
|
||||||
{
|
|
||||||
Word_t
|
|
||||||
Index = 0,
|
|
||||||
success;
|
|
||||||
J1F(success, MasterHashtable_Binary, Index);
|
|
||||||
while( success )
|
|
||||||
{
|
|
||||||
Delete_Hashtable(Index);
|
|
||||||
J1F(success, MasterHashtable_Binary, Index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Word_t New_Hashtable(Word_t Index, Word_t reserve)
|
|
||||||
{
|
|
||||||
Word_t success; //Dummy for macros.
|
|
||||||
J1T(success, MasterHashtable_Binary, Index);
|
|
||||||
|
|
||||||
if (success && reserve)
|
|
||||||
return Index; //If the bit is set but it's 'reserved', return the index.
|
|
||||||
|
|
||||||
//Only do this if the bit is not set or not reserved.
|
|
||||||
J1FE(success, MasterHashtable_Binary, Index);
|
|
||||||
J1S(success, MasterHashtable_Binary, Index);
|
|
||||||
|
|
||||||
PPvoid_t Hashtable = JudyLIns(&MasterHashtable, Index, PJE0);
|
|
||||||
*Hashtable = (PWord_t) NULL;
|
|
||||||
|
|
||||||
return Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
PPvoid_t Find_Hashtable(Word_t Index, Word_t disable_check, AMX* amx)
|
|
||||||
{
|
|
||||||
Word_t success;
|
|
||||||
J1T(success, MasterHashtable_Binary, Index);
|
|
||||||
if (success || disable_check)
|
|
||||||
{ //Bit is valid
|
|
||||||
if(!success)
|
|
||||||
New_Hashtable(Index);
|
|
||||||
|
|
||||||
return JudyLGet(MasterHashtable, Index, PJE0);
|
|
||||||
}
|
|
||||||
MF_LogError(amx,AMX_ERR_NATIVE,"Hashtable %d is invalid.", Index);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Delete_Hashtable(Word_t Index)
|
|
||||||
{
|
|
||||||
int success;
|
|
||||||
J1T(success, MasterHashtable_Binary, Index);
|
|
||||||
if (success)
|
|
||||||
{ //If the bit was set, clear, unset and delist hashtable.
|
|
||||||
Clear_Hashtable(Index);
|
|
||||||
J1U(success, MasterHashtable_Binary, Index);
|
|
||||||
JudyLDel(&MasterHashtable, Index, PJE0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Clear_Hashtable(Word_t Index)
|
|
||||||
{
|
|
||||||
int success;
|
|
||||||
J1T(success, MasterHashtable_Binary, Index);
|
|
||||||
if (success) //dont bother with unset hashtables.
|
|
||||||
{
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(Index);
|
|
||||||
JHSFA(success, *Hashtable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Type> //This will support input char*, Vector*, int, and cell_real*.
|
|
||||||
void Hashtable_Set(PPvoid_t Hashtable, char* Index, Type value)
|
|
||||||
{
|
|
||||||
int Len = strlen(Index)+1;
|
|
||||||
PPvoid_t PValue = JudyHSIns(Hashtable, Index, Len, PJE0);
|
|
||||||
*PValue = reinterpret_cast<void*>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
PPvoid_t Hashtable_Get(AMX* amx,PPvoid_t Hashtable, char *Index, int ignore_error = 0)
|
|
||||||
{
|
|
||||||
PPvoid_t PValue = JudyHSGet(*Hashtable, Index, strlen(Index)+1);
|
|
||||||
if (PValue == NULL && !ignore_error)
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Hashtable get on index \"%s\" is invalid", Index);
|
|
||||||
return PValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_Create(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
return New_Hashtable(params[1],params[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_Delete(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
Delete_Hashtable( params[1] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_Clear(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
Clear_Hashtable( params[1] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_SetVector(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
Vector *value = new Vector(
|
|
||||||
amx_ctof(input_vec[0]),
|
|
||||||
amx_ctof(input_vec[1]),
|
|
||||||
amx_ctof(input_vec[2])
|
|
||||||
);
|
|
||||||
int strlen;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_vec(value);
|
|
||||||
}
|
|
||||||
Hashtable_Set(Hashtable,Index,elem_value);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_GetVector(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
int strlen;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
|
||||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, params[4]);
|
|
||||||
|
|
||||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) {
|
|
||||||
vAmx[0] = amx_ftoc(0);
|
|
||||||
vAmx[1] = amx_ftoc(0);
|
|
||||||
vAmx[2] = amx_ftoc(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
int error = 0;
|
|
||||||
const Vector retr_vec = *elem_value.get_vec(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
vAmx[0] = amx_ftoc(retr_vec.x);
|
|
||||||
vAmx[1] = amx_ftoc(retr_vec.y);
|
|
||||||
vAmx[2] = amx_ftoc(retr_vec.z);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_SetString(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
//params[3]: value
|
|
||||||
int iLen = 0;
|
|
||||||
char *value = MF_GetAmxString(amx,params[3],1,&iLen);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_str(value);
|
|
||||||
}
|
|
||||||
Hashtable_Set(Hashtable,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_GetString(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[5], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
Pvoid_t * PValue = Hashtable_Get(amx, Hashtable, Index, params[5]);
|
|
||||||
|
|
||||||
//params[3] and params[4] are the return string and length respectively.
|
|
||||||
|
|
||||||
|
|
||||||
if( PValue == NULL )
|
|
||||||
return MF_SetAmxString(amx, params[3] , "dne", params[4] );
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
const char* str_out = elem_value.get_str(error);
|
|
||||||
return MF_SetAmxString( amx , params[3] , str_out, params[4] );
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_SetFloat(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//params[3]: value
|
|
||||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(amx_ctof(params[3]));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_flo(amx_ctof(params[3]));
|
|
||||||
}
|
|
||||||
Hashtable_Set(Hashtable,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_GetFloat(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[3], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) return amx_ftoc(0.0);
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
cell retr_float = amx_ftoc(elem_value.get_flo(error));
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return retr_float;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_SetInt(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(params[3]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_int(params[3]);
|
|
||||||
}
|
|
||||||
Hashtable_Set(Hashtable,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_GetInt(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[3], amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
Pvoid_t * PValue = Hashtable_Get(amx, Hashtable, Index, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) return 0;
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
cell retr_int = elem_value.get_int(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return retr_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_Memory(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
Pvoid_t * Array = Find_Hashtable(params[1],params[2],amx);
|
|
||||||
if (Array == NULL) return 0;
|
|
||||||
|
|
||||||
return JudyLMemUsed(*Array);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Hashtable_Remove(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: hashtable
|
|
||||||
PPvoid_t Hashtable = Find_Hashtable(params[1], 0, amx);
|
|
||||||
if (Hashtable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
JudyHSDel(Hashtable, Index, strlength+1, PJE0 );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO hashtable_exports[] = {
|
|
||||||
{ "hashtable_set_str", Hashtable_SetString },
|
|
||||||
{ "hashtable_get_str", Hashtable_GetString },
|
|
||||||
|
|
||||||
{ "hashtable_set_vec", Hashtable_SetVector },
|
|
||||||
{ "hashtable_get_vec", Hashtable_GetVector },
|
|
||||||
|
|
||||||
{ "hashtable_set_int", Hashtable_SetInt },
|
|
||||||
{ "hashtable_get_int", Hashtable_GetInt },
|
|
||||||
|
|
||||||
{ "hashtable_set_float", Hashtable_SetFloat },
|
|
||||||
{ "hashtable_get_float", Hashtable_GetFloat },
|
|
||||||
|
|
||||||
{ "hashtable_memory", Hashtable_Memory },
|
|
||||||
|
|
||||||
{ "hashtable_remove", Hashtable_Remove },
|
|
||||||
|
|
||||||
{ "hashtable_create", Hashtable_Create },
|
|
||||||
{ "hashtable_delete", Hashtable_Delete },
|
|
||||||
{ "hashtable_clear", Hashtable_Clear },
|
|
||||||
{ NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,703 +0,0 @@
|
||||||
#if !defined _JUDYSL_ENABLED_
|
|
||||||
#define _JUDYSL_ENABLED_
|
|
||||||
|
|
||||||
#define MAXLINELEN 1024
|
|
||||||
|
|
||||||
Pvoid_t MasterKeytable = (Pvoid_t) NULL; //Create the control array
|
|
||||||
|
|
||||||
//Create an array that stores whether or not indices are used.
|
|
||||||
Pvoid_t MasterKeytable_Binary = (Pvoid_t) NULL;
|
|
||||||
|
|
||||||
void Delete_MasterKeytable(void);
|
|
||||||
|
|
||||||
Word_t New_Keytable(Word_t Index, Word_t reserve = 0);
|
|
||||||
PPvoid_t Find_Keytable(Word_t Index, Word_t disable_check = 1, AMX *amx = 0);
|
|
||||||
void Delete_Keytable(Word_t Index);
|
|
||||||
void Clear_Keytable(Word_t Index);
|
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
void Keytable_Set(PPvoid_t Keytable, char *Index, Type value);
|
|
||||||
|
|
||||||
PPvoid_t Keytable_Get(AMX* amx, Pvoid_t Keytable, char *Index, int ignore_error = 0);
|
|
||||||
|
|
||||||
|
|
||||||
void Delete_MasterKeytable(void)
|
|
||||||
{
|
|
||||||
Word_t
|
|
||||||
Index = 0,
|
|
||||||
success;
|
|
||||||
J1F(success, MasterKeytable_Binary, Index);
|
|
||||||
while( success )
|
|
||||||
{
|
|
||||||
Delete_Keytable(Index);
|
|
||||||
J1F(success, MasterKeytable_Binary, Index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Word_t New_Keytable(Word_t Index, Word_t reserve)
|
|
||||||
{
|
|
||||||
Word_t success; //Dummy for macros.
|
|
||||||
J1T(success, MasterKeytable_Binary, Index);
|
|
||||||
|
|
||||||
if (success && reserve)
|
|
||||||
return Index; //If the bit is set but it's 'reserved', return the index.
|
|
||||||
|
|
||||||
//Only do this if the bit is not set or not reserved.
|
|
||||||
J1FE(success, MasterKeytable_Binary, Index);
|
|
||||||
J1S(success, MasterKeytable_Binary, Index);
|
|
||||||
|
|
||||||
PPvoid_t Keytable = JudyLIns(&MasterKeytable, Index, PJE0);
|
|
||||||
*Keytable = (PWord_t) NULL;
|
|
||||||
|
|
||||||
return Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
PPvoid_t Find_Keytable(Word_t Index, Word_t disable_check, AMX* amx)
|
|
||||||
{
|
|
||||||
Word_t success;
|
|
||||||
J1T(success, MasterKeytable_Binary, Index);
|
|
||||||
if (success || disable_check)
|
|
||||||
{ //Bit is valid
|
|
||||||
if(!success)
|
|
||||||
New_Keytable(Index);
|
|
||||||
|
|
||||||
return JudyLGet(MasterKeytable, Index, PJE0);
|
|
||||||
}
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Keytable \"%s\" is invalid", Index);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Delete_Keytable(Word_t Index)
|
|
||||||
{
|
|
||||||
int success;
|
|
||||||
J1T(success, MasterKeytable_Binary, Index);
|
|
||||||
if (success)
|
|
||||||
{ //If the bit was set, clear and delete keytable.
|
|
||||||
Clear_Keytable(Index);
|
|
||||||
J1U(success, MasterKeytable_Binary, Index);
|
|
||||||
JudyLDel(&MasterKeytable, Index, PJE0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Clear_Keytable(Word_t Index)
|
|
||||||
{
|
|
||||||
int success;
|
|
||||||
J1T(success, MasterKeytable_Binary, Index);
|
|
||||||
if (success) //dont bother with unset Keytables.
|
|
||||||
{
|
|
||||||
PPvoid_t Keytable = Find_Keytable(Index);
|
|
||||||
char *Key = "";
|
|
||||||
PPvoid_t PValue = JudySLFirst(*Keytable, Key, PJE0);
|
|
||||||
while (PValue != NULL)
|
|
||||||
{
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
elem_value.delete_element();
|
|
||||||
PValue = JudySLNext(*Keytable, Key, PJE0);
|
|
||||||
}
|
|
||||||
JudySLFreeArray(Keytable, PJE0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Save(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
int filename_length;
|
|
||||||
char *file = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
|
||||||
file = MF_BuildPathname("%s", file);
|
|
||||||
unlink(file);
|
|
||||||
FILE *KeytableDB = fopen(file,"w");
|
|
||||||
if (!KeytableDB)
|
|
||||||
return 0;
|
|
||||||
char* Key = new char[1024]; Key[0] = '\0';
|
|
||||||
PPvoid_t PValue = JudySLFirst(*Keytable, reinterpret_cast<uint8_t*>(Key), PJE0);
|
|
||||||
element elem = NULL;
|
|
||||||
char elem_type = 0;
|
|
||||||
|
|
||||||
int error;
|
|
||||||
|
|
||||||
REAL vector_data[3] = { 0.0, 0.0, 0.0 };
|
|
||||||
while (PValue)
|
|
||||||
{
|
|
||||||
elem = *reinterpret_cast<element*>(*PValue);
|
|
||||||
elem_type = elem.get_type();
|
|
||||||
|
|
||||||
if (elem_type < elem_type_int || elem_type > elem_type_vector)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
short key_len = strlen(Key);
|
|
||||||
fwrite(&key_len, sizeof(short), 1, KeytableDB);
|
|
||||||
fwrite(Key, sizeof(char), key_len, KeytableDB);
|
|
||||||
fwrite(&elem_type, sizeof(char), 1, KeytableDB);
|
|
||||||
if (elem_type == elem_type_int)
|
|
||||||
{
|
|
||||||
int int_buffer = elem.get_int(error);
|
|
||||||
fwrite(&int_buffer, sizeof(int), 1, KeytableDB);
|
|
||||||
}
|
|
||||||
else if (elem_type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL flo_buffer = elem.get_flo(error);
|
|
||||||
fwrite(&flo_buffer, sizeof(REAL), 1, KeytableDB);
|
|
||||||
}
|
|
||||||
else if (elem_type == elem_type_char)
|
|
||||||
{
|
|
||||||
const char* str_buffer = elem.get_str(error);
|
|
||||||
short buf_len = strlen(str_buffer);
|
|
||||||
fwrite(&buf_len, sizeof(short), 1, KeytableDB);
|
|
||||||
fwrite(str_buffer, sizeof(char), buf_len, KeytableDB);
|
|
||||||
}
|
|
||||||
else if (elem_type == elem_type_vector)
|
|
||||||
{
|
|
||||||
const Vector* vec_buffer = elem.get_vec(error);
|
|
||||||
fwrite(vec_buffer, sizeof(Vector), 1, KeytableDB);
|
|
||||||
}
|
|
||||||
PValue = JudySLNext(*Keytable, Key, PJE0);
|
|
||||||
}
|
|
||||||
fclose(KeytableDB);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Load(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: file
|
|
||||||
int filename_length;
|
|
||||||
char *file = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
|
||||||
file = MF_BuildPathname("%s", file);
|
|
||||||
FILE *KeytableDB = fopen(file, "a+");
|
|
||||||
if (!KeytableDB)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
//params[2]: keytable to create (optional index supplied)
|
|
||||||
int KeytableIndex = New_Keytable(params[2], params[3]);
|
|
||||||
Clear_Keytable(KeytableIndex); //make sure the keytable is empty.
|
|
||||||
PPvoid_t Keytable = Find_Keytable(KeytableIndex);
|
|
||||||
while(!feof(KeytableDB))
|
|
||||||
{
|
|
||||||
char* index = ""; char type = 0; short index_len;
|
|
||||||
element *elem_value = NULL;
|
|
||||||
fread(&index_len, sizeof(short), 1, KeytableDB);
|
|
||||||
index = new char[index_len+1];
|
|
||||||
fgets(index, index_len+1, KeytableDB);
|
|
||||||
if (feof(KeytableDB) || ferror(KeytableDB))
|
|
||||||
break;
|
|
||||||
fread(&type, sizeof(char), 1, KeytableDB);
|
|
||||||
if (type < elem_type_int || type > elem_type_vector)
|
|
||||||
{
|
|
||||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading keytable database \"%s\" into keytable %d. Bad file.", file, KeytableIndex);
|
|
||||||
return KeytableIndex;
|
|
||||||
}
|
|
||||||
else if (type == elem_type_int)
|
|
||||||
{
|
|
||||||
int value = 0; fread(&value, sizeof(int), 1, KeytableDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL value = 0; fread(&value, sizeof(REAL), 1, KeytableDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_char)
|
|
||||||
{
|
|
||||||
short length; fread(&length, sizeof(short), 1, KeytableDB);
|
|
||||||
char* value = new char[length+1]; fgets(value, length+1, KeytableDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
delete(value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_vector)
|
|
||||||
{
|
|
||||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, KeytableDB);
|
|
||||||
elem_value = new element(value);
|
|
||||||
}
|
|
||||||
Keytable_Set(Keytable,index,elem_value);
|
|
||||||
delete (index);
|
|
||||||
}
|
|
||||||
fclose(KeytableDB);
|
|
||||||
return KeytableIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Save_ASCII(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: file
|
|
||||||
int filename_length;
|
|
||||||
char *inputfile = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
|
||||||
inputfile = MF_BuildPathname("%s", inputfile);
|
|
||||||
FILE *KeytableDB = fopen(inputfile, "a+");
|
|
||||||
if (!KeytableDB)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
char *outputfile = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
|
||||||
outputfile = MF_BuildPathname("%s", outputfile);
|
|
||||||
FILE *ReadableDB = fopen(outputfile, "w");
|
|
||||||
|
|
||||||
char *buffer = "\0";
|
|
||||||
|
|
||||||
while(!feof(KeytableDB))
|
|
||||||
{
|
|
||||||
char* key = NULL; char type = 0; short key_len;
|
|
||||||
fread(&key_len, sizeof(short), 1, KeytableDB);
|
|
||||||
key = new char[key_len+1];
|
|
||||||
fgets(key, key_len+1, KeytableDB);
|
|
||||||
if (feof(KeytableDB) || ferror(KeytableDB))
|
|
||||||
break;
|
|
||||||
fread(&type, sizeof(char), 1, KeytableDB);
|
|
||||||
|
|
||||||
sprintf(buffer, "Key %-32s Length %3d, Type %7s", key, key_len, elem_types[type]);
|
|
||||||
if (type < elem_type_int || type > elem_type_vector)
|
|
||||||
{
|
|
||||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading array database \"%s\" into readable format. Bad file.", inputfile);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if (type == elem_type_int)
|
|
||||||
{
|
|
||||||
int value = 0; fread(&value, sizeof(int), 1, KeytableDB);
|
|
||||||
fprintf(ReadableDB, "%s\t\t\t\tValue: %d\n", buffer, value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL value = 0; fread(&value, sizeof(REAL), 1, KeytableDB);
|
|
||||||
fprintf(ReadableDB, "%s\t\t\t\tValue: %f\n", buffer, value);
|
|
||||||
}
|
|
||||||
else if (type == elem_type_char)
|
|
||||||
{
|
|
||||||
short length; fread(&length, sizeof(short), 1, KeytableDB);
|
|
||||||
char* value = new char[length+1]; fgets(value, length+1, KeytableDB);
|
|
||||||
fprintf(ReadableDB, "%s Length %3d\tValue: \"%s\"\n", buffer, length, value);
|
|
||||||
delete value;
|
|
||||||
}
|
|
||||||
else if (type == elem_type_vector)
|
|
||||||
{
|
|
||||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, KeytableDB);
|
|
||||||
fprintf(ReadableDB, "%s\t\t\t\tValue: {%f,%f,%f}\n", buffer, (*value).x, (*value).y, (*value).z);
|
|
||||||
delete value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(KeytableDB);
|
|
||||||
fclose(ReadableDB);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Type> //This will support input char*, Vector*, int, and cell_real*.
|
|
||||||
void Keytable_Set(PPvoid_t Keytable, char* Index, Type value)
|
|
||||||
{
|
|
||||||
PPvoid_t PValue; // pointer to keytable element value
|
|
||||||
PValue = JudySLIns(Keytable, Index, PJE0);
|
|
||||||
*PValue = reinterpret_cast<void*>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
PPvoid_t Keytable_Get(AMX* amx, PPvoid_t Keytable, char *Index, int ignore_error = 0)
|
|
||||||
{
|
|
||||||
PPvoid_t PValue = JudySLGet( *Keytable, Index, PJE0 );
|
|
||||||
if (PValue == NULL && !ignore_error)
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Keytable get on key \"%s\" is invalid", Index);
|
|
||||||
return PValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Create(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
return New_Keytable(params[1],params[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Delete(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
Delete_Keytable( params[1] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Clear(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
Clear_Keytable( params[1] );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_SetVector(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
Vector *value = new Vector(
|
|
||||||
amx_ctof(input_vec[0]),
|
|
||||||
amx_ctof(input_vec[1]),
|
|
||||||
amx_ctof(input_vec[2])
|
|
||||||
);
|
|
||||||
int strlen;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_vec(value);
|
|
||||||
}
|
|
||||||
Keytable_Set(Keytable,Index,elem_value);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_GetVector(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
int strlen;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
|
||||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, params[4]);
|
|
||||||
|
|
||||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) {
|
|
||||||
vAmx[0] = amx_ftoc(0);
|
|
||||||
vAmx[1] = amx_ftoc(0);
|
|
||||||
vAmx[2] = amx_ftoc(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
int error = 0;
|
|
||||||
const Vector retr_vec = *elem_value.get_vec(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
vAmx[0] = amx_ftoc(retr_vec.x);
|
|
||||||
vAmx[1] = amx_ftoc(retr_vec.y);
|
|
||||||
vAmx[2] = amx_ftoc(retr_vec.z);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_SetString(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
//params[3]: value
|
|
||||||
int iLen = 0;
|
|
||||||
char *value = MF_GetAmxString(amx,params[3],1,&iLen);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_str(value);
|
|
||||||
}
|
|
||||||
Keytable_Set(Keytable,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_GetString(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
Pvoid_t * PValue = Keytable_Get(amx, Keytable, Index, params[5]);
|
|
||||||
|
|
||||||
//params[3] and params[4] are the return string and length respectively.
|
|
||||||
|
|
||||||
|
|
||||||
if( PValue == NULL )
|
|
||||||
return MF_SetAmxString(amx, params[3] , "dne", params[4] );
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
const char* str_out = elem_value.get_str(error);
|
|
||||||
return MF_SetAmxString( amx , params[3] , str_out, params[4] );
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_SetFloat(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//params[3]: value
|
|
||||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(amx_ctof(params[3]));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_flo(amx_ctof(params[3]));
|
|
||||||
}
|
|
||||||
Keytable_Set(Keytable,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_GetFloat(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) return amx_ftoc(0.0);
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
cell retr_float = amx_ftoc(elem_value.get_flo(error));
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return retr_float;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_SetInt(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
|
||||||
element *elem_value = NULL;
|
|
||||||
if ( PValue == NULL )
|
|
||||||
elem_value = new element(params[3]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elem_value = reinterpret_cast<element*>(*PValue);
|
|
||||||
(*elem_value).set_int(params[3]);
|
|
||||||
}
|
|
||||||
Keytable_Set(Keytable,Index,elem_value);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_GetInt(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
Pvoid_t * PValue = Keytable_Get(amx, Keytable, Index, params[3]);
|
|
||||||
|
|
||||||
if( PValue == NULL ) return 0;
|
|
||||||
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
cell retr_int = elem_value.get_int(error);
|
|
||||||
if (error)
|
|
||||||
elem_value.issue_type_error(amx, params[1], Index);
|
|
||||||
return retr_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Memory(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
Pvoid_t * Keytable = Find_Keytable(params[1],params[2],amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
return JudyLMemUsed(*Keytable);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Remove(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], 0, amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//Have to delete the element
|
|
||||||
PPvoid_t PValue = JudySLGet(*Keytable, Index, PJE0);
|
|
||||||
if (PValue == NULL) return 1;
|
|
||||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
|
||||||
elem_value.delete_element();
|
|
||||||
|
|
||||||
JudySLDel(Keytable, Index, PJE0 );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Next(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//params[3], params[4]: return key and length
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudySLNext(*Keytable, Index, PJE0);
|
|
||||||
|
|
||||||
if (pointer == NULL) {
|
|
||||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Prev(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//params[3], params[4]: return key and length
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudySLPrev(*Keytable, Index, PJE0);
|
|
||||||
|
|
||||||
if (pointer == NULL) {
|
|
||||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_First(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//params[3], params[4]: return key and length
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudySLFirst(*Keytable, Index, PJE0);
|
|
||||||
|
|
||||||
if (pointer == NULL) {
|
|
||||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Keytable_Last(AMX *amx,cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
//params[3], params[4]: return key and length
|
|
||||||
|
|
||||||
PPvoid_t pointer;
|
|
||||||
pointer = JudySLLast(*Keytable, Index, PJE0);
|
|
||||||
|
|
||||||
if (pointer == NULL) {
|
|
||||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Key_IsEmpty(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
PPvoid_t pointer = JudySLGet(*Keytable, Index, PJE0);
|
|
||||||
|
|
||||||
return (pointer == NULL) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL Key_IsFilled(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
//params[1]: keytable
|
|
||||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
|
||||||
if (Keytable == NULL) return 0;
|
|
||||||
|
|
||||||
//params[2]: key
|
|
||||||
int strlength;
|
|
||||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
|
||||||
|
|
||||||
PPvoid_t pointer = JudySLGet(*Keytable, Index, PJE0);
|
|
||||||
|
|
||||||
return (pointer != NULL) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO keytable_exports[] = {
|
|
||||||
{ "keytable_set_string", Keytable_SetString },
|
|
||||||
{ "keytable_get_string", Keytable_GetString },
|
|
||||||
|
|
||||||
{ "keytable_set_vector", Keytable_SetVector },
|
|
||||||
{ "keytable_get_vector", Keytable_GetVector },
|
|
||||||
|
|
||||||
{ "keytable_set_int", Keytable_SetInt },
|
|
||||||
{ "keytable_get_int", Keytable_GetInt },
|
|
||||||
|
|
||||||
{ "keytable_set_float", Keytable_SetFloat },
|
|
||||||
{ "keytable_get_float", Keytable_GetFloat },
|
|
||||||
|
|
||||||
{ "keytable_isempty", Key_IsEmpty },
|
|
||||||
{ "keytable_isfilled", Key_IsFilled },
|
|
||||||
|
|
||||||
{ "keytable_memory", Keytable_Memory },
|
|
||||||
|
|
||||||
{ "keytable_remove", Keytable_Remove },
|
|
||||||
|
|
||||||
{ "keytable_create", Keytable_Create },
|
|
||||||
{ "keytable_delete", Keytable_Delete },
|
|
||||||
{ "keytable_clear", Keytable_Clear },
|
|
||||||
|
|
||||||
{ "keytable_next", Keytable_Next },
|
|
||||||
{ "keytable_prev", Keytable_Prev },
|
|
||||||
{ "keytable_first", Keytable_First },
|
|
||||||
{ "keytable_last", Keytable_Last },
|
|
||||||
|
|
||||||
{ "keytable_save", Keytable_Save },
|
|
||||||
{ "keytable_load", Keytable_Load },
|
|
||||||
|
|
||||||
{ "keytable_save_ascii", Keytable_Save_ASCII },
|
|
||||||
|
|
||||||
{ NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,31 +0,0 @@
|
||||||
#include "osdefs.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include <extdll.h>
|
|
||||||
#include "amxxmodule.h"
|
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
#define JU_WIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define JUDYERROR_NOTEST 1
|
|
||||||
#include <Judy.h>
|
|
||||||
|
|
||||||
#include "element.h"
|
|
||||||
|
|
||||||
#include "CKeytable.h"
|
|
||||||
#include "CArray.h"
|
|
||||||
#include "CHashtable.h"
|
|
||||||
|
|
||||||
void OnAmxxAttach()
|
|
||||||
{
|
|
||||||
MF_AddNatives(array_exports);
|
|
||||||
MF_AddNatives(keytable_exports);
|
|
||||||
MF_AddNatives(hashtable_exports);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnAmxxDetach()
|
|
||||||
{
|
|
||||||
Delete_MasterArray();
|
|
||||||
Delete_MasterKeytable();
|
|
||||||
Delete_MasterHashtable();
|
|
||||||
}
|
|
|
@ -1,210 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* element.h
|
|
||||||
* This class acts as sort of an interface for storing values in the judy
|
|
||||||
* arrays. By storing an 'element' with error handling and type checking,
|
|
||||||
* crashes and errors are less likely. In addition, by storing the type of
|
|
||||||
* data it is also possible to save or load from a file.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#if !defined(_CLASSDEF_ELEMENT_)
|
|
||||||
#define _CLASSDEF_ELEMENT_
|
|
||||||
|
|
||||||
const Vector* null_vec = new Vector();
|
|
||||||
|
|
||||||
enum {
|
|
||||||
elem_type_none, //only used on init.
|
|
||||||
elem_type_int,
|
|
||||||
elem_type_real,
|
|
||||||
elem_type_char,
|
|
||||||
elem_type_vector
|
|
||||||
};
|
|
||||||
|
|
||||||
const char* elem_types[] =
|
|
||||||
{
|
|
||||||
"-NO VALUE-",
|
|
||||||
"INTEGER",
|
|
||||||
"FLOAT",
|
|
||||||
"STRING",
|
|
||||||
"VECTOR"
|
|
||||||
};
|
|
||||||
|
|
||||||
class element
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void set_int(int Value);
|
|
||||||
void set_flo(REAL Value);
|
|
||||||
void set_str(char* Value);
|
|
||||||
void set_vec(Vector* Value);
|
|
||||||
|
|
||||||
element (int Value) { set_int(Value); }
|
|
||||||
element (REAL Value) { set_flo(Value); }
|
|
||||||
element (char* Value) { set_str(Value); }
|
|
||||||
element (Vector* Value) { set_vec(Value); }
|
|
||||||
element(void);
|
|
||||||
|
|
||||||
REAL get_flo(int &error);
|
|
||||||
int get_int(int &error);
|
|
||||||
const char* get_str(int &error);
|
|
||||||
const Vector* get_vec(int &error);
|
|
||||||
|
|
||||||
int get_type(void);
|
|
||||||
Pvoid_t get_ptr(void);
|
|
||||||
|
|
||||||
virtual ~element();
|
|
||||||
|
|
||||||
void delete_element(void) { clear(); element::~element(); }
|
|
||||||
|
|
||||||
char* get_elem_as_string(void);
|
|
||||||
|
|
||||||
//This is handy because it takes all the data needed and issues the error.
|
|
||||||
void issue_type_error(AMX *amx, int Keytable, char* Index);
|
|
||||||
void issue_type_error(AMX *amx, int Array, int Index);
|
|
||||||
private:
|
|
||||||
Pvoid_t element_ptr; //Contains a pointer to whatever data is actually stored.
|
|
||||||
void clear(void);
|
|
||||||
char element_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
Pvoid_t element::get_ptr(void)
|
|
||||||
{
|
|
||||||
return element_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void element::issue_type_error(AMX *amx, int Keytable, char* Index)
|
|
||||||
{
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE,
|
|
||||||
"Function attempted to read NON-%s value at key \"%s\" in keytable %d, actual value: %s",
|
|
||||||
elem_types[element_type], Index, Keytable, get_elem_as_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
void element::issue_type_error(AMX *amx, int Array, int Index)
|
|
||||||
{
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE,
|
|
||||||
"Function attempted to read NON-%s value at index %d in array %d, actual value: %s",
|
|
||||||
elem_types[element_type], Index, Array, get_elem_as_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
char* element::get_elem_as_string(void)
|
|
||||||
{
|
|
||||||
char* value = "";
|
|
||||||
Vector vector_val;
|
|
||||||
int error; //Is not checked.
|
|
||||||
switch (element_type)
|
|
||||||
{
|
|
||||||
case elem_type_int:
|
|
||||||
sprintf(value, "%d", get_int(error));
|
|
||||||
break;
|
|
||||||
case elem_type_real:
|
|
||||||
sprintf(value, "%f", get_int(error));
|
|
||||||
break;
|
|
||||||
case elem_type_char:
|
|
||||||
sprintf(value, "\"%s\"", get_str(error));
|
|
||||||
break;
|
|
||||||
case elem_type_vector:
|
|
||||||
vector_val = *get_vec(error);
|
|
||||||
sprintf(value, "{%f,%f,%f}", vector_val.x, vector_val.y, vector_val.z);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sprintf(value, "-NO VALUE-");
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
REAL element::get_flo(int &error)
|
|
||||||
{
|
|
||||||
if (element_type == elem_type_real)
|
|
||||||
return *reinterpret_cast<REAL*>(element_ptr);
|
|
||||||
error = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int element::get_int(int &error)
|
|
||||||
{
|
|
||||||
if (element_type == elem_type_int)
|
|
||||||
return reinterpret_cast<int>(element_ptr);
|
|
||||||
error = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* element::get_str(int &error)
|
|
||||||
{
|
|
||||||
if (element_type == elem_type_char)
|
|
||||||
return reinterpret_cast<const char*>(element_ptr);
|
|
||||||
error = 1;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
const Vector* element::get_vec(int &error)
|
|
||||||
{
|
|
||||||
if (element_type == elem_type_vector)
|
|
||||||
return reinterpret_cast<const Vector*>(element_ptr);
|
|
||||||
error = 1;
|
|
||||||
return null_vec;
|
|
||||||
}
|
|
||||||
|
|
||||||
int element::get_type(void)
|
|
||||||
{
|
|
||||||
return element_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
element::element() { }
|
|
||||||
void element::set_int(int Value)
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
element_type = elem_type_int;
|
|
||||||
element_ptr = reinterpret_cast<void*>(Value);
|
|
||||||
//Don't need to make it a pointer to an int here.
|
|
||||||
}
|
|
||||||
void element::set_flo(REAL Value)
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
element_type = elem_type_real;
|
|
||||||
element_ptr = new REAL(Value);
|
|
||||||
}
|
|
||||||
void element::set_str(char* Value)
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
element_type = elem_type_char;
|
|
||||||
char *string_val = new char[strlen(Value)+1];
|
|
||||||
strcpy(string_val,Value);
|
|
||||||
element_ptr = reinterpret_cast<void*>(string_val);
|
|
||||||
}
|
|
||||||
void element::set_vec(Vector* Value)
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
element_type = elem_type_vector;
|
|
||||||
element_ptr = reinterpret_cast<void*>(Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
element::~element()
|
|
||||||
{
|
|
||||||
//do nothing here or else data WILL be lost.
|
|
||||||
}
|
|
||||||
|
|
||||||
void element::clear()
|
|
||||||
{
|
|
||||||
//This function intelligently creates a pointer x,
|
|
||||||
//which will be of correct type and then deletes it.
|
|
||||||
|
|
||||||
if (element_type == elem_type_real)
|
|
||||||
{
|
|
||||||
REAL *real_val = reinterpret_cast<REAL*>(element_ptr);
|
|
||||||
delete real_val;
|
|
||||||
//This is actually a pointer to the float/double.
|
|
||||||
}
|
|
||||||
else if (element_type == elem_type_char)
|
|
||||||
{
|
|
||||||
char *char_val = reinterpret_cast<char*>(element_ptr);
|
|
||||||
delete char_val;
|
|
||||||
//Again, cast a pointer.
|
|
||||||
}
|
|
||||||
else if (element_type == elem_type_vector)
|
|
||||||
{
|
|
||||||
Vector *vector_val = reinterpret_cast<Vector*>(element_ptr);
|
|
||||||
delete vector_val;
|
|
||||||
//And again.
|
|
||||||
}
|
|
||||||
element_ptr = NULL; //Null the address as well. (Used for ints too.)
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // !defined(_CLASSDEF_ELEMENT_)
|
|
|
@ -1,463 +0,0 @@
|
||||||
// Configuration
|
|
||||||
|
|
||||||
#ifndef __MODULECONFIG_H__
|
|
||||||
#define __MODULECONFIG_H__
|
|
||||||
|
|
||||||
// Module info
|
|
||||||
#define MODULE_NAME "Array"
|
|
||||||
#define MODULE_VERSION "1.65"
|
|
||||||
#define MODULE_AUTHOR "Rukia and Anpheus"
|
|
||||||
#define MODULE_URL "www.alphapoint.org/rcr"
|
|
||||||
#define MODULE_LOGTAG "ARRAY"
|
|
||||||
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
|
|
||||||
#define MODULE_RELOAD_ON_MAPCHANGE
|
|
||||||
|
|
||||||
#ifdef __DATE__
|
|
||||||
#define MODULE_DATE __DATE__
|
|
||||||
#else // __DATE__
|
|
||||||
#define MODULE_DATE "Unknown"
|
|
||||||
#endif // __DATE__
|
|
||||||
|
|
||||||
// metamod plugin?
|
|
||||||
//#define USE_METAMOD
|
|
||||||
|
|
||||||
// - AMXX Init functions
|
|
||||||
// Also consider using FN_META_*
|
|
||||||
// AMXX query
|
|
||||||
//#define FN_AMXX_QUERY OnAmxxQuery
|
|
||||||
// AMXX attach
|
|
||||||
// Do native functions init here (MF_AddNatives)
|
|
||||||
#define FN_AMXX_ATTACH OnAmxxAttach
|
|
||||||
// AMXX dettach
|
|
||||||
#define FN_AMXX_DETTACH OnAmxxDettach
|
|
||||||
// All plugins loaded
|
|
||||||
// Do forward functions init here (MF_RegisterForward)
|
|
||||||
// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
|
|
||||||
|
|
||||||
/**** METAMOD ****/
|
|
||||||
// If your module doesn't use metamod, you may close the file now :)
|
|
||||||
#ifdef USE_METAMOD
|
|
||||||
// ----
|
|
||||||
// Hook Functions
|
|
||||||
// Uncomment these to be called
|
|
||||||
// You can also change the function name
|
|
||||||
|
|
||||||
// - Metamod init functions
|
|
||||||
// Also consider using FN_AMXX_*
|
|
||||||
// Meta query
|
|
||||||
//#define FN_META_QUERY OnMetaQuery
|
|
||||||
// Meta attach
|
|
||||||
//#define FN_META_ATTACH OnMetaAttach
|
|
||||||
// Meta dettach
|
|
||||||
//#define FN_META_DETTACH OnMetaDettach
|
|
||||||
|
|
||||||
// (wd) are Will Day's notes
|
|
||||||
// - GetEntityAPI2 functions
|
|
||||||
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
|
|
||||||
// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
|
|
||||||
// #define FN_DispatchThink DispatchThink /* pfnThink() */
|
|
||||||
// #define FN_DispatchUse DispatchUse /* pfnUse() */
|
|
||||||
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
|
|
||||||
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
|
|
||||||
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
|
|
||||||
// #define FN_DispatchSave DispatchSave /* pfnSave() */
|
|
||||||
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
|
|
||||||
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
|
|
||||||
// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */
|
|
||||||
// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */
|
|
||||||
// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */
|
|
||||||
// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */
|
|
||||||
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
|
|
||||||
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
|
|
||||||
// #define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
|
||||||
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
|
||||||
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
|
||||||
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
|
||||||
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
|
||||||
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
|
|
||||||
// #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
|
||||||
// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
|
|
||||||
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
|
|
||||||
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
|
|
||||||
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
|
|
||||||
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
|
|
||||||
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
|
|
||||||
// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */
|
|
||||||
// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */
|
|
||||||
// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */
|
|
||||||
// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */
|
|
||||||
// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */
|
|
||||||
// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */
|
|
||||||
// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */
|
|
||||||
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
|
|
||||||
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
|
|
||||||
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
|
|
||||||
// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
|
|
||||||
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
|
|
||||||
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
|
|
||||||
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
|
|
||||||
// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
|
|
||||||
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
|
|
||||||
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
|
|
||||||
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
|
|
||||||
// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */
|
|
||||||
// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */
|
|
||||||
// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */
|
|
||||||
|
|
||||||
// - GetEntityAPI2_Post functions
|
|
||||||
// #define FN_GameDLLInit_Post GameDLLInit_Post
|
|
||||||
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
|
|
||||||
// #define FN_DispatchThink_Post DispatchThink_Post
|
|
||||||
// #define FN_DispatchUse_Post DispatchUse_Post
|
|
||||||
// #define FN_DispatchTouch_Post DispatchTouch_Post
|
|
||||||
// #define FN_DispatchBlocked_Post DispatchBlocked_Post
|
|
||||||
// #define FN_DispatchKeyValue_Post DispatchKeyValue_Post
|
|
||||||
// #define FN_DispatchSave_Post DispatchSave_Post
|
|
||||||
// #define FN_DispatchRestore_Post DispatchRestore_Post
|
|
||||||
// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post
|
|
||||||
// #define FN_SaveWriteFields_Post SaveWriteFields_Post
|
|
||||||
// #define FN_SaveReadFields_Post SaveReadFields_Post
|
|
||||||
// #define FN_SaveGlobalState_Post SaveGlobalState_Post
|
|
||||||
// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post
|
|
||||||
// #define FN_ResetGlobalState_Post ResetGlobalState_Post
|
|
||||||
// #define FN_ClientConnect_Post ClientConnect_Post
|
|
||||||
// #define FN_ClientDisconnect_Post ClientDisconnect_Post
|
|
||||||
// #define FN_ClientKill_Post ClientKill_Post
|
|
||||||
// #define FN_ClientPutInServer_Post ClientPutInServer_Post
|
|
||||||
// #define FN_ClientCommand_Post ClientCommand_Post
|
|
||||||
// #define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
|
|
||||||
// #define FN_ServerActivate_Post ServerActivate_Post
|
|
||||||
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
|
|
||||||
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
|
|
||||||
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
|
|
||||||
// #define FN_StartFrame_Post StartFrame_Post
|
|
||||||
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
|
|
||||||
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
|
|
||||||
// #define FN_GetGameDescription_Post GetGameDescription_Post
|
|
||||||
// #define FN_PlayerCustomization_Post PlayerCustomization_Post
|
|
||||||
// #define FN_SpectatorConnect_Post SpectatorConnect_Post
|
|
||||||
// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post
|
|
||||||
// #define FN_SpectatorThink_Post SpectatorThink_Post
|
|
||||||
// #define FN_Sys_Error_Post Sys_Error_Post
|
|
||||||
// #define FN_PM_Move_Post PM_Move_Post
|
|
||||||
// #define FN_PM_Init_Post PM_Init_Post
|
|
||||||
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
|
|
||||||
// #define FN_SetupVisibility_Post SetupVisibility_Post
|
|
||||||
// #define FN_UpdateClientData_Post UpdateClientData_Post
|
|
||||||
// #define FN_AddToFullPack_Post AddToFullPack_Post
|
|
||||||
// #define FN_CreateBaseline_Post CreateBaseline_Post
|
|
||||||
// #define FN_RegisterEncoders_Post RegisterEncoders_Post
|
|
||||||
// #define FN_GetWeaponData_Post GetWeaponData_Post
|
|
||||||
// #define FN_CmdStart_Post CmdStart_Post
|
|
||||||
// #define FN_CmdEnd_Post CmdEnd_Post
|
|
||||||
// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post
|
|
||||||
// #define FN_GetHullBounds_Post GetHullBounds_Post
|
|
||||||
// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post
|
|
||||||
// #define FN_InconsistentFile_Post InconsistentFile_Post
|
|
||||||
// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post
|
|
||||||
|
|
||||||
// - GetEngineAPI functions
|
|
||||||
// #define FN_PrecacheModel PrecacheModel
|
|
||||||
// #define FN_PrecacheSound PrecacheSound
|
|
||||||
// #define FN_SetModel SetModel
|
|
||||||
// #define FN_ModelIndex ModelIndex
|
|
||||||
// #define FN_ModelFrames ModelFrames
|
|
||||||
// #define FN_SetSize SetSize
|
|
||||||
// #define FN_ChangeLevel ChangeLevel
|
|
||||||
// #define FN_GetSpawnParms GetSpawnParms
|
|
||||||
// #define FN_SaveSpawnParms SaveSpawnParms
|
|
||||||
// #define FN_VecToYaw VecToYaw
|
|
||||||
// #define FN_VecToAngles VecToAngles
|
|
||||||
// #define FN_MoveToOrigin MoveToOrigin
|
|
||||||
// #define FN_ChangeYaw ChangeYaw
|
|
||||||
// #define FN_ChangePitch ChangePitch
|
|
||||||
// #define FN_FindEntityByString FindEntityByString
|
|
||||||
// #define FN_GetEntityIllum GetEntityIllum
|
|
||||||
// #define FN_FindEntityInSphere FindEntityInSphere
|
|
||||||
// #define FN_FindClientInPVS FindClientInPVS
|
|
||||||
// #define FN_EntitiesInPVS EntitiesInPVS
|
|
||||||
// #define FN_MakeVectors MakeVectors
|
|
||||||
// #define FN_AngleVectors AngleVectors
|
|
||||||
// #define FN_CreateEntity CreateEntity
|
|
||||||
// #define FN_RemoveEntity RemoveEntity
|
|
||||||
// #define FN_CreateNamedEntity CreateNamedEntity
|
|
||||||
// #define FN_MakeStatic MakeStatic
|
|
||||||
// #define FN_EntIsOnFloor EntIsOnFloor
|
|
||||||
// #define FN_DropToFloor DropToFloor
|
|
||||||
// #define FN_WalkMove WalkMove
|
|
||||||
// #define FN_SetOrigin SetOrigin
|
|
||||||
// #define FN_EmitSound EmitSound
|
|
||||||
// #define FN_EmitAmbientSound EmitAmbientSound
|
|
||||||
// #define FN_TraceLine TraceLine
|
|
||||||
// #define FN_TraceToss TraceToss
|
|
||||||
// #define FN_TraceMonsterHull TraceMonsterHull
|
|
||||||
// #define FN_TraceHull TraceHull
|
|
||||||
// #define FN_TraceModel TraceModel
|
|
||||||
// #define FN_TraceTexture TraceTexture
|
|
||||||
// #define FN_TraceSphere TraceSphere
|
|
||||||
// #define FN_GetAimVector GetAimVector
|
|
||||||
// #define FN_ServerCommand ServerCommand
|
|
||||||
// #define FN_ServerExecute ServerExecute
|
|
||||||
// #define FN_engClientCommand engClientCommand
|
|
||||||
// #define FN_ParticleEffect ParticleEffect
|
|
||||||
// #define FN_LightStyle LightStyle
|
|
||||||
// #define FN_DecalIndex DecalIndex
|
|
||||||
// #define FN_PointContents PointContents
|
|
||||||
// #define FN_MessageBegin MessageBegin
|
|
||||||
// #define FN_MessageEnd MessageEnd
|
|
||||||
// #define FN_WriteByte WriteByte
|
|
||||||
// #define FN_WriteChar WriteChar
|
|
||||||
// #define FN_WriteShort WriteShort
|
|
||||||
// #define FN_WriteLong WriteLong
|
|
||||||
// #define FN_WriteAngle WriteAngle
|
|
||||||
// #define FN_WriteCoord WriteCoord
|
|
||||||
// #define FN_WriteString WriteString
|
|
||||||
// #define FN_WriteEntity WriteEntity
|
|
||||||
// #define FN_CVarRegister CVarRegister
|
|
||||||
// #define FN_CVarGetFloat CVarGetFloat
|
|
||||||
// #define FN_CVarGetString CVarGetString
|
|
||||||
// #define FN_CVarSetFloat CVarSetFloat
|
|
||||||
// #define FN_CVarSetString CVarSetString
|
|
||||||
// #define FN_AlertMessage AlertMessage
|
|
||||||
// #define FN_EngineFprintf EngineFprintf
|
|
||||||
// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData
|
|
||||||
// #define FN_PvEntPrivateData PvEntPrivateData
|
|
||||||
// #define FN_FreeEntPrivateData FreeEntPrivateData
|
|
||||||
// #define FN_SzFromIndex SzFromIndex
|
|
||||||
// #define FN_AllocString AllocString
|
|
||||||
// #define FN_GetVarsOfEnt GetVarsOfEnt
|
|
||||||
// #define FN_PEntityOfEntOffset PEntityOfEntOffset
|
|
||||||
// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity
|
|
||||||
// #define FN_IndexOfEdict IndexOfEdict
|
|
||||||
// #define FN_PEntityOfEntIndex PEntityOfEntIndex
|
|
||||||
// #define FN_FindEntityByVars FindEntityByVars
|
|
||||||
// #define FN_GetModelPtr GetModelPtr
|
|
||||||
// #define FN_RegUserMsg RegUserMsg
|
|
||||||
// #define FN_AnimationAutomove AnimationAutomove
|
|
||||||
// #define FN_GetBonePosition GetBonePosition
|
|
||||||
// #define FN_FunctionFromName FunctionFromName
|
|
||||||
// #define FN_NameForFunction NameForFunction
|
|
||||||
// #define FN_ClientPrintf ClientPrintf
|
|
||||||
// #define FN_ServerPrint ServerPrint
|
|
||||||
// #define FN_Cmd_Args Cmd_Args
|
|
||||||
// #define FN_Cmd_Argv Cmd_Argv
|
|
||||||
// #define FN_Cmd_Argc Cmd_Argc
|
|
||||||
// #define FN_GetAttachment GetAttachment
|
|
||||||
// #define FN_CRC32_Init CRC32_Init
|
|
||||||
// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer
|
|
||||||
// #define FN_CRC32_ProcessByte CRC32_ProcessByte
|
|
||||||
// #define FN_CRC32_Final CRC32_Final
|
|
||||||
// #define FN_RandomLong RandomLong
|
|
||||||
// #define FN_RandomFloat RandomFloat
|
|
||||||
// #define FN_SetView SetView
|
|
||||||
// #define FN_Time Time
|
|
||||||
// #define FN_CrosshairAngle CrosshairAngle
|
|
||||||
// #define FN_LoadFileForMe LoadFileForMe
|
|
||||||
// #define FN_FreeFile FreeFile
|
|
||||||
// #define FN_EndSection EndSection
|
|
||||||
// #define FN_CompareFileTime CompareFileTime
|
|
||||||
// #define FN_GetGameDir GetGameDir
|
|
||||||
// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable
|
|
||||||
// #define FN_FadeClientVolume FadeClientVolume
|
|
||||||
// #define FN_SetClientMaxspeed SetClientMaxspeed
|
|
||||||
// #define FN_CreateFakeClient CreateFakeClient
|
|
||||||
// #define FN_RunPlayerMove RunPlayerMove
|
|
||||||
// #define FN_NumberOfEntities NumberOfEntities
|
|
||||||
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
|
|
||||||
// #define FN_InfoKeyValue InfoKeyValue
|
|
||||||
// #define FN_SetKeyValue SetKeyValue
|
|
||||||
// #define FN_SetClientKeyValue SetClientKeyValue
|
|
||||||
// #define FN_IsMapValid IsMapValid
|
|
||||||
// #define FN_StaticDecal StaticDecal
|
|
||||||
// #define FN_PrecacheGeneric PrecacheGeneric
|
|
||||||
// #define FN_GetPlayerUserId GetPlayerUserId
|
|
||||||
// #define FN_BuildSoundMsg BuildSoundMsg
|
|
||||||
// #define FN_IsDedicatedServer IsDedicatedServer
|
|
||||||
// #define FN_CVarGetPointer CVarGetPointer
|
|
||||||
// #define FN_GetPlayerWONId GetPlayerWONId
|
|
||||||
// #define FN_Info_RemoveKey Info_RemoveKey
|
|
||||||
// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue
|
|
||||||
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
|
|
||||||
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
|
|
||||||
// #define FN_PrecacheEvent PrecacheEvent
|
|
||||||
// #define FN_PlaybackEvent PlaybackEvent
|
|
||||||
// #define FN_SetFatPVS SetFatPVS
|
|
||||||
// #define FN_SetFatPAS SetFatPAS
|
|
||||||
// #define FN_CheckVisibility CheckVisibility
|
|
||||||
// #define FN_DeltaSetField DeltaSetField
|
|
||||||
// #define FN_DeltaUnsetField DeltaUnsetField
|
|
||||||
// #define FN_DeltaAddEncoder DeltaAddEncoder
|
|
||||||
// #define FN_GetCurrentPlayer GetCurrentPlayer
|
|
||||||
// #define FN_CanSkipPlayer CanSkipPlayer
|
|
||||||
// #define FN_DeltaFindField DeltaFindField
|
|
||||||
// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex
|
|
||||||
// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex
|
|
||||||
// #define FN_SetGroupMask SetGroupMask
|
|
||||||
// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline
|
|
||||||
// #define FN_Cvar_DirectSet Cvar_DirectSet
|
|
||||||
// #define FN_ForceUnmodified ForceUnmodified
|
|
||||||
// #define FN_GetPlayerStats GetPlayerStats
|
|
||||||
// #define FN_AddServerCommand AddServerCommand
|
|
||||||
// #define FN_Voice_GetClientListening Voice_GetClientListening
|
|
||||||
// #define FN_Voice_SetClientListening Voice_SetClientListening
|
|
||||||
// #define FN_GetPlayerAuthId GetPlayerAuthId
|
|
||||||
|
|
||||||
// - GetEngineAPI_Post functions
|
|
||||||
// #define FN_PrecacheModel_Post PrecacheModel_Post
|
|
||||||
// #define FN_PrecacheSound_Post PrecacheSound_Post
|
|
||||||
// #define FN_SetModel_Post SetModel_Post
|
|
||||||
// #define FN_ModelIndex_Post ModelIndex_Post
|
|
||||||
// #define FN_ModelFrames_Post ModelFrames_Post
|
|
||||||
// #define FN_SetSize_Post SetSize_Post
|
|
||||||
// #define FN_ChangeLevel_Post ChangeLevel_Post
|
|
||||||
// #define FN_GetSpawnParms_Post GetSpawnParms_Post
|
|
||||||
// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post
|
|
||||||
// #define FN_VecToYaw_Post VecToYaw_Post
|
|
||||||
// #define FN_VecToAngles_Post VecToAngles_Post
|
|
||||||
// #define FN_MoveToOrigin_Post MoveToOrigin_Post
|
|
||||||
// #define FN_ChangeYaw_Post ChangeYaw_Post
|
|
||||||
// #define FN_ChangePitch_Post ChangePitch_Post
|
|
||||||
// #define FN_FindEntityByString_Post FindEntityByString_Post
|
|
||||||
// #define FN_GetEntityIllum_Post GetEntityIllum_Post
|
|
||||||
// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post
|
|
||||||
// #define FN_FindClientInPVS_Post FindClientInPVS_Post
|
|
||||||
// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post
|
|
||||||
// #define FN_MakeVectors_Post MakeVectors_Post
|
|
||||||
// #define FN_AngleVectors_Post AngleVectors_Post
|
|
||||||
// #define FN_CreateEntity_Post CreateEntity_Post
|
|
||||||
// #define FN_RemoveEntity_Post RemoveEntity_Post
|
|
||||||
// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post
|
|
||||||
// #define FN_MakeStatic_Post MakeStatic_Post
|
|
||||||
// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post
|
|
||||||
// #define FN_DropToFloor_Post DropToFloor_Post
|
|
||||||
// #define FN_WalkMove_Post WalkMove_Post
|
|
||||||
// #define FN_SetOrigin_Post SetOrigin_Post
|
|
||||||
// #define FN_EmitSound_Post EmitSound_Post
|
|
||||||
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
|
|
||||||
// #define FN_TraceLine_Post TraceLine_Post
|
|
||||||
// #define FN_TraceToss_Post TraceToss_Post
|
|
||||||
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
|
|
||||||
// #define FN_TraceHull_Post TraceHull_Post
|
|
||||||
// #define FN_TraceModel_Post TraceModel_Post
|
|
||||||
// #define FN_TraceTexture_Post TraceTexture_Post
|
|
||||||
// #define FN_TraceSphere_Post TraceSphere_Post
|
|
||||||
// #define FN_GetAimVector_Post GetAimVector_Post
|
|
||||||
// #define FN_ServerCommand_Post ServerCommand_Post
|
|
||||||
// #define FN_ServerExecute_Post ServerExecute_Post
|
|
||||||
// #define FN_engClientCommand_Post engClientCommand_Post
|
|
||||||
// #define FN_ParticleEffect_Post ParticleEffect_Post
|
|
||||||
// #define FN_LightStyle_Post LightStyle_Post
|
|
||||||
// #define FN_DecalIndex_Post DecalIndex_Post
|
|
||||||
// #define FN_PointContents_Post PointContents_Post
|
|
||||||
// #define FN_MessageBegin_Post MessageBegin_Post
|
|
||||||
// #define FN_MessageEnd_Post MessageEnd_Post
|
|
||||||
// #define FN_WriteByte_Post WriteByte_Post
|
|
||||||
// #define FN_WriteChar_Post WriteChar_Post
|
|
||||||
// #define FN_WriteShort_Post WriteShort_Post
|
|
||||||
// #define FN_WriteLong_Post WriteLong_Post
|
|
||||||
// #define FN_WriteAngle_Post WriteAngle_Post
|
|
||||||
// #define FN_WriteCoord_Post WriteCoord_Post
|
|
||||||
// #define FN_WriteString_Post WriteString_Post
|
|
||||||
// #define FN_WriteEntity_Post WriteEntity_Post
|
|
||||||
// #define FN_CVarRegister_Post CVarRegister_Post
|
|
||||||
// #define FN_CVarGetFloat_Post CVarGetFloat_Post
|
|
||||||
// #define FN_CVarGetString_Post CVarGetString_Post
|
|
||||||
// #define FN_CVarSetFloat_Post CVarSetFloat_Post
|
|
||||||
// #define FN_CVarSetString_Post CVarSetString_Post
|
|
||||||
// #define FN_AlertMessage_Post AlertMessage_Post
|
|
||||||
// #define FN_EngineFprintf_Post EngineFprintf_Post
|
|
||||||
// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post
|
|
||||||
// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post
|
|
||||||
// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post
|
|
||||||
// #define FN_SzFromIndex_Post SzFromIndex_Post
|
|
||||||
// #define FN_AllocString_Post AllocString_Post
|
|
||||||
// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post
|
|
||||||
// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post
|
|
||||||
// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post
|
|
||||||
// #define FN_IndexOfEdict_Post IndexOfEdict_Post
|
|
||||||
// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post
|
|
||||||
// #define FN_FindEntityByVars_Post FindEntityByVars_Post
|
|
||||||
// #define FN_GetModelPtr_Post GetModelPtr_Post
|
|
||||||
// #define FN_RegUserMsg_Post RegUserMsg_Post
|
|
||||||
// #define FN_AnimationAutomove_Post AnimationAutomove_Post
|
|
||||||
// #define FN_GetBonePosition_Post GetBonePosition_Post
|
|
||||||
// #define FN_FunctionFromName_Post FunctionFromName_Post
|
|
||||||
// #define FN_NameForFunction_Post NameForFunction_Post
|
|
||||||
// #define FN_ClientPrintf_Post ClientPrintf_Post
|
|
||||||
// #define FN_ServerPrint_Post ServerPrint_Post
|
|
||||||
// #define FN_Cmd_Args_Post Cmd_Args_Post
|
|
||||||
// #define FN_Cmd_Argv_Post Cmd_Argv_Post
|
|
||||||
// #define FN_Cmd_Argc_Post Cmd_Argc_Post
|
|
||||||
// #define FN_GetAttachment_Post GetAttachment_Post
|
|
||||||
// #define FN_CRC32_Init_Post CRC32_Init_Post
|
|
||||||
// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post
|
|
||||||
// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post
|
|
||||||
// #define FN_CRC32_Final_Post CRC32_Final_Post
|
|
||||||
// #define FN_RandomLong_Post RandomLong_Post
|
|
||||||
// #define FN_RandomFloat_Post RandomFloat_Post
|
|
||||||
// #define FN_SetView_Post SetView_Post
|
|
||||||
// #define FN_Time_Post Time_Post
|
|
||||||
// #define FN_CrosshairAngle_Post CrosshairAngle_Post
|
|
||||||
// #define FN_LoadFileForMe_Post LoadFileForMe_Post
|
|
||||||
// #define FN_FreeFile_Post FreeFile_Post
|
|
||||||
// #define FN_EndSection_Post EndSection_Post
|
|
||||||
// #define FN_CompareFileTime_Post CompareFileTime_Post
|
|
||||||
// #define FN_GetGameDir_Post GetGameDir_Post
|
|
||||||
// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post
|
|
||||||
// #define FN_FadeClientVolume_Post FadeClientVolume_Post
|
|
||||||
// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post
|
|
||||||
// #define FN_CreateFakeClient_Post CreateFakeClient_Post
|
|
||||||
// #define FN_RunPlayerMove_Post RunPlayerMove_Post
|
|
||||||
// #define FN_NumberOfEntities_Post NumberOfEntities_Post
|
|
||||||
// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post
|
|
||||||
// #define FN_InfoKeyValue_Post InfoKeyValue_Post
|
|
||||||
// #define FN_SetKeyValue_Post SetKeyValue_Post
|
|
||||||
// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post
|
|
||||||
// #define FN_IsMapValid_Post IsMapValid_Post
|
|
||||||
// #define FN_StaticDecal_Post StaticDecal_Post
|
|
||||||
// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post
|
|
||||||
// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post
|
|
||||||
// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post
|
|
||||||
// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post
|
|
||||||
// #define FN_CVarGetPointer_Post CVarGetPointer_Post
|
|
||||||
// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post
|
|
||||||
// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post
|
|
||||||
// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post
|
|
||||||
// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post
|
|
||||||
// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post
|
|
||||||
// #define FN_PrecacheEvent_Post PrecacheEvent_Post
|
|
||||||
// #define FN_PlaybackEvent_Post PlaybackEvent_Post
|
|
||||||
// #define FN_SetFatPVS_Post SetFatPVS_Post
|
|
||||||
// #define FN_SetFatPAS_Post SetFatPAS_Post
|
|
||||||
// #define FN_CheckVisibility_Post CheckVisibility_Post
|
|
||||||
// #define FN_DeltaSetField_Post DeltaSetField_Post
|
|
||||||
// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post
|
|
||||||
// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post
|
|
||||||
// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post
|
|
||||||
// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post
|
|
||||||
// #define FN_DeltaFindField_Post DeltaFindField_Post
|
|
||||||
// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post
|
|
||||||
// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post
|
|
||||||
// #define FN_SetGroupMask_Post SetGroupMask_Post
|
|
||||||
// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post
|
|
||||||
// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post
|
|
||||||
// #define FN_ForceUnmodified_Post ForceUnmodified_Post
|
|
||||||
// #define FN_GetPlayerStats_Post GetPlayerStats_Post
|
|
||||||
// #define FN_AddServerCommand_Post AddServerCommand_Post
|
|
||||||
// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post
|
|
||||||
// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post
|
|
||||||
// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post
|
|
||||||
|
|
||||||
// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData
|
|
||||||
// #define FN_GameShutdown GameShutdown
|
|
||||||
// #define FN_ShouldCollide ShouldCollide
|
|
||||||
|
|
||||||
// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post
|
|
||||||
// #define FN_GameShutdown_Post GameShutdown_Post
|
|
||||||
// #define FN_ShouldCollide_Post ShouldCollide_Post
|
|
||||||
|
|
||||||
|
|
||||||
#endif // USE_METAMOD
|
|
||||||
|
|
||||||
#endif // __MODULECONFIG_H__
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/* __MSDOS__ set when compiling for DOS (not Windows)
|
|
||||||
* _Windows set when compiling for any version of Microsoft Windows
|
|
||||||
* __WIN32__ set when compiling for Windows95 or WindowsNT (32 bit mode)
|
|
||||||
* __32BIT__ set when compiling in 32-bit "flat" mode (DOS or Windows)
|
|
||||||
*
|
|
||||||
* Copyright 1998-2002, ITB CompuPhase, The Netherlands.
|
|
||||||
* info@compuphase.com.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _OSDEFS_H
|
|
||||||
#define _OSDEFS_H
|
|
||||||
|
|
||||||
/* Every compiler uses different "default" macros to indicate the mode
|
|
||||||
* it is in. Throughout the source, we use the Borland C++ macros, so
|
|
||||||
* the macros of Watcom C/C++ and Microsoft Visual C/C++ are mapped to
|
|
||||||
* those of Borland C++.
|
|
||||||
*/
|
|
||||||
#if defined(__WATCOMC__)
|
|
||||||
# if defined(__WINDOWS__) || defined(__NT__)
|
|
||||||
# define _Windows 1
|
|
||||||
# endif
|
|
||||||
# ifdef __386__
|
|
||||||
# define __32BIT__ 1
|
|
||||||
# endif
|
|
||||||
# if defined(_Windows) && defined(__32BIT__)
|
|
||||||
# define __WIN32__ 1
|
|
||||||
# endif
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# if defined(_WINDOWS) || defined(_WIN32)
|
|
||||||
# define _Windows 1
|
|
||||||
# endif
|
|
||||||
# ifdef _WIN32
|
|
||||||
# define __WIN32__ 1
|
|
||||||
# define __32BIT__ 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __linux__
|
|
||||||
#include <endian.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Linux NOW has these */
|
|
||||||
#if !defined BIG_ENDIAN
|
|
||||||
#define BIG_ENDIAN 4321
|
|
||||||
#endif
|
|
||||||
#if !defined LITTLE_ENDIAN
|
|
||||||
#define LITTLE_ENDIAN 1234
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
|
|
||||||
#if !defined BYTE_ORDER
|
|
||||||
#if defined UCLINUX
|
|
||||||
#define BYTE_ORDER BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define BYTE_ORDER LITTLE_ENDIAN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _OSDEFS_H */
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user