Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#8392) error blending jungle
Home

[Freeciv-Dev] (PR#8392) error blending jungle

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8392) error blending jungle
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Mar 2004 09:23:39 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8392 >

In iso-view the client will spit out messages like "sprite is NULL" from 
time to time.  This is because jungle has is_blended set to 0, and the 
code doesn't handle this properly.

Of course jungle should be blended, so this patch changes that.  The 
patch also fixes the handling of blending: blending is only done when 
both terrains being blended have is_blended set.

The patch also adds an assertion to ADD_SPRITE to make sure the sprite 
is non-NULL.  This "error" is fairly harmless but as long as the GUI 
code considers this an error so should tilespec.c.

jason

? Womoks
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.152
diff -u -r1.152 tilespec.c
--- client/tilespec.c   24 Mar 2004 06:18:18 -0000      1.152
+++ client/tilespec.c   26 Mar 2004 17:20:26 -0000
@@ -1372,7 +1372,8 @@
 }
 
 #define ADD_SPRITE(s, x_offset, y_offset) \
-  (sprs->sprite = s,                      \
+  (assert(s != NULL),                     \
+   sprs->sprite = s,                      \
    sprs->offset_x = x_offset,             \
    sprs->offset_y = y_offset,             \
    sprs++)
@@ -1907,9 +1908,9 @@
                                      enum tile_terrain_type *ttype_near)
 {
   struct drawn_sprite *saved_sprs = sprs;
+  enum tile_terrain_type ttype = map_get_terrain(map_x, map_y);
 
-  if (is_isometric) {
-    enum tile_terrain_type ttype = map_get_terrain(map_x, map_y);
+  if (is_isometric && sprites.terrain[ttype]->is_blended) {
     enum direction4 dir;
     const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
     const int offsets[4][2] = {
@@ -1927,7 +1928,8 @@
 
       if (!MAPSTEP(x1, y1, map_x, map_y, DIR4_TO_DIR8[dir])
          || tile_get_known(x1, y1) == TILE_UNKNOWN
-         || other == ttype) {
+         || other == ttype
+         || !sprites.terrain[other]->is_blended) {
        continue;
       }
 
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.13
diff -u -r1.13 isotrident.tilespec
--- data/isotrident.tilespec    24 Mar 2004 06:18:19 -0000      1.13
+++ data/isotrident.tilespec    26 Mar 2004 17:20:27 -0000
@@ -90,7 +90,7 @@
 mine_sprite = "tx.mine"
 
 [terrain_jungle]
-is_blended = 0
+is_blended = 1
 is_layered = 0
 match_type = 0
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8392) error blending jungle, Jason Short <=