[Freeciv-Dev] Re: (PR#7001) Ghost unit (delta bug most probably)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7001 >
On Thu, Dec 04, 2003 at 03:20:44AM -0800, Arnstein Lindgard wrote:
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7001 >
>
> A similar ghost: When successfully attacking an enemy city, the
> occupied flag goes away even if there are more units inside the city.
And the patch. I wonder why it worked before.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil.
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.124
diff -u -u -r1.124 climisc.c
--- client/climisc.c 2003/11/28 17:37:19 1.124
+++ client/climisc.c 2003/12/04 19:30:31
@@ -99,8 +99,10 @@
pcity = map_get_city(x, y);
if (pcity) {
- pcity->client.occupied =
- (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+ if (city_owner(pcity) == game.player_ptr) {
+ pcity->client.occupied =
+ (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+ }
refresh_city_dialog(pcity);
freelog(LOG_DEBUG, "map city %s, %s, (%d %d)", pcity->name,
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.339
diff -u -u -r1.339 packhand.c
--- client/packhand.c 2003/11/28 17:37:19 1.339
+++ client/packhand.c 2003/12/04 19:30:32
@@ -1021,13 +1021,12 @@
update_unit_focus();
- if(pcity) {
- /* Unit moved out of a city - update the occupied status. The
- * logic is a little shaky since it's not clear whether we can
- * see the internals of the city or not; however, the server should
- * send us a city update to clear things up. */
- pcity->client.occupied =
- (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+ if (pcity) {
+ if (city_owner(pcity) == game.player_ptr) {
+ pcity->client.occupied =
+ (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) >
+ 0);
+ }
if(pcity->id==punit->homecity)
repaint_city = TRUE;
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.136
diff -u -u -r1.136 city.h
--- common/city.h 2003/09/28 17:44:16 1.136
+++ common/city.h 2003/12/04 19:30:33
@@ -256,6 +256,13 @@
struct {
/* Only used at the client (the serer is omniscient). */
+
+ /*
+ * For its own cities the client will update the occupied field
+ * based on its own unit list at this position. For enemy cities
+ * the client will use the occupied flag that the server sends in
+ * the city_short_info packet.
+ */
bool occupied;
bool happy, unhappy;
} client;
|
|