Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] Re: (PR#9980) placed_map crash in mapgen
Home

[Freeciv-Dev] Re: (PR#9980) placed_map crash in mapgen

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mburda@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9980) placed_map crash in mapgen
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Sep 2004 09:16:56 -0700
Reply-to: rt@xxxxxxxxxxx

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

Marcelo Burda wrote:

> diff -ruN -Xfreeciv/diff_ignore freeciv/server/mapgen.c 
> freeciv_fix/server/mapgen.c
> --- freeciv/server/mapgen.c   2004-09-08 04:38:14.000000000 +0200
> +++ freeciv_fix/server/mapgen.c       2004-09-08 08:26:18.911635272 +0200
> @@ -2515,8 +2515,11 @@
>                         * (map.xsize - spares)) / 100;
>    totalweight = 100 * game.nplayers;
>  
> +  assert(placed_map == NULL);
> +
>    while (!done && bigfrac > midfrac) {
>      done = TRUE;
> +    if ( placed_map != NULL ) { destroy_placed_map(); }
>      initworld(pstate);
>      
>      /* Create one big island for each player. */
> @@ -2546,6 +2549,11 @@
>      /* We could never make adequately big islands. */
>      freelog(LOG_NORMAL, _("Falling back to generator %d."), 1);
>      map.generator = 1;
> +
> +    /* init world create this map, destroy it before abort */
> +    destroy_placed_map();
> +    free(height_map);
> +    height_map = NULL;
>      return;
>    }

This is really ugly.  Now we have the non-bug-checking as if we'd use 
init_placed_map, but we still have to do all the work to call 
destroy_placed_map...

jason




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