Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] Re: (PR#11923) Consisten core from civserver
Home

[Freeciv-Dev] Re: (PR#11923) Consisten core from civserver

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: paul@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11923) Consisten core from civserver
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jan 2005 12:58:24 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11923 >

Paul Zastoupil wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=11923 >
> 
> tech.c:597         if (!future.p[pplayer->future_tech - 1]) {
> 
> #0  get_tech_name (pplayer=0x81cd7b8, tech=0) at tech.c:597
> #1  0x080744f1 in found_new_tech (plr=0x81cd7b8, tech_found=198,
> was_discovery=true,
>     saving_bulbs=true, next_tech=0) at plrhand.c:375
> #2  0x08074842 in tech_researched (plr=0x81cd7b8) at plrhand.c:515
> #3  0x08074a6f in update_tech (plr=0x81cd7b8, bulbs=727) at plrhand.c:542
> #4  0x08064d62 in update_city_activities (pplayer=0x81cd7b8) at
> cityturn.c:1365
> #5  0x0804f147 in main_loop () at srv_main.c:591
> #6  0x080500cc in srv_main () at srv_main.c:1892
> #7  0x0804a3ad in main (argc=8, argv=0xfee26d94) at civserver.c:200
> 
> Savegame attached to ticket.

Argh.  Here's a patch.

-jason

Index: common/tech.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v
retrieving revision 1.76.2.3
diff -u -r1.76.2.3 tech.c
--- common/tech.c       5 Jan 2005 23:07:41 -0000       1.76.2.3
+++ common/tech.c       14 Jan 2005 20:57:48 -0000
@@ -591,17 +591,20 @@
     /* TRANS: "None" tech */
     return _("None");
   case A_FUTURE:
-    for (i = future.size; i < pplayer->future_tech; i++) {
-      string_vector_append(&future, NULL);
+    /* pplayer->future_tech == 0 means "Future Tech. 1". */
+    for (i = future.size; i <= pplayer->future_tech; i++) {
+      char *ptr = NULL;
+
+      string_vector_append(&future, &ptr);
     }
-    if (!future.p[pplayer->future_tech - 1]) {
+    if (!future.p[pplayer->future_tech]) {
       char buffer[1024];
 
       my_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"),
                  pplayer->future_tech + 1);
-      future.p[pplayer->future_tech - 1] = mystrdup(buffer);
+      future.p[pplayer->future_tech] = mystrdup(buffer);
     }
-    return future.p[pplayer->future_tech - 1];
+    return future.p[pplayer->future_tech];
   default:
     /* Includes A_NONE */
     if (!tech_exists(tech)) {

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