Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9910) effect terrains aren't sent properly
Home

[Freeciv-Dev] (PR#9910) effect terrains aren't sent properly

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9910) effect terrains aren't sent properly
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Sep 2004 14:38:39 -0700
Reply-to: rt@xxxxxxxxxxx

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

dio_get_effect and dio_put_effect break with negative terrain numbers. 
Mateusz reports that if you compiled with DEBUG this will always cause 
an immediate client segfault.  No doubt without DEBUG it will cause a 
segfault at some later point.

I again point out that these specialty dataio functions are a scourge.

jason

Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.181
diff -u -r1.181 capstr.c
--- common/capstr.c     2 Sep 2004 18:36:14 -0000       1.181
+++ common/capstr.c     2 Sep 2004 21:35:34 -0000
@@ -79,7 +79,7 @@
                    "+want_hack invasions bombard +killstack2 spec +spec2 " \
                    "+city_map startunits +turn_last_built +happyborders " \
                    "+connid +love2 +ocean_num +govclean +orders3 +rev_fin " \
-                   "+terr16"
+                   "+terr16b"
 
 /* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
  *
@@ -149,7 +149,7 @@
  * "rev_fin" means the revolution_finishes value replaces the revolution
  * value.
  *
- * "terr16" is 16-bit terrain values
+ * "terr16b" is 16-bit terrain values
  */
 
 void init_our_capability(void)
Index: common/dataio.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/dataio.c,v
retrieving revision 1.11
diff -u -r1.11 dataio.c
--- common/dataio.c     2 Jun 2004 19:47:41 -0000       1.11
+++ common/dataio.c     2 Sep 2004 21:35:34 -0000
@@ -723,7 +723,7 @@
   dio_get_uint8(din, &peffect->cond_adv);
   dio_get_uint8(din, (int *) &(peffect->cond_eff));
   dio_get_uint8(din, (int *) &(peffect->aff_unit));
-  dio_get_uint8(din, (int *) &(peffect->aff_terr));
+  dio_get_sint16(din, (int *) &(peffect->aff_terr));
   dio_get_uint16(din, (int *) &(peffect->aff_spec));
 }
 
@@ -738,6 +738,6 @@
   dio_put_uint8(dout, peffect->cond_adv);
   dio_put_uint8(dout, peffect->cond_eff);
   dio_put_uint8(dout, peffect->aff_unit);
-  dio_put_uint8(dout, peffect->aff_terr);
+  dio_put_sint16(dout, peffect->aff_terr);
   dio_put_uint16(dout, peffect->aff_spec);
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9910) effect terrains aren't sent properly, Jason Short <=