Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/findpath_modification into lp:widelands

2018-02-14 Thread GunChleoc
I replied in the diff.

Maybe you need a different tutorial, or to sit down with somebody to teach you. 
That tutorial is maybe too abstract, and you need some exercises to go along 
with it? Or maybe what's confusing you here is the combination of pointers and 
object orientation?

Diff comments:

> 
> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc   2018-02-12 11:43:28 +
> +++ src/ai/defaultai.cc   2018-02-13 07:54:42 +
> @@ -3537,32 +3647,41 @@
>   // This is a candidate, sending all necessary info to 
> RoadCandidates
>   const bool different_economy = 
> (player_immovable->get_economy() != flag.get_economy());
>   const int32_t air_distance = 
> map.calc_distance(flag.get_position(), reachable_coords);
> - RoadCandidates.add_flag(reachable_coords, air_distance, 
> different_economy);
> + if 
> (!RoadCandidates.has_candidate(reachable_coords.hash())) {
> + RoadCandidates.add_flag(reachable_coords, 
> air_distance, different_economy);
> + }
>   }
>   }
>  
>   // now we walk over roads and if field is reachable by roads, we change 
> the distance assigned
>   // above
> - std::priority_queue queue;
> - std::vector nearflags;  // only used to collect flags 
> reachable walk over roads
> - queue.push(NearFlag(flag, 0, 0));
> + std::map nearflags;  // only used to collect flags 
> reachable walk over roads
> + nearflags[flag.get_position().hash()] = NearFlag(, 0);
>  
>   // algorithm to walk on roads
> - while (!queue.empty()) {
> - std::vector::iterator f =
> -find(nearflags.begin(), nearflags.end(), queue.top().flag);
> -
> - if (f != nearflags.end()) {
> - queue.pop();
> - continue;
> - }
> -
> - nearflags.push_back(queue.top());
> - queue.pop();
> - NearFlag& nf = nearflags.back();
> -
> + // All nodes are marked as to_be_checked and under some conditions, the 
> same node can be checked
> + // twice
> + for (;;) {
> + // looking for a node with shortest existing road distance from 
> starting flag and one that has
> + // to be checked
> + uint32_t start_field = std::numeric_limits::max();
> + uint32_t nearest_distance = 1;
> + for (auto item : nearflags) {
> + if (item.second.current_road_distance < 
> nearest_distance && item.second.to_be_checked) {
> + nearest_distance = 
> item.second.current_road_distance;
> + start_field = item.first;
> + }
> + }
> + // OK, so no NearFlag left to be checked - quitting the loop now

No, because it's not obvious that item.second.to_be_checked will become false 
for all items eventually. Otherwise, we wouldn't have this discussion ;)

> + if (start_field == std::numeric_limits::max()) {
> + break;
> + }
> +
> + nearflags[start_field].to_be_checked = false;
> +
> + // Now going over roads leading from this flag
>   for (uint8_t i = 1; i <= 6; ++i) {
> - Road* const road = nf.flag->get_road(i);
> + Road* const road = 
> nearflags[start_field].flag->get_road(i);
>  
>   if (!road) {
>   continue;


-- 
https://code.launchpad.net/~widelands-dev/widelands/findpath_modification/+merge/337103
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/findpath_modification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/findpath_modification into lp:widelands

2018-02-14 Thread TiborB
see comment in diff

I know the link with tutorial - very well. If it is about integers I somehow 
understand it, but objects or std containers are too confusing to me. I know, I 
should try harder ;)

Diff comments:

> 
> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc   2018-02-12 11:43:28 +
> +++ src/ai/defaultai.cc   2018-02-13 07:54:42 +
> @@ -3537,32 +3647,41 @@
>   // This is a candidate, sending all necessary info to 
> RoadCandidates
>   const bool different_economy = 
> (player_immovable->get_economy() != flag.get_economy());
>   const int32_t air_distance = 
> map.calc_distance(flag.get_position(), reachable_coords);
> - RoadCandidates.add_flag(reachable_coords, air_distance, 
> different_economy);
> + if 
> (!RoadCandidates.has_candidate(reachable_coords.hash())) {
> + RoadCandidates.add_flag(reachable_coords, 
> air_distance, different_economy);
> + }
>   }
>   }
>  
>   // now we walk over roads and if field is reachable by roads, we change 
> the distance assigned
>   // above
> - std::priority_queue queue;
> - std::vector nearflags;  // only used to collect flags 
> reachable walk over roads
> - queue.push(NearFlag(flag, 0, 0));
> + std::map nearflags;  // only used to collect flags 
> reachable walk over roads
> + nearflags[flag.get_position().hash()] = NearFlag(, 0);
>  
>   // algorithm to walk on roads
> - while (!queue.empty()) {
> - std::vector::iterator f =
> -find(nearflags.begin(), nearflags.end(), queue.top().flag);
> -
> - if (f != nearflags.end()) {
> - queue.pop();
> - continue;
> - }
> -
> - nearflags.push_back(queue.top());
> - queue.pop();
> - NearFlag& nf = nearflags.back();
> -
> + // All nodes are marked as to_be_checked and under some conditions, the 
> same node can be checked
> + // twice
> + for (;;) {
> + // looking for a node with shortest existing road distance from 
> starting flag and one that has
> + // to be checked
> + uint32_t start_field = std::numeric_limits::max();
> + uint32_t nearest_distance = 1;
> + for (auto item : nearflags) {
> + if (item.second.current_road_distance < 
> nearest_distance && item.second.to_be_checked) {
> + nearest_distance = 
> item.second.current_road_distance;
> + start_field = item.first;
> + }
> + }
> + // OK, so no NearFlag left to be checked - quitting the loop now

This comment above is not enough?

> + if (start_field == std::numeric_limits::max()) {
> + break;
> + }
> +
> + nearflags[start_field].to_be_checked = false;
> +
> + // Now going over roads leading from this flag
>   for (uint8_t i = 1; i <= 6; ++i) {
> - Road* const road = nf.flag->get_road(i);
> + Road* const road = 
> nearflags[start_field].flag->get_road(i);
>  
>   if (!road) {
>   continue;


-- 
https://code.launchpad.net/~widelands-dev/widelands/findpath_modification/+merge/337103
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/findpath_modification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1639514_fix_yellow_player into lp:widelands

2018-02-14 Thread kaputtnik
No idea... the branch is merged in revision 8588 at: 2018-02-13 02:17:15 UTC. 
This could be seen when pulling trunk and also if you watch the source code 
https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/files

Maybe launchpad is confused?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1639514_fix_yellow_player/+merge/337507
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/fix_infrastructure_return_values.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune into lp:widelands

2018-02-14 Thread Teppo Mäenpää
@GunChleoc: Thanks for spotting, is this okay now?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1669230-lastbastion-finetune/+merge/337083
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1669230-lastbastion-finetune into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/findpath_modification into lp:widelands

2018-02-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 3176. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/340855844.
Appveyor build 2990. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_findpath_modification-2990.
-- 
https://code.launchpad.net/~widelands-dev/widelands/findpath_modification/+merge/337103
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/findpath_modification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/findpath_modification into lp:widelands

2018-02-14 Thread GunChleoc
> Also see comment in the code...

Comment looks good, can you please add it to the code?

Regarding pointers and references, they are an important feature of C++, so if 
you can find the time to read up on them, it will be time well spent. Here's a 
tutorial: http://www.cplusplus.com/doc/tutorial/pointers/

I first came into contact with them when when I modified a C program, and I got 
myself a book and did a couple of exercises.
-- 
https://code.launchpad.net/~widelands-dev/widelands/findpath_modification/+merge/337103
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/findpath_modification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1639514_fix_yellow_player into lp:widelands

2018-02-14 Thread Tino
Has anyone an idea, why this was not merged to trunk by now?
Interestingly it is already merged on github to master: 
https://github.com/widelands/widelands/commit/4b2baddcdcd635b4c4b07490ea43efcbb20e2df9
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1639514_fix_yellow_player/+merge/337507
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/fix_infrastructure_return_values.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/findpath_modification into lp:widelands

2018-02-14 Thread Tino
Appveyor is not able to parallel build x64 Debug due to memory constraints on 
Appveyor (see build times for every job: x86 release/debug + x64 release builds 
are taking ~30 minutes, x64 debug takes ~90 minutes.)

But now in this branch we also hit the time limit of 120 minutes with the x64 
debug build, so the job was cancelled.
The logfiles show that compiling was fine, appveyor cancelled at the point when 
the installer was build.

I've manually triggered a re-build of this branch, so perhaps it is now a few 
minutes faster and will finish...
-- 
https://code.launchpad.net/~widelands-dev/widelands/findpath_modification/+merge/337103
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/findpath_modification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands

2018-02-14 Thread GunChleoc
All we have of the old fullscreen graphics are some flattend jpg files dating 
back to sourceforge, so the only way to go ahead was to completely redo the 
graphics. I showed some screen shots last summer on the forum: 
https://wl.widelands.org/forum/topic/2881/

I'd be happy to have someone help with tweaking the colors :)

Sorry, but reloading the graphics in-game is not trivial.
-- 
https://code.launchpad.net/~widelands-dev/widelands/background_images/+merge/337629
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/background_images into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/findpath_modification into lp:widelands

2018-02-14 Thread TiborB
I am not sure what appveyor problem exactly is...
-- 
https://code.launchpad.net/~widelands-dev/widelands/findpath_modification/+merge/337103
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/findpath_modification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp