[Pkg-freeciv-devel] another 2.0.0 bug
Jason Dorje Short
jdorje@users.sf.net
Sat, 23 Apr 2005 15:09:28 -0400
This is a multi-part message in MIME format.
--------------050204080307080702000302
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
This patch fixes another rare 2.0.0 bug that can cause the client to freeze.
-jason
--------------050204080307080702000302
Content-Type: text/x-patch;
name="decrease.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="decrease.diff"
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.151.2.19
retrieving revision 1.151.2.20
diff -u -r1.151.2.19 -r1.151.2.20
--- client/mapview_common.c 1 Mar 2005 21:46:46 -0000 1.151.2.19
+++ client/mapview_common.c 23 Apr 2005 17:18:08 -0000 1.151.2.20
@@ -1874,6 +1874,11 @@
set_units_in_combat(punit0, punit1);
+ /* Make sure we don't start out with fewer HP than we're supposed to
+ * end up with (which would cause the following loop to break). */
+ punit0->hp = MAX(punit0->hp, hp0);
+ punit1->hp = MAX(punit1->hp, hp1);
+
while (punit0->hp > hp0 || punit1->hp > hp1) {
const int diff0 = punit0->hp - hp0, diff1 = punit1->hp - hp1;
--------------050204080307080702000302--