[Freeciv-Dev] (PR#9584) Patch: Don't show "You have bought" if only the
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9584 >
> [ciaran17@xxxxxxxxxx - Mon Aug 02 01:44:41 2004]:
>
> If you buy a city's production target and then change the worklist,
> you get the warning "Game: You have bought this turn, can't change."
>
> This behaviour is appropriate if you are trying to change the
> production target, but not if you are only changing the worklist.
>
> This patch is intended to stop the message appearing unless you try to
> change the target after buying it.
There is a bug here; the error message shouldn't be sent. But your
patch also has a bug, because you don't check is_building_unit. This
patch is a better fix, I think.
It might be an error on the client's part that it sends this packet at
all. Certainly it shouldn't be needed. In city_change_production() in
citydlg_common.c it is tempting to put a check to avoid sending a no-op
request. Similarly in clipboard_send_production_packet there is such a
check. However I think a check here is an error, since the client may
be out-of-sync from the server (if you change production and change back
before the server responds, the client will erronously think the packet
is a no-op).
Of course the worklist code could just not call this function. I didn't
look that deeply.
jason
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.132
diff -u -r1.132 cityhand.c
--- server/cityhand.c 2 Jun 2004 22:54:15 -0000 1.132
+++ server/cityhand.c 5 Aug 2004 14:44:25 -0000
@@ -340,6 +340,12 @@
return;
}
+ if (pcity->is_building_unit == is_build_id_unit_id
+ && pcity->currently_building == build_id) {
+ /* The client probably shouldn't send such a packet. */
+ return;
+ }
+
if (is_build_id_unit_id && !can_build_unit(pcity, build_id))
return;
if (!is_build_id_unit_id && !can_build_improvement(pcity, build_id))
|
|