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

Anything related on how to build / improve your AI using BWAPI, BWTA, BWSAL, etc.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
ZerGreenOne
Posts: 2
Joined: Sat Sep 17, 2016 10:11 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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.

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “AI development (BWAPI Bots)”

Who is online

Users browsing this forum: No registered users and 9 guests