← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1718745-allows-seafaring into lp:widelands

 

See comment in diff

Diff comments:

> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc	2017-12-03 08:23:27 +0000
> +++ src/ai/defaultai.cc	2017-12-06 18:39:54 +0000
> @@ -1951,11 +1953,8 @@
>  
>  	const Map& map = game().map();
>  
> -	if (gametime % 5 == 0) {
> -		// TODO(unknown): Counting port spaces is very primitive way for this
> -		// there should be better alternative f.e. like map::allows_seafaring()
> -		// function but simplier
> -		seafaring_economy = map.get_port_spaces().size() >= 2;
> +	if (gametime > last_seafaring_check_ + 5000U) {
> +		seafaring_economy = map.allows_seafaring();
>  	}

You probably need here:
last_seafaring_check_ = gametime
Also 5s will make no difference if function is called every ~5 seconds, I would use at least 20 or so...

>  
>  	for (int32_t i = 0; i < 4; ++i)


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1718745-allows-seafaring/+merge/333233
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1718745-allows-seafaring.


References