Quote from name:Azrael.Wrath
Bring can cause a memory leak, Command can't.
Woot, a memory leak?!
Quote from name:Azrael.Wrath
As outlined by rockz above, Command is much more similar to Accumulate than it is to Bring.
Disagree. Accumulate only accesses a single variable, when Command iterates through the units array.
Quote from name:HCM™Aristocrat
AFAIK Command scans the array of units and checks for the number of units with the same ID, but it is possible that a variable is assigned to the number of units owned by the player and is modified on creation/removal/death. In the first case it would be O(n) but in the second case it would be O(1) like the death and accumulate conditions.
Haven't understood about O(1) thing (the bold part). Could you please elaborate more why you think it's O(1) but not O(n)?
Quote from name:HCM™Aristocrat
Bring, however, functions like this: (as far as I know)
-Iterates through all units.
-Once a unit of the type is found, It locates the center of the unit and uses arithmetic to find the four corners of the unit.
-Then, it performs four comparisons for each corner, to check to see if they lie within the location.
-If so, then the unit is in the location and 1 is added to the "bring count".
-When all units have been scanned it checks that number.
Actually it operates a bit differently. There is a cache which is filled with all units on a given location. Bring fills the cache with units and then iterates through this cache. If the cache wasn't invalidated and if the next Bring runs on the same location, SC won't reiterate through all units performing "narrowing" (when it checks whether a unit is in the location), it uses the cache instead. Some actions doesn't invalidate the cache (like CreateUnit) which is a well known bug when a unit appears to be invisible for the Bring condition.
Moral: always group multiple Brings working on the same location.
Lets say you have 5 characters, and each character has 100 triggers of this type. If you put that condition first, it means for any particular player, 400 triggers will return false on their first condition, and only 100 triggers will return true on their first condition. That is much better than waiting until the 2nd, 3rd or 4th condition to wipe out 4/5 of triggers.
Right. Norm wasn't very clear and I read it literary that
all 2500 Deaths conditions are
always true.
Post has been edited 4 time(s), last time on Jul 1 2010, 6:12 am by Wormer.
Some.