summaryrefslogtreecommitdiff
path: root/ai_new.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-12-03 21:57:05 +0000
committertron <tron@openttd.org>2004-12-03 21:57:05 +0000
commit5fc510bbfc0546ff09a0b3bf283572392dfdb2b5 (patch)
treef66c41d1934032e4de287daa7c53e7e795082529 /ai_new.c
parentff7b0294b89fa7c9ced381efdfd1121216341e76 (diff)
downloadopenttd-5fc510bbfc0546ff09a0b3bf283572392dfdb2b5.tar.xz
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
Diffstat (limited to 'ai_new.c')
-rw-r--r--ai_new.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ai_new.c b/ai_new.c
index 347129995..e651a87f1 100644
--- a/ai_new.c
+++ b/ai_new.c
@@ -568,7 +568,7 @@ static void AiNew_State_FindStation(Player *p) {
if (p->ainew.tbt == AI_BUS && (FACIL_BUS_STOP & st->facilities) == FACIL_BUS_STOP) {
if (st->town == town) {
// Check how much cargo there is left in the station
- if ((st->goods[p->ainew.cargo].waiting_acceptance & 0xFFF) > road_vehicle_info(i)->capacity * AI_STATION_REUSE_MULTIPLER) {
+ if ((st->goods[p->ainew.cargo].waiting_acceptance & 0xFFF) > RoadVehInfo(i)->capacity * AI_STATION_REUSE_MULTIPLER) {
if (AiNew_CheckVehicleStation(p, st)) {
// We did found a station that was good enough!
new_tile = st->xy;
@@ -827,7 +827,7 @@ static int AiNew_HowManyVehicles(Player *p) {
// Passenger run.. how long is the route?
length = p->ainew.path_info.route_length;
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
- tiles_a_day = road_vehicle_info(i)->max_speed * DAY_TICKS / 256 / 16;
+ tiles_a_day = RoadVehInfo(i)->max_speed * DAY_TICKS / 256 / 16;
// We want a vehicle in a station once a month at least, so, calculate it!
// (the * 2 is because we have 2 stations ;))
amount = ((int)(((float)length / (float)tiles_a_day / 30 * 2))) * 2;
@@ -842,7 +842,7 @@ static int AiNew_HowManyVehicles(Player *p) {
// Passenger run.. how long is the route?
length = p->ainew.path_info.route_length;
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
- tiles_a_day = road_vehicle_info(i)->max_speed * DAY_TICKS / 256 / 16;
+ tiles_a_day = RoadVehInfo(i)->max_speed * DAY_TICKS / 256 / 16;
if (p->ainew.from_deliver)
max_cargo = DEREF_INDUSTRY(p->ainew.from_ic)->total_production[0];
else
@@ -853,7 +853,7 @@ static int AiNew_HowManyVehicles(Player *p) {
// We want all the cargo to be gone in a month.. so, we know the cargo it delivers
// we know what the vehicle takes with him, and we know the time it takes him
// to get back here.. now let's do some math!
- amount = (int)(((float)length / (float)tiles_a_day / 30 * 2) * ((float)max_cargo / (float)road_vehicle_info(i)->capacity));
+ amount = (int)(((float)length / (float)tiles_a_day / 30 * 2) * ((float)max_cargo / (float)RoadVehInfo(i)->capacity));
amount += 1;
return amount;
} else {