Complete.Org: Mailing Lists: Archives: freeciv-dev: December 1999:
[Freeciv-Dev] Re: patch for "ran out of continents in client" bug
Home

[Freeciv-Dev] Re: patch for "ran out of continents in client" bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: schaefer@xxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch for "ran out of continents in client" bug
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Wed, 22 Dec 1999 10:58:54 +1100 (EST)

Peter Schaefer <schaefer@xxxxxx> wrote:

> The bug is triggered by the apollo program, which tells the client about
> every city,
> which in turn becomes am entire continent by itself.
> 
> I have worked around it by assigning all these cities the same number.

This seems to me a special-case fix to a general-case problem.

How about the following instead:

- Change the continent field to a short or int.  (Server can still
just use up to 255 real continents if it wants).
- Instead of an array to keep track of used contient numbers in
the client, keep track of the maximum continent number, and
have a genlist for any re-used numbers.  When a new number
is required, take it from the genlist, or if empty, increment
the maximum.

> In addition, I changed the continent renumbering function so that it
> can actually merge continents.

Hmm, are you sure it wasn't doing this already?  
It was supposed to.

Eg, this looks likely:

> @@ -182,7 +217,7 @@
>       if(this_con==-1) {
>         ptile->continent = this_con = con;
>       } else if(con != this_con) {
> -       freelog(LOG_DEBUG, "renumbering client continent %d to %d at (%d %d)",
> +       freelog(LOG_DEBUG, "renumber client continent %d to %d at (%d %d)",
>              con, this_con, x, y);
>         climap_renumber_continent(i,j,this_con);
>         used_continent_val[con] = 0;

(And why the gratuitous changing of output messages above? :-/

-- David

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