- Joined
- Dec 16, 2010
- Messages
- 31
I've attached the example map with the small amount of code.
Situation:
I have a single struct, with two triggers. Both triggers register in TriggerRegisterUnitInRange() and go to different boolexpr.
In one of the boolexpr, the handle of GetTriggeringTrigger() matches the trigger that was registered.
In the other boolexpr, the handles don't match (wtf?). The weirder part is that if I get rid of some of the code in the second one (the if statement and the unit = null) then it seems to work.
code:
Does anyone know what might cause this behavior?
Situation:
I have a single struct, with two triggers. Both triggers register in TriggerRegisterUnitInRange() and go to different boolexpr.
In one of the boolexpr, the handle of GetTriggeringTrigger() matches the trigger that was registered.
In the other boolexpr, the handles don't match (wtf?). The weirder part is that if I get rid of some of the code in the second one (the if statement and the unit = null) then it seems to work.
code:
JASS:
library AdvancedProjectile initializer initShowBug
module Projectile
trigger collisionTrg1
trigger collisionTrg2
static thistype ref
static method createNormal takes nothing returns thistype
local thistype this = thistype.allocate()
local unit u1 = CreateUnit(Player(0), 'hpea', 0,0,0)
local unit u2 = CreateUnit(Player(0), 'hpea', 0,0,0)
set ref = this
set collisionTrg1 = CreateTrigger()
call TriggerRegisterUnitInRange(collisionTrg1, u1, 200.0, null)
call TriggerAddCondition(collisionTrg1, function thistype.inRangeEnum)
set collisionTrg2 = CreateTrigger()
call TriggerRegisterUnitInRange(collisionTrg2, u2, 200.0, null)
call TriggerAddCondition(collisionTrg2, function thistype.inRangeEnum2)
return this
endmethod
//This one doesn't bug out, handle id's match
static method inRangeEnum2 takes nothing returns boolean
call BJDebugMsg("This: "+I2S(GetHandleId(ref.collisionTrg2))+" should match "+I2S(GetHandleId(GetTriggeringTrigger())) + " <-- And it does. wtf..")
return false
endmethod
//this one shows different handle id's
static method inRangeEnum takes nothing returns boolean
call BJDebugMsg("This: "+I2S(GetHandleId(ref.collisionTrg1))+" should match "+I2S(GetHandleId(GetTriggeringTrigger())) + " <-- But it doesn't!?")
//this line (the comment) causes the bad handle id --- lol?
return false
endmethod
endmodule
struct ProjectileStruct
implement Projectile
endstruct
function ShowBug takes nothing returns nothing
call ProjectileStruct.createNormal()
endfunction
function initShowBug takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 1.0, false)
call TriggerAddAction(t, function ShowBug)
endfunction
endlibrary
Does anyone know what might cause this behavior?
Attachments
Last edited: