see comment in diff

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 12:01:30 +0000
> @@ -5075,8 +5076,12 @@
>       }
>       // 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;
> +     {

No, this is not good. No other player is refered here. 'pn' is me and I am 
looking for strength of my team - if I am in a team.

Or technically it is good but replace 'other' with word that indicates it is 
'me'

Or we can replace instanced game().get_player(pn) in entire function...

> +             const Player* other = game().get_player(pn);
> +             const TeamNumber team_number = other ? other->team_number() : 0;
> +             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.

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to