diff options
author | rubidium <rubidium@openttd.org> | 2006-12-30 11:41:54 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2006-12-30 11:41:54 +0000 |
commit | 34bc8008d3d5c65c18bd2762fa7279a30b44e29c (patch) | |
tree | c71a0d3b3e4a1fcc81bcd5bd776430aadb2168b7 | |
parent | 405f80c0d12557152a24e579c8ca26e114d1a8b0 (diff) | |
download | openttd-34bc8008d3d5c65c18bd2762fa7279a30b44e29c.tar.xz |
(svn r7640) -Codechange: move a table from industry_cmd.c to table/industry_land
-Codechange: add a reference to the industry GFX enum and some comments to the tables
-Codechange: remove some magic numbers
-rw-r--r-- | industry_cmd.c | 43 | ||||
-rw-r--r-- | industry_map.h | 5 | ||||
-rw-r--r-- | table/industry_land.h | 57 |
3 files changed, 58 insertions, 47 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index ccec97c55..c366d220a 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -451,8 +451,10 @@ static void AnimateTile_Industry(TileIndex tile) } break; - case 148: case 149: case 150: case 151: - case 152: case 153: case 154: case 155: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_1: case GFX_PLASTIC_FOUNTAIN_ANIMATED_2: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8: if ((_tick_counter & 3) == 0) { IndustryGfx gfx = GetIndustryGfx(tile); @@ -567,14 +569,10 @@ static void MakeIndustryTileBigger(TileIndex tile) SetIndustryAnimationLoop(tile, 0); break; - case GFX_PLASTIC_FOUNTAIN_ANIMATED_1: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_2: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_4: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_6: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: - case GFX_PLASTIC_FOUNTAIN_ANIMATED_8: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_1: case GFX_PLASTIC_FOUNTAIN_ANIMATED_2: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6: + case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8: AddAnimatedTile(tile); break; } @@ -1107,31 +1105,6 @@ static const Town *CheckMultipleIndustryInTown(TileIndex tile, int type) return t; } -static const byte _industry_section_bits[] = { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 4, 2, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 4, 2, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, -}; - static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, int type) { _error_message = STR_0239_SITE_UNSUITABLE; diff --git a/industry_map.h b/industry_map.h index b284ab1f0..bef925ef6 100644 --- a/industry_map.h +++ b/industry_map.h @@ -48,6 +48,7 @@ enum { GFX_BUBBLE_CATCHER = 162, GFX_TOFFEE_QUARY = 165, GFX_SUGAR_MINE_SIEVE = 174, + NUM_INDUSTRY_GFXES = 175, }; static inline IndustryID GetIndustryIndex(TileIndex t) @@ -212,7 +213,7 @@ static const IndustryTypeSolver industry_gfx_Solver [IT_END] = { /** * Get the animation loop number * @param tile the tile to get the animation loop number of - * @pre IsTileType(tile, MP_INDUSTRY + * @pre IsTileType(tile, MP_INDUSTRY) */ static inline byte GetIndustryAnimationLoop(TileIndex tile) { @@ -224,7 +225,7 @@ static inline byte GetIndustryAnimationLoop(TileIndex tile) * Set the animation loop number * @param tile the tile to set the animation loop number of * @param count the new animation frame number - * @pre IsTileType(tile, MP_INDUSTRY + * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryAnimationLoop(TileIndex tile, byte count) { diff --git a/table/industry_land.h b/table/industry_land.h index 5ceec7c4f..22d731706 100644 --- a/table/industry_land.h +++ b/table/industry_land.h @@ -15,7 +15,7 @@ typedef struct DrawIndustrySpec4Struct { #define M(s1, s2, sx, sy, w, h, dz, p) { s1, s2, sx, sy, w - 1, h - 1, dz, p } -static const DrawBuildingsTileStruct _industry_draw_tile_data[700] = { +static const DrawBuildingsTileStruct _industry_draw_tile_data[NUM_INDUSTRY_GFXES * 4] = { M( 0xf54, 0x7db, 7, 0, 9, 9, 10, 0), M( 0xf54, 0x7dc, 7, 0, 9, 9, 30, 0), M( 0xf54, 0x7dd, 7, 0, 9, 9, 30, 0), @@ -898,12 +898,16 @@ static const byte _industry_anim_offs_2[] = { static const byte _coal_plant_sparks_x[] = {11, 11, 14, 13, 18, 15}; static const byte _coal_plant_sparks_y[] = {23, 11, 6, 3, 1, 0}; -/* next frame in an animation */ #define N 255 -static const byte _industry_section_animation_next[] = { +/** + * Next frame in an animation + * The indices into this table are the ones as described by + * the enum with GFX_*s in industry_map.h. + */ +static const byte _industry_section_animation_next[NUM_INDUSTRY_GFXES] = { N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, -N, 16, N, N, N, N, N, N, +N, 16, N, N, N, N, N, N, // <- growing forest N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, @@ -917,19 +921,23 @@ N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, -N, N, 129, N, N, N, N, N, -135, N, N, N, N, N, N, N, +N, N, 129, N, N, N, N, N, // <- growing candyfloss +135, N, N, N, N, N, N, N, // <- 'growing' batteries N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, }; -/* animation to start when goods is produced */ -static const byte _industry_produce_section[] = { +/** + * Animation to start when goods is produced + * The indices into this table are the ones as described by + * the enum with GFX_*s in industry_map.h. + */ +static const byte _industry_produce_section[NUM_INDUSTRY_GFXES] = { N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, -17, N, N, N, N, N, N, N, +17, N, N, N, N, N, N, N, // <- chopping forest N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, @@ -943,7 +951,7 @@ N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, -N, 130, N, N, N, N, N, 136, +N, 130, N, N, N, N, N, 136, // <- chopping candyfloss and reaping batteries N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, @@ -952,3 +960,32 @@ N, N, N, N, N, N, N, }; #undef N + +/** + * The indices into this table are the ones as described by + * the enum with GFX_*s in industry_map.h. + */ +static const byte _industry_section_bits[NUM_INDUSTRY_GFXES] = { + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 4, 2, 16, 16, 16, 16, // <- temperate bank + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 4, 2, 16, 16, 16, 16, 16, // <- sub-arctic/sub-tropical bank + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, +}; |