[Freeciv-Dev] Re: premature GOTO abortion (PR#10719)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=10719 >
Christian Knoke wrote:
> This is about a special problem with Goto. I consider this as a big (*sigh*)
> bug and I think, although otherwise stated, that this *can* be fixed for 2.0
Here is a patch that, fixes it. Not very pretty though.
For both branches.
-jason
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.323
diff -u -r1.323 unittools.c
--- server/unittools.c 2 Mar 2005 19:17:51 -0000 1.323
+++ server/unittools.c 3 Mar 2005 20:13:22 -0000
@@ -3180,13 +3180,19 @@
* next turn. */
freelog(LOG_DEBUG, " orders move failed (out of MP).");
if (unit_has_orders(punit)) {
- /* FIXME: If this was the last move, the orders will already have
- * been freed. This is a problem, but very hard to fix. The
- * way things work now the orders have to be freed before the
- * last move is done for things like caravan popups to work (see
- * free_unit_orders above). So we can't wait until here to
- * free the orders without extensive changes elsewhere. */
punit->orders.index--;
+ } else {
+ /* FIXME: If this was the last move, the orders will already have
+ * been freed, so we have to add them back on. This is quite a
+ * hack; one problem is that the no-orders unit has probably
+ * already had its unit info sent out to the client. */
+ punit->has_orders = TRUE;
+ punit->orders.length = 1;
+ punit->orders.index = 0;
+ punit->orders.repeat = FALSE;
+ punit->orders.vigilant = FALSE;
+ punit->orders.list = fc_malloc(sizeof(order));
+ punit->orders.list[0] = order;
}
send_unit_info(NULL, punit);
return TRUE;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: premature GOTO abortion (PR#10719),
Jason Short <=
|
|