Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#4680) civ_score should use border information
Home

[Freeciv-Dev] (PR#4680) civ_score should use border information

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4680) civ_score should use border information
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jul 2003 23:35:49 -0700
Reply-to: rt@xxxxxxxxxxxxxx

The civ_score function should use the border information to calculate 
land area.

I have not looked closely at this problem, but I would suggest something 
like the following:

   #define SQ DEFAULT_BORDERS * (DEFAULT_BORDERS + 1)

   int landarea[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];

   memset(landarea, 0, sizeof(landarea));

   whole_map_iterate(x, y) {
     if (game.borders > 0) {
       landarea[map_get_owner(x, y)]++;
     } else {
       struct city *pcity = get_nearest_city(x, y);

       if (squared_distance(x, y, pcity->x, pcity->y) < SQ) {
         landarea[pcity->owner]++;
       }
     }
   } whole_map_iterate_end;

this is a clean implementation that just isn't quite as good when 
borders are disabled.  But it's much better IMO than enabling borders, 
recalculating all ownership, counting them up, and finally disabling them.

Alternately when game.borders==0 the old calculation could still be 
used.  IMO this is too much code.

jason




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4680) civ_score should use border information, Jason Short <=