HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Macintosh Desyncs with TriggerAddCondition

10-23-2011, 10:26 PM#1
tooltiperror
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.
Collapse 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:
Expand JASS:

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.
Attached Files
File type: w3mMacDesyncTest(2).w3m (17.0 KB)
File type: w3gMac Desync Myth Debonked.w3g (3.5 KB)
10-23-2011, 10:40 PM#2
BBQ
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
Anitarf
Quote:
Originally Posted by BBQ
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.
I've seen you mention this before, but without having a thread like this to link to I hope you can understand why I remained sceptical. You may have heard it from someone you trust enough to have accepted it as true, but the rest of us could not make that judgement without the test results being posted somewhere like this.

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
Bribe
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
Anitarf
Quote:
Originally Posted by Bribe
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.
Well, unless you also call that function directly in addition to evaluating it, only the clone will ever be called in the final map script so the unused original should get removed by the map optimizer.