(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
authortron
Thu, 03 Nov 2005 15:25:45 +0000
changeset 2588 40d7dba79fc7
parent 2587 d554e2a03afa
child 2589 28c7b9b212af
(svn r3125) Symbolic names for skiping sprites and the end of the sprite list
gfxinit.c
table/landscape_sprite.h
--- a/gfxinit.c	Thu Nov 03 09:22:24 2005 +0000
+++ b/gfxinit.c	Thu Nov 03 15:25:45 2005 +0000
@@ -24,6 +24,11 @@
 	const MD5File landscape[3]; // landscape specific grf files
 } FileList;
 
+enum {
+	SKIP = 0xFFFE,
+	END  = 0xFFFF
+};
+
 #include "table/files.h"
 #include "table/landscape_sprite.h"
 
@@ -69,10 +74,10 @@
 
 	DEBUG(spritecache, 2) ("Reading indexed grf-file ``%s''", filename);
 
-	for (; (start = *index_tbl++) != 0xffff;) {
+	while ((start = *index_tbl++) != END) {
 		uint end = *index_tbl++;
 
-		if (start == 0xfffe) { // skip sprites (amount in second var)
+		if (start == SKIP) { // skip sprites (amount in second var)
 			SkipSprites(end);
 		} else { // load sprites and use indexes from start to end
 			do {
@@ -187,83 +192,83 @@
 
 
 static const SpriteID trg1idx[] = {
-	     0,    1, // Mouse cursor, ZZZ
+	   0,    1, // Mouse cursor, ZZZ
 /* Medium font */
-	     2,   92, // ' ' till 'z'
-	0xFFFE,   36,
-	   160,  160, // Move ¾ to the correct position
-	    98,   98, // Up arrow
-	   131,  133,
-	0xFFFE,    1, // skip currency sign
-	   135,  135,
-	0xFFFE,    1,
-	   137,  137,
-	0xFFFE,    1,
-	   139,  139,
-	   140,  140, // TODO Down arrow
-	   141,  141,
-	   142,  142, // TODO Check mark
-	   143,  143, // TODO Cross
-	   144,  144,
-	   145,  145, // TODO Right arrow
-	   146,  149,
-	   118,  122, // Transport markers
-	0xFFFE,    2,
-	   157,  157,
-	   114,  115, // Small up/down arrows
-	0xFFFE,    1,
-	   161,  225,
+	   2,   92, // ' ' till 'z'
+	SKIP,   36,
+	 160,  160, // Move ¾ to the correct position
+	  98,   98, // Up arrow
+	 131,  133,
+	SKIP,    1, // skip currency sign
+	 135,  135,
+	SKIP,    1,
+	 137,  137,
+	SKIP,    1,
+	 139,  139,
+	 140,  140, // TODO Down arrow
+	 141,  141,
+	 142,  142, // TODO Check mark
+	 143,  143, // TODO Cross
+	 144,  144,
+	 145,  145, // TODO Right arrow
+	 146,  149,
+	 118,  122, // Transport markers
+	SKIP,    2,
+	 157,  157,
+	 114,  115, // Small up/down arrows
+	SKIP,    1,
+	 161,  225,
 /* Small font */
-	   226,  316, // ' ' till 'z'
-	0xFFFE,   36,
-	   384,  384, // Move ¾ to the correct position
-	   322,  322, // Up arrow
-	   355,  357,
-	0xFFFE,    1, // skip currency sign
-	   359,  359,
-	0xFFFE,    1,
-	   361,  361,
-	0xFFFE,    1,
-	   363,  363,
-	   364,  364, // TODO Down arrow
-	   365,  366,
-	0xFFFE,    1,
-	   368,  368,
-	   369,  369, // TODO Right arrow
-	   370,  373,
-	0xFFFE,    7,
-	   381,  381,
-	0xFFFE,    3,
-	   385,  449,
+	 226,  316, // ' ' till 'z'
+	SKIP,   36,
+	 384,  384, // Move ¾ to the correct position
+	 322,  322, // Up arrow
+	 355,  357,
+	SKIP,    1, // skip currency sign
+	 359,  359,
+	SKIP,    1,
+	 361,  361,
+	SKIP,    1,
+	 363,  363,
+	 364,  364, // TODO Down arrow
+	 365,  366,
+	SKIP,    1,
+	 368,  368,
+	 369,  369, // TODO Right arrow
+	 370,  373,
+	SKIP,    7,
+	 381,  381,
+	SKIP,    3,
+	 385,  449,
 /* Big font */
-	   450,  540, // ' ' till 'z'
-	0xFFFE,   36,
-	   608,  608, // Move ¾ to the correct position
-	0xFFFE,    1,
-	   579,  581,
-	0xFFFE,    1,
-	   583,  583,
-	0xFFFE,    5,
-	   589,  589,
-	0xFFFE,   15,
-	   605,  605,
-	0xFFFE,    3,
-	   609,  625,
-	0xFFFE,    1,
-	   627,  632,
-	0xFFFE,    1,
-	   634,  639,
-	0xFFFE,    1,
-	   641,  657,
-	0xFFFE,    1,
-	   659,  664,
-	0xFFFE,    2,
-	   667,  671,
-	0xFFFE,    1,
-	   673,  673,
+	 450,  540, // ' ' till 'z'
+	SKIP,   36,
+	 608,  608, // Move ¾ to the correct position
+	SKIP,    1,
+	 579,  581,
+	SKIP,    1,
+	 583,  583,
+	SKIP,    5,
+	 589,  589,
+	SKIP,   15,
+	 605,  605,
+	SKIP,    3,
+	 609,  625,
+	SKIP,    1,
+	 627,  632,
+	SKIP,    1,
+	 634,  639,
+	SKIP,    1,
+	 641,  657,
+	SKIP,    1,
+	 659,  664,
+	SKIP,    2,
+	 667,  671,
+	SKIP,    1,
+	 673,  673,
 /* Graphics */
-	   674, 4792,
-	0xFFFF
+	 674, 4792,
+	END
 };
 
 /* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the
@@ -309,7 +314,7 @@
 	 93,  96, // { | } ~ medium
 	541, 544, // { | } ~ large
 	SPR_HOUSE_ICON, SPR_HOUSE_ICON,
-	0xffff,
+	END
 };
 
 static byte _sprite_page_to_load = 0xFF;
--- a/table/landscape_sprite.h	Thu Nov 03 09:22:24 2005 +0000
+++ b/table/landscape_sprite.h	Thu Nov 03 15:25:45 2005 +0000
@@ -23,7 +23,7 @@
  0x818,  0x81D,
  0x3DE,  0x3EB,
 0x1212, 0x1212,
-0xffff,
+END
 };
 
 static const SpriteID _landscape_spriteindexes_2[] = {
@@ -60,7 +60,7 @@
  0xFF5,  0xFF5,
  0xFF8,  0xFF8,
 0x1212, 0x1212,
-0xffff,
+END
 };
 
 static const SpriteID _landscape_spriteindexes_3[] = {
@@ -130,38 +130,38 @@
  0x514,  0x514,
  0x511,  0x511,
  0x322,  0x322,
- 0xffff,
+END
 };
 
 
 /* Slope graphics indexes temperate climate
 Skip first 3 sprites and only load the proper set */
 static const SpriteID _slopes_spriteindexes_0[] = {
- 0xfffe,  3,
- SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
- 0xffff,
+	SKIP, 3,
+	SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
+	END
 };
 
 /* Slope graphics indexes arctic climate
 Skip first 79 sprites and only load the proper set */
 static const SpriteID _slopes_spriteindexes_1[] = {
- 0xfffe,  79,
- SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
- 0xffff,
+	SKIP, 79,
+	SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
+	END
 };
 
 /* Slope graphics indexes tropical climate
 Skip first 155 sprites and only load the proper set */
 static const SpriteID _slopes_spriteindexes_2[] = {
- 0xfffe,  155,
- SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
- 0xffff,
+	SKIP, 155,
+	SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
+	END
 };
 
 /* Slope graphics indexes toyland climate
 Skip first 231 sprites and only load the proper set */
 static const SpriteID _slopes_spriteindexes_3[] = {
- 0xfffe,  231,
- SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
- 0xffff,
+	SKIP, 231,
+	SPR_SLOPES_BASE, SPR_SLOPES_BASE + 73,
+	END
 };