← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1829471-worker-preciousness into lp:widelands

 

I think the deduction of Recruitment of second carrier will not work this way as Outputs of recruitment sites contains the worker so it isn't empty. see inline comment as well

Diff comments:

> 
> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc	2019-05-17 11:45:39 +0000
> +++ src/ai/defaultai.cc	2019-05-19 16:18:33 +0000
> @@ -684,6 +682,26 @@
>  			for (const DescriptionIndex& temp_output : prod.output_ware_types()) {
>  				bo.outputs.push_back(temp_output);
>  			}
> +
> +			// Read information about worker outputs
> +			if (prod.output_worker_types().size() > 0) {
> +				for (const DescriptionIndex& temp_output : prod.output_worker_types()) {
> +					if (temp_output == tribe_->soldier()) {
> +						bo.set_is(BuildingAttribute::kBarracks);
> +					}
> +					const WorkerHints* worker_hints = tribe_->get_worker_descr(temp_output)->ai_hints();
> +					if (worker_hints != nullptr) {
> +						const int worker_preciousness = worker_hints->preciousness(tribe_->name());
> +						if (worker_preciousness != Widelands::kInvalidWare) {
> +							bo.initial_preciousness += worker_preciousness;
> +						}
> +					}
> +				}
> +				if (!bo.is(BuildingAttribute::kBarracks) && bo.outputs.empty()) {

outputs of recruitment sites isn't empty, as it has a worker as output

> +					bo.set_is(BuildingAttribute::kRecruitment);
> +				}
> +			}
> +
>  			for (const auto& temp_position : prod.working_positions()) {
>  				bo.positions.push_back(temp_position.first);
>  			}


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1829471-worker-preciousness/+merge/367608
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1829471-worker-preciousness.


References