HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

auto index excluding dummy casters: how?

06-09-2009, 10:31 AM#1
Sinnergy
in auto index documentation, ive got this paragraph which i dont understand much
Quote:
The UnitFilter function in the config section is provided so that you can make AutoIndex completely ignore any unit-types that don't need to be indexed. Examples of things you may want ignored include dummy casters (such as xe or Caster System dummy casters) or other private system units.
Collapse JASS:
public function UnitFilter takes nothing returns boolean
    return true
endfunction
//Any units you filter out in this function will not be indexed by AutoIndex.
//Use GetFilterUnit() to refer to the filtered unit. If you use Caster System
//or xe, make sure to filter out the dummy units' typeid.
ive searched inside the autoindex trigger and havent found any block of functions that excludes dummy units. where should i exclude these dummy casters? thanks
06-09-2009, 10:50 AM#2
akolyt0r
Collapse JASS:
public function UnitFilter takes nothing returns boolean
    return not GetUnitTypeId(GetFilterUnit())==YOUR_DUMMY_ID
endfunction
06-09-2009, 01:06 PM#3
DioD
Collapse JASS:
globals

    boolean array FILTERINDEX

endglobals


function HASH8191 takes integer I returns integer
    return I - (I / 8191)*8191
endfunction

function INITFILTERARRAY takes nothing returns nothing

    set FILTERINDEX[HASH8191('Hfoo')] = true
    
endfunction


function FILTERBYARRAY takes nothing returns boolean
    return not FILTERINDEX[HASH8191(GetUnitTypeId(GetFilterUnit()))]
endfunction 


This functions allow you to build fast and efficient filter system to handle unlimited number of unit types.

vJass LARGE arrays allows to cover large number of typeids also you can add collusion handler (check code section for linked list)
06-09-2009, 02:13 PM#4
grim001
the question is: why would anyone need to filter more than a handful of unit types?
06-09-2009, 03:11 PM#5
Vexorian
Collapse JASS:
public function UnitFilter takes nothing returns boolean
    return (GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') == 0)
endfunction
06-10-2009, 09:57 AM#6
Sinnergy
Quote:
Originally Posted by Vexorian
Collapse JASS:
public function UnitFilter takes nothing returns boolean
    return (GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') == 0)
endfunction
in some dummy caster systems, dummy units dont have locust ability in default, and the system will only add the locust ability when that unit is created or will be used

so which comes first? autoindex's unit detection on map enter, or systems that adds locust ability to dummy units on creation?

im just asking
06-11-2009, 12:20 PM#7
Anachron
I suggest waiting 0.00001 second and add locust then.
06-11-2009, 12:30 PM#8
grim001
autoindex would come first.

At the moment I suggest you don't waste a lot of time worrying about AutoIndex. All unit indexing might become useless once we benchmark hashtable and see how it compares in speed to UnitUserData.