Update compiler and includes to version 1.7.0.
This commit is contained in:
Vendored
+132
-44
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* SourceMod (C)2004-2014 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
@@ -40,38 +40,123 @@
|
||||
*/
|
||||
enum EventHookMode
|
||||
{
|
||||
EventHookMode_Pre, /**< Hook callback fired before event is fired */
|
||||
EventHookMode_Post, /**< Hook callback fired after event is fired */
|
||||
EventHookMode_PostNoCopy /**< Hook callback fired after event is fired, but event data won't be copied */
|
||||
EventHookMode_Pre, //< Hook callback fired before event is fired */
|
||||
EventHookMode_Post, //< Hook callback fired after event is fired */
|
||||
EventHookMode_PostNoCopy //< Hook callback fired after event is fired, but event data won't be copied */
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook function types for events.
|
||||
*/
|
||||
funcenum EventHook
|
||||
typeset EventHook
|
||||
{
|
||||
/**
|
||||
* Called when a game event is fired.
|
||||
*
|
||||
* @param event Handle to event. This could be INVALID_HANDLE if every plugin hooking
|
||||
* this event has set the hook mode EventHookMode_PostNoCopy.
|
||||
* @param name String containing the name of the event.
|
||||
* @param dontBroadcast True if event was not broadcast to clients, false otherwise.
|
||||
* @return Ignored for post hooks. Plugin_Handled will block event if hooked as pre.
|
||||
*/
|
||||
Action:public(Handle:event, const String:name[], bool:dontBroadcast),
|
||||
/**
|
||||
* Called when a game event is fired.
|
||||
*
|
||||
* @param event Handle to event. This could be INVALID_HANDLE if every plugin hooking
|
||||
* this event has set the hook mode EventHookMode_PostNoCopy.
|
||||
* @param name String containing the name of the event.
|
||||
* @param dontBroadcast True if event was not broadcast to clients, false otherwise.
|
||||
* @noreturn
|
||||
*/
|
||||
public(Handle:event, const String:name[], bool:dontBroadcast),
|
||||
// Called when a game event is fired.
|
||||
//
|
||||
// @param event Handle to event. This could be INVALID_HANDLE if every plugin hooking
|
||||
// this event has set the hook mode EventHookMode_PostNoCopy.
|
||||
// @param name String containing the name of the event.
|
||||
// @param dontBroadcast True if event was not broadcast to clients, false otherwise.
|
||||
// @return Ignored for post hooks. Plugin_Handled will block event if hooked as pre.
|
||||
///
|
||||
function Action (Event event, const char[] name, bool dontBroadcast);
|
||||
//
|
||||
// Called when a game event is fired.
|
||||
//
|
||||
// @param event Handle to event. This could be INVALID_HANDLE if every plugin hooking
|
||||
// this event has set the hook mode EventHookMode_PostNoCopy.
|
||||
// @param name String containing the name of the event.
|
||||
// @param dontBroadcast True if event was not broadcast to clients, false otherwise.
|
||||
// @noreturn
|
||||
///
|
||||
function void (Event event, const char[] name, bool dontBroadcast);
|
||||
};
|
||||
|
||||
methodmap Event < Handle
|
||||
{
|
||||
// Fires a game event.
|
||||
//
|
||||
// This function closes the event Handle after completing.
|
||||
//
|
||||
// @param dontBroadcast Optional boolean that determines if event should be broadcast to clients.
|
||||
public native void Fire(bool dontBroadcast=false);
|
||||
|
||||
// Cancels a previously created game event that has not been fired. This
|
||||
// is necessary to avoid leaking memory when an event isn't fired.
|
||||
public native void Cancel();
|
||||
|
||||
// Returns the boolean value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param defValue Optional default value to use if the key is not found.
|
||||
// @return The boolean value of the specfied event key.
|
||||
public native bool GetBool(const char[] key, bool defValue=false);
|
||||
|
||||
// Sets the boolean value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param value New boolean value.
|
||||
public native void SetBool(const char[] key, bool value);
|
||||
|
||||
// Returns the integer value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param defValue Optional default value to use if the key is not found.
|
||||
// @return The integer value of the specfied event key.
|
||||
public native int GetInt(const char[] key, int defValue=0);
|
||||
|
||||
// Sets the integer value of a game event's key.
|
||||
//
|
||||
// Integer value refers to anything that can be reduced to an integer.
|
||||
// The various size specifiers, such as "byte" and "short" are still
|
||||
// integers, and only refer to how much data will actually be sent
|
||||
// over the network (if applicable).
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param value New integer value.
|
||||
public native void SetInt(const char[] key, int value);
|
||||
|
||||
// Returns the floating point value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param defValue Optional default value to use if the key is not found.
|
||||
// @return The floating point value of the specfied event key.
|
||||
public native float GetFloat(const char[] key, float defValue=0.0);
|
||||
|
||||
// Sets the floating point value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param value New floating point value.
|
||||
public native void SetFloat(const char[] key, float value);
|
||||
|
||||
// Retrieves the string value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param value Buffer to store the value of the specified event key.
|
||||
// @param maxlength Maximum length of string buffer.
|
||||
// @param defValue Optional default value to use if the key is not found.
|
||||
public native void GetString(const char[] key, char[] value, int maxlength, const char[] defvalue="");
|
||||
|
||||
// Sets the string value of a game event's key.
|
||||
//
|
||||
// @param key Name of event key.
|
||||
// @param value New string value.
|
||||
public native void SetString(const char[] key, const char[] value);
|
||||
|
||||
// Retrieves the name of a game event.
|
||||
//
|
||||
// @param name Buffer to store the name of the event.
|
||||
// @param maxlength Maximum length of string buffer.
|
||||
public native void GetName(char[] name, int maxlength);
|
||||
|
||||
// Sets whether an event's broadcasting will be disabled or not.
|
||||
//
|
||||
// This has no effect on events Handles that are not from HookEvent
|
||||
// or HookEventEx callbacks.
|
||||
property bool BroadcastDisabled {
|
||||
public native set(bool dontBroadcast);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a hook for when a game event is fired.
|
||||
*
|
||||
@@ -81,7 +166,7 @@ funcenum EventHook
|
||||
* @noreturn
|
||||
* @error Invalid event name or invalid callback function.
|
||||
*/
|
||||
native HookEvent(const String:name[], EventHook:callback, EventHookMode:mode=EventHookMode_Post);
|
||||
native void HookEvent(const char[] name, EventHook callback, EventHookMode mode=EventHookMode_Post);
|
||||
|
||||
/**
|
||||
* Creates a hook for when a game event is fired.
|
||||
@@ -92,7 +177,7 @@ native HookEvent(const String:name[], EventHook:callback, EventHookMode:mode=Eve
|
||||
* @return True if event exists and was hooked successfully, false otherwise.
|
||||
* @error Invalid callback function.
|
||||
*/
|
||||
native bool:HookEventEx(const String:name[], EventHook:callback, EventHookMode:mode=EventHookMode_Post);
|
||||
native bool HookEventEx(const char[] name, EventHook callback, EventHookMode mode=EventHookMode_Post);
|
||||
|
||||
/**
|
||||
* Removes a hook for when a game event is fired.
|
||||
@@ -103,13 +188,13 @@ native bool:HookEventEx(const String:name[], EventHook:callback, EventHookMode:m
|
||||
* @noreturn
|
||||
* @error Invalid callback function or no active hook for specified event.
|
||||
*/
|
||||
native UnhookEvent(const String:name[], EventHook:callback, EventHookMode:mode=EventHookMode_Post);
|
||||
native void UnhookEvent(const char[] name, EventHook callback, EventHookMode mode=EventHookMode_Post);
|
||||
|
||||
/**
|
||||
* Creates a game event to be fired later.
|
||||
*
|
||||
* The Handle should not be closed via CloseHandle(). It must be closed via
|
||||
* FireEvent() or CancelCreatedEvent().
|
||||
* event.Fire() or event.Cancel().
|
||||
*
|
||||
* @param name Name of event.
|
||||
* @param force If set to true, this forces the event to be created even if it's not being hooked.
|
||||
@@ -117,7 +202,7 @@ native UnhookEvent(const String:name[], EventHook:callback, EventHookMode:mode=E
|
||||
* @return Handle to event. INVALID_HANDLE is returned if the event doesn't exist or isn't
|
||||
being hooked (unless force is true).
|
||||
*/
|
||||
native Handle:CreateEvent(const String:name[], bool:force=false);
|
||||
native Event CreateEvent(const char[] name, bool force=false);
|
||||
|
||||
/**
|
||||
* Fires a game event.
|
||||
@@ -129,7 +214,7 @@ native Handle:CreateEvent(const String:name[], bool:force=false);
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native FireEvent(Handle:event, bool:dontBroadcast=false);
|
||||
native void FireEvent(Handle event, bool dontBroadcast=false);
|
||||
|
||||
/**
|
||||
* Cancels a previously created game event that has not been fired.
|
||||
@@ -138,17 +223,18 @@ native FireEvent(Handle:event, bool:dontBroadcast=false);
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native CancelCreatedEvent(Handle:event);
|
||||
native void CancelCreatedEvent(Handle event);
|
||||
|
||||
/**
|
||||
* Returns the boolean value of a game event's key.
|
||||
*
|
||||
* @param event Handle to the event.
|
||||
* @param key Name of event key.
|
||||
* @param defValue Optional default value to use if the key is not found.
|
||||
* @return The boolean value of the specfied event key.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native bool:GetEventBool(Handle:event, const String:key[]);
|
||||
native bool GetEventBool(Handle event, const char[] key, bool defValue=false);
|
||||
|
||||
/**
|
||||
* Sets the boolean value of a game event's key.
|
||||
@@ -159,17 +245,18 @@ native bool:GetEventBool(Handle:event, const String:key[]);
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native SetEventBool(Handle:event, const String:key[], bool:value);
|
||||
native void SetEventBool(Handle event, const char[] key, bool value);
|
||||
|
||||
/**
|
||||
* Returns the integer value of a game event's key.
|
||||
*
|
||||
* @param event Handle to the event.
|
||||
* @param key Name of event key.
|
||||
* @param defValue Optional default value to use if the key is not found.
|
||||
* @return The integer value of the specfied event key.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native GetEventInt(Handle:event, const String:key[]);
|
||||
native int GetEventInt(Handle event, const char[] key, int defValue=0);
|
||||
|
||||
/**
|
||||
* Sets the integer value of a game event's key.
|
||||
@@ -185,17 +272,18 @@ native GetEventInt(Handle:event, const String:key[]);
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native SetEventInt(Handle:event, const String:key[], value);
|
||||
native void SetEventInt(Handle event, const char[] key, int value);
|
||||
|
||||
/**
|
||||
* Returns the floating point value of a game event's key.
|
||||
*
|
||||
* @param event Handle to the event.
|
||||
* @param key Name of event key.
|
||||
* @param defValue Optional default value to use if the key is not found.
|
||||
* @return The floating point value of the specfied event key.
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native Float:GetEventFloat(Handle:event, const String:key[]);
|
||||
native float GetEventFloat(Handle event, const char[] key, float defValue=0.0);
|
||||
|
||||
/**
|
||||
* Sets the floating point value of a game event's key.
|
||||
@@ -206,7 +294,7 @@ native Float:GetEventFloat(Handle:event, const String:key[]);
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native SetEventFloat(Handle:event, const String:key[], Float:value);
|
||||
native void SetEventFloat(Handle event, const char[] key, float value);
|
||||
|
||||
/**
|
||||
* Retrieves the string value of a game event's key.
|
||||
@@ -215,10 +303,11 @@ native SetEventFloat(Handle:event, const String:key[], Float:value);
|
||||
* @param key Name of event key.
|
||||
* @param value Buffer to store the value of the specified event key.
|
||||
* @param maxlength Maximum length of string buffer.
|
||||
* @param defValue Optional default value to use if the key is not found.
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native GetEventString(Handle:event, const String:key[], String:value[], maxlength);
|
||||
native void GetEventString(Handle event, const char[] key, char[] value, int maxlength, const char[] defvalue="");
|
||||
|
||||
/**
|
||||
* Sets the string value of a game event's key.
|
||||
@@ -229,7 +318,7 @@ native GetEventString(Handle:event, const String:key[], String:value[], maxlengt
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native SetEventString(Handle:event, const String:key[], const String:value[]);
|
||||
native void SetEventString(Handle event, const char[] key, const char[] value);
|
||||
|
||||
/**
|
||||
* Retrieves the name of a game event.
|
||||
@@ -240,7 +329,7 @@ native SetEventString(Handle:event, const String:key[], const String:value[]);
|
||||
* @noreturn
|
||||
* @error Invalid or corrupt Handle.
|
||||
*/
|
||||
native GetEventName(Handle:event, String:name[], maxlength);
|
||||
native void GetEventName(Handle event, char[] name, int maxlength);
|
||||
|
||||
/**
|
||||
* Sets whether an event's broadcasting will be disabled or not.
|
||||
@@ -253,5 +342,4 @@ native GetEventName(Handle:event, String:name[], maxlength);
|
||||
* @noreturn
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native SetEventBroadcast(Handle:event, bool:dontBroadcast);
|
||||
|
||||
native void SetEventBroadcast(Handle event, bool dontBroadcast);
|
||||
|
||||
Reference in New Issue
Block a user