Skip to content

Commit

Permalink
RegisterNativeEvent: Add UnregisterNativeEventHandler
Browse files Browse the repository at this point in the history
Add new wrapper for TriggerRemoveCondition(). Since Warcraft3 1.30.4,
this function has been fixed and can be used safely for triggercondition
removal.
  • Loading branch information
crojewsk committed Sep 16, 2020
1 parent cd679cd commit b517338
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jass/RegisterNativeEvent.j
@@ -1,6 +1,6 @@
/*****************************************************************************
*
* RegisterNativeEvent v1.1.1.3
* RegisterNativeEvent v1.1.1.4
* by Bannar
*
* Storage of trigger handles for native events.
Expand Down Expand Up @@ -47,6 +47,9 @@
* function RegisterNativeEvent takes integer whichEvent, code func returns nothing
* Registers new event handler func for specified event whichEvent.
*
* function UnregisterNativeEventHandler takes integer whichEvent, triggercondition handler returns nothing
* Unregisters specified event handler for event whichEvent. Requires Warcraft 1.30.4+.
*
*****************************************************************************/
library RegisterNativeEvent uses optional Table

Expand Down Expand Up @@ -119,4 +122,8 @@ function RegisterNativeEvent takes integer whichEvent, code func returns nothing
call RegisterIndexNativeEvent(bj_MAX_PLAYER_SLOTS, whichEvent, func)
endfunction

function UnregisterNativeEventHandler takes integer whichEvent, triggercondition handler returns nothing
call TriggerRemoveCondition(GetNativeEventTrigger(whichEvent), handler)
endfunction

endlibrary

0 comments on commit b517338

Please sign in to comment.