diff options
author | belugas <belugas@openttd.org> | 2007-02-21 02:22:43 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-02-21 02:22:43 +0000 |
commit | 771932d8891e9f1e52b957958c97511317c36055 (patch) | |
tree | d4e3de75d0a2b45871683afdcf9f9343ad9e036f /src/industry_cmd.cpp | |
parent | ef2daa5060e251834e82df1ba3e081579ff84f2f (diff) | |
download | openttd-771932d8891e9f1e52b957958c97511317c36055.tar.xz |
(svn r8827) -Codechange: Cleanup of industry_cmd (Step-6). Implementation of IndustryTileSPec, the alter ego of IndustrySpec.
It offers identification of the different industry tiles in a more distinct manner, as well as regrouping scattered pieces of data across the sources. More to come
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r-- | src/industry_cmd.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 525177c2d..b1ae614bb 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -87,6 +87,12 @@ const IndustrySpec *GetIndustrySpec(IndustryType thistype) return &_industry_specs[thistype]; } +const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx) +{ + assert(gfx < NUM_INDUSTRY_GFXES); + return &_industry_tile_specs[gfx]; +} + void DestroyIndustry(Industry *i) { BEGIN_TILE_LOOP(tile_cur, i->width, i->height, i->xy); @@ -277,16 +283,16 @@ static Slope GetSlopeTileh_Industry(TileIndex tile, Slope tileh) static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) { - IndustryGfx gfx = GetIndustryGfx(tile); + const IndustryTileSpec *itspec = GetIndustryTileSpec(GetIndustryGfx(tile)); CargoID a; - a = _industry_section_accepts_1[gfx]; - if (a != CT_INVALID) ac[a] = (a == 0) ? 1 : 8; + a = itspec->accepts_cargo[0]; + if (a != CT_INVALID) ac[a] = (a == CT_PASSENGERS) ? 1 : 8; - a = _industry_section_accepts_2[gfx]; + a = itspec->accepts_cargo[1]; if (a != CT_INVALID) ac[a] = 8; - a = _industry_section_accepts_3[gfx]; + a = itspec->accepts_cargo[2]; if (a != CT_INVALID) ac[a] = 8; } @@ -1155,7 +1161,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable * CheckIfCanLevelIndustryPlatform(). */ if (tileh != SLOPE_FLAT) { Slope t; - byte bits = _industry_section_bits[it->gfx]; + byte bits = GetIndustryTileSpec(it->gfx)->slopes_refused; if (bits & 0x10) return false; |