summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-26 19:20:15 +0000
committertron <tron@openttd.org>2006-03-26 19:20:15 +0000
commitc40740e058983e02912d7844a64f0c2568df7b28 (patch)
treeab641b54ed908fa761cf34615a8966e70f7e78d1 /ai
parent3ecd8bd2eec6fdbaeb71b88b1b9a7e7cbcef6681 (diff)
downloadopenttd-c40740e058983e02912d7844a64f0c2568df7b28.tar.xz
(svn r4120) Use the new station functions where appropriate
Diffstat (limited to 'ai')
-rw-r--r--ai/default/default.c17
-rw-r--r--ai/trolly/trolly.c4
2 files changed, 5 insertions, 16 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index 847ef12e9..7b89d0b1f 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -359,7 +359,7 @@ static void AiHandleReplaceAircraft(Player *p)
BackuppedOrders orderbak[1];
EngineID veh;
- if (!IsAircraftHangarTile(v->tile) || !(v->vehstatus&VS_STOPPED)) {
+ if (!IsHangarTile(v->tile) || !(v->vehstatus & VS_STOPPED)) {
AiHandleGotoDepot(p, CMD_SEND_AIRCRAFT_TO_HANGAR);
return;
}
@@ -3176,15 +3176,6 @@ static void AiStateDeleteRoadBlocks(Player *p)
p->ai.state = AIS_0;
}
-static bool AiCheckIfHangar(Station *st)
-{
- TileIndex tile = st->airport_tile;
-
- // HANGAR of airports
- // 0x20 - hangar large airport (32)
- // 0x41 - hangar small airport (65)
- return (_m[tile].m5 == 32 || _m[tile].m5 == 65);
-}
static void AiStateAirportStuff(Player *p)
{
@@ -3245,7 +3236,7 @@ static void AiStateAirportStuff(Player *p)
* here for now (some of the new airport types would be
* broken because they will probably need different
* tileoff values etc), no matter that
- * AiCheckIfHangar() makes no sense. --pasky */
+ * IsHangarTile() makes no sense. --pasky */
if (acc_planes == HELICOPTERS_ONLY) {
/* Heliports should have maybe own rulesets but
* OTOH we don't want AI to pick them up when
@@ -3255,7 +3246,7 @@ static void AiStateAirportStuff(Player *p)
* because we have no such rule. */
rule = 1;
} else {
- rule = AiCheckIfHangar(st);
+ rule = IsHangarTile(st->airport_tile);
}
aib->cur_building_rule = rule;
@@ -3504,7 +3495,7 @@ static void AiStateSellVeh(Player *p)
DoCommandByTile(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
} else if (v->type == VEH_Aircraft) {
- if (!IsAircraftHangarTile(v->tile) || !(v->vehstatus & VS_STOPPED)) {
+ if (!IsHangarTile(v->tile) || !(v->vehstatus & VS_STOPPED)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommandByTile(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
goto going_to_depot;
diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c
index eac7793ae..9f00579cb 100644
--- a/ai/trolly/trolly.c
+++ b/ai/trolly/trolly.c
@@ -617,9 +617,7 @@ static void AiNew_State_FindStation(Player *p)
if (AiNew_CheckVehicleStation(p, st)) {
// We did found a station that was good enough!
new_tile = st->xy;
- // Cheap way to get the direction of the station...
- // Bus stations save it as 0x47 .. 0x4A, so decrease it with 0x47, and tada!
- direction = _m[st->xy].m5 - 0x47;
+ direction = GetRoadStationDir(st->xy);
break;
}
}