← Back to team overview

widelands-dev team mailing list archive

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

 

Code LGTM, 2 nits. There is also a codecheck failure for the printf.

Testing still needs to be done, on a debug build to test the asserts

Diff comments:

> 
> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc	2018-04-29 09:20:29 +0000
> +++ src/ai/defaultai.cc	2018-05-30 19:30:27 +0000
> @@ -625,12 +625,26 @@
>  		if (bld.needs_seafaring()) {
>  			bo.set_is(BuildingAttribute::kNeedsSeafaring);
>  		}
> -		if (bh.is_logproducer()) {
> +		// some important buildings are identified first the woodcutter/lumberjack
> +		if (bh.collects_ware_from_map() == "log") {
>  			bo.set_is(BuildingAttribute::kLumberjack);
>  		}
> -		if (bh.is_graniteproducer()) {
> +		// quarries
> +		if (bh.collects_ware_from_map() == "granite") {
>  			bo.set_is(BuildingAttribute::kNeedsRocks);
>  		}
> +		// wells
> +		if (bh.collects_ware_from_map() == "water") {
> +			bo.set_is(BuildingAttribute::kWell);
> +		}
> +		// here we identify hunters
> +		if (bh.collects_ware_from_map() == "meat") {
> +			bo.set_is(BuildingAttribute::kHunter);
> +		}
> +		// and fishers
> +		if (bh.collects_ware_from_map() == "fish" && bo.inputs.empty()) {

Do we want to have the empty input check for all of them, for consistency?

> +			bo.set_is(BuildingAttribute::kFisher);
> +		}
>  		if (create_basic_buildings_list &&
>  		    bh.basic_amount() > 0) {  // This is the very begining of the game
>  			assert(persistent_data->remaining_basic_buildings.count(bo.id) == 0);
> @@ -2629,6 +2634,11 @@
>  
>  			if (bo.type == BuildingObserver::Type::kProductionsite) {
>  
> +				if (bo.collected_map_resource != INVALID_INDEX) {
> +					printf ("DEBUG: considering %s at %3dx%3d - %d collecting producers nearby\n",

Remove his line or use log

> +					bo.name, bf->coords.x, bf->coords.y, bf->collecting_producers_nearby.at(bo.collected_map_resource));
> +					}
> +
>  				prio += management_data.neuron_pool[44].get_result_safe(bf->military_score_ / 20) / 5;
>  
>  				// Some productionsites strictly require supporting sites nearby


-- 
https://code.launchpad.net/~widelands-dev/widelands/frisian_balancing_with_ai_hints/+merge/347166
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/frisian_balancing_with_ai_hints into lp:widelands.


References