From b1e2ae44d6564709c0947319849a4928f0d0f949 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 20 Aug 2006 19:31:58 +0000 Subject: (svn r6005) -Cleanup: introduce IndustryID and use it -Cleanup: use TownID and StationID for two instances of uint16 --- economy.c | 4 ++-- industry.h | 2 +- industry_cmd.c | 4 ++-- industry_map.h | 4 ++-- openttd.h | 1 + town_cmd.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/economy.c b/economy.c index 602417648..0e6f3eb5c 100644 --- a/economy.c +++ b/economy.c @@ -844,7 +844,7 @@ Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode) return tp; } -void DeleteSubsidyWithIndustry(uint16 index) +void DeleteSubsidyWithIndustry(IndustryID index) { Subsidy *s; @@ -857,7 +857,7 @@ void DeleteSubsidyWithIndustry(uint16 index) } } -void DeleteSubsidyWithStation(uint16 index) +void DeleteSubsidyWithStation(StationID index) { Subsidy *s; bool dirty = false; diff --git a/industry.h b/industry.h index 698a981a0..2e618edd9 100644 --- a/industry.h +++ b/industry.h @@ -35,7 +35,7 @@ struct Industry { Year last_prod_year; byte was_cargo_delivered; - uint16 index; + IndustryID index; }; typedef struct IndustryTileTable { diff --git a/industry_cmd.c b/industry_cmd.c index e614a6b52..cdabc032c 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -811,7 +811,7 @@ static void SetupFarmFieldFence(TileIndex tile, int size, byte type, Axis direct } while (--size); } -static void PlantFarmField(TileIndex tile, uint16 industry) +static void PlantFarmField(TileIndex tile, IndustryID industry) { uint size_x, size_y; uint32 r; @@ -1404,7 +1404,7 @@ static Industry *AllocateIndustry(void) FOR_ALL_INDUSTRIES(i) { if (i->xy == 0) { - uint index = i->index; + IndustryID index = i->index; if (i->index > _total_industries) _total_industries = i->index; diff --git a/industry_map.h b/industry_map.h index db9e1a0d3..5486a1528 100644 --- a/industry_map.h +++ b/industry_map.h @@ -28,7 +28,7 @@ enum { GFX_TOY_FACTORY = 143 }; -static inline uint GetIndustryIndex(TileIndex t) +static inline IndustryID GetIndustryIndex(TileIndex t) { assert(IsTileType(t, MP_INDUSTRY)); return _m[t].m2; @@ -95,7 +95,7 @@ static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx) _m[t].m5 = gfx; } -static inline void MakeIndustry(TileIndex t, uint index, IndustryGfx gfx) +static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx) { SetTileType(t, MP_INDUSTRY); _m[t].m1 = 0; diff --git a/openttd.h b/openttd.h index 857f92b15..ee94ec78c 100644 --- a/openttd.h +++ b/openttd.h @@ -38,6 +38,7 @@ typedef struct DrawPixelInfo DrawPixelInfo; typedef uint16 VehicleID; typedef uint16 StationID; typedef uint16 TownID; +typedef uint16 IndustryID; typedef byte PlayerID; typedef byte OrderID; typedef byte CargoID; diff --git a/town_cmd.c b/town_cmd.c index cf3a919c6..7691179cf 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -951,7 +951,7 @@ static Town *AllocateTown(void) Town *t; FOR_ALL_TOWNS(t) { if (t->xy == 0) { - uint index = t->index; + TownID index = t->index; if (t->index > _total_towns) _total_towns = t->index; -- cgit v1.2.3-70-g09d2