TiborB has proposed merging lp:~widelands-dev/widelands/ai_mineable_tweak_2 
into lp:widelands.

Commit message:
AI now ignores blocked_fields (unaccesible fields) when counting available mine 
fields per type.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ai_mineable_tweak_2/+merge/342490

One small detail I forgot. When AI counts types of mineable fields per 
resource, it should ignore fields that are not accessible.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ai_mineable_tweak_2 into lp:widelands.
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2018-03-27 09:10:21 +0000
+++ src/ai/defaultai.cc	2018-04-01 21:34:50 +0000
@@ -1212,9 +1212,11 @@
 		i += 1;
 	}
 	// Updating overall statistics, first we flush the data and then iterate over all mine fields
+	// ignoring fields that are blocked usually because they are not accessible
 	mine_fields_stat.zero();
 	for (const auto& mineable_field : mineable_fields) {
-		if (mineable_field->coords.field->get_resources_amount() > 0) {
+		if (mineable_field->coords.field->get_resources_amount() > 0 &&
+		 !blocked_fields.is_blocked(mineable_field->coords)) {
 			mine_fields_stat.add(mineable_field->coords.field->get_resources());
 		}
 	}

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to