Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12069) fogstyle as an enum
Home

[Freeciv-Dev] (PR#12069) fogstyle as an enum

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12069) fogstyle as an enum
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 31 Jan 2005 22:01:30 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch:

- Converts fogstyle to be an enumerated value.

- Adds a FOG_NONE for an empty fogstyle.  This is more or less a 
placeholder but may be used (in conjunction with darkness_style) for 
better blended fog/darkness.

-jason

? data/isotrident/fog.png
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.171
diff -u -r1.171 mapview_common.c
--- client/mapview_common.c     5 Jan 2005 23:24:24 -0000       1.171
+++ client/mapview_common.c     1 Feb 2005 05:55:26 -0000
@@ -1444,7 +1444,7 @@
                                get_drawable_unit(ptile, citymode),
                                ptile->city, citymode);
   bool fog = (ptile->known == TILE_KNOWN_FOGGED && draw_fog_of_war
-             && fogstyle == 0);
+             && fogstyle == FOG_AUTO);
 
   /*** Draw terrain and specials ***/
   put_drawn_sprites(pcanvas, canvas_x, canvas_y, count, tile_sprs, fog);
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.225
diff -u -r1.225 tilespec.c
--- client/tilespec.c   29 Jan 2005 18:18:04 -0000      1.225
+++ client/tilespec.c   1 Feb 2005 05:55:26 -0000
@@ -85,7 +85,7 @@
 int num_tiles_explode_unit=0;
 
 static int roadstyle;
-int fogstyle;
+enum fog_style fogstyle;
 static int flag_offset_x, flag_offset_y;
 
 #define NUM_CORNER_DIRS 4
@@ -865,8 +865,9 @@
 
   roadstyle = secfile_lookup_int_default(file, is_isometric ? 0 : 1,
                                         "tilespec.roadstyle");
-  fogstyle = secfile_lookup_int_default(file, is_isometric ? 0 : 1,
-                                       "tilespec.fogstyle");
+  fogstyle
+    = secfile_lookup_int_default(file, is_isometric ? FOG_AUTO : FOG_SPRITE,
+                                "tilespec.fogstyle");
   darkness_style = secfile_lookup_int(file, "tilespec.darkness_style");
   if (darkness_style < DARKNESS_NONE
       || darkness_style > DARKNESS_CARD_FULL
@@ -1915,7 +1916,7 @@
    sprs->type = DRAWN_SPRITE,                                  \
    sprs->data.sprite.style = draw_style,                       \
    sprs->data.sprite.sprite = s,                               \
-   sprs->data.sprite.foggable = (draw_fog && fogstyle == 0),   \
+   sprs->data.sprite.foggable = (draw_fog && fogstyle == FOG_AUTO),    \
    sprs->data.sprite.offset_x = x_offset,                      \
    sprs->data.sprite.offset_y = y_offset,                      \
    sprs++)
@@ -2819,9 +2820,9 @@
     break;
 
   case LAYER_FOG:
-    if (fogstyle == 1 && draw_fog_of_war
+    if (fogstyle == FOG_SPRITE && draw_fog_of_war
        && ptile && tile_get_known(ptile) == TILE_KNOWN_FOGGED) {
-      /* With fogstyle 1, fog is done this way. */
+      /* With FOG_AUTO, fog is done this way. */
       ADD_SPRITE_SIMPLE(sprites.tx.fog);
     }
     break;
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.97
diff -u -r1.97 tilespec.h
--- client/tilespec.h   22 Jan 2005 19:45:39 -0000      1.97
+++ client/tilespec.h   1 Feb 2005 05:55:26 -0000
@@ -301,7 +301,14 @@
 };
 
 extern struct named_sprites sprites;
-extern int fogstyle;
+
+/* Don't reorder this enum since tilesets depend on it. */
+enum fog_style {
+  FOG_AUTO, /* Fog is automatically appended by the code. */
+  FOG_SPRITE, /* A single fog sprite is provided by the tileset (tx.fog). */
+  FOG_NONE /* No fog. */
+};
+extern enum fog_style fogstyle;
 
 struct Sprite *get_citizen_sprite(struct citizen_type type,
                                  int citizen_index,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12069) fogstyle as an enum, Jason Short <=