widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04179
Re: [Merge] lp:~widelands-dev/widelands/trainingsites_and_teams into lp:widelands
I will incorporate your comments of course, thanks for review, and I added one answer to your comment in the diff...
Diff comments:
>
> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc 2015-05-07 20:46:32 +0000
> +++ src/ai/defaultai.cc 2015-06-29 19:22:37 +0000
> @@ -253,8 +268,17 @@
> if (check_economies()) { // is a must
> return;
> };
> - taskDue[ScheduleTasks::kRoadCheck] = gametime + 400;
> - improve_roads(gametime);
> + taskDue[ScheduleTasks::kRoadCheck] = gametime + 1000;
> + // testing 5 roads
> + {
> + int32_t roads_to_check = (roads.size() + 1 < 5) ? roads.size() + 1 : 5;
> + for (int i = 0; i < roads_to_check; i += 1) {
> + if (improve_roads(gametime)) {
> + // if significant change takes place do not go on
> + break;
> + };
> + }
> + }
> break;
I will add the comment to code, but take note that improve_roads() checks only 1 road, similarly check_productionsites and check_militarysites - they take one member from front, check it, and push it to the back of vector. This check is usually quite primitive/cheap and it could "waste" one AI think() cycle - AI think once in 0.5 seconds I think. So I simply change it to check 5 roads at once
> case ScheduleTasks::kUnbuildableFCheck :
> taskDue[ScheduleTasks::kUnbuildableFCheck] = gametime + 4000;
--
https://code.launchpad.net/~widelands-dev/widelands/trainingsites_and_teams/+merge/260517
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/trainingsites_and_teams into lp:widelands.
References