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

Anything related on how to build / improve your AI using BWAPI, BWTA, BWSAL, etc.
ZerGreenOne
Posts: 2
Joined: Sat Sep 17, 2016 10:11 pm

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

Postby ZerGreenOne » Sat Sep 17, 2016 10:21 pm

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.
ZerGreenOne
Posts: 2
Joined: Sat Sep 17, 2016 10:11 pm

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

Postby ZerGreenOne » Sun Sep 18, 2016 9:11 am

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.

Return to “AI development (BWAPI Bots)”

Who is online

Users browsing this forum: No registered users and 1 guest