Complete.Org: Mailing Lists: Archives: freeciv-ai: July 2003:
[freeciv-ai] Re: AI Diplomacy v11 (PR#2413)
Home

[freeciv-ai] Re: AI Diplomacy v11 (PR#2413)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] Re: AI Diplomacy v11 (PR#2413)
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 21 Jul 2003 09:15:13 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 21 Jul 2003, Gregory Berkolaiko wrote:
> @ -220,29 +230,42 @@
>  for (i = 0; i < MAX_NUM_PLAYERS; i++) {
>    struct player *aplayer = get_player(i);
>
> -  ai->diplomacy.player_intel[i].is_allied_with_enemy = FALSE;
> -  ai->diplomacy.player_intel[i].at_war_with_ally = FALSE;
> -ai->diplomacy.player_intel[i].is_allied_with_ally = FALSE;
> +  ai->diplomacy.player_intel[i].is_allied_with_enemy = NULL;
> +  ai->diplomacy.player_intel[i].at_war_with_ally = NULL;
> +  ai->diplomacy.player_intel[i].is_allied_with_ally = NULL;
>  [....]
>
> I can see why it's not players_iterate (although I would prefer it this
> way).But maybe you can skip the players that are dead or not there at
> all?

The point is, as explained in the comment,

  /* Set per-player variables. We must set all players, since players
   * can be created during a turn, and we don't want those to have
   * invalid values. */

that new players can suddenly pop up out of nowhere, from civil war eg.

I see no reason to not set these variables properly for dead players,
either. The speed gain is totally negligible, you add lines of code and
open up for strange bugs in the future if that player slot is ever reused
during the turn.

  - Per




[Prev in Thread] Current Thread [Next in Thread]