[Freeciv-Dev] (PR#12195) reload the current tileset
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12195 >
New patch: Vasco wanted it to be "reload tileset" not "reread tileset".
-jason
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.232
diff -u -r1.232 tilespec.c
--- client/tilespec.c 6 Feb 2005 22:11:10 -0000 1.232
+++ client/tilespec.c 9 Feb 2005 22:55:55 -0000
@@ -62,7 +62,7 @@
/* Stores the currently loaded tileset. This differs from the value in
* options.h since that variable is changed by the GUI code. */
-static char current_tileset[512];
+char current_tileset[512];
static const int DIR4_TO_DIR8[4] =
{ DIR8_NORTH, DIR8_SOUTH, DIR8_EAST, DIR8_WEST };
@@ -423,7 +423,8 @@
Unlike the initial reading code, which reads pieces one at a time,
this gets rid of the old data and reads in the new all at once. If the
new tileset fails to load the old tileset may be reloaded; otherwise the
- client will exit.
+ client will exit. If a NULL name is given the current tileset will be
+ reread.
It will also call the necessary functions to redraw the graphics.
***********************************************************************/
@@ -433,6 +434,10 @@
struct tile *center_tile;
enum client_states state = get_client_state();
+ if (!tileset_name) {
+ tileset_name = current_tileset;
+ }
+
freelog(LOG_NORMAL, "Loading tileset %s.", tileset_name);
/* Step 0: Record old data.
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.62
diff -u -r1.62 menu.c
--- client/gui-gtk-2.0/menu.c 9 Feb 2005 16:23:12 -0000 1.62
+++ client/gui-gtk-2.0/menu.c 9 Feb 2005 22:55:55 -0000
@@ -74,6 +74,9 @@
MENU_GAME_OPTIONS,
MENU_GAME_MSG_OPTIONS,
+#ifdef DEBUG
+ MENU_GAME_RELOAD_TILESET,
+#endif
MENU_GAME_SAVE_OPTIONS_ON_EXIT,
MENU_GAME_SAVE_OPTIONS,
MENU_GAME_SERVER_OPTIONS1,
@@ -205,6 +208,9 @@
case MENU_GAME_MSG_OPTIONS:
popup_messageopt_dialog();
break;
+ case MENU_GAME_RELOAD_TILESET:
+ tilespec_reread(NULL);
+ break;
case MENU_GAME_SAVE_OPTIONS_ON_EXIT:
if (save_options_on_exit ^ GTK_CHECK_MENU_ITEM(widget)->active) {
save_options_on_exit ^= 1;
@@ -663,6 +669,10 @@
game_menu_callback, MENU_GAME_MSG_OPTIONS
},
{ "/" N_("Game") "/sep1", NULL,
NULL, 0,
"<Separator>" },
+#ifdef DEBUG
+ { "/" N_("Game") "/" N_("_Reload Tileset"), "<ctrl><alt>r",
+ game_menu_callback, MENU_GAME_RELOAD_TILESET },
+#endif
{ "/" N_("Game") "/" N_("Save Options on _Exit"), NULL,
game_menu_callback, MENU_GAME_SAVE_OPTIONS_ON_EXIT,
"<CheckItem>" },
{ "/" N_("Game") "/" N_("Sa_ve Options"), NULL,
|
|