This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

core dump in drawing names


Here's a core dump (I got it by restoring a certain saved game and
hitting "{" twice) in drawing names.  The cause of the core dump was
that a negative value for the x coordinate was being pased to
draw_units (with the core dump in unit_view_at).

The enclosed patch does prevent the core dump but I'm not sure it is
quite right, especially in the case of cylindrical worlds.

Index: tcltk/tkmap.c
===================================================================
RCS file: /cvs/xconq/xconq/tcltk/tkmap.c,v
retrieving revision 1.100
diff -u -r1.100 tkmap.c
--- tcltk/tkmap.c	11 Sep 2002 21:21:31 -0000	1.100
+++ tcltk/tkmap.c	26 Oct 2002 03:50:25 -0000
@@ -1440,6 +1440,9 @@
 		if (mapw->vp->power == 6)
 			namelength = 3;
 		for (i = x0 - namelength; i < x0; i++) {
+			if (!x_in_area(i, y0)) {
+				continue;
+			}
 			for_all_stack(wrapx(i), y0, unit) {
 				if (unit->name) {
 		    			draw_units(mapw, wrapx(i), y0);
@@ -1451,6 +1454,9 @@
 	}
 	/* Then draw any units in the row. */
 	for (x = x0; x < x0 + len; ++x) {
+	    if (!x_in_area(x, y0)) {
+		continue;
+	    }
 	    draw_units(mapw, wrapx(x), y0);
 	}
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]