From d5909f901a8558dbfc562c75a387d66251c6ed20 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sun, 26 Mar 2006 22:23:32 +0000 Subject: (svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type. --- ai/default/default.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ai/default') diff --git a/ai/default/default.c b/ai/default/default.c index 7b89d0b1f..cb17433e6 100644 --- a/ai/default/default.c +++ b/ai/default/default.c @@ -156,7 +156,7 @@ static EngineID AiChooseTrainToBuild(byte railtype, int32 money, byte flag, Tile return best_veh_index; } -static EngineID AiChooseRoadVehToBuild(byte cargo, int32 money, TileIndex tile) +static EngineID AiChooseRoadVehToBuild(CargoID cargo, int32 money, TileIndex tile) { EngineID best_veh_index = INVALID_ENGINE; int32 best_veh_cost = 0; @@ -431,7 +431,7 @@ static void AiStateDoReplaceVehicle(Player *p) typedef struct FoundRoute { int distance; - byte cargo; + CargoID cargo; void *from; void *to; } FoundRoute; @@ -451,7 +451,7 @@ static Industry *AiFindRandomIndustry(void) static void AiFindSubsidyIndustryRoute(FoundRoute *fr) { uint i; - byte cargo; + CargoID cargo; Subsidy *s; Industry *from, *to_ind; Town *to_tow; @@ -468,7 +468,7 @@ static void AiFindSubsidyIndustryRoute(FoundRoute *fr) // Don't want passengers or mail cargo = s->cargo_type; - if (cargo == 0xFF || cargo == CT_PASSENGERS || cargo == CT_MAIL || s->age > 7) + if (cargo == CT_INVALID || cargo == CT_PASSENGERS || cargo == CT_MAIL || s->age > 7) return; fr->cargo = cargo; @@ -522,7 +522,7 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr) Industry *i,*i2; Town *t; uint32 r; - byte cargo; + CargoID cargo; // initially error fr->distance = -1; @@ -535,7 +535,7 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr) // pick a random produced cargo cargo = i->produced_cargo[0]; - if (r & 1 && i->produced_cargo[1] != 0xFF) cargo = i->produced_cargo[1]; + if (r & 1 && i->produced_cargo[1] != CT_INVALID) cargo = i->produced_cargo[1]; fr->cargo = cargo; -- cgit v1.2.3-70-g09d2