Page 1 of 1

How to use Custom UnitFilters? (C++ dll)

Posted: Sat Sep 17, 2016 10:21 pm
by ZerGreenOne
Suppose I have an unordered_map that takes units and maps them to integers. I have a unit u. How can I use u->GetClosestUnit() to get the closest unit that is mapped to a certain value via an unordered_map? GetClosestUnit takes a value of type UnitFilter (Which is an alias of UnaryFilter<Unit>), so how can I create a UnitFilter that will be able to to find the value mapped to in the unordered_map by the current choice of ClosestUnit?

Or just in general, how can I create a custom UnitFilter for use in GetClosestUnit(), that can juggle values based on the current iteration of GetClosestUnit()? The exact example doesn't matter.

Re: How to use Custom UnitFilters? (C++ dll)

Posted: Sun Sep 18, 2016 9:11 am
by ZerGreenOne
Actually, nevermind, apparently you have to create a function that returns bool and has an argument of type Unit, and then create a variable of type UnitFilter and set it to be equal to that function.