Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12401) encapsulate intro_filenames
Home

[Freeciv-Dev] (PR#12401) encapsulate intro_filenames

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12401) encapsulate intro_filenames
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 2 Mar 2005 11:47:38 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12401 >

See also PR#12390.  This patch is a simpler alternative to that one.

This patch simply encapsulates the main_intro_filename and 
minimap_intro_filename values in tilespec.c.  Accessor functions are 
added and used.

-jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.253
diff -u -r1.253 tilespec.c
--- client/tilespec.c   2 Mar 2005 19:00:33 -0000       1.253
+++ client/tilespec.c   2 Mar 2005 19:26:07 -0000
@@ -56,8 +56,8 @@
 
 #define TILESPEC_SUFFIX ".tilespec"
 
-char *main_intro_filename;
-char *minimap_intro_filename;
+static char *main_intro_filename;
+static char *minimap_intro_filename;
 
 struct named_sprites sprites;
 
@@ -288,6 +288,26 @@
   return hex_height;
 }
 
+/****************************************************************************
+  Return the path within the data directories where the main intro graphics
+  file can be found.  (It is left up to the GUI code to load and unload this
+  file.)
+****************************************************************************/
+const char *tileset_main_intro_filename(void)
+{
+  return main_intro_filename;
+}
+
+/****************************************************************************
+  Return the path within the data directories where the mini intro graphics
+  file can be found.  (It is left up to the GUI code to load and unload this
+  file.)
+****************************************************************************/
+const char *tileset_mini_intro_filename(void)
+{
+  return minimap_intro_filename;
+}
+
 /**************************************************************************
   Initialize.
 **************************************************************************/
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.116
diff -u -r1.116 tilespec.h
--- client/tilespec.h   2 Mar 2005 19:00:34 -0000       1.116
+++ client/tilespec.h   2 Mar 2005 19:26:07 -0000
@@ -362,10 +362,6 @@
 struct Sprite *get_treaty_thumb_sprite(bool on_off);
 struct sprite_vector *get_unit_explode_animation(void);
 
-/* full pathnames: */
-extern char *main_intro_filename;
-extern char *minimap_intro_filename;
-
 /* These variables contain the size of the tiles used within the game.
  *
  * "normal" tiles include most mapview graphics, particularly the basic
@@ -414,6 +410,8 @@
 int tileset_full_tile_height(void);
 int tileset_small_sprite_width(void);
 int tileset_small_sprite_height(void);
+const char *tileset_main_intro_filename(void);
+const char *tileset_mini_intro_filename(void);
 
 struct Sprite *load_sprite(const char *tag_name);
 void unload_sprite(const char *tag_name);
Index: client/gui-ftwl/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/graphics.c,v
retrieving revision 1.1
diff -u -r1.1 graphics.c
--- client/gui-ftwl/graphics.c  29 Jul 2004 14:10:13 -0000      1.1
+++ client/gui-ftwl/graphics.c  2 Mar 2005 19:26:07 -0000
@@ -52,8 +52,8 @@
 void load_intro_gfx(void)
 {
   /* PORTME */
-  intro_gfx_sprite = load_gfxfile(main_intro_filename);
-  radar_gfx_sprite = load_gfxfile(minimap_intro_filename);
+  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename());
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());
 }
 
 /**************************************************************************
Index: client/gui-gtk/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/graphics.c,v
retrieving revision 1.53
diff -u -r1.53 graphics.c
--- client/gui-gtk/graphics.c   24 Mar 2004 06:18:18 -0000      1.53
+++ client/gui-gtk/graphics.c   2 Mar 2005 19:26:07 -0000
@@ -117,7 +117,7 @@
 
   /* Main graphic */
 
-  intro_gfx_sprite = load_gfxfile(main_intro_filename);
+  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename());
   tot=intro_gfx_sprite->width;
 
   face_gc = gdk_gc_new(root_window);
@@ -133,7 +133,7 @@
 
   /* Minimap graphic */
 
-  radar_gfx_sprite = load_gfxfile(minimap_intro_filename);
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());
   tot = radar_gfx_sprite->width;
 
   my_snprintf(s, sizeof(s), "%d.%d.%d%s",
Index: client/gui-gtk-2.0/pages.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/pages.c,v
retrieving revision 1.17
diff -u -r1.17 pages.c
--- client/gui-gtk-2.0/pages.c  5 Feb 2005 07:15:36 -0000       1.17
+++ client/gui-gtk-2.0/pages.c  2 Mar 2005 19:26:08 -0000
@@ -169,7 +169,7 @@
   gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
   gtk_container_add(GTK_CONTAINER(align), frame);
 
-  image = gtk_image_new_from_file(main_intro_filename);
+  image = gtk_image_new_from_file(tileset_main_intro_filename());
   g_signal_connect_after(image, "expose_event",
       G_CALLBACK(intro_expose), NULL);
   gtk_container_add(GTK_CONTAINER(frame), image);
Index: client/gui-mui/mapclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapclass.c,v
retrieving revision 1.102
diff -u -r1.102 mapclass.c
--- client/gui-mui/mapclass.c   28 Feb 2005 04:01:53 -0000      1.102
+++ client/gui-mui/mapclass.c   2 Mar 2005 19:26:08 -0000
@@ -811,8 +811,8 @@
     colors_pen[i] = ObtainBestPenA(cm, r, g, b, 0); /* global in colors.c */
   }
 
-  data->intro_gfx_sprite = load_sprite(main_intro_filename, FALSE);
-  data->radar_gfx_sprite = load_sprite(minimap_intro_filename, FALSE);
+  data->intro_gfx_sprite = load_sprite(tileset_main_intro_filename(), FALSE);
+  data->radar_gfx_sprite = load_sprite(tileset_mini_intro_filename(), FALSE);
 
   if ((dh = data->drawhandle = ObtainDrawHandle(pen_shared_map, 
&_screen(o)->RastPort, _screen(o)->ViewPort.ColorMap,
                                           GGFX_DitherMode, DITHERMODE_NONE,
Index: client/gui-sdl/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/graphics.c,v
retrieving revision 1.33
diff -u -r1.33 graphics.c
--- client/gui-sdl/graphics.c   14 Feb 2005 17:52:56 -0000      1.33
+++ client/gui-sdl/graphics.c   2 Mar 2005 19:26:09 -0000
@@ -3450,7 +3450,7 @@
 SDL_Surface * get_intro_gfx(void)
 {
   if(!pIntro_gfx) {
-   pIntro_gfx = load_surf(main_intro_filename);
+   pIntro_gfx = load_surf(tileset_main_intro_filename());
   }
   return pIntro_gfx;
 }
@@ -3461,7 +3461,7 @@
 SDL_Surface * get_logo_gfx(void)
 {
   SDL_Surface *pLogo;
-  SDL_Surface *pLogo_Surf = IMG_Load(minimap_intro_filename);
+  SDL_Surface *pLogo_Surf = IMG_Load(tileset_mini_intro_filename());
   assert(pLogo_Surf != NULL);
   pLogo = SDL_CreateRGBSurface(SDL_SWSURFACE,
                        pLogo_Surf->w, pLogo_Surf->h,
Index: client/gui-stub/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/graphics.c,v
retrieving revision 1.13
diff -u -r1.13 graphics.c
--- client/gui-stub/graphics.c  4 Feb 2005 02:07:06 -0000       1.13
+++ client/gui-stub/graphics.c  2 Mar 2005 19:26:09 -0000
@@ -48,8 +48,8 @@
 void load_intro_gfx(void)
 {
   /* PORTME */
-  intro_gfx_sprite = load_gfxfile(main_intro_filename);
-  radar_gfx_sprite = load_gfxfile(minimap_intro_filename);
+  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename());
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());
 }
 
 /****************************************************************************
Index: client/gui-win32/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/graphics.c,v
retrieving revision 1.24
diff -u -r1.24 graphics.c
--- client/gui-win32/graphics.c 14 Feb 2005 02:39:49 -0000      1.24
+++ client/gui-win32/graphics.c 2 Mar 2005 19:26:09 -0000
@@ -80,8 +80,8 @@
 void
 load_intro_gfx(void)
 {
-  intro_gfx_sprite=load_gfxfile(main_intro_filename);
-  radar_gfx_sprite = load_gfxfile(minimap_intro_filename);     
+  intro_gfx_sprite=load_gfxfile(tileset_main_intro_filename());
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());     
 }
 
 /**************************************************************************
Index: client/gui-xaw/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/graphics.c,v
retrieving revision 1.54
diff -u -r1.54 graphics.c
--- client/gui-xaw/graphics.c   1 Dec 2004 18:56:53 -0000       1.54
+++ client/gui-xaw/graphics.c   2 Mar 2005 19:26:09 -0000
@@ -112,7 +112,7 @@
 
   /* Main graphic */
 
-  intro_gfx_sprite=load_gfxfile(main_intro_filename);
+  intro_gfx_sprite=load_gfxfile(tileset_main_intro_filename());
   tot=intro_gfx_sprite->width;
 
   y=intro_gfx_sprite->height-(2*lin);
@@ -126,7 +126,7 @@
 
   /* Minimap graphic */
 
-  radar_gfx_sprite=load_gfxfile(minimap_intro_filename);
+  radar_gfx_sprite=load_gfxfile(tileset_mini_intro_filename());
   tot=radar_gfx_sprite->width;
 
   y = radar_gfx_sprite->height - (lin +

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12401) encapsulate intro_filenames, Jason Short <=