• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Is there more effective playergroup (force) loops?

Status
Not open for further replies.
Level 23
Joined
Nov 29, 2006
Messages
2,482
Hm well, I've seen examples of improving Integer Loops, and Unit Groups.

But is there a way of doing this for a force as well?

I mean, this works for a unit group;
JASS:
function LoopEx takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        //loop actions
        call GroupRemoveUnit(g, u)
    endloop
    call DestroyGroup(g)
endfunction

is there something similiar for a force, or do I have to do call ForForce( my_force, function my_func )?
hm, it would be great if there is one, thus its otherwise screwing my locals.

/regards
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
What do you mean by the ForceEnum function?

Hmm there are 4 ForceEnum functions:

JASS:
native ForceEnumAllies          takes force whichForce, player whichPlayer, boolexpr filter returns nothing
native ForceEnumEnemies         takes force whichForce, player whichPlayer, boolexpr filter returns nothing
native ForceEnumPlayers         takes force whichForce, boolexpr filter returns nothing
native ForceEnumPlayersCounted  takes force whichForce, boolexpr filter, integer countLimit returns nothing

But I don't see what they've got to do with this. Maybe EF just made a mistake (like he made a mistake in punctuation :p).
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Yesyes, I see...

Then I know. Thanks

Well the reason why I dislike those enumerations are perhaps that it doesnt work with locals without using the handle bug.

~Offtopic~
The reason why using H2I bug is because the handles are turned into an integer code, and then, wont drain the same amount of memory if you would when you store a handle?
Am I right?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
The reason why using H2I bug is because the handles are turned into an integer code, and then, wont drain the same amount of memory if you would when you store a handle?
Am I right?
No, it's because gamecaches can't store non-primitive types (Their way of storing units is... useless for anything other than a multimap campaign).

Well the reason why I dislike those enumerations are perhaps that it doesnt work with locals without using the handle bug.
Or storing to globals, but if you have to pass a significant amount of information, Need_O2's way is definitely better (Especially since with only 16 players you can't really have this get too inefficient).
 
Status
Not open for further replies.
Top