Merge pull request #185 from powerlord/tr-event

Update events.inc to Transitional syntax.
This commit is contained in:
David Anderson 2014-11-08 15:56:20 -08:00
commit cd0ac3ae37

View File

@ -59,7 +59,7 @@ union EventHook
* @param dontBroadcast True if event was not broadcast to clients, false otherwise. * @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. * @return Ignored for post hooks. Plugin_Handled will block event if hooked as pre.
*/ */
function Action (Handle event, const char[] name, bool dontBroadcast); function Action (Event event, const char[] name, bool dontBroadcast);
/** /**
* Called when a game event is fired. * Called when a game event is fired.
* *
@ -69,7 +69,7 @@ union EventHook
* @param dontBroadcast True if event was not broadcast to clients, false otherwise. * @param dontBroadcast True if event was not broadcast to clients, false otherwise.
* @noreturn * @noreturn
*/ */
function void (Handle event, const char[] name, bool dontBroadcast); function void (Event event, const char[] name, bool dontBroadcast);
}; };
/** /**
@ -81,7 +81,7 @@ union EventHook
* @noreturn * @noreturn
* @error Invalid event name or invalid callback function. * @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. * Creates a hook for when a game event is fired.
@ -92,7 +92,7 @@ native HookEvent(const String:name[], EventHook:callback, EventHookMode:mode=Eve
* @return True if event exists and was hooked successfully, false otherwise. * @return True if event exists and was hooked successfully, false otherwise.
* @error Invalid callback function. * @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. * Removes a hook for when a game event is fired.
@ -103,7 +103,7 @@ native bool:HookEventEx(const String:name[], EventHook:callback, EventHookMode:m
* @noreturn * @noreturn
* @error Invalid callback function or no active hook for specified event. * @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. * Creates a game event to be fired later.
@ -117,7 +117,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 * @return Handle to event. INVALID_HANDLE is returned if the event doesn't exist or isn't
being hooked (unless force is true). 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. * Fires a game event.
@ -129,7 +129,7 @@ native Handle:CreateEvent(const String:name[], bool:force=false);
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @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. * Cancels a previously created game event that has not been fired.
@ -138,7 +138,7 @@ native FireEvent(Handle:event, bool:dontBroadcast=false);
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @error Invalid or corrupt Handle.
*/ */
native CancelCreatedEvent(Handle:event); native void CancelCreatedEvent(Handle event);
/** /**
* Returns the boolean value of a game event's key. * Returns the boolean value of a game event's key.
@ -149,7 +149,7 @@ native CancelCreatedEvent(Handle:event);
* @return The boolean value of the specfied event key. * @return The boolean value of the specfied event key.
* @error Invalid or corrupt Handle. * @error Invalid or corrupt Handle.
*/ */
native bool:GetEventBool(Handle:event, const String:key[], bool:defValue=false); native bool GetEventBool(Handle event, const char[] key, bool defValue=false);
/** /**
* Sets the boolean value of a game event's key. * Sets the boolean value of a game event's key.
@ -160,7 +160,7 @@ native bool:GetEventBool(Handle:event, const String:key[], bool:defValue=false);
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @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. * Returns the integer value of a game event's key.
@ -171,7 +171,7 @@ native SetEventBool(Handle:event, const String:key[], bool:value);
* @return The integer value of the specfied event key. * @return The integer value of the specfied event key.
* @error Invalid or corrupt Handle. * @error Invalid or corrupt Handle.
*/ */
native GetEventInt(Handle:event, const String:key[], defValue=0); native int GetEventInt(Handle event, const char[] key, int defValue=0);
/** /**
* Sets the integer value of a game event's key. * Sets the integer value of a game event's key.
@ -187,7 +187,7 @@ native GetEventInt(Handle:event, const String:key[], defValue=0);
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @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. * Returns the floating point value of a game event's key.
@ -198,7 +198,7 @@ native SetEventInt(Handle:event, const String:key[], value);
* @return The floating point value of the specfied event key. * @return The floating point value of the specfied event key.
* @error Invalid or corrupt Handle. * @error Invalid or corrupt Handle.
*/ */
native Float:GetEventFloat(Handle:event, const String:key[], Float:defValue=0.0); native float GetEventFloat(Handle event, const char[] key, float defValue=0.0);
/** /**
* Sets the floating point value of a game event's key. * Sets the floating point value of a game event's key.
@ -209,7 +209,7 @@ native Float:GetEventFloat(Handle:event, const String:key[], Float:defValue=0.0)
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @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. * Retrieves the string value of a game event's key.
@ -222,7 +222,7 @@ native SetEventFloat(Handle:event, const String:key[], Float:value);
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @error Invalid or corrupt Handle.
*/ */
native GetEventString(Handle:event, const String:key[], String:value[], maxlength, const String:defvalue[]=""); 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. * Sets the string value of a game event's key.
@ -233,7 +233,7 @@ native GetEventString(Handle:event, const String:key[], String:value[], maxlengt
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @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. * Retrieves the name of a game event.
@ -244,7 +244,7 @@ native SetEventString(Handle:event, const String:key[], const String:value[]);
* @noreturn * @noreturn
* @error Invalid or corrupt Handle. * @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. * Sets whether an event's broadcasting will be disabled or not.
@ -257,5 +257,20 @@ native GetEventName(Handle:event, String:name[], maxlength);
* @noreturn * @noreturn
* @error Invalid Handle. * @error Invalid Handle.
*/ */
native SetEventBroadcast(Handle:event, bool:dontBroadcast); native void SetEventBroadcast(Handle event, bool dontBroadcast);
methodmap Event < Handle {
public Event() = CreateEvent;
public Fire() = FireEvent;
public Cancel() = CancelCreatedEvent;
public GetBool() = GetEventBool;
public SetBool() = SetEventBool;
public GetInt() = GetEventInt;
public SetInt() = SetEventInt;
public GetFloat() = GetEventFloat;
public SetFloat() = SetEventFloat;
public GetString() = GetEventString;
public SetString() = SetEventString;
public GetName() = GetEventName;
public SetBroadcast() = SetEventBroadcast;
}