diff options
author | Darkvater <Darkvater@openttd.org> | 2006-03-26 22:23:32 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2006-03-26 22:23:32 +0000 |
commit | e91fa54a157e73958e2bc7cbf212c8ef7df75d6b (patch) | |
tree | 2a31936844a550db9aea12a9b2645bfd4e7e7fa2 /ai/default | |
parent | d3a98e09618594016a0d2b7c60e49a64efee3fab (diff) | |
download | openttd-e91fa54a157e73958e2bc7cbf212c8ef7df75d6b.tar.xz |
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Diffstat (limited to 'ai/default')
-rw-r--r-- | ai/default/default.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; |