Commit Graph

342 Commits (6a2af1cd295fc98a3ca3817a63df02ff015b0b13)

Author SHA1 Message Date
rubidium 8d6dec5e72 (svn r16524) -Fix [FS#2963]: missing guards in the NoAI API making it possible to hit an assert in OpenTTD. 15 years ago
yexo a2c5c2651a (svn r16520) -Fix [NoAI]: Make sure AIBridge::BuildBridge returns what the documentation says it does (r16244 for AIBridge) 15 years ago
rubidium bb854f2b97 (svn r16510) -Doc: silence some (AI) doxygen warnings by adding comments about the appropriate things. 15 years ago
yexo 62a698df32 (svn r16502) -Fix [FS#2935]: when an AI was suspended while in a function called (indirectly) via call/acall/pcall OpenTTD crashed. Fix this by disallowing AIs to be suspended while called via call/acall/pcall.
IMPORTANT FOR AI WRITERS: AIs can no longer call any DoCommand functions (change anything, build vehicles, etc.) in a function called (indirectly) via call/acall/pcall. Where possible, please rewrite your code so it doesn't use call/acall/pcall
15 years ago
alberth 580e478e4e (svn r16491) -Codechange: Added parentheses around bitwise operators for code style. 15 years ago
smatz 0c53f04c07 (svn r16441) -Codechange: new class SpecializedVehicle used as superclass for all vehicle types 15 years ago
yexo c04e5a9aa3 (svn r16440) -Fix [NoAI]: AIRail::GetRailStationDirection returned incorrect information 15 years ago
yexo 68042a6dde (svn r16433) -Codechange: Remove most of CmdSetAutoreplace and replace it with calls to CmdChangeCompanySetting 15 years ago
rubidium c496a3e014 (svn r16421) -Codechange: do not unnecessarily remove constness or unnecessarily add it. 15 years ago
smatz 1eb48cdded (svn r16403) -Codechange: move code related to subsidies to separate file 15 years ago
yexo 2d8609080f (svn r16400) -Add [NoAI]: add AISignList that can be used to get a list of valid signs. This makes AISign::GetMaxSignID obsolete. 15 years ago
rubidium 6cfc38b97c (svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle 15 years ago
smatz 329407e9bc (svn r16395) -Fix (r16379): max sign ID can be higher than total number of signs 15 years ago
rubidium cd382b28a3 (svn r16394) -Codechange: move (NewGRF) cache variables into a separate struct so (some vehicle related) NewGRF cache 'desyncs' can be tested easier. 15 years ago
rubidium 4c0542c17f (svn r16393) -Codechange: move VehicleRail to Train. 15 years ago
rubidium 1324100d69 (svn r16391) -Codechange: use Train instead of Vehicle where appropriate. 15 years ago
rubidium 489253b630 (svn r16390) -Codechange: move u.road to RoadVehicle. 15 years ago
smatz d6e203ebe2 (svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead 15 years ago
smatz 6636ed7589 (svn r16354) -Codechange: use 'new' pool accessors and methods for Engine too 15 years ago
smatz 512db5248e (svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get() 15 years ago
smatz 05db91dc65 (svn r16349) -Codechange: rename IsPlainRailTile() to IsPlainRail(), introduce shiny new IsPlainRailTile() 15 years ago
rubidium f1955333c9 (svn r16332) -Codechange: replace some -1 + 1 with 'nothing' or <= .. - 1 with < .. - 1 (both caused due to wrapper functions) 15 years ago
smatz 0c10daa243 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index) 15 years ago
smatz d495dc5dbc (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index) 15 years ago
yexo d489f93473 (svn r16315) -Codechange: move the autorenew settings to a new CompanySettings struct 15 years ago
frosch 1205f02b43 (svn r16311) -Fix: (Get|Set)TrackBits() is only valid for RAIL_TILE_NORMAL and _SIGNALS. 15 years ago
frosch 41aec3d3c7 (svn r16267) -Documentation: [NoAI] Explain how to deal with IDs of various objects. 15 years ago
frosch 074569ca80 (svn r16266) -Documentation: [NoAI] Add details to AITile::(Raise|Lower)Tile wrt. modifiing multiple corners at once. 15 years ago
frosch cb66ca57c1 (svn r16264) -Change/Fix (r16262): [NoAI] Change SLOPE_INVALID to 0xFFFF so that SLOPE_INVALID != (SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK). 15 years ago
yexo 2060b0b29a (svn r16262) -Fix [NoAI]: Check slopes passed to the API better for validity 15 years ago
yexo 6ced713033 (svn r16253) -Add [NoAI]: AIController::GetVersion, this returns the newgrf-version of OpenTTD 15 years ago
yexo 0ad4f31658 (svn r16252) -Add [NoAI]: AIAirport::GetPrice, returning the building cost of an airport 15 years ago
yexo f51d764fbd (svn r16249) -Fix [NoAI]: Enable parameter checking for AIController::* functions again 15 years ago
yexo cac5b8bf79 (svn r16244) -Fix [NoAI]: Make sure AITunnel::BuildTunnel returns what the documentation says it does 15 years ago
yexo eb162ef55d (svn r16243) -Fix [FS#2875]: CmdBuildTunnel could be called with invalid parameters from the api code, causing crashes later 15 years ago
yexo d0c22e5f46 (svn r16239) -Fix (r16199): Use the stop/non-stop intermediate orderflags AIs can give for goto-depot orders 15 years ago
frosch ac1b753f9a (svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
-Fix: 'Go non-stop to nearest depot'-orders did not work wrt. the 'non-stop' part.
-Fix: Adding 'Go to nearest depot'-orders did not respect the default setting for 'non-stop'.
15 years ago
yexo 59a9d1eade (svn r16172) -Fix (r16171): typo (thanks SmatZ) 15 years ago
yexo 406e231634 (svn r16171) -Add [NoAI]: two new error codes to AITile: ERR_AREA_ALREADY_FLAT and ERR_ESCAVATION_WOULD_DAMAGE. 15 years ago
frosch 4f45dce1b5 (svn r16166) -Add [NoAI]: AITile::Get(Min|Max|Corner)Height 15 years ago
yexo e03736b304 (svn r16165) -Add [FS#2801] [NoAI]: several functions to AIOrder to check the what kind of order an order is.
-Fix: AIOrder::GetOrderDestination and AIOrder::GetOrderFlags didn't work on ORDER_CURRENT when the vehicle was loading/leaving in a station.
15 years ago
yexo 65633e1a50 (svn r16158) -Codechange: fix the string alignment in all .hpp.sq files 15 years ago
yexo 46ba81964b (svn r16151) -Codechange: move some includes around to prevent including half the AI api in non-noai related code. 15 years ago
yexo 4444e48566 (svn r16150) -Fix [NoAI]: Change WAYPOINT_INVALID to 0xFFFF from -1 as that's the value the AIs got (due to casting).
Clarify some api documentation.
15 years ago
rubidium 5c5b357043 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible. 15 years ago
rubidium e0e9a1b02e (svn r16114) -Cleanup: unify some more strings and remove some more unused strings 15 years ago
yexo cdfdd87286 (svn r16109) -Fix [NoAI]: Make sure AIOrder::GetDestination always returns a tile belonging to the station 15 years ago
yexo 66d95f6a66 (svn r16108) -Fix [NoAI]: When giving an aircraft a goto-hangar order don't let it be a normal goto-station order.
Note to AI writers: AIOrder.AppendOrder(vehicle_id, AIStation.GetLocation(station_id)) will give a goto-hangar order for helistations (assuming the station sign is at it's default location).
15 years ago
yexo cf6adbfe4f (svn r16107) -Add [NoAI]: AIOF_STOP_IN_DEPOT to the orderflags in AIOrder to allow stop-in-depot orders 15 years ago
yexo 7d9549ffd3 (svn r16106) -Fix [NoAI]: AIOrder::SetOrderFlags always removed "Service if needed" from goto-depot orders. 15 years ago
yexo a1af08f4d3 (svn r16091) -Change [FS#2778]: Reverse the order of the lines in the AI debug window 15 years ago
frosch 8501c74b94 (svn r16062) -Fix (r16037): AIOrder::InsertOrder was broken. Default all AI orders to 'stop at far end'. 15 years ago
yexo 058477ed89 (svn r15910) -Fix [FS#2777]: Clarify that TILE_INVALID is part of AIMap make doxygen output some documentation for it. 15 years ago
frosch c1fec40b1a (svn r15901) -Add: AIIndustryType::IsBuiltOnWater(), HasHeliport() and HasDock(). Just like AIIndustry. 15 years ago
yexo 9fd6956496 (svn r15881) -Fix (r15875): add an explicit cast so some compilers stop complaining. 15 years ago
yexo a0388f85a3 (svn r15875) -Add: AIBridge::GetBridgeID() so AIs can get the type of bridge that are already build. 15 years ago
frosch 779a9f4e24 (svn r15860) -Add: AIRoad::GetRoadVehicleTypeForCargo() to tell whether a certain cargo needs a bus- or a truckstop. 15 years ago
frosch 6f15901769 (svn r15859) -Documentation: Meaning of AICargo::CC_PASSENGERS wrt. bus- and truckstops, and meaning of AICargo::IsFreight() wrt. freight train weight multiplier. 15 years ago
frosch 25b70e8c0d (svn r15789) -Codechange: Add DiagdirBetweenTiles() and use it. 16 years ago
frosch c297a99eff (svn r15763) -Codechange/Fix: Add Engine::GetDisplayDefaultCapacity() and use it everywhere, so CB 36 is also used everywhere. 16 years ago
yexo cd73406b9c (svn r15743) -Codechange: move the definitions of some fake squirrel types to their own file. 16 years ago
rubidium f3e0fd7416 (svn r15711) -Codechange: lots of whitespace cleanup/fixes 16 years ago
frosch f35e00844c (svn r15705) -Fix: Do not show passenger-/mail-capacity if the aircraft carries only cargo. 16 years ago
yexo 21daa3fbc9 (svn r15684) -Add [NoAI]: AIOrder::SkipToOrder(). 16 years ago
yexo 4a6a30cc52 (svn r15658) -Fix [NoAI]: Rewrite AIAbstractList::Valuate to make it more readable and fix a crash if no parameters are given to that function. 16 years ago
yexo 0860685417 (svn r15616) -Change [API CHANGE]: Rename AIOrder::ChangeOrder() to AIOrder::SetOrderFlags(). 16 years ago
yexo 89fc2b2b08 (svn r15614) -Add [NoAI]: AIVehicleList_Group(group_id) and AIVehicleList_DefaultGroup(vehicle_type). 16 years ago
yexo 1362d2c16b (svn r15587) -Fix (r15345): I should really test even those simple api functions better. 16 years ago
yexo 11ce4538b4 (svn r15563) -Change [API CHANGE]: Remove AIIndustry::GetMaxIndustryID(). 16 years ago
yexo 301dcb6dc4 (svn r15558) -Cleanup: Remove some unnecessary friend declarations. 16 years ago
frosch abe4692da2 (svn r15541) -Revert (r15399): 'v->cargo_type' is also used in other places, which cannot accept CT_INVALID.
-Codechange: Add Engine::GetDefaultCargoType() and Engine::CanCarryCargo() and use them.
-Fix [FS#2617]: When articulated parts have no available default cargo, use the cargo type of the first part for livery selection.
-Change: To decide whether a vehicle is refittable do not test its current capacity for being zero, but always use the 'capacity property'.
  Note: The property is used unmodifed without calling CB 15/36. By setting it to a non-zero value and returning zero in the callback vehicles can be refitted to/from zero capacity for e.g. livery effects.
  Note: It is intentional that you cannot control refittability by CB 36.
16 years ago
glx 85ea21a5d0 (svn r15535) -Fix (r15460, pre noai merge): use '.' as 'any' for squirrel calls typechecking as stated in squirrel docs 16 years ago
yexo 14f6bd6ce1 (svn r15527) -Fix (r15526): A ')' too much. 16 years ago
yexo 05856bf05f (svn r15526) -Add [NoAI]: Support for conditional orders. 16 years ago
yexo 157bf66b01 (svn r15524) -Add [NoAI]: AIEngine::GetPower, AIEngine::GetWeight and AIEngine::GetMaxTractiveEffort. 16 years ago
yexo 9a507acf37 (svn r15520) -Cleanup [NoAI]: Fix some typos, unify the comment style and update some documentation since a few enums have been renamed. 16 years ago
yexo 69df9f2787 (svn r15519) -Add [NoAI]: support for waypoints by adding AIRail::Build/Remove RailWaypoint, AIWaypoint and AIWaypointList. 16 years ago
yexo a6350c0287 (svn r15494) -Change [API CHANGE]: Split AIRoad::BuildRoadStation in BuildRoadStation and BuildDriveThroughRoadStation. 16 years ago
yexo fa0cf4bbd1 (svn r15492) -Change [API CHANGE]: Split AIVehicle::MoveWagon in MoveWagon and MoveWagonChain (frosch). 16 years ago
yexo c59caa45b7 (svn r15491) -Change [API CHANGE]: AIMarine::BuildWaterDepot now accepts a front tile instead of a bool is_vertical (frosch). 16 years ago
yexo d8de2d1413 (svn r15490) -Change [API CHANGE]: Remove AIBridge::GetYearAvailable. AIBridge::IsValidBridge now only returns true for available bridges. 16 years ago
yexo e7eb6d05a0 (svn r15489) -Change [API CHANGE]: Remove AIAirport::AirportAvailable. AIAirport::IsValidAirportType now only returns true for available AirportTypes. 16 years ago
yexo 8583274f18 (svn r15488) -Change [API CHANGE]: Add support for distant-join stations. 16 years ago
yexo a79524c805 (svn r15487) -Change [API CHANGE]: Remove the never implemented function AIEventVehicleCrashed::CloneCrashedVehicle. 16 years ago
yexo 320018aac1 (svn r15486) -Change [API CHANGE]: Remove AITown::GetMaxTownID. 16 years ago
yexo f20378dcf7 (svn r15485) -Change [API CHANGE]: Split AIIndustry::HasHeliportAndDock and GetHeliportAndDockLocation in HasHeliport/HasDock and GetHeliportLocation/GetDockLocation. 16 years ago
yexo efc8a034b1 (svn r15484) -Change [API CHANGE]: Remove AICompany::GetCompanyName and SetCompanyName. They've been replaced with GetName and SetName. 16 years ago
yexo 8bb601f8ae (svn r15483) -Change [API CHANGE]: Remove AIIndustry::GetProduction, use AIIndustry::GetLastMonthProduction instead. 16 years ago
yexo d0895a65ce (svn r15482) -Fix [NoAI]: Typos in api docs. 16 years ago
yexo 8e75f5244c (svn r15481) -Fix [NoAI]: Make sure AIs can't call functions they shouldn't call. 16 years ago
frosch de9c91ecee (svn r15479) -Fix: Documentation of AIIndustryType::CanBuildIndustry(). 16 years ago
yexo 526edf35a5 (svn r15462) -Change [NoAI]: Make AIController::GetTick() and AIController::GetSetting() static functions.
-Fix (r15460): ai_controller.hpp.sq was forgotten.
16 years ago
rubidium 0111a10d7a (svn r15460) -Fix [NoAI]: don't require an instance to exist in the scope for static functions and limit exposure of the internal function GetClassName. 16 years ago
yexo ec9d949434 (svn r15441) -Cleanup: Use a return value instead of passing a pointer to where the result should be stored. 16 years ago
yexo 8ef2024b96 (svn r15440) -Fix: Backup AIObject::GetAllowDoCommand and restore the old value so AIs can't work around it. 16 years ago
peter1138 4b1728079c (svn r15436) -Codechange: Return index of station spec within station class as a return parameter of GetCustomStationSpecByGrf(), as the index is already known. Saves on an extra loop and an extern... 16 years ago
rubidium 283b3d16ab (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability. 16 years ago
Yexo 1fbb8d3ac3 (svn r15408) -Fix (r15027): AIs could call AIController::Sleep() at times they're not allowed to sleep. 16 years ago
rubidium 2a66e934b8 (svn r15406) -Fix: make Valuate actually cost a few opcodes to not make it a single opcode method of doing lots of the same thing. This should resolve most of the hiccups caused by AIs. 16 years ago
frosch f1240daed6 (svn r15400) -Fix: Typos in comments. 16 years ago
frosch d526d1f70d (svn r15360) -Fix: Flooding vehicles did not trigger an AI event. 16 years ago
frosch d5a6fcce54 (svn r15359) -Add [NoAI]: AIEventVehicleCrashed::CRASH_RV_UFO, AIEventDisasterZeppelinerCrashed and AIEventDisasterZeppelinerCleared as aliens accepted NoAIs as competing life-form. 16 years ago
frosch f6fa77d5f9 (svn r15358) -Add [NoAI]: AIEventVehicleCrashed::GetCrashReason() 16 years ago
rubidium 580f6fcbab (svn r15355) -Codechange: simplify some stuff now ->FirstShared returns non-NULL again. 16 years ago
Yexo 96f279608b (svn r15346) -Add [NoAI]: Add AIAirport::GetNearestTown() so AIs can known in which town the noise level will increase. 16 years ago
Yexo 8f51ee50c1 (svn r15345) -Add [NoAI]: Add AIVehicle::HasSharedOrders() and AIVehicleList_SharedOrders. 16 years ago
Yexo 70a38e8a60 (svn r15343) -Add [NoAI]: Add AITown::GetRoadLayout so AIs can get the road layout per town. 16 years ago
smatz 16d1904e70 (svn r15324) -Codechange: unify the class used for comparing of strings for std::map 16 years ago
frosch 61a893d6fd (svn r15308) -Codechange: Deduplicate km-ish/h -> mph conversions. 16 years ago
frosch be395d0f3d (svn r15307) -Fix: AIVehicle::GetCurrentSpeed() should also use km-ish/h instead of mph. (Documentation by Rubidium) 16 years ago
frosch 9c2ba4f96a (svn r15306) -Codechange: Deduplicate code by adding Engine::GetDisplayMaxSpeed(), GetPower() and GetDisplayWeight(). (and using them) 16 years ago
smatz 9021c20b5e (svn r15299) -Cleanup: remove many redundant includes 16 years ago
smatz 4eff39a54c (svn r15278) -Fix [FS#2332]: test noise limit of nearest town instead of st->town 16 years ago
Yexo c8a4bf862b (svn r15277) -Fix (r15027): Building bridges in AITestMode always returned false. 16 years ago
glx 53fe1afa1f (svn r15270) -Change [API CHANGE]: remove AIEventTest 16 years ago
glx 470da22ac3 (svn r15263) -Codechange: added Engine::GetCost() to remove some code duplication. 16 years ago
glx 9b73303b4d (svn r15261) -Add: added Engine::GetRunningCost() to remove some code duplication. Also stops AIs decrementing vehicle counter of first company 16 years ago
frosch 7120b2455a (svn r15255) -Fix (r15027): AIVehicle::GetLength() returned only the length of the first part of articulated road vehicles. 16 years ago
frosch 8be4bc3d1e (svn r15252) -Fix (r15027): AIMarine::AreWaterTilesConnected() reported aqueducts being connected with all surrounding tiles. Also add some type safety. 16 years ago
frosch 2eb5af3bb8 (svn r15244) -Fix (r15027): The station tile of an oilrig-like industry is not neccessarily the first industry tile. 16 years ago
frosch ac7883fe93 (svn r15241) -Fix (r15027): NoAI API was not aware of certain newindustries 'features'. 16 years ago
Yexo e3c69b7c4e (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map. 16 years ago
Yexo dcdb771c40 (svn r15187) -Fix: assert when an AI called AIRoad::GetNeighbourRoadCount on a tile at the north edge (bug found by SmatZ). 16 years ago
peter1138 b85389dca5 (svn r15149) -Codechange: GetMaskOfTownActions() is used by a Cmd handler, therefore it does not belong in _gui. 16 years ago
rubidium a0e24cc6c9 (svn r15139) -Fix [NoAI]: a wrong tile got returned for hangar tiles when the station sign isn't over st->airport_tile. 16 years ago
truebrain eb0d82ada0 (svn r15123) -Fix [NoAI]: 'const char *' implies that the return value should not be free'd, which is should .. so make them 'char *' 16 years ago
truebrain dec721ca6f (svn r15109) -Add [NoAI]: add AITile::LevelTiles (Yexo) 16 years ago
truebrain cafff6eb60 (svn r15102) -Fix (r15101): somehow makedepend fucked up (patch by Yexo) 16 years ago
truebrain bd520ca562 (svn r15101) -Change [API CHANGE]: more consistant naming for consts:
INVALID_TOWN_RATING        -> TOWN_RATING_INVALID
   INVALID_TRANSPORT          -> TRANSPORT_INVALID
   INVALID_ORDER              -> ORDER_INVALID
   INVALID_GROUP              -> GROUP_INVALID
   GROUP_ALL/DEFAULT          -> ALL/DEFAULT_GROUP
   VEHICLE_RAIL/ROAD/..       -> VT_RAIL/ROAD/..
   MY_COMPANY                 -> COMPANY_SELF
   FIRST/LAST/INVALID_COMPANY -> COMPANY_FIRST/LAST/INVALID
16 years ago
truebrain b9ebab0e5d (svn r15100) -Add [NoAI]: introduce TILE_INVALID as const 16 years ago
truebrain 1cd56af6da (svn r15099) -Fix (r15078): GetTileIndex(0, -1) is perfectly fine 16 years ago
truebrain fe7997e95f (svn r15093) -Fix [NoAI]: check if a tile is valid before using IsTileType (bug found by Zuu, patch by Yexo) 16 years ago
truebrain 61093eb211 (svn r15084) -Fix [NoAI] (r15027): by removing the threads for NoAIs, it is no longer possible to use DoCommand (even indirect) in AIAbstractList::Valuator(). 16 years ago
truebrain 9724a986c8 (svn r15078) -Fix [NoAI]: AIMap didn't filter its input (Yexo) 16 years ago
smatz ca45774160 (svn r15077) -Codechange: enumify DAYS_IN_YEAR and DAYS_IN_LEAP_YEAR
-Change: when computing daily running cost, divide by 365 (instead of 364). Since r12134, the rounding errors don't need this correction anymore
16 years ago
peter1138 4585d9785d (svn r15073) -Fix (r15067) [FS#2532]: Default copy constructors don't necessarily do what you want. Instead of creating one, we now pass a pointer around as that avoids additional allocations. 16 years ago
peter1138 afb94c252d (svn r15067) -Fix [FS#2531]: Possible compiler bug, alleviated by using SmallVector instead of using std::set. SmallVector does everything needed anyway. 16 years ago
smatz 638411c087 (svn r15062) -Fix: further forgotten svn properties and headers 16 years ago
smatz c30ce23866 (svn r15061) -Fix (r15027): three files were missing the Id header 16 years ago
truebrain 03725c057f (svn r15036) -Fix: use the same value for 'random' through-out the code for PlantTree 16 years ago
truebrain dcae208dfe (svn r15033) -Fix (r15027): silent a warning when compiling without network 16 years ago
truebrain c2406cd42d (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
NoAI is an API (a framework) to build your own AIs in. See:
   http://wiki.openttd.org/wiki/index.php/AI:Main_Page
 With many thanks to:
  - glx and Rubidium for their syncing, feedback and hard work
  - Yexo for his feedback, patches, and AIs which tested the system very deep
  - Morloth for his feedback and patches
  - TJIP for hosting a challenge which kept NoAI on track
  - All AI authors for testing our AI API, and all other people who helped in one way or another
-Remove: all old AIs and their cheats/hacks
16 years ago