widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02099
Re: FindNodeResource - counting fields with fishes
On 18.06.2014, at 14:00, Tibor Bamhor <tiborb95@xxxxxxxxx> wrote:
> Thanks - it worked!!! (no surprise)
>
> BTW also animals (game) is not counted by now so hunters are placed blindly
> - and dismantle is done so ... could you advice how to count them?
>
> I know there is get_bob function, but there is a lot of types of animals…
all of them are editable and huntable. So what?
>
>
>
> 2014-06-18 13:36 GMT+02:00 SirVer <SirVer@xxxxxx>:
>
>>
>> On 18.06.2014, at 13:21, Tibor Bamhor <tiborb95@xxxxxxxxx> wrote:
>>
>>> Hi,
>>>
>>> this is programming-related question, I can not figure it out (no wonder
>>> with my experiences):
>>>
>>> I need to count fields with fishes (currently no such feature in AI), I
>>> somehow came to this:
>>>
>>> if (field.water_nearby_ >0){
>>> map.find_fields(Area<FCoords>(field.coords, 6), &resource_list,
>>> FindNodeResource(tribe->safe_ware_index("fish")));
>>
>> this is the issue. You want to find a map resource, so you need to look up
>> the index for the resource in the map (World::get_resource(“fish”))
>>
>>> field.fish_nearby_ = resource_list.size();
>>> }
>>>
>>> The problem is that it still calculates 0; so first - is the syntax OK?
>>>
>>> Or perhaps the problem is with third argument?
>>>
>>> I grepped the code but failed to find piece of code that I would
>> copy/paste
>>> and use for my purposes.
>>>
>>> Thanks
>>>
>>> --
>>>
>> https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
>>> Your team Widelands Developers is subscribed to branch
>> lp:~widelands-dev/widelands/one_world.
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~widelands-dev
>>> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~widelands-dev
>>> More help : https://help.launchpad.net/ListHelp
>>
>>
>> --
>> https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
>> Your team Widelands Developers is subscribed to branch
>> lp:~widelands-dev/widelands/one_world.
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~widelands-dev
>> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~widelands-dev
>> More help : https://help.launchpad.net/ListHelp
>>
>
> --
> https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
> Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/one_world.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~widelands-dev
> Post to : widelands-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~widelands-dev
> More help : https://help.launchpad.net/ListHelp
--
https://code.launchpad.net/~widelands-dev/widelands/one_world/+merge/222708
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/one_world.
Follow ups
References