#include "../../stdafx.h"
#include "../../openttd.h"
#include "../../aircraft.h"
#include "../../bridge_map.h"
#include "../../tile_cmd.h"
#include "../../landscape.h"
#include "../../rail_map.h"
#include "../../road_map.h"
#include "../../roadveh.h"
#include "../../station_map.h"
#include "../../tunnel_map.h"
#include "../../command_func.h"
#include "../../town.h"
#include "../../industry.h"
#include "../../pathfind.h"
#include "../../airport.h"
#include "../../variables.h"
#include "../../bridge.h"
#include "../../date_func.h"
#include "../../tunnelbridge_map.h"
#include "../../window_func.h"
#include "../../vehicle_func.h"
#include "../../functions.h"
#include "../../company_func.h"
#include "../../company_base.h"
#include "../../settings_type.h"
#include "default.h"
#include "../../tunnelbridge.h"
#include "../../order_func.h"
#include "../../table/ai_rail.h"
Go to the source code of this file.
Data Structures | |
| struct | FoundRoute |
| struct | AiRailPathFindData |
| struct | AiRailFinder |
| struct | AiRoadFinder |
| struct | AiRoadEnum |
Defines | |
| #define | GET_TOWN_OR_INDUSTRY_TILE(p) (((Town*)(p))->xy) |
Typedefs | |
| typedef void | AiStateAction (Company *c) |
| typedef EngineID | CheckReplaceProc (const Company *c, const Vehicle *v) |
| typedef void | DoReplaceProc (Company *c) |
Enumerations | |
| enum | { AIS_0 = 0, AIS_1 = 1, AIS_VEH_LOOP = 2, AIS_VEH_CHECK_REPLACE_VEHICLE = 3, AIS_VEH_DO_REPLACE_VEHICLE = 4, AIS_WANT_NEW_ROUTE = 5, AIS_BUILD_DEFAULT_RAIL_BLOCKS = 6, AIS_BUILD_RAIL = 7, AIS_BUILD_RAIL_VEH = 8, AIS_DELETE_RAIL_BLOCKS = 9, AIS_BUILD_DEFAULT_ROAD_BLOCKS = 10, AIS_BUILD_ROAD = 11, AIS_BUILD_ROAD_VEHICLES = 12, AIS_DELETE_ROAD_BLOCKS = 13, AIS_AIRPORT_STUFF = 14, AIS_BUILD_DEFAULT_AIRPORT_BLOCKS = 15, AIS_BUILD_AIRCRAFT_VEHICLES = 16, AIS_CHECK_SHIP_STUFF = 17, AIS_BUILD_DEFAULT_SHIP_BLOCKS = 18, AIS_DO_SHIP_STUFF = 19, AIS_SELL_VEHICLE = 20, AIS_REMOVE_STATION = 21, AIS_REMOVE_TRACK = 22, AIS_REMOVE_SINGLE_RAIL_TILE = 23 } |
Functions | |
| static TrackBits | GetRailTrackStatus (TileIndex tile) |
| static void | AiCase0 (Company *c) |
| static void | AiCase1 (Company *c) |
| static void | AiStateVehLoop (Company *c) |
| static EngineID | AiChooseTrainToBuild (RailType railtype, Money money, byte flag, TileIndex tile) |
| static EngineID | AiChooseRoadVehToBuild (CargoID cargo, Money money, TileIndex tile) |
| static EngineID | AiChooseAircraftToBuild (Money money, byte forbidden) |
| Choose aircraft to build. | |
| static Money | AiGetBasePrice (const Company *c) |
| static EngineID | AiChooseRoadVehToReplaceWith (const Company *c, const Vehicle *v) |
| static EngineID | AiChooseAircraftToReplaceWith (const Company *c, const Vehicle *v) |
| static EngineID | AiChooseTrainToReplaceWith (const Company *c, const Vehicle *v) |
| static EngineID | AiChooseShipToReplaceWith (const Company *c, const Vehicle *v) |
| static void | AiHandleGotoDepot (Company *c, int cmd) |
| static void | AiRestoreVehicleOrders (Vehicle *v, BackuppedOrders *bak) |
| static void | AiHandleReplaceTrain (Company *c) |
| static void | AiHandleReplaceRoadVeh (Company *c) |
| static void | AiHandleReplaceAircraft (Company *c) |
| static void | AiHandleReplaceShip (Company *c) |
| static void | AiStateCheckReplaceVehicle (Company *c) |
| static void | AiStateDoReplaceVehicle (Company *c) |
| static Town * | AiFindRandomTown () |
| static Industry * | AiFindRandomIndustry () |
| static void | AiFindSubsidyIndustryRoute (FoundRoute *fr) |
| static void | AiFindSubsidyPassengerRoute (FoundRoute *fr) |
| static void | AiFindRandomIndustryRoute (FoundRoute *fr) |
| static void | AiFindRandomPassengerRoute (FoundRoute *fr) |
| static bool | AiCheckIfRouteIsGood (Company *c, FoundRoute *fr, byte bitmask) |
| static byte | AiGetDirectionBetweenTiles (TileIndex a, TileIndex b) |
| static TileIndex | AiGetPctTileBetween (TileIndex a, TileIndex b, byte pct) |
| static void | AiWantLongIndustryRoute (Company *c) |
| static void | AiWantMediumIndustryRoute (Company *c) |
| static void | AiWantShortIndustryRoute (Company *c) |
| static void | AiWantMailRoute (Company *c) |
| static void | AiWantPassengerRoute (Company *c) |
| static void | AiWantTrainRoute (Company *c) |
| static void | AiWantLongRoadIndustryRoute (Company *c) |
| static void | AiWantMediumRoadIndustryRoute (Company *c) |
| static void | AiWantLongRoadPassengerRoute (Company *c) |
| static void | AiWantPassengerRouteInsideTown (Company *c) |
| static void | AiWantRoadRoute (Company *c) |
| static void | AiWantPassengerAircraftRoute (Company *c) |
| static void | AiWantOilRigAircraftRoute (Company *c) |
| static void | AiWantAircraftRoute (Company *c) |
| static void | AiStateWantNewRoute (Company *c) |
| static bool | AiCheckTrackResources (TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
| static CommandCost | AiDoBuildDefaultRailTrack (TileIndex tile, const AiDefaultBlockData *p, RailType railtype, byte flag) |
| static int | AiBuildDefaultRailTrack (TileIndex tile, byte p0, byte p1, byte p2, byte p3, byte dir, byte cargo, RailType railtype, CommandCost *cost) |
| static void | AiDoTerraformLand (TileIndex tile, DiagDirection dir, int unk, int mode) |
| static void | AiStateBuildDefaultRailBlocks (Company *c) |
| static TileIndex | AiGetEdgeOfDefaultRailBlock (byte rule, TileIndex tile, byte cmd, DiagDirection *dir) |
| static bool | AiEnumFollowTrack (TileIndex tile, AiRailPathFindData *a, int track, uint length) |
| static bool | AiDoFollowTrack (const Company *c) |
| static bool | AiIsTileBanned (const Company *c, TileIndex tile, byte val) |
| static void | AiBanTile (Company *c, TileIndex tile, byte val) |
| static void | AiBuildRailRecursive (AiRailFinder *arf, TileIndex tile, DiagDirection dir) |
| static bool | AiCheckRailPathBetter (AiRailFinder *arf, const byte *p) |
| static void | AiCheckBuildRailBridgeHere (AiRailFinder *arf, TileIndex tile, const byte *p) |
| static void | AiCheckBuildRailTunnelHere (AiRailFinder *arf, TileIndex tile, const byte *p) |
| static void | AiBuildRailConstruct (Company *c) |
| static bool | AiRemoveTileAndGoForward (Company *c) |
| static void | AiBuildRailDestruct (Company *c) |
| static void | AiBuildRail (Company *c) |
| static void | AiStateBuildRail (Company *c) |
| static StationID | AiGetStationIdByDef (TileIndex tile, int id) |
| static EngineID | AiFindBestWagon (CargoID cargo, RailType railtype) |
| static void | AiStateBuildRailVeh (Company *c) |
| static void | AiStateDeleteRailBlocks (Company *c) |
| static bool | AiCheckRoadResources (TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
| static CommandCost | AiDoBuildDefaultRoadBlock (TileIndex tile, const AiDefaultBlockData *p, byte flag) |
| static int | AiFindBestDefaultRoadBlock (TileIndex tile, byte direction, byte cargo, CommandCost *cost) |
| static bool | AiCheckBlockDistances (Company *c, TileIndex tile) |
| static void | AiStateBuildDefaultRoadBlocks (Company *c) |
| static void | AiBuildRoadRecursive (AiRoadFinder *arf, TileIndex tile, DiagDirection dir) |
| static bool | AiCheckRoadPathBetter (AiRoadFinder *arf, const byte *p) |
| static bool | AiEnumFollowRoad (TileIndex tile, AiRoadEnum *a, Trackdir track, uint length) |
| static bool | AiCheckRoadFinished (Company *c) |
| static bool | AiBuildRoadHelper (TileIndex tile, int flags, int type) |
| static void | AiCheckBuildRoadBridgeHere (AiRoadFinder *arf, TileIndex tile, const byte *p) |
| static void | AiCheckBuildRoadTunnelHere (AiRoadFinder *arf, TileIndex tile, const byte *p) |
| static void | AiBuildRoadConstruct (Company *c) |
| static void | AiBuildRoad (Company *c) |
| static TileIndex | AiGetRoadBlockEdge (byte rule, TileIndex tile, DiagDirection *dir) |
| static void | AiStateBuildRoad (Company *c) |
| static StationID | AiGetStationIdFromRoadBlock (TileIndex tile, int id) |
| static void | AiStateBuildRoadVehicles (Company *c) |
| static void | AiStateDeleteRoadBlocks (Company *c) |
| static void | AiStateAirportStuff (Company *c) |
| static CommandCost | AiDoBuildDefaultAirportBlock (TileIndex tile, const AiDefaultBlockData *p, byte flag) |
| static bool | AiCheckAirportResources (TileIndex tile, const AiDefaultBlockData *p, byte cargo) |
| static int | AiFindBestDefaultAirportBlock (TileIndex tile, byte cargo, byte heli, CommandCost *cost) |
| static void | AiStateBuildDefaultAirportBlocks (Company *c) |
| static StationID | AiGetStationIdFromAircraftBlock (TileIndex tile, int id) |
| static void | AiStateBuildAircraftVehicles (Company *c) |
| static void | AiStateCheckShipStuff (Company *c) |
| static void | AiStateBuildDefaultShipBlocks (Company *c) |
| static void | AiStateDoShipStuff (Company *c) |
| static void | AiStateSellVeh (Company *c) |
| static void | AiStateRemoveStation (Company *c) |
| static void | AiRemoveCompanyRailOrRoad (Company *c, TileIndex tile) |
| static void | AiStateRemoveTrack (Company *c) |
| static void | AiStateRemoveSingleRailTile (Company *c) |
| void | ShowBuyCompanyDialog (CompanyID company) |
| static void | AiHandleTakeover (Company *c) |
| static void | AiAdjustLoan (const Company *c) |
| static void | AiBuildCompanyHQ (Company *c) |
| void | AiDoGameLoop (Company *c) |
Variables | |
| static uint | _ai_service_interval |
| CompanyAI | _companies_ai [MAX_COMPANIES] |
| static CheckReplaceProc *const | _veh_check_replace_proc [] |
| static DoReplaceProc *const | _veh_do_replace_proc [] |
| static const byte | _terraform_up_flags [] |
| static const byte | _terraform_down_flags [] |
| static const byte | _ai_table_15 [4][8] |
| static bool | _want_road_truck_station |
| static AiStateAction *const | _ai_actions [] |
Definition in file default.cpp.
| static EngineID AiChooseAircraftToBuild | ( | Money | money, | |
| byte | forbidden | |||
| ) | [static] |
Choose aircraft to build.
| money | current AI money | |
| forbidden | forbidden flags - AIR_HELI = 0 (always allowed), AIR_CTOL = 1 (bit 0), AIR_FAST = 2 (bit 1) |
Definition at line 209 of file default.cpp.
References CMD_BUILD_AIRCRAFT, CmdSucceeded(), DC_QUERY_COST, DoCommand(), CommandCost::GetCost(), and HasBit().
const byte _ai_table_15[4][8] [static] |
Initial value:
{
{0, 0, 4, 3, 3, 1, 128 + 0, 64},
{1, 1, 2, 0, 4, 2, 128 + 1, 65},
{0, 2, 2, 3, 5, 1, 128 + 2, 66},
{1, 3, 5, 0, 3, 2, 128 + 3, 67}
}
Definition at line 1947 of file default.cpp.
const byte _terraform_down_flags[] [static] |
Initial value:
{
1, 2, 3, 4,
5, 6, 1, 8,
9, 10, 8, 12,
4, 2, 0, 0,
1, 2, 3, 4,
5, 6, 2, 8,
9, 10, 1, 12,
8, 4
}
Definition at line 1764 of file default.cpp.
const byte _terraform_up_flags[] [static] |
Initial value:
{
14, 13, 12, 11,
10, 9, 8, 7,
6, 5, 4, 3,
2, 1, 0, 1,
2, 1, 4, 1,
2, 1, 8, 1,
2, 1, 4, 2,
2, 1
}
Definition at line 1753 of file default.cpp.
CheckReplaceProc* const _veh_check_replace_proc[] [static] |
Initial value:
{
AiChooseTrainToReplaceWith,
AiChooseRoadVehToReplaceWith,
AiChooseShipToReplaceWith,
AiChooseAircraftToReplaceWith,
}
Definition at line 422 of file default.cpp.
DoReplaceProc* const _veh_do_replace_proc[] [static] |
Initial value:
{
AiHandleReplaceTrain,
AiHandleReplaceRoadVeh,
AiHandleReplaceShip,
AiHandleReplaceAircraft
}
Definition at line 430 of file default.cpp.
1.5.6