This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: Improved combat code
- From: Eric McDonald <mcdonald at phy dot cmich dot edu>
- To: Hans Ronne <hronne at comhem dot se>
- Cc: xconq7 at sources dot redhat dot com
- Date: Sat, 21 Aug 2004 21:09:36 -0600
- Subject: Re: Improved combat code
- References: <l03130300bd4d9d8171d1@[212.181.162.155]>
Hans Ronne wrote:
3. Unit images are now updated correctly when a unit is wrecked or changes
type.
I hope that this was just a mistake on your part:
===================================================================
RCS file: /cvs/xconq/xconq/ChangeLog,v
retrieving revision 1.1473
retrieving revision 1.1474
diff -u -r1.1473 -r1.1474
--- xconq/ChangeLog 2004/08/22 00:12:25 1.1473
+++ xconq/ChangeLog 2004/08/22 00:37:40 1.1474
@@ -1,19 +1,15 @@
-2004-08-22 Eric McDonald
+2004-08-21 Hans Ronne
- Reduce buzzing when formations are in use. Also, improve previous
- fix.
- * run.c (side_move_some_units): Be more selective about what plans
- get executed by making sure that there is either a pending action
- or a task list. Only set the 'waitingfortask' flag on plans with
- formations if their are actually tasks present.
-
- Fix display bug that appeared in 'change-type' sometime in the past
- few months, probably as a result of hacking the image loading or
- unit views.
- * unit.c (change_unit_type): Upon changing type, set the unit's
- image name to an empty string (to force loading of a new image),
- and then call 'set_unit_image'. (A call to 'update_side_display'
- used to do the right thing, but apparently not anymore.)
+ Add network functions for TASK_ATTACK and TASK_FIRE.
+ * tp.c (net_push_attack_task): New function.
+ (net_set_attack_task): New function.
+ (net_push_fire_task): New function.
+ (net_set_fire_task): New function.
+
+ Fix so that images are updated for units that are
+ wrecked or change type.
+ * unit.c (change_unit_type): Set unit->image_name and
+ unit->imf to NULL and call set_unit_image.
===================================================================
RCS file: /cvs/xconq/xconq/kernel/unit.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- xconq/kernel/unit.c 2004/08/22 00:12:26 1.94
+++ xconq/kernel/unit.c 2004/08/22 00:37:41 1.95
@@ -443,6 +443,10 @@
all_see_leave(unit, unit->x, unit->y, (transport == NULL));
/* Do the actual change. */
unit->type = newtype;
+ /* Reset unit image to new type. */
+ unit->imf = NULL;
+ unit->image_name = NULL;
+ set_unit_image(unit);
/* Make sure the new unit is complete. */
unit->cp = u_cp(newtype);
/* Set the new hp to the same ratio of max as the unit had before.
@@ -520,10 +524,6 @@
newtype, reason))
return;
}
- /* Set the unit image by first clearing the old image name.
- 'set_unit_image' will set a new image name and image for us. */
- unit->image_name = "";
- set_unit_image(unit);
/* Increment viewing coverage. */
cover_area(unit->side, unit, transport, -1, -1, unit->x, unit->y);
/* If vision range is 0, allow glimpses of adjacent cell terrain.