Bring compiler pragmas to the top

To ensure full support for the transitional syntax. Also updated
DHooks.inc until Dr!fter does.
This commit is contained in:
shavitush 2016-06-30 12:24:39 +03:00
parent 9b13e3b3e0
commit ca6eae68d5
11 changed files with 86 additions and 86 deletions

View File

@ -92,7 +92,7 @@ typeset ListenCB
{ {
//Deleted //Deleted
function void (int entity); function void (int entity);
//Created //Created
function void (int entity, const char[] classname); function void (int entity, const char[] classname);
}; };
@ -105,42 +105,42 @@ typeset DHookCallback
{ {
//Function Example: void Ham::Test() with this pointer ignore //Function Example: void Ham::Test() with this pointer ignore
function MRESReturn (); function MRESReturn ();
//Function Example: void Ham::Test() with this pointer passed //Function Example: void Ham::Test() with this pointer passed
function MRESReturn (int pThis); function MRESReturn (int pThis);
//Function Example: void Ham::Test(int cake) with this pointer ignore //Function Example: void Ham::Test(int cake) with this pointer ignore
function MRESReturn (Handle hParams); function MRESReturn (Handle hParams);
//Function Example: void Ham::Test(int cake) with this pointer passed //Function Example: void Ham::Test(int cake) with this pointer passed
function MRESReturn (int pThis, Handle hParams); function MRESReturn (int pThis, Handle hParams);
//Function Example: int Ham::Test() with this pointer ignore //Function Example: int Ham::Test() with this pointer ignore
function MRESReturn (Handle hReturn); function MRESReturn (Handle hReturn);
//Function Example: int Ham::Test() with this pointer passed //Function Example: int Ham::Test() with this pointer passed
function MRESReturn (int pThis, Handle hReturn); function MRESReturn (int pThis, Handle hReturn);
//Function Example: int Ham::Test(int cake) with this pointer ignore //Function Example: int Ham::Test(int cake) with this pointer ignore
function MRESReturn (Handle hReturn, Handle hParams); function MRESReturn (Handle hReturn, Handle hParams);
//Function Example: int Ham::Test(int cake) with this pointer passed //Function Example: int Ham::Test(int cake) with this pointer passed
function MRESReturn (int pThis, Handle hReturn, Handle hParams); function MRESReturn (int pThis, Handle hReturn, Handle hParams);
//Address NOW //Address NOW
//Function Example: void Ham::Test() with this pointer passed //Function Example: void Ham::Test() with this pointer passed
function MRESReturn (Address pThis); function MRESReturn (Address pThis);
//Function Example: void Ham::Test(int cake) with this pointer passed //Function Example: void Ham::Test(int cake) with this pointer passed
function MRESReturn (Address pThis, Handle hParams); function MRESReturn (Address pThis, Handle hParams);
//Function Example: int Ham::Test() with this pointer passed //Function Example: int Ham::Test() with this pointer passed
function MRESReturn (Address pThis, Handle hReturn); function MRESReturn (Address pThis, Handle hReturn);
//Function Example: int Ham::Test(int cake) with this pointer passed //Function Example: int Ham::Test(int cake) with this pointer passed
function MRESReturn (Address pThis, Handle hReturn, Handle hParams); function MRESReturn (Address pThis, Handle hReturn, Handle hParams);
}; };
/* Adds an entity listener hook /* Adds an entity listener hook
@ -168,7 +168,7 @@ native bool DHookRemoveEntityListener(ListenType type, ListenCB callback);
* @param returntype Type type of return * @param returntype Type type of return
* @param thistype Type of this pointer or ignore (ignore can be used if not needed) * @param thistype Type of this pointer or ignore (ignore can be used if not needed)
* @param callback Callback function * @param callback Callback function
* *
* @return Returns setup handle for the hook or INVALID_HANDLE. * @return Returns setup handle for the hook or INVALID_HANDLE.
*/ */
native Handle DHookCreate(int offset, HookType hooktype, ReturnType returntype, ThisPointerType thistype, DHookCallback callback); native Handle DHookCreate(int offset, HookType hooktype, ReturnType returntype, ThisPointerType thistype, DHookCallback callback);
@ -179,7 +179,7 @@ native Handle DHookCreate(int offset, HookType hooktype, ReturnType returntype,
* @param type Param type * @param type Param type
* @param size Used for Objects (not Object ptr) to define the size of the object. * @param size Used for Objects (not Object ptr) to define the size of the object.
* @param flag Used to change the pass type. * @param flag Used to change the pass type.
* *
* @error Invalid setup handle or too many params added (request upping the max in thread) * @error Invalid setup handle or too many params added (request upping the max in thread)
* @noreturn * @noreturn
*/ */
@ -187,170 +187,170 @@ native void DHookAddParam(Handle setup, HookParamType type, int size=-1, DHookPa
//native DHookAddParam(Handle:setup, HookParamType:type); //native DHookAddParam(Handle:setup, HookParamType:type);
/* Hook entity /* Hook entity
* *
* @param setup Setup handle to use to add the hook. * @param setup Setup handle to use to add the hook.
* @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!) * @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!)
* @param entity Entity index to hook on. * @param entity Entity index to hook on.
* @param removalcb Callback for when the hook is removed (Entity hooks are auto-removed on entity destroyed and will call this callback) * @param removalcb Callback for when the hook is removed (Entity hooks are auto-removed on entity destroyed and will call this callback)
* *
* @error Invalid setup handle, invalid entity or invalid hook type. * @error Invalid setup handle, invalid entity or invalid hook type.
* @return -1 on fail a hookid on success * @return -1 on fail a hookid on success
*/ */
native int DHookEntity(Handle setup, bool post, int entity, DHookRemovalCB removalcb=INVALID_FUNCTION); native int DHookEntity(Handle setup, bool post, int entity, DHookRemovalCB removalcb=INVALID_FUNCTION);
/* Hook gamerules /* Hook gamerules
* *
* @param setup Setup handle to use to add the hook. * @param setup Setup handle to use to add the hook.
* @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!) * @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!)
* @param removalcb Callback for when the hook is removed (Game rules hooks are auto-removed on map end and will call this callback) * @param removalcb Callback for when the hook is removed (Game rules hooks are auto-removed on map end and will call this callback)
* *
* @error Invalid setup handle, failing to get gamerules pointer or invalid hook type. * @error Invalid setup handle, failing to get gamerules pointer or invalid hook type.
* @return -1 on fail a hookid on success * @return -1 on fail a hookid on success
*/ */
native int DHookGamerules(Handle setup, bool post, DHookRemovalCB removalcb=INVALID_FUNCTION); native int DHookGamerules(Handle setup, bool post, DHookRemovalCB removalcb=INVALID_FUNCTION);
/* Hook a raw pointer /* Hook a raw pointer
* *
* @param setup Setup handle to use to add the hook. * @param setup Setup handle to use to add the hook.
* @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!) * @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!)
* @param addr This pointer address. * @param addr This pointer address.
* @param removalcb Callback for when the hook is removed (Entity hooks are auto-removed on entity destroyed and will call this callback) * @param removalcb Callback for when the hook is removed (Entity hooks are auto-removed on entity destroyed and will call this callback)
* *
* @error Invalid setup handle, invalid address or invalid hook type. * @error Invalid setup handle, invalid address or invalid hook type.
* @return -1 on fail a hookid on success * @return -1 on fail a hookid on success
*/ */
native int DHookRaw(Handle setup, bool post, Address addr, DHookRemovalCB removalcb=INVALID_FUNCTION); native int DHookRaw(Handle setup, bool post, Address addr, DHookRemovalCB removalcb=INVALID_FUNCTION);
/* Remove hook by hook id /* Remove hook by hook id
* *
* @param hookid Hook id to remove * @param hookid Hook id to remove
* *
* @return true on success false otherwise * @return true on success false otherwise
* @note This will not fire the removal callback! * @note This will not fire the removal callback!
*/ */
native bool DHookRemoveHookID(int hookid); native bool DHookRemoveHookID(int hookid);
/* Get param value (Only use for: int, entity, bool or float param types) /* Get param value (Only use for: int, entity, bool or float param types)
* *
* @param hParams Handle to params structure * @param hParams Handle to params structure
* @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1. 0 Will return the number of params stored) * @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1. 0 Will return the number of params stored)
* *
* @error Invalid handle. Invalid param number. Invalid param type. * @error Invalid handle. Invalid param number. Invalid param type.
* @return value if num greater than 0. If 0 returns paramcount. * @return value if num greater than 0. If 0 returns paramcount.
*/ */
native any DHookGetParam(Handle hParams, int num); native any DHookGetParam(Handle hParams, int num);
/* Get vector param value /* Get vector param value
* *
* @param hParams Handle to params structure * @param hParams Handle to params structure
* @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1.) * @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1.)
* @param vec Vector buffer to store result. * @param vec Vector buffer to store result.
* *
* @error Invalid handle. Invalid param number. Invalid param type. * @error Invalid handle. Invalid param number. Invalid param type.
* @noreturn * @noreturn
*/ */
native void DHookGetParamVector(Handle hParams, int num, float vec[3]); native void DHookGetParamVector(Handle hParams, int num, float vec[3]);
/* Get string param value /* Get string param value
* *
* @param hParams Handle to params structure * @param hParams Handle to params structure
* @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1.) * @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1.)
* @param buffer String buffer to store result * @param buffer String buffer to store result
* @param size Buffer size * @param size Buffer size
* *
* @error Invalid handle. Invalid param number. Invalid param type. * @error Invalid handle. Invalid param number. Invalid param type.
* @noreturn * @noreturn
*/ */
native void DHookGetParamString(Handle hParams, int num, char[] buffer, int size); native void DHookGetParamString(Handle hParams, int num, char[] buffer, int size);
/* Set param value (Only use for: int, entity, bool or float param types) /* Set param value (Only use for: int, entity, bool or float param types)
* *
* @param hParams Handle to params structure * @param hParams Handle to params structure
* @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.) * @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.)
* @param value Value to set it as (only pass int, bool, float or entity index) * @param value Value to set it as (only pass int, bool, float or entity index)
* *
* @error Invalid handle. Invalid param number. Invalid param type. * @error Invalid handle. Invalid param number. Invalid param type.
* @noreturn * @noreturn
*/ */
native void DHookSetParam(Handle hParams, int num, any value); native void DHookSetParam(Handle hParams, int num, any value);
/* Set vector param value /* Set vector param value
* *
* @param hParams Handle to params structure * @param hParams Handle to params structure
* @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.) * @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.)
* @param vec Value to set vector as. * @param vec Value to set vector as.
* *
* @error Invalid handle. Invalid param number. Invalid param type. * @error Invalid handle. Invalid param number. Invalid param type.
* @noreturn * @noreturn
*/ */
native void DHookSetParamVector(Handle hParams, int num, float vec[3]); native void DHookSetParamVector(Handle hParams, int num, float vec[3]);
/* Set string param value /* Set string param value
* *
* @param hParams Handle to params structure * @param hParams Handle to params structure
* @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.) * @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.)
* @param value Value to set string as. * @param value Value to set string as.
* *
* @error Invalid handle. Invalid param number. Invalid param type. * @error Invalid handle. Invalid param number. Invalid param type.
* @noreturn * @noreturn
*/ */
native void DHookSetParamString(Handle hParams, int num, char[] value); native void DHookSetParamString(Handle hParams, int num, char[] value);
/* Get return value (Only use for: int, entity, bool or float return types) /* Get return value (Only use for: int, entity, bool or float return types)
* *
* @param hReturn Handle to return structure * @param hReturn Handle to return structure
* *
* @error Invalid Handle, invalid type. * @error Invalid Handle, invalid type.
* @return Returns default value if prehook returns actual value if post hook. * @return Returns default value if prehook returns actual value if post hook.
*/ */
native any DHookGetReturn(Handle hReturn); native any DHookGetReturn(Handle hReturn);
/* Get return vector value /* Get return vector value
* *
* @param hReturn Handle to return structure * @param hReturn Handle to return structure
* @param vec Vector buffer to store result in. (In pre hooks will be default value (0.0,0.0,0.0)) * @param vec Vector buffer to store result in. (In pre hooks will be default value (0.0,0.0,0.0))
* *
* @error Invalid Handle, invalid type. * @error Invalid Handle, invalid type.
* @noreturn * @noreturn
*/ */
native void DHookGetReturnVector(Handle hReturn, float vec[3]); native void DHookGetReturnVector(Handle hReturn, float vec[3]);
/* Get return string value /* Get return string value
* *
* @param hReturn Handle to return structure * @param hReturn Handle to return structure
* @param buffer String buffer to store result in. (In pre hooks will be default value "") * @param buffer String buffer to store result in. (In pre hooks will be default value "")
* @param size String buffer size * @param size String buffer size
* *
* @error Invalid Handle, invalid type. * @error Invalid Handle, invalid type.
* @noreturn * @noreturn
*/ */
native void DHookGetReturnString(Handle hReturn, char[] buffer, int size); native void DHookGetReturnString(Handle hReturn, char[] buffer, int size);
/* Set return value (Only use for: int, entity, bool or float return types) /* Set return value (Only use for: int, entity, bool or float return types)
* *
* @param hReturn Handle to return structure * @param hReturn Handle to return structure
* @param value Value to set return as * @param value Value to set return as
* *
* @error Invalid Handle, invalid type. * @error Invalid Handle, invalid type.
* @noreturn * @noreturn
*/ */
native void DHookSetReturn(Handle hReturn, any value); native void DHookSetReturn(Handle hReturn, any value);
/* Set return vector value /* Set return vector value
* *
* @param hReturn Handle to return structure * @param hReturn Handle to return structure
* @param vec Value to set return vector as * @param vec Value to set return vector as
* *
* @error Invalid Handle, invalid type. * @error Invalid Handle, invalid type.
* @noreturn * @noreturn
*/ */
native void DHookSetReturnVector(Handle hReturn, float vec[3]); native void DHookSetReturnVector(Handle hReturn, float vec[3]);
/* Set return string value /* Set return string value
* *
* @param hReturn Handle to return structure * @param hReturn Handle to return structure
* @param value Value to set return string as * @param value Value to set return string as
* *
* @error Invalid Handle, invalid type. * @error Invalid Handle, invalid type.
* @noreturn * @noreturn
*/ */
@ -450,7 +450,7 @@ public Extension __ext_dhooks =
}; };
#if !defined REQUIRE_EXTENSIONS #if !defined REQUIRE_EXTENSIONS
public __ext_dhooks_SetNTVOptional() public void __ext_dhooks_SetNTVOptional()
{ {
MarkNativeAsOptional("DHookAddEntityListener"); MarkNativeAsOptional("DHookAddEntityListener");
MarkNativeAsOptional("DHookRemoveEntityListener"); MarkNativeAsOptional("DHookRemoveEntityListener");
@ -479,4 +479,4 @@ public __ext_dhooks_SetNTVOptional()
MarkNativeAsOptional("DHookIsNullParam"); MarkNativeAsOptional("DHookIsNullParam");
MarkNativeAsOptional("DHookGetParamObjectPtrString"); MarkNativeAsOptional("DHookGetParamObjectPtrString");
} }
#endif #endif

View File

@ -481,7 +481,7 @@ native int Shavit_PrintToChat(int client, const char[] format, any ...);
// same as Shavit_PrintToChat() but loops through the whole server // same as Shavit_PrintToChat() but loops through the whole server
// code stolen from the base halflife.inc file // code stolen from the base halflife.inc file
stock Shavit_PrintToChatAll(const char[] format, any ...) stock void Shavit_PrintToChatAll(const char[] format, any ...)
{ {
char[] buffer = new char[255]; char[] buffer = new char[255];

View File

@ -18,6 +18,10 @@
* *
*/ */
#pragma newdecls required
#pragma semicolon 1
#pragma dynamic 131072
#include <sourcemod> #include <sourcemod>
#include <sdktools> #include <sdktools>
#include <geoip> #include <geoip>
@ -30,10 +34,6 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <adminmenu> #include <adminmenu>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
//#define DEBUG //#define DEBUG
// game type (CS:S/CS:GO) // game type (CS:S/CS:GO)

View File

@ -18,6 +18,10 @@
* *
*/ */
#pragma newdecls required
#pragma semicolon 1
#pragma dynamic 131072
#include <sourcemod> #include <sourcemod>
#define USES_STYLE_NAMES #define USES_STYLE_NAMES
@ -25,10 +29,6 @@
#include <shavit> #include <shavit>
#include <clientprefs> #include <clientprefs>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
#define HUD_NONE (0) #define HUD_NONE (0)
#define HUD_MASTER (1 << 0) // master setting #define HUD_MASTER (1 << 0) // master setting
#define HUD_CENTER (1 << 1) // show hud as hint text #define HUD_CENTER (1 << 1) // show hud as hint text

View File

@ -18,6 +18,10 @@
* *
*/ */
#pragma newdecls required
#pragma semicolon 1
#pragma dynamic 131072
#include <sourcemod> #include <sourcemod>
#include <cstrike> #include <cstrike>
#include <sdktools> #include <sdktools>
@ -30,10 +34,6 @@
#undef REQUIRE_EXTENSIONS #undef REQUIRE_EXTENSIONS
#include <dhooks> #include <dhooks>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
bool gB_Hide[MAXPLAYERS+1]; bool gB_Hide[MAXPLAYERS+1];
bool gB_Late; bool gB_Late;
int gF_LastFlags[MAXPLAYERS+1]; int gF_LastFlags[MAXPLAYERS+1];

View File

@ -20,6 +20,10 @@
// I have no idea if this plugin will work with CS:S, sorry. // I have no idea if this plugin will work with CS:S, sorry.
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
#include <sourcemod> #include <sourcemod>
#include <cstrike> #include <cstrike>
#include <sdktools> #include <sdktools>
@ -29,10 +33,6 @@
#define USES_STYLE_PROPERTIES #define USES_STYLE_PROPERTIES
#include <shavit> #include <shavit>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
ServerGame gSG_Type = Game_Unknown; ServerGame gSG_Type = Game_Unknown;
int gI_ReplayTick[MAX_STYLES]; int gI_ReplayTick[MAX_STYLES];

View File

@ -18,14 +18,14 @@
* *
*/ */
#include <sourcemod>
#include <sdktools>
#include <shavit>
#pragma semicolon 1 #pragma semicolon 1
#pragma dynamic 131072 #pragma dynamic 131072
#pragma newdecls required #pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <shavit>
#define SOUNDS_LIMIT 64 // we really don't need more than that #define SOUNDS_LIMIT 64 // we really don't need more than that
ServerGame gSG_Type = Game_Unknown; ServerGame gSG_Type = Game_Unknown;

View File

@ -18,6 +18,10 @@
* *
*/ */
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
#include <sourcemod> #include <sourcemod>
#define USES_STYLE_NAMES #define USES_STYLE_NAMES
@ -25,10 +29,6 @@
#define USES_STYLE_PROPERTIES #define USES_STYLE_PROPERTIES
#include <shavit> #include <shavit>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
// macros // macros
#define MAPSDONE 0 #define MAPSDONE 0
#define MAPSLEFT 1 #define MAPSLEFT 1

View File

@ -20,13 +20,13 @@
// original idea from ckSurf. // original idea from ckSurf.
#include <sourcemod>
#include <shavit>
#pragma semicolon 1 #pragma semicolon 1
#pragma dynamic 131072 #pragma dynamic 131072
#pragma newdecls required #pragma newdecls required
#include <sourcemod>
#include <shavit>
// #define DEBUG // #define DEBUG
// database handle // database handle

View File

@ -18,6 +18,10 @@
* *
*/ */
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
#include <sourcemod> #include <sourcemod>
#define USES_STYLE_NAMES #define USES_STYLE_NAMES
@ -27,10 +31,6 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <adminmenu> #include <adminmenu>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
//#define DEBUG //#define DEBUG
bool gB_Late; bool gB_Late;

View File

@ -18,6 +18,10 @@
* *
*/ */
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
#include <sourcemod> #include <sourcemod>
#include <sdktools> #include <sdktools>
#include <cstrike> #include <cstrike>
@ -26,10 +30,6 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <adminmenu> #include <adminmenu>
#pragma semicolon 1
#pragma dynamic 131072
#pragma newdecls required
#define PLACEHOLDER 32767 #define PLACEHOLDER 32767
ServerGame gSG_Type = Game_Unknown; ServerGame gSG_Type = Game_Unknown;