| 10-23-2011, 10:26 PM | #1 |
The word on the street has been that using TriggerAddCondition incorrectly can desync users on MacOS X. By "incorrectly" I mean you provide a function that does not return a boolean. This gets by in Warcraft III's syntax checker, but only if you use a wrapper function. JASS:library Desyncronizer function TriggerAddEvilCondition takes trigger trig, code handler returns triggercondition return TriggerAddCondition(trig, Condition(handler)) endfunction endlibrary Provide a function that returns nothing to TriggerAddEvilCondition and Mac users would get nasty desyncs. However, Blizzard claimed to fix this as of Patch 1.26. I was informed of this bug by Anitarf, and we tested it on Battle.net. I was testing on MacOS X 10.6.8 on a Model 6,1 MacBook. This was the script that was used: JASS:// MacTest // Originally by tooltiperror // Fixed by Anitarf to actually compile scope MacTest initializer onInit private function onSkip takes nothing returns nothing call BJDebugMsg("Try not to become a man of success but a man of value.") call BJDebugMsg("- Albert Einstein") endfunction private function TriggerAddConditionWrapper takes trigger t, code c returns nothing call TriggerAddCondition(t, Condition(c)) endfunction private function onInit takes nothing returns nothing local trigger trig = CreateTrigger() // It's a two player map, I'm assuming. call TriggerRegisterPlayerEvent(trig, Player(0), EVENT_PLAYER_END_CINEMATIC) call TriggerRegisterPlayerEvent(trig, Player(1), EVENT_PLAYER_END_CINEMATIC) call TriggerRegisterPlayerEvent(trig, Player(2), EVENT_PLAYER_END_CINEMATIC) // Registering events is the ying to my yang. call TriggerAddConditionWrapper(trig, function onSkip) endfunction endscope We went on, pressed Esc a bunch of times... and nothing happened. So this bug has been successfully fixed by Blizzard. Cheers for Mac users everywhere. Attached is the replay, and the test map (by Anitarf) in case anybody is interested. Happy modding, stay classy. |
| 10-23-2011, 10:40 PM | #2 |
A small correction, the vanilla syntax checker perfectly allows you to pass functions that return nothing to Condition() and Filter(). It is PJass that doesn't... so you need to do some evil workarounds. And thank you for the actual confirmation - I've been "thinking" it was fixed for quite some time, but I guess it's official now. |
| 10-23-2011, 11:29 PM | #3 | |
Quote:
The fact that this no longer desyncs does make public APIs that take code values to use as trigger conditions more bearable since user functions no longer need dummy boolean return statements, but I still find function interfaces preferable for this task since they can take arguments. |
| 10-24-2011, 07:40 AM | #4 |
Function interfaces wouldn't be so bad if they didn't make copies of the function pointer, especially when you have a huge function that gets cloned over. |
| 10-24-2011, 04:46 PM | #5 | |
Quote:
|
