From c40740e058983e02912d7844a64f0c2568df7b28 Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 26 Mar 2006 19:20:15 +0000 Subject: (svn r4120) Use the new station functions where appropriate --- ai/default/default.c | 17 ++++------------- ai/trolly/trolly.c | 4 +--- 2 files changed, 5 insertions(+), 16 deletions(-) (limited to 'ai') 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; } } -- cgit v1.2.3-54-g00ecf