[Wierd?] Optimizing maps

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

[Wierd?] Optimizing maps

Post by naturesfury »

soooo u guys no how it says like fixing IsUnitType glitches when u optimize a script? (.j)

welll i looked thru an optimized map......and thought.........wouldnt taht change what hapens?
cause this:

return (IsUnitType(randomunit,UNIT_TYPE_HERO)!=false)

went to this:

return(IsUnitType(randomunit,UNIT_TYPE_HERO)!=false)!=null
(made this ------^ the same as the unit above so it wouldnt be confused......optimized, it was sN or something)

the first would return true or false, wheather the random unit was a hero or not
(if not a hero, it would return false) (if it was a hero, it would return true)
the second would return whether the boolean was null or not
so..it would return true whether or not the unit was a hero
(if hero, it would return true) (if not hero, it would still return true)
cause...

for the unit=hero scenario
IsUnitType(randomunit, UNIT_TYPE_HERO) would be true
true!=false is true
true!=null is true
return true

for the unit != hero scenario
IsUnitType(randomunit, UNIT_TYPE_HERO) would be false
false!=false would be false
false!=null is true
return true

welllllllll tahts what im thinking
and im srsly hoping the optimizer doesnt screw up scripts......soooo

where's my error lol xD
X3n0nX
Member
Posts: 63
Joined: December 22nd, 2010, 7:37 am
Title: Administrator
Location: Middle East

Re: [Wierd?] Optimizing maps

Post by X3n0nX »

What are you trying to say? I don't get your point. I used IsUnitType before, it works fine. Or are you trying to say that the optimizer screws your JASS scripts? Try running the synthax check in JASSCRAFT. ;),
Image
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: [Wierd?] Optimizing maps

Post by naturesfury »

ok yea the isunittype works fine
even after optimization

but looking at the logic, im saying it doesnt make sense
looking purely at the JASS, the optimization SHOULD have changed it (as i mentioned above)
(and gave 2 senarios)
but it didnt......and the JASS works as it should before the optimization

so im wondering why/how that is......
(how/why is "return (IsUnitType(randomunit,UNIT_TYPE_HERO)!=false)" equal to "return(IsUnitType(randomunit,UNIT_TYPE_HERO)!=false)!=null" )
X3n0nX
Member
Posts: 63
Joined: December 22nd, 2010, 7:37 am
Title: Administrator
Location: Middle East

Re: [Wierd?] Optimizing maps

Post by X3n0nX »

It makes your the code more efficient, I'm not sure but. I think it nulls "randomunit" if it returns false. ;)
Image