1.1 --- a/plugins/include/timers.inc Sun Mar 01 16:43:48 2009 -0500
1.2 +++ b/plugins/include/timers.inc Sun Mar 01 16:48:55 2009 -0500
1.3 @@ -39,7 +39,8 @@
1.4
1.5 #define TIMER_REPEAT (1<<0) /**< Timer will repeat until it returns Plugin_Stop */
1.6 #define TIMER_FLAG_NO_MAPCHANGE (1<<1) /**< Timer will not carry over mapchanges */
1.7 -#define TIMER_HNDL_CLOSE (1<<9) /**< Timer will automatically call CloseHandle() on its value when finished */
1.8 +#define TIMER_HNDL_CLOSE (1<<9) /**< Deprecated define, replaced by below */
1.9 +#define TIMER_DATA_HNDL_CLOSE (1<<9) /**< Timer will automatically call CloseHandle() on its data when finished */
1.10
1.11 /**
1.12 * Any of the following prototypes will work for a timed function.
1.13 @@ -50,7 +51,7 @@
1.14 * Called when the timer interval has elapsed.
1.15 *
1.16 * @param timer Handle to the timer object.
1.17 - * @param hndl Handle passed when the timer was created.
1.18 + * @param hndl Handle passed to CreateTimer() when timer was created.
1.19 * @return Plugin_Stop to stop a repeating timer, any other value for
1.20 * default behavior.
1.21 */
1.22 @@ -60,11 +61,11 @@
1.23 * Called when the timer interval has elapsed.
1.24 *
1.25 * @param timer Handle to the timer object.
1.26 - * @param value Value passed when the timer was created.
1.27 + * @param data Data passed to CreateTimer() when timer was created.
1.28 * @return Plugin_Stop to stop a repeating timer, any other value for
1.29 * default behavior.
1.30 */
1.31 - Action:public(Handle:timer, any:value),
1.32 + Action:public(Handle:timer, any:data),
1.33
1.34 /**
1.35 * Called when the timer interval has elapsed.
1.36 @@ -81,18 +82,18 @@
1.37 *
1.38 * @param interval Interval from the current game time to execute the given function.
1.39 * @param func Function to execute once the given interval has elapsed.
1.40 - * @param value Handle or value to give to the timer function.
1.41 + * @param data Handle or value to pass through to the timer callback function.
1.42 * @param flags Flags to set (such as repeatability or auto-Handle closing).
1.43 * @return Handle to the timer object. You do not need to call CloseHandle().
1.44 * If the timer could not be created, INVALID_HANDLE will be returned.
1.45 */
1.46 -native Handle:CreateTimer(Float:interval, Timer:func, any:value=INVALID_HANDLE, flags=0);
1.47 +native Handle:CreateTimer(Float:interval, Timer:func, any:data=INVALID_HANDLE, flags=0);
1.48
1.49 /**
1.50 * Kills a timer. Use this instead of CloseHandle() if you need more options.
1.51 *
1.52 - * @param autoClose If autoClose is true, the timer's value will be
1.53 - * closed as a handle if TIMER_HNDL_CLOSE was not specified.
1.54 + * @param autoClose If autoClose is true, the data that was passed to CreateTimer() will
1.55 + * be closed as a handle if TIMER_DATA_HNDL_CLOSE was not specified.
1.56 * @noreturn
1.57 */
1.58 native KillTimer(Handle:timer, bool:autoClose=false);
1.59 @@ -189,20 +190,21 @@
1.60 native bool:IsServerProcessing();
1.61
1.62 /**
1.63 - * Creates a timer associated with a new data pack, and returns the datapack.
1.64 + * Creates a timer associated with a new datapack, and returns the datapack.
1.65 * @note The datapack is automatically freed when the timer ends.
1.66 * @note The position of the datapack is not reset or changed for the timer function.
1.67 *
1.68 * @param interval Interval from the current game time to execute the given function.
1.69 * @param func Function to execute once the given interval has elapsed.
1.70 - * @param data The newly created datapack is passed though this by-reference parameter.
1.71 + * @param datapack The newly created datapack is passed though this by-reference
1.72 + * parameter to the timer callback function.
1.73 * @param flags Timer flags.
1.74 * @return Handle to the timer object. You do not need to call CloseHandle().
1.75 */
1.76 -stock Handle:CreateDataTimer(Float:interval, Timer:func, &Handle:data, flags=0)
1.77 +stock Handle:CreateDataTimer(Float:interval, Timer:func, &Handle:datapack, flags=0)
1.78 {
1.79 - data = CreateDataPack();
1.80 - flags |= TIMER_HNDL_CLOSE;
1.81 - return CreateTimer(interval, func, data, flags);
1.82 + datapack = CreateDataPack();
1.83 + flags |= TIMER_DATA_HNDL_CLOSE;
1.84 + return CreateTimer(interval, func, datapack, flags);
1.85 }
1.86