Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (s
Home

[Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (s

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mburda@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 29 May 2004 00:34:21 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8632 >

Marcelo Burda wrote:

> Yes, yes, as you see i not make exactly  it, i see!!.
> some place this is not a good idea, in the def of a global array, that
> is simply not posible.
> not worry.
> but still one place where i not understan why there is a for over the
> number of tiles of the map. probably i litle numer is ok
> --- freeciv/server/citytools.c        2004-05-28 11:35:27.000000000 +0200
> +++ freeciv_/server/citytools.c       2004-05-29 02:12:42.000000000 +0200
> @@ -280,7 +280,7 @@
>    Nation_Type_id nation_list[game.nation_count], n;
>    int queue_size;
>  
> -  static const int num_tiles = MAP_MAX_WIDTH * MAP_MAX_HEIGHT; 
> +  const int num_tiles = NATIVE_WIDTH * NATIVE_HEIGHT; 
>  
>    /* tempname must be static because it's returned below. */
>    static char tempname[MAX_LEN_NAME];
> @@ -371,7 +371,7 @@
>      }
>    }
>  
> -  for (i = 1; i <= num_tiles; i++ ) {
> +  for (i = 1; i <= num_tiles; i++ ) { /* why num_tiles ?? [mburda] */
>      my_snprintf(tempname, MAX_LEN_NAME, _("City no. %d"), i);
>      if (!game_find_city_by_name(tempname)) {
>        return tempname;
> diff -ruN -Xfreeciv/diff_ignore freeciv/server/mapgen.c
> freeciv_/server/mapgen.c

It's just an arbitrary bound.  It's exceptionally unlikely that the 
"City no. %d" case will even be reached.  But if it is we don't want to 
run out of possible city names since that's basically a fatal error.

This bound doesn't hurt anything and should stay.  Although it would be 
fine as a INDEX_WIDTH (NATIVE_WIDTH * NATIVE_HEIGHT) as well.

jason




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