Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] (PR#2967) die(), don't assert when a sprite tag is missing
Home

[Freeciv-Dev] (PR#2967) die(), don't assert when a sprite tag is missing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2967) die(), don't assert when a sprite tag is missing
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 1 Feb 2003 09:35:14 -0800
Reply-to: rt@xxxxxxxxxxxxxx

This patch changes SET_SPRITE and SET_SPRITE_ALT so that they call die() 
to give a useful error message and exit rather than just assert()ing 
when a necessary sprite tag is missing.

Although this code may change soon, I found this patch very helpful when 
debugging a tileset that uses roadstyle 1 in iso mode.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.107
diff -u -r1.107 tilespec.c
--- client/tilespec.c   2003/01/30 18:30:34     1.107
+++ client/tilespec.c   2003/02/01 17:33:23
@@ -619,7 +619,9 @@
 /* Not very safe, but convenient: */
 #define SET_SPRITE(field, tag) do { \
        sprites.field = hash_lookup_data(sprite_hash, tag);\
-       assert(sprites.field != NULL);\
+       if (!sprites.field) {                              \
+         die("Sprite tag %s missing.", buffer);           \
+       }                                                  \
     } while(FALSE)
 
 /* Sets sprites.field to tag or (if tag isn't available) to alt */
@@ -628,7 +630,9 @@
        if (!sprites.field) {                                   \
            sprites.field = hash_lookup_data(sprite_hash, alt); \
        }                                                       \
-       assert(sprites.field != NULL);                          \
+       if (!sprites.field) {                                   \
+         die("Sprite tag %s and alternate %s are both missing.", tag, alt); \
+       }                                                       \
     } while(FALSE)
 
 /* Sets sprites.field to tag, or NULL if not available */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2967) die(), don't assert when a sprite tag is missing, Jason Short via RT <=