← Back to team overview

widelands-dev team mailing list archive

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

 

probalby, see now

Diff comments:

> === modified file 'src/ai/defaultai.cc'
> --- src/ai/defaultai.cc	2015-10-25 12:26:20 +0000
> +++ src/ai/defaultai.cc	2015-10-26 13:09:27 +0000
> @@ -5075,8 +5076,9 @@
>  	}
>  	// adding power of team (minus my power) divided by 2
>  	// (if I am a part of a team of course)
> -	if (game().get_player(pn)->team_number() > 0) {
> -		my_power += (team_power[game().get_player(pn)->team_number()] - my_power) / 2;
> +	const TeamNumber team_number = player_ ? player_->team_number() : 0;

no sense to test correctness of player_, it should be always defined. But you can add assert(player_) somewhere above

> +	if (team_number > 0) {
> +		my_power += (team_power[team_number] - my_power) / 2;
>  	}
>  
>  	// now we test all players to identify 'attackable' ones


-- 
https://code.launchpad.net/~widelands-dev/widelands/ai_null_enemy/+merge/275673
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ai_null_enemy.


References