Merge lp:~widelands-dev/widelands/bug-1800818 into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 8912
Proposed branch: lp:~widelands-dev/widelands/bug-1800818
Merge into: lp:widelands
Diff against target: 23 lines (+13/-0)
1 file modified
src/ai/defaultai.cc (+13/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1800818
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+358368@code.launchpad.net

Commit message

When An AI finds that it has more than one barracks, it will disassemble the additional barracks. Should happen only after taking over from a human player.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

Code LGTM, not tested yet

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2018-10-12 10:02:20 +0000
+++ src/ai/defaultai.cc 2018-11-06 10:30:11 +0000
@@ -4278,6 +4278,19 @@
42784278
4279 // Barracks4279 // Barracks
4280 if (site.bo->is(BuildingAttribute::kBarracks)) {4280 if (site.bo->is(BuildingAttribute::kBarracks)) {
4281 // If we somehow have more than one barracks we will dismantle current one
4282 if (site.bo->total_count() > 1) {
4283 log("%2d: We have %d barracks, that is not supported by AI and if caused by AI it is an error; dismantling the barracks at %3dx%3d\n",
4284 player_number(), site.bo->total_count(), site.site->get_position().x, site.site->get_position().y);
4285 if (connected_to_wh) {
4286 game().send_player_dismantle(*site.site);
4287 } else {
4288 game().send_player_bulldoze(*site.site);
4289 }
4290 return true;
4291 }
4292
4293
4281 assert(site.bo->total_count() == 1);4294 assert(site.bo->total_count() == 1);
4282 for (auto& queue : site.site->inputqueues()) {4295 for (auto& queue : site.site->inputqueues()) {
4283 if (queue->get_max_fill() > 4) {4296 if (queue->get_max_fill() > 4) {

Subscribers

People subscribed via source and target branches

to status/vote changes: