Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2363) tileset switching: depends on client state
Home

[Freeciv-Dev] (PR#2363) tileset switching: depends on client state

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2363) tileset switching: depends on client state
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 19 Nov 2002 11:57:30 -0800
Reply-to: rt@xxxxxxxxxxxxxx

If you switch tilesets while the client is in the wrong state, bad 
things will happen.

This patch corrects this.

jason

? client/gui-gtk/diff
? client/gui-stub/stub-update.diff
? client/gui-xaw/diff
Index: client//tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.89
diff -u -r1.89 tilespec.c
--- client//tilespec.c  2002/11/17 02:21:11     1.89
+++ client//tilespec.c  2002/11/19 19:55:52
@@ -42,6 +42,7 @@
 #include "support.h"
 #include "unit.h"
 
+#include "civclient.h" /* for get_client_state() */
 #include "climisc.h" /* for tile_get_known() */
 #include "control.h" /* for fill_xxx */
 #include "graphics_g.h"
@@ -267,6 +268,7 @@
 {
   int id;
   int center_x, center_y;
+  enum client_states state = get_client_state();
 
   freelog(LOG_NORMAL, "Loading tileset %s.", tileset_name);
 
@@ -307,6 +309,10 @@
    * doesn't mess up too badly if we change tilesets while not connected
    * to a server.
    */
+  if (state < CLIENT_SELECT_RACE_STATE) {
+    /* The ruleset data is not sent until this point. */
+    return;
+  }
   for (id = T_FIRST; id < T_COUNT; id++) {
     tilespec_setup_tile_type(id);
   }
@@ -331,6 +337,11 @@
    *
    * Do any necessary redraws.
    */
+  if (state < CLIENT_GAME_RUNNING_STATE) {
+    /* Unless the client state is playing a game or in gameover,
+       we don't want/need to redraw. */
+    return;
+  }
   tileset_changed();
   center_tile_mapcanvas(center_x, center_y);
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2363) tileset switching: depends on client state, Jason Short via RT <=