1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-13 09:39:10 +00:00

Compare commits

...

83 Commits

Author SHA1 Message Date
rubidium
9cd6b5f7fb (svn r17678) -Release 0.7.3 2009-10-01 11:00:14 +00:00
rubidium
9360409b4e (svn r17677) [0.7] -Backport from trunk:
- Fix: [NewGRF] Crash when trying to build an industry that has no industry layout defined [FS#3233] (r17638, r17633)
[0.7] -Prepare for 0.7.3
2009-10-01 10:55:05 +00:00
rubidium
9443dea1f1 (svn r17630) [0.7] -Prepare: for 0.7.3-RC2 2009-09-24 19:28:49 +00:00
rubidium
36649f354a (svn r17629) [0.7] -Backport from trunk:
- Document: AIInfo's functions [FS#3216] (r17627, r17621)
- Fix: Prevent false positives when verifying company and president name lengths (r17611).
- Fix: When a command did not fail in test run and failed in exec run, error message was not set. Affects only few commands (r17607)
- Fix: [NewGRF] Crash when defining the same tile in a tile layout twice [FS#3218] (r17605)
2009-09-24 19:22:32 +00:00
rubidium
88f87bc4ac (svn r17610) [0.7] -Fix [FS#3227] (r17302): reloading an AI caused reading and later freeing of already freed memory 2009-09-22 12:31:45 +00:00
rubidium
57992d5eac (svn r17598) [0.7] -Backport from trunk:
- Fix: Vehicle image was not always updated when needed (r17594)
- Fix: [NoAI] Could not query the size of small airports when they could not be build anymore [FS#3212] (r17591)
- Fix: Erroneous message about changing the difficulty level [FS#3220] (r17588)
- Fix: Assertion triggered when the second vehicle in a 101+ (or 11+ if mammoth trains is disabled) vehicle free wagon chain is an engine and the first vehicle is moved to another chain [FS#3208] (r17576)
2009-09-21 15:41:58 +00:00
rubidium
429eb416ac (svn r17565) [0.7] -Backport from trunk:
- Fix: Memory leak when viewing the NewGRF settings of a server (r17563)
- Fix: The NewGRF settings of (remote) network games did not get properly updated when the NewGRFs were rescanned causing reading of freed data [FS#2972] (r17562)
- Fix: Close the "Add NewGRF" window when you close the "NewGRF Settings" window. The add window has a pointer to the settings which means that not deleting it would cause dereferencing an already freed pointer [FS#3206] (r17559)
- Update: Documentation about bug reporting and known bugs (r17554)
2009-09-18 07:09:11 +00:00
rubidium
803e452fab (svn r17564) [0.7] -Backport from trunk:
- Fix: Vehicles waiting for their time table did not load anymore after their initial load was completed [FS#3201] (r17551)
- Fix: Aircraft were given an unfair advantage in station rating calculations (r17550)
- Fix: [NewGRF] Sign extending of profit calculation did not work (r17546)
- Fix: [NoAI] AIs had 'infinite' time when running code from the global scope [FS#3202] (r17545)
- Fix: [NoAI] Crash when doing commands in the 'global' scope [FS#3202] (r17544)
2009-09-18 07:00:35 +00:00
rubidium
a6251ba1a5 (svn r17519) [0.7] -Update: some of the documentation 2009-09-13 08:12:14 +00:00
rubidium
edbd568094 (svn r17517) [0.7] -Backport from trunk:
- Fix: [Squirrel] In some cases the call stack would not be cleaned up properly during crash handling. Occasionally this causes asserts to be triggered or crashes [FS#3189] (r17515)
- Fix: When loading GRFConfigs from ini file, validate them wrt. duplicate GRF IDs [FS#3197] (r17510)
- Fix: When building a part fails during cloning, sell what was already cloned instead of leaving it "for free". Also make cloning multiheaded trains possible with with "max - 1" vehicles existing [FS#3196] (r17509)
- Fix: The wrong value was restored to SetAllowDoCommand possible resulting in an AI that was not allowed to do any actions (r17500)
2009-09-12 20:59:34 +00:00
rubidium
6e14331cda (svn r17516) [0.7] -Backport from trunk:
- Fix: Road vehicles could get lost when the prelimiary destination (for the pathfinder heuristics) is unreachable [FS#3188] (r17491)
- Fix: Silence compile warning that is only triggered when you are using a broken iconv (r17479)
- Fix: In some cases compilation failed because the search path for ICU was not added to the ldflags (r17476, r17474)
- Document: Compiler warning when compiled without asserts in GCC 4.4+ is not our fault but a GCC bug. Includes a reference to the appropriate GCC bug report (r17461)
2009-09-12 20:44:12 +00:00
rubidium
58ebb4c65c (svn r17456) [0.7] -Backport from trunk:
- Fix: When building roads is not allowed for town, then do not build the initial piece either [FS#3173] (r17444)
- Fix: Destruction of depots did not remove any vehicle lists related to the depot, causing windows pointing to deleted depots and (thus) crashes [FS#3180] (r17442)
- Fix: Economy recession would never end when economy is set to Steady while in recession (r17426)
- Fix: The index of orders loaded from old savegames was owerwritten with an unitialized value (r17419)
2009-09-07 14:09:45 +00:00
rubidium
a442343076 (svn r17417) [0.7] -Backport from trunk:
- Fix: Incomplete check on validity of industry type when building industries (r17413)
- Fix: [Squirrel] Guard against Squirrel stack overflows (r17403)
- Fix: [NoAI] During every save a few slots on the Squirrel stack were leaked (r17402)
- Fix: [NoAI] Several AITile::* functions did not check whether their parameters were valid (r17378)
2009-09-04 20:40:15 +00:00
rubidium
0a4299bdfd (svn r17347) [0.7] -Fix (r17346): backport r16350 too as it fixes stuff a bug introduced by r16349, which was needed for the fix of r17307. 2009-09-01 13:28:15 +00:00
rubidium
ad2fbaddc1 (svn r17346) [0.7] -Backport from trunk:
- Document: how to manually install AIs
- Fix: Memory leak when trying to bankrupt the local company, other minor improvements of bankruptcy (r17342, r17341, r17340)
- Fix: Not all non-ASCII characters were entered with escapes in the About window (r17309)
- Fix: [NoAI] AIRail::RemoveRailTrack returned ERR_PRECONDITION_ERROR for road/rail-crossings (r17307)
2009-09-01 13:16:53 +00:00
smatz
36497b584e (svn r17305) [0.7] -Backport from trunk:
-Fix: [NoAI] AITown::GetLastMonthTransported didn't work as documented at all, make it return what AITown::GetLastMonthProduction did
-Change: [NoAI] AITown::GetLastMonthProduction now returns the same value as AITown::GetMaxProduction
-Add: [NoAI] AITown::GetLastMonthTransportedPercentage and AIIndustry::GetLastMonthTransportedPercentage
2009-08-29 11:18:03 +00:00
rubidium
47ae295ee1 (svn r17302) [0.7] -Backport from trunk:
- Fix: [NoAI] Reloading an AI started a new AI in the first available company slot causing other AIs to be started [FS#3153] (r17298)
- Fix: Crash after upgrading base graphics set when opening the game options menu and you were using the upgraded set [FS#3147] (r17291)
- Fix: [Squirrel] Stack was not always cleared properly with tail recursion (r17284)
- Fix: [Squirrel] Calling a function that has default parameters with not enough parameters can cause a crash (r17273)
- Change: Mention the MD5 checksum of the original NewGRF in the "saveload failed horribly"-error message and make it more clear that the filename is of the current NewGRF [FS#3139] (r17267)
2009-08-28 17:17:08 +00:00
rubidium
ca66a61cc9 (svn r17260) [0.7] -Backport from trunk:
- Fix: Other tunnel end not shown if building rail tunnels and the first railtype is not available yet [FS#3141] (r17251)
- Fix: One could, via unselect all, also unselect already installed content; it would not uninstall it though [FS#3137] (r17245)
- Change: Make overbuilding the front tile of a road station/depot with road consistent with overbuilding the front tile of tunnels/bridges [FS#2802] (r17239)
- Change [NoAI]: Load the API before compiling an AI script so AIs can subclass API classes and use API constants as part of their own constants (r17043)
2009-08-22 15:38:42 +00:00
matthijs
e492c5928d (svn r17240) [0.7] -Backport from trunk:
- Change: Improve error output on missing or corrupt files (r17238).
2009-08-20 16:01:59 +00:00
rubidium
a0bc64394c (svn r17236) [0.7] -Backport from trunk:
- Fix: [NoAI] AIs that crashed during Save() were not killed as they should [FS#3134] (r17231)
- Fix: [NoAI] Do not assert when an AI uses AI*Mode objects incorrectly but crash the AI instead (r17230)
- Change: [NoAI] Crash an AI when it uses a DoCommand / Sleep instead of just printing an error message in the AI Debug Window [FS#2980] (r17223)
2009-08-20 13:25:21 +00:00
rubidium
91078be657 (svn r17235) [0.7] -Backport from trunk:
- Fix: [NoAI] IsRoadTypeAvailable(GetCurrentRoadType()) was not a precondition for several AIRoad::* functions (r17203)
- Fix: [NoAI] Do not say you are building a depot when you are actually building a station (API docs typo) (r17201)
- Change: [NoAI] When the API requests a string as parameter allow every squirrel type and convert to a string [FS#3101] (r17221)
2009-08-20 12:22:31 +00:00
rubidium
86725561d5 (svn r17234) [0.7] -Backport from trunk:
- Fix: Remove the (deprecated since 2006) Encoding entry from the openttd.desktop file (r17226)
- Fix: With time tables vehicles would stay in the 'loading' state after they have finished loading [FS#3129, FS#3130] (r17222)
- Fix: Do not ignore white space changes (e.g. alignment fixes) in the exporter (r17220)
- Fix: Accept monthly production values in the scenario editor [FS#2406] (r17198)
- Change: [Unix] Only use colorized error output on interactive terminals (r17227)
- Update: credits to reflect the (current) truth a bit better (r17210)
2009-08-20 12:18:46 +00:00
rubidium
2801567da7 (svn r17197) [0.7] -Backport from trunk:
- Fix: [Squirrel] FPE when an AI tried to do "% 0" (r17195)
- Fix: [NoAI] Guard the valuator against 'external' modifications of the valuated list which could cause it to go into an infinite loop [FS#3124] (r17193)
- Remove: UNICODE notice in windows installer (r17186)
- Fix: Do not return exit value of rm, but of the actual configure run (r17163)
2009-08-15 22:06:51 +00:00
rubidium
c16325b939 (svn r17160) [0.7] -Backport from trunk:
- Fix: A stuck train could free the reservation of another train if it was reversed or did crash (r17152)
- Fix: A train entering a PBS section through a block signal could cause a train crash if another reservation ending at a safe tile was already present in the section [FS#3104] (r17151)
- Fix: Update vehicle position cache when the vehicle sprite changes [FS#3060] (r17121)
- Fix: News message about ordered refits failing was not very clear [FS#3091] (r17096)
2009-08-12 15:51:35 +00:00
rubidium
53983ec1af (svn r17158) [0.7] -Backport from trunk:
- Fix: Some typos in .obg stuff (r17136)
- Fix: Mark industry tiles dirty when trigger are triggered (r17118)
- Fix: Squirrel_export.sh failed for some locales (r17109)
- Fix: Make restart command work again and make the help show how it works and how it does not work [FS#3092] (r17097)
- Fix: Make ParseStringChoice a bit safer (r17095)
- Change: Make strgen warn if the translation uses STRINGn or RAW_STRING instead of STRING (r17137, r17129)
2009-08-12 15:22:50 +00:00
rubidium
a61574a033 (svn r17081) [0.7] -Backport from trunk:
- Fix: [NewGRF] Mark house tiles dirty when triggers were triggered (r17047)
- Fix: [NewGRF] Trigger house trigger 02 only for the north tile [FS#3085] (r17046)
- Fix: Graphical glitch with graph key [FS#3083] (r17041)
- Fix: "[bd]ash"-ism in configure [FS#3076] (r17026)
- Fix: Infinite recursion in content dependency checking [FS#3075] (r17015)
- Fix: Concatenating strings in Squirrel when non-ASCII strings were received from OpenTTD failed [FS#3074] (r17013)
2009-08-06 00:04:00 +00:00
rubidium
ad2c54d119 (svn r17080) [0.7] -Backport from trunk:
- Fix: [NoAI] Documentation of AITile::LevelTiles was wrong (r17049)
- Add: [NoAI] AICompany::Get/Set PresidentGender (r17016)
- Add: [NoAI] AIEngine::GetDesignDate (r17014)
- Add: [NoAI] AIStation::GetConstructionDate (r17012)
- Add: [NoAI] AIAbstractList::SORT_ASCENDING / SORT_DESCENDING (r17005)
- Fix: [NoAI] AIBridge::GetPrice returned incorrect values (r16986)
2009-08-05 23:57:41 +00:00
rubidium
fa713d0e3b (svn r17079) [0.7] -Backport from trunk:
- Change: Add notion of Ctrl_Click in the tooltip for Loan borrow/repay buttons [FS#3066] (r16979)
- Fix: Make it so that failing to generate many random towns in scenario editor returns a failing message [FS#3059] (r16977)
- Change: [MSVC] Make all language files depend on english.txt (r16975)
- Change: There is no point in not randomising engine introduction-date before 1922. Instead disable the randomisation for the first two years after game-start, so you do not have to wait for the first engine (r16929)
- Fix: The last manually added server would not be saved [FS#3062] (r16981)
2009-08-05 23:49:30 +00:00
rubidium
645664eced (svn r17078) [0.7] -Fix [FS#3082]: crash when renaming some towns (already fixed in trunk by rewrite of the function) 2009-08-05 23:32:18 +00:00
rubidium
19cad228e8 (svn r17077) [0.7] -Fix [FS#3024]: rpm spec file failed for CentOS; apparantly their rpmbuild is pickier or so 2009-08-05 23:30:10 +00:00
rubidium
f39f14aceb (svn r17009) [0.7] -Backport from trunk/prepare for release:
- Fix: Vehicles would wait "very long" when they had nothing to unload and gradual loading was disabled [FS#3054] (r16933)
2009-07-31 22:23:19 +00:00
rubidium
a86469d6bc (svn r16904) [0.7] -Backport language updates 2009-07-21 18:28:34 +00:00
rubidium
d567f99ecf (svn r16902) [0.7] -Backport from trunk:
- Fix: When marking trains stuck do not reset the unload/stuck counter when the vehicle is unloading. It will be automatically reset once the vehicle wants to leave the station [FS#3046] (r16901)
- Fix: [NoAI]: Small errors in the API documentation [FS#3037] (r16865)
- Fix: Savegames from before 0.4 would get their waypoint 'index' messed up (r16854)
- Fix: Cargo payments were not destroyed when a vehicle was destructed. This only happened when you crashed a vehicle while it was unloading [FS#3032, FS#3046] (r16801)
2009-07-21 17:17:20 +00:00
rubidium
969d538026 (svn r16835) [0.7] -Backport from trunk:
- Fix: Call the AI Save() function only once so AIs can not crash OpenTTD [FS#3034] (r16834)
- Fix: Use the palette of the vehicle being drawn instead of the one of the front vehicle (r16819)
- Update: language files
2009-07-15 20:29:45 +00:00
rubidium
5cde77086d (svn r16830) [0.7] -Backport from trunk:
- Change: Introduce a plural 'rule' for Korean (r16811)
- Fix: Automatic resizing of SelectCompanyLiveryWindow was not working as expected [FS#3021] (r16809)
2009-07-14 20:38:45 +00:00
rubidium
6d8d781d5c (svn r16807) [0.7] -Fix (r16806): shouldn't forget to revert the 'mistakes' of the script :( 2009-07-13 10:31:41 +00:00
rubidium
08dc96571a (svn r16806) [0.7] -Backport from trunk: language updates 2009-07-13 10:27:27 +00:00
rubidium
a123484ee0 (svn r16804) [0.7] -Backport from trunk:
- Fix: Service orders did not behave like conditional orders; if a train does not need service it did not completely skip the order, but still go in the direction of the depot [FS#3031] (r16802)
- Fix: Houses would not get build on the map edge [FS#3025] (r16795)
- Fix: Audio playback rate was fixed at 11025Hz regardless of the rate specified to the audio driver, resulting in incorrect playback speed. It is still preferable to use 11025Hz output rate if possible as OpenTTD's sample rate converter is very low quality (r16784)
- Fix: Do not use the same error message for turning around road vehicles and flipping parts of trains in the depot [FS#3019] (r16772)
2009-07-13 10:16:50 +00:00
rubidium
3edbb1a543 (svn r16803) [0.7] -Backport from trunk:
- Add: [NoAI] AIVehicle::GetReliability to get the current reliability of vehicles (r16790)
- Fix: The win32 and win64 binary packages would not get their readme converted to DOS line endings (r16769)
- Fix: [NoAI] AITile::GetCargoProduction/Acceptance did not accept a radius of 0 anymore (r16767)
- Fix: In the refit window the "Select cargo type to carry" line always showed the ship refit tooltip [FS#3018] (r16757)
2009-07-13 09:57:37 +00:00
rubidium
893bccf4c8 (svn r16744) [0.7] -Backport from trunk:
- Fix: r16660 and r16669 are needed to make r16709 work as it should.
- Fix: some small 'errors' in the English language file
2009-07-04 21:06:17 +00:00
rubidium
a97240dede (svn r16742) [0.7] -Backport from trunk:
- Fix: Only pay for whatever has been actually unloaded and perform the payment when unloading has finished [FS#2995] (r16694)
2009-07-04 17:39:00 +00:00
rubidium
876d064c4d (svn r16741) [0.7] -Backport from trunk:
- Fix: When loading a savegame Engine::grffile might be left NULL in certain cases (dynamic_engines enabled, articulated vehicle with only wagon-override action3s) (r16737)
- Fix: Show Close instead of Cancel when there is nothing to canel in the content downloading window [FS#2991] (r16732)
- Fix: [NoAI] AIDepotList contained wrong tiles for hangars when st->xy != st->airport_tile (r16731)
- Fix: The Join station window did not show all stations nearby in some cases (r16728)
- Fix: Invalidate subsidies with invalid source or destination when converting older savegames (r16710)
- Fix: The list of animated tiles could have duplicates (only for old savegames) and tiles that were not animated [FS#2994] (r16709)
2009-07-04 17:20:48 +00:00
rubidium
660fe672e8 (svn r16705) [0.7] -Backport: language updates 2009-06-30 20:29:39 +00:00
rubidium
b49c6e0cbd (svn r16704) [0.7] -Backport from trunk:
- Fix: When SDL/Allegro fail to initialise, fall back on another video driver but not to the null driver (r16702, r16700, r16699)
- Fix: Limit the screen's resolution to 65535x65535 so the dirty pixels stay within bounds of a 32 bits integer [FS#3001] (r16701)
- Fix: Missing debug string for ESRB_SAFE_TILE in YAPF debugging helper [FS#3002] (r16690)
- Fix: When there is no AI version that can load data from the savegame, load the latest version of the same AI instead of a random AI (r16651, r16650, r16649)
2009-06-30 20:11:36 +00:00
rubidium
0ffca06944 (svn r16638) [0.7] -Backport from trunk:
- Fix: Loading of some town data from old savegames was broken (r16631)
- Fix: [NewGRF] Some of the var action 2 80+ variables contained wrong values from NewGRF perspective (r16615, r16613)
- Fix: Antialiased fonts broken; check pixel_mode instead of palette_mode (r16602)
- Fix: Give a more meaningful error message when console commands expect an integer but do not get one (r16600)
2009-06-23 20:48:48 +00:00
rubidium
024aa14f94 (svn r16598) [0.7] -Backport from trunk:
- Fix: Mouse would under some circumstances not be undrawn when drawing the first chat line causing two mouse pointers to be visible [FS#2969] (r16594)
- Fix: Do not crash when tars/NewGRFs are removed, just tell the file could not be opened/found [FS#2967] (r16590)
- Fix: Set default stack size to 1MB to prevent _chstk crash (MSVC) [FS#2978] (r16589, r16588)
- Fix: [Network] Always send the starting date from the game you are currently playing instead the starting date from the config file (r16573)
2009-06-18 22:16:52 +00:00
rubidium
2d454f37f0 (svn r16597) [0.7] -Backport from trunk:
- Fix: Also catch FPEs in saveload and the warning about missing NewGRFs; only happens when assertions are disabled and NewGRFs are missing (r16572)
- Fix: In some cases, train could be stuck in depot [FS#2974] (r16571)
- Fix: [NoAI] AIMarine::AreWaterTilesConnected did not return true for bridge head<>neighbouring water tile (r16563)
- Fix: Removing of duplicates of base graphics set could behave randomly (r16548)
2009-06-18 22:14:13 +00:00
rubidium
a00a4b5ad8 (svn r16539) [0.7] -Backport from trunk:
- Fix: When finding duplicate graphics sets favour the more complete one (r16538)
- Fix: [Squirrel] Crash that occured when an AI was halted while one or more generators were still in a 'running' state [FS#2942] (r16534)
- Fix: [Squirrel] Do not copy an object when we just checked that the pointer to it is NULL (r16532)
- Fix: Notify small UFOs on deletion of road vehicles, so they can head for somewhere else instead of stumbling over a ghost (r16525)
- Update: a few languages.
2009-06-08 22:53:39 +00:00
rubidium
b1d2a8876b (svn r16531) [0.7] -Backport from trunk:
- Fix: [NoAI] StationIDs from oilrigs were not considered valid by the API (r16529)
- Fix: Draw PBS reservation as groundsprite resp. childsprite of foundation/bridgehead [FS#2959] (r16528)
- Fix: Missing guards in the NoAI API making it possible to hit an assert in OpenTTD [FS#2963] (r16524)
- Fix: [NoAI] Possible assert in AI debug window when an AI was stopped an a human company took its CompanyID [FS#2962] (r16522)
- Fix: [NoAI] Make sure AIBridge::BuildBridge returns what the documentation says it does (r16520)
2009-06-07 15:26:33 +00:00
rubidium
253702529d (svn r16511) [0.7] -Backport from trunk:
- Doc: [NoAI] Silence some (AI) doxygen warnings by adding comments about the appropriate things (r16510)
- Fix: [NoAI] All Sleep/DoCommand calls failed instead of only those via a call/acall/pcall function (r16509)
2009-06-03 18:55:45 +00:00
rubidium
65c5e26913 (svn r16508) [0.7] -Backport from trunk:
- Fix: Base graphics names must be unique, so do not add duplicates (r16503)
- Fix: [NoAI] 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 [FS#2935] (r16502)
2009-06-03 13:33:58 +00:00
rubidium
9456d20800 (svn r16500) [0.7] -Backport: lots of changed strings from trunk 2009-06-01 17:48:11 +00:00
rubidium
7ccaa82206 (svn r16482) [0.7] -Backport from trunk:
- Fix: [NewGRF] Invalidate NewGRF variable caches of more vehicles in more places. Esp. they were only invalidated for trains (r16480)
- Fix: [NewGRF] Call callbacks after initialisation of vehicle variables (r16479)
- Fix: [NewGRF] Determining most common (sub-)cargo-type was broken due to someone confusing similiary named variables (r16478)
- Fix: Loading indicator when 'unload' in and 'no loading' is off was pointing to the wrong direction [FS#2936] (r16477)
- Fix: Track reservation was drawn at bridge heads in the menu (r16470)
2009-05-31 12:22:53 +00:00
rubidium
02f3d2d8af (svn r16481) [0.7] -Backport from trunk:
- Fix: [NoAI] Another try/catch related bug (r16454)
- Fix: Road vehicles ending up on the pavement when they are in a drive through station that got removed due to bankruptcy [FS#2909] (r16448)
- Fix: [NoAI] AIRail::GetRailStationDirection returned incorrect information (r16440)
- Fix: Crash when a company is deleted while a dropdown with company names is open (r16430)
- Change: [NoAI] Stop an AI when it takes too long to initialize or load [FS#2869] (r16425)
2009-05-31 12:18:03 +00:00
rubidium
7742f8c080 (svn r16423) [0.7] -Backport from trunk:
- Fix: Do not allow content download via the console when there is no zlib as it is done for the GUI already [FS#2919] (r16420)
- Fix: Some 64bit architectures require size_t to be aligned at 8-byte boundary, ensure it for MemBlock (r16415)
- Add: [NoAI] AISignList that can be used to get a list of valid signs (r16400)
- Fix: [NewGRF] Disable multitile houses with non-zero population on additional tiles as they cause desyncs and because the specs do not allow that either (r16383)
- Fix: [NewGRF] Valid UTF-8 sequences between 0x20 and 0xFF should be allowed as is instead of being treated as control codes (r16374)
- Fix: [NewGRF] Use a valid StringID as fall-back when undefined generic NewGRF strings of vehicles are requested (r16366)
2009-05-25 17:15:15 +00:00
rubidium
ba01583ce3 (svn r16364) [0.7] -Backport from trunk:
- Fix: The previously selected NewGRF station type was still remembered after switching to a different game without newstations enabled, preventing stations from being built (r16363)
- Fix: Pointer incremented with wrong count (r16361)
- Fix: Delete invalid depots in TTD savegames caused by improper SVXConverter conversions (r16357)
2009-05-21 11:47:45 +00:00
rubidium
498e5989d1 (svn r16355) [0.7] -Backport from trunk:
- Fix: Invalid read when OTTD savegame contains VEH_INVALID (r16353)
- Fix: Signal handler could end in endless loop (r16351)
- Fix: [NewGRF] When overriding 'original sounds', only allow overriding of the 'original sounds' and not any other that is already loaded (r16339)
- Fix: Desyncs when removing lots of stations/towns (r16329, r16328)
[0.7] -Cleanup: unify style of changelog
2009-05-18 20:17:28 +00:00
rubidium
ab7b117c50 (svn r16324) [0.7] -Backport from trunk:
- Fix: Desyncs due to the fact that depot searching with a maximum search depth simply does not work with YAPF's caches [FS#2900] (r16323)
- Fix: Trains could get stuck in a depot when they wanted to go to the same depot again [FS#2873] (r16322)
- Fix: In the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios (r16321)
- Fix: Loading of savegames created in revision between 0.3.5 and 0.3.6 caused crash (r16320)
- Fix: [NoAI] Set the autorenew settings for new AI companies to the default values, not to 0 or the local settings (r16316)
- Fix: [NewGRF] Allow accessing the house age when the house is not yet built (r16314)
- Fix: (Get|Set)TrackBits() is only valid for RAIL_TILE_NORMAL and _SIGNALS (r16311)
2009-05-16 20:29:53 +00:00
rubidium
085b498c28 (svn r16310) [0.7] -Backport from trunk:
- Fix: Parameter is invalid when it is equal to length of an array (r16308)
- Fix: Close all windows before unloading the AI system as closing the content-download window will rescan for AIs [FS#2901] (r16306)
- Fix: ICC (Intel C++ Compiler) defined __GNUC__ but does not define __builtin_bswap32, so fall back to the default swap method for ICC (r16295)
- Fix: Road vehicles were unable to find a depot when turning around (in some cases), causing 'nearest depot' orders to be occasionally lost [FS#2893] (r16291
2009-05-15 10:24:13 +00:00
rubidium
30eff93341 (svn r16309) [0.7] -Backport from trunk:
- Fix: Unable to (re)set the desert state for watery tiles [FS#2888] (r16290)
- Fix: Possible (in theory) desync related to autorenew settings (r16287)
- Fix: Crash after using the 'Reset landscape' function and remove all waypoint signs and buoys after resetting landscape (r16280)
- Fix: [NewGRF] Disable multitile houses for which the newgrf does not define proper additional tiles (r16274)
2009-05-15 10:17:00 +00:00
rubidium
139a213d4d (svn r16278) [0.7] -Backport from trunk:
- Fix: The language is called Slovak, not Slovakish (r16090)
2009-05-11 15:35:26 +00:00
rubidium
06c45d6fe5 (svn r16275) [0.7] -Backport a lot of language updates from trunk. 2009-05-10 22:35:36 +00:00
rubidium
8446d6b8c2 (svn r16273) [0.7] -Backport from trunk:
- Fix: Wrong number of parameters or wrong parameter types sent to printf-like functions at several places (r16269)
- Fix: [NewGRF] When callback 2E returns an amount of 0, do not transport 1 unit to the station (r16268)
- Fix: [NoAI] Various documentation omissions with respect to IDs of various objects and corners for AITile::(Raise|Lower)Tile (r16267,r16266)
2009-05-10 21:33:55 +00:00
rubidium
9676072298 (svn r16272) [0.7] -Backport from trunk:
- Fix: [NoAI] Check slopes passed to the API better for validity (r16264, r16262)
- Fix: [NewGRF] Interpret setting bridge property 08 to 0 as always available (r16263)
- Add: [NoAI] AIController::GetVersion, this returns the version of OpenTTD in the same way as for NewGRFs (r16253)
- Add: [NoAI] AIAirport::GetPrice, returning the building cost of an airport (r16252)
- Fix: [NoAI] Enable parameter checking for AIController::* functions again (r16249)
2009-05-10 21:26:46 +00:00
rubidium
2db7e3a0a8 (svn r16248) [0.7] -Backport from trunk:
- Fix: Improve corner case order handling: mark order as done only when actually done, obey non-stop orders, do only stop/refit at the depot in the order (r16240,r16228,r16199,r16198,r16187)
- Fix: Use the stop/non-stop intermediate orderflags AIs can give for goto-depot orders (r16239)
2009-05-06 23:21:43 +00:00
rubidium
1e9fd18e6a (svn r16247) [0.7] -Backport from trunk:
- Fix: [NoAI] Make sure AITunnel::BuildTunnel returns what the documentation says it does (r16244)
- Fix: [NoAI] CmdBuildTunnel could be called with invalid parameters from the API code, causing crashes later [FS#2875] (r16243)
- Fix: [NewGRF] ActionB should use the online parameters from GRFFile instead of the initial user-specified values from GRFConfig. Also use the values as they were set when the ActionB was executed, not as they are set when the message is shown (r16223)
- Fix: Possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation [FS#2862] (r16220)
- Fix: Shared orders without orders were not properly converted causing corrupt/invalid orders when loading pre 0.7 savegames [FS#2878] (r16214)
2009-05-06 22:37:19 +00:00
rubidium
909af50aaa (svn r16246) [0.7] -Backport from trunk:
- Fix: [Squirrel] the traps variable wasn't restored, causing try/catch blocks to be 'forgotten' during a suspend (r16181)
- Add: [NoAI] Two new error codes to AITile: ERR_AREA_ALREADY_FLAT and ERR_EXCAVATION_WOULD_DAMAGE (r16171)
- Add: [NoAI] AITile::Get(Min|Max|Corner)Height (r16166)
- Add: [NoAI] Several functions to AIOrder to check the what kind of order an order is [FS#2801] (r16165)
- Fix: [NoAI] AIOrder::GetOrderDestination and AIOrder::GetOrderFlags didn't work on ORDER_CURRENT when the vehicle was loading/leaving in a station (r16165)
- Fix: [NoAI] Change WAYPOINT_INVALID to 0xFFFF from -1 as that is the value the AIs got (due to casting) (r16150)
2009-05-06 22:31:52 +00:00
rubidium
07a16f9282 (svn r16245) [0.7] -Backport from trunk:
- Fix: Hardcoded (old sized) MAX_COMPANIES constant (r16182)
- Fix: Do not try to reserve path for trains crashed in station [FS#2866] (r16178)
- Fix: Forbid joining AI companies via the 'move' and 'join' console commands/multiplayer lobby (r16176, r16175)
- Fix: The overflowsafe type did not like dividing by int64 larger than MAX_INT32 causing division by negative numbers and small anomolies when drawing graphs [FS#2855] (r16130)
2009-05-06 22:21:32 +00:00
rubidium
28e7981a5b (svn r16121) [0.7] -Backport from trunk:
- Add: [NoAI] UseAsRandomAI as function in info.nut. When an AI returns false, it will never be chosen as random AI (r16113)
- Fix: [NoAI] Make sure AIOrder::GetDestination always returns a tile belonging to the station (16109)
- Fix: [NoAI] When giving an aircraft a goto-hangar order do not let it be a normal goto-station order (r16108)
- Add: [NoAI] AIOF_STOP_IN_DEPOT to the orderflags in AIOrder to allow stop-in-depot orders (r16107)
- Fix: [NoAI] AIOrder::SetOrderFlags always removed "Service if needed" from goto-depot orders (r16106)
- Add: [NoAI] GetURL() as possible function to info.nut. If AIs implement it, that url is shown when the AI crashes and also in the AI selection window [FS#2808] (r16093)
- Change: [NoAI] Reverse the order of the lines in the AI debug window [FS#2778] (r16091)
- Fix: [NoAI] AIDebug window profiled the blitters by invalidating itself unconditionally on repaint. OTOH it was not invalidated in other cases when needed (r16094)
- Fix: [NoAI] MOF_COND_DESTINATION was not accepted by CmdModifyOrder() (r16063)
2009-04-22 09:00:19 +00:00
rubidium
f7cc97fe5c (svn r16120) [0.7] -Backport from trunk:
- Fix: Road was removed when both the Remove button was active and Ctrl was pressed [FS#2582] (r16119)
- Fix: Connect tried to validate too much of the company ID with too little information on hand [FS#2849] (r16096)
- Fix: Insanely fast trains would not stop in time for stations/'jump' over waypoints/via stations within a tick, which would cause the order not to be processed causing the train to go in loops until (with luck) it 'hit' the tile [FS#2824] (r16079)
- Fix: Content download progress bar 'resetting' due to mathematical overflow [FS#2845] (r16071)
- Fix: Memory leak when querying a server multiple times (r16064)
2009-04-22 08:48:08 +00:00
rubidium
d9ed2d380f (svn r16061) [0.7] -Backport from trunk:
- Fix: Non advanced vehicle list did not handle company switching correctly (r16054)
- Fix: Do not warn that crashed vehicles are getting old; upgrading them is impossible [FS#2740] (r16048)
- Fix: The currency abbreviation for the Romanian Leu is now RON [FS#774] (r16041)
- Fix: Dash was not able to run iconv detection (r16035)
- Fix: [NewGRF] Do not give "... Mines" as name to the station of oil rigs, or more general: do not add "... Mines" when the all of the cargoes are part of the liquid, passenger or mail classes [FS#2785] (r16029)
2009-04-14 21:20:03 +00:00
rubidium
60901368cc (svn r16060) [0.7] -Backport from trunk:
- Fix: Storing/loading some currencies failed due to inconsistent settings "tables" [FS#2826] (r16028)
- Fix: Usage of uninitialised memory when trying to build a random new industry, but there are no industrytypes to choose from (i.e. all appearance probabilities are zero) (r16027)
- Fix: "Build separate station" in the station picker would reuse deleted stations [FS#2818] (r16025)
- Fix: 32 bpp sprites in tars would also be shown in the list of heightmaps [FS#2817] (r16023)
- Fix: Sometimes the unregister "query" thread could be delayed so much that the network stuff was already closed and the packet would never reach the master server causing the server to appear online longer than necessary (r16022)
- Fix: Chance16() did not work for b = 1. Also transform the formula to not use divisions (r16006)
2009-04-14 21:13:07 +00:00
rubidium
9f5e690118 (svn r16059) [0.7] -Backport from trunk:
- Fix: Inconsistency between using NETWORK_NAME_LENGTH and NETWORK_CLIENT_NAME_LENGTH for the length of client names (r15988)
- Fix: [NewGRF] Abort production callback after 0x10000 iterations and show a messagebox blaming the NewGRF [FS#2787] (r15958)
- Fix: [NewGRF] Set callback_param1 (var 10) to 1 only when requested (r15957)
- Fix: Tooltip of detailed ratings window button showed wrong tip (r15943)
- Change: Harden string copying on places where it is possible (r16024)
- Change: Use recent Czech language for plural form (r15965)
2009-04-14 21:07:33 +00:00
rubidium
2fbd7ff6cc (svn r15912) [0.7] -Backport from trunk:
- Update: lots and lots of translations
- Fix: Chat completion got called twice causing tab completion to seemingly fail (r15905)
2009-04-01 14:24:54 +00:00
rubidium
1595413545 (svn r15904) [0.7] -Backport from trunk:
- Feature: Watermark crash.sav and do not generate crash information if a loaded crash.sav causes a crash so the real crash report does not get overwritten (r15893)
- Feature: Add autoclean_novehicles setting which will, when autoclean_companies is true, remove any company with no vehicles and no active client after autoclean_novehicles-months (r15848)
- Add: [NoAI] AIIndustryType::IsBuiltOnWater(), HasHeliport() and HasDock(). Just like AIIndustry (r15901)
- Add: [NoAI] AIBridge::GetBridgeID() so AIs can get the type of bridge that are already build (r15875)
- Add: [NoAI] AIRoad::GetRoadVehicleTypeForCargo() to tell whether a certain cargo needs a bus- or a truckstop (r15860)
2009-03-30 23:22:13 +00:00
rubidium
76b2e1c5ab (svn r15903) [0.7] -Backport from trunk:
- Fix: YAPF did not apply the platform length (too long/too short) penalties (r15900)
- Fix: Fixing the slopes was done a bit more often than intended making map generation with the original generator horribly slow (r15895)
- Fix: YAPF used different penalties for aqueducts than for other water tiles (r15891)
- Fix: Round the production rate up, so e.g. oilrigs always produce some passengers on lowest production level [FS#2772] (r15888)
- Fix: Libtimidity cannot handle frees of NULL (in contrast of most other frees) [FS#2770] (r15886)
- Fix: Make sure house class/ID counters do not overflow (r15831)
2009-03-30 23:15:05 +00:00
rubidium
7e1385b6eb (svn r15828) [0.7] -Prepare: for 0.7.0-RC2. 2009-03-23 00:19:22 +00:00
rubidium
4ec28e1ba7 (svn r15826) [0.7] -Backport from trunk:
- Update: language files
- Fix: Some (newer) GCCs have trouble compiling the Win32 specific part of fontcache.cpp; jumps across variable declarations [FS#2752] (r15818)
- Fix: When sorting on cost do not sort on the running cost [FS#2749] (r15778)
2009-03-23 00:12:52 +00:00
rubidium
30afba1d10 (svn r15775) [0.7] -Backport from trunk:
- Fix: Do not show the message about reporting an AI crash for the dummy AI (r15774)
- Fix: Number of active clients was not always properly updated [FS#2475] (r15773)
- Fix: Settings from the [gameopt] section (from old 0.6 config files) were overwritten with default values (r15771)
- Fix: Infinite loop when skipping sprites when a GRF is invalid (or truncated) (r15767)
- Fix: Crash when opening the content list window twice; inconsistencies when clicking download twice [FS#2744] (r15766)
2009-03-19 23:50:54 +00:00
rubidium
61e97110c9 (svn r15765) [0.7] -Backport from trunk:
- Change: [NewGRF] Expose GRF ID of engines in var action property 0x25 (r15739)
- Fix: Add Engine::GetDisplayDefaultCapacity() and use it everywhere, so CB 36 is also used everywhere (r15763)
- Fix: [Windows] Inlined UTF-8 characters (in the source code) are not handled properly on Eastern versions of Windows so escape them (r15762)
- Fix: [Windows] On some system searching a font using its English name fails. So now we search the font using the localised name and use the English name for the final 'validation' only (r15757)
2009-03-18 19:50:34 +00:00
rubidium
9e592b9986 (svn r15764) [0.7] -Backport from trunk:
- Fix: Number of houses in house variables 0x44, 0x60 and 0x61 were incorrect after 0xFF had been reached and could desync clients joining afterwards (r15755)
- Fix: Crash when clicking the small area between the savegame list and the save button in the save game window [FS#2742] (r15753)
- Fix: Do not try to (un)draw the cursor when the screen is not ready (r15752)
- Fix: The big UFO sometimes landed just outside the map. Instead of landing, just disappear (fly away) in those cases (r15750)
- Fix: Crash because submarines would sometimes start far outside of the map [FS#2739] (r15748)
- Fix: Road ownership getting lost when removing a road stop [FS#2736] (r15747)
- Fix: Update threading code for OS/2, add mutex support, fix compilation (r15746, r15745)
- Fix: When town generator failed to create requested number of towns, there were too many cities (r15744)
2009-03-18 19:47:05 +00:00
rubidium
de7a4a4006 (svn r15737) [0.7] -Prepare: for 0.7.0-RC1. 2009-03-15 22:42:48 +00:00
rubidium
53dc1a89da (svn r15734) [0.7] -Branch: the long awaited branch so we can introduce new features in trunk before 0.7.0, but not let them destabalize the pending release :) 2009-03-15 22:14:10 +00:00
351 changed files with 18350 additions and 11429 deletions

View File

@@ -1,7 +1,7 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = openttd
PROJECT_NAME = OpenTTD
OUTPUT_DIRECTORY = docs/source/
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English

View File

@@ -93,7 +93,7 @@ ifeq ($(shell if test -f config.cache; then echo 1; fi), 1)
@echo " Going to reconfigure with last known settings..."
@echo "----------------"
# Make sure we don't lock config.cache
@$(shell cat config.cache | sed 's~\\ ~\\\\ ~g') || exit 1
@$(shell cat config.cache | sed 's@\\ @\\\\ @g') || exit 1
@echo "----------------"
@echo "Reconfig done. Please re-execute make."
@echo "----------------"

View File

@@ -19,8 +19,8 @@ BIN_DIR = "$(ROOT_DIR)/bin"
SRC_DIR = "$(ROOT_DIR)/src"
BUNDLE_DIR = "$(ROOT_DIR)/bundle"
BUNDLES_DIR = "$(ROOT_DIR)/bundles"
TTD = "openttd.exe"
TARGET := $(shell echo $(PLATFORM) | sed "s~win64~x64~;s~win32~Win32~")
TTD = openttd.exe
TARGET := $(shell echo $(PLATFORM) | sed "s@win64@x64@;s@win32@Win32@")
all:
$(Q)cp objs/$(TARGET)/Release/$(TTD) $(BIN_DIR)/$(TTD)

View File

@@ -4,7 +4,6 @@ CC_BUILD = !!CC_BUILD!!
CXX_BUILD = !!CXX_BUILD!!
WINDRES = !!WINDRES!!
STRIP = !!STRIP!!
CC_CFLAGS = !!CC_CFLAGS!!
CFLAGS = !!CFLAGS!!
CFLAGS_BUILD = !!CFLAGS_BUILD!!
LIBS = !!LIBS!!
@@ -28,7 +27,6 @@ CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!!
SORT = !!SORT!!
REVISION = !!REVISION!!
AWK = !!AWK!!
GCC295 = !!GCC295!!
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
@@ -53,20 +51,6 @@ CFLAGS_MAKEDEP += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SCRIPT_SRC_DIR)
ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
# This 'sed' basicly just removes 'const' from the line if it is a 2+D array
# For more information, please check:
# http://maillist.openttd.org/pipermail/devs/2007-April/000284.html
# http://maillist.openttd.org/pipermail/devs/2007-February/000248.html
GCC295_FIX=sed -r 's~^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$~\1\2 \4\6\8\9~g'
# This 'sed' removes the 3rd '4' in the # lines of the -E output of
# gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the
# compiler can't handle that information (just don't ask). So we remove it
# and then it compiles happily and without bitching :)
# Furthermore gcc 2.95 has some trouble with protected and private when
# accessing the protected/private stuff of the enclosing class (or the
# super class of the enclosing class).
GCC295_FIX_2=sed -e 's~\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$~\1~g;s~private:~public:~g;s~protected:~public:~g'
# Check if we want to show what we are doing
ifdef VERBOSE
Q =
@@ -98,7 +82,7 @@ MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3 -d' ')
ifdef REVISION
# Use specified revision (which should be of the form "r000").
REV := $(REVISION)
REV_NR := $(shell echo $(REVISION) | sed "s~[^0-9]~~g")
REV_NR := $(shell echo $(REVISION) | sed "s@[^0-9]@@g")
else
# Use autodetected revisions
REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
@@ -114,7 +98,7 @@ REV_NR := 0
endif
# This helps to recompile if flags change
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CC_CFLAGS) $(CFLAGS)" ]; then echo "$(CC_CFLAGS) $(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CFLAGS)" ]; then echo "$(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi )
RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORCE)" ]; then echo "$(ENDIAN_FORCE)" > $(CONFIG_CACHE_ENDIAN); fi )
@@ -143,15 +127,15 @@ endif
$(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@
$(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_RC:%.o=%.d): %.d: $(SRC_DIR)/%.rc $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
@@ -182,7 +166,7 @@ endif
# Convert x:/... paths to /x/... for mingw
ifeq ($(OS), MINGW)
@cat Makefile.dep.tmp | sed 's~\([a-zA-Z]\):\/~\/\1\/~g' > Makefile.dep.tmp.mingw
@cat Makefile.dep.tmp | sed 's@/\([a-zA-Z]\):\/@\/\1\/@g' > Makefile.dep.tmp.mingw
@cp Makefile.dep.tmp.mingw Makefile.dep.tmp
@rm -f Makefile.dep.tmp.mingw
endif
@@ -192,7 +176,7 @@ endif
@$(AWK) ' \
/^# DO NOT/ { print $$0 ; next} \
/^#/ {next} \
/:/ { \
/: / { \
left = NF - 1; \
for (n = 2; n <= NF; n++) { \
if (match($$n, "^$(ROOT_DIR)") == 0) { \
@@ -211,7 +195,7 @@ endif
{ \
print $$0 \
} \
' < Makefile.dep.tmp | sed 's~ *~ ~g;s~ $$~~' | $(SORT) > Makefile.dep
' < Makefile.dep.tmp | sed 's@ *@ @g;s@ $$@@' | $(SORT) > Makefile.dep
$(Q)rm -f Makefile.dep.tmp Makefile.dep.tmp.bak
@@ -226,17 +210,9 @@ endif
# Compile all the files according to the targets
$(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $<
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
ifeq ($(GCC295), 1)
$(Q)$(CXX_HOST) -E $(CFLAGS) $< | $(GCC295_FIX) | $(GCC295_FIX_2) | $(CXX_HOST) $(CFLAGS) -c -o $@ -x c++ -
else
$(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $<
endif
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
@@ -280,10 +256,10 @@ $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
# Revision files
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s~@@REVISION@@~$(REV_NR)~g;s~@@VERSION@@~$(REV)~g;s~@@MODIFIED@@~$(MODIFIED)~g;s~@@DATE@@~`date +%d.%m.%y`~g" > $(SRC_DIR)/rev.cpp
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/rev.cpp
$(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s~@@REVISION@@~$(REV_NR)~g;s~@@VERSION@@~$(REV)~g;s~@@DATE@@~`date +%d.%m.%y`~g" > $(SRC_DIR)/ottdres.rc
$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/ottdres.rc
FORCE:

View File

@@ -58,7 +58,7 @@ function Regression::TestInit()
}
list = AIList();
list.Sort(AIAbstractList.SORT_BY_VALUE, true);
list.Sort(AIAbstractList.SORT_BY_VALUE, AIAbstractList.SORT_ASCENDING);
print("");
print(" Value Ascending");
list.AddItem( 5, 10);
@@ -93,7 +93,7 @@ function Regression::TestInit()
}
list = AIList();
list.Sort(AIAbstractList.SORT_BY_ITEM, false);
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_DESCENDING);
print("");
print(" Item Descending");
list.AddItem( 5, 10);
@@ -128,7 +128,7 @@ function Regression::TestInit()
}
list = AIList();
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
print("");
print(" Item Ascending");
list.AddItem( 5, 10);
@@ -213,13 +213,15 @@ function Regression::Airport()
print(" GetAirportType(): " + AIAirport.GetAirportType(32116));
for (local i = -1; i < 10; i++) {
print(" IsValidAirportType(" + i + "): " + AIAirport.IsValidAirportType(i));
print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
print(" IsAirportInformationAvailable(" + i + "): " + AIAirport.IsAirportInformationAvailable(i));
print(" IsValidAirportType(" + i + "): " + AIAirport.IsValidAirportType(i));
print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
}
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" GetPrice(): " + AIAirport.GetPrice(0));
print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, AIStation.STATION_JOIN_ADJACENT));
print(" IsHangarTile(): " + AIAirport.IsHangarTile(32116));
print(" IsAirportTile(): " + AIAirport.IsAirportTile(32116));
@@ -256,12 +258,15 @@ function Regression::Bridge()
print(" Valid Bridges: " + j);
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33155));
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33155));
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
@@ -329,6 +334,7 @@ function Regression::Cargo()
print(" GetCargoIncome(10, 10): " + AICargo.GetCargoIncome(i, 10, 10));
print(" GetCargoIncome(100, 10): " + AICargo.GetCargoIncome(i, 100, 10));
print(" GetCargoIncome(10, 100): " + AICargo.GetCargoIncome(i, 10, 100));
print(" GetRoadVehicleTypeForCargo(): " + AIRoad.GetRoadVehicleTypeForCargo(i));
}
}
@@ -540,7 +546,7 @@ function Regression::Industry()
print("--Industry--");
print(" GetIndustryCount(): " + AIIndustry.GetIndustryCount());
local list = AIIndustryList();
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
if (AIIndustry.IsValidIndustry(i)) j++;
print(" Industry " + i);
@@ -631,6 +637,9 @@ function Regression::IndustryTypeList()
print(" GetName(): " + AIIndustryType.GetName(i));
print(" CanBuildIndustry(): " + AIIndustryType.CanBuildIndustry(i));
print(" CanProspectIndustry(): " + AIIndustryType.CanProspectIndustry(i));
print(" IsBuiltOnWater(): " + AIIndustryType.IsBuiltOnWater(i));
print(" HasHeliport(): " + AIIndustryType.HasHeliport(i));
print(" HasDock(): " + AIIndustryType.HasDock(i));
}
}
@@ -659,7 +668,7 @@ function Regression::List()
print(" HasItem(1050): " + list.HasItem(1050));
print(" HasItem(1051): " + list.HasItem(1051));
print(" IsEmpty(): " + list.IsEmpty());
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
print(" List Dump:");
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
@@ -1069,9 +1078,10 @@ function Regression::Sign()
print(" BuildSign(33409, 'Some other Sign'): " + sign_id);
print(" RemoveSign(" + sign_id + "): " + AISign.RemoveSign(sign_id));
print("");
print(" GetMaxSignID(): " + AISign.GetMaxSignID());
for (local i = -1; i < AISign.GetMaxSignID() + 1; i++) {
if (AISign.IsValidSign(i)) j++;
local list = AISignList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
j++;
print(" Sign " + i);
print(" IsValidSign(): " + AISign.IsValidSign(i));
print(" GetName(): " + AISign.GetName(i));
@@ -1182,7 +1192,7 @@ function Regression::TileList()
print("");
print("--TileList--");
print(" Count(): " + list.Count());
list.AddRectangle(41895 - 256 * 2, 256 * 2 + 41895 + 8);
list.AddRectangle(34436, 256 * 2 + 34436 + 8);
print(" Count(): " + list.Count());
list.Valuate(AITile.GetHeight);
@@ -1193,6 +1203,30 @@ function Regression::TileList()
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetCornerHeight, AITile.CORNER_N);
print(" CornerHeight(North): done");
print(" Count(): " + list.Count());
print(" ListDump:");
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetMinHeight);
print(" MinHeight(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetMaxHeight);
print(" MaxHeight(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetSlope);
list.KeepValue(0);
print(" Slope(): done");
@@ -1203,6 +1237,8 @@ function Regression::TileList()
print(" " + i + " => " + list.GetValue(i));
}
list.Clear();
list.AddRectangle(41895 - 256 * 2, 256 * 2 + 41895 + 8);
list.Valuate(AITile.IsBuildable);
list.KeepValue(1);
print(" Buildable(): done");
@@ -1312,7 +1348,7 @@ function Regression::Town()
print("--Town--");
print(" GetTownCount(): " + AITown.GetTownCount());
local list = AITownList();
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
if (AITown.IsValidTown(i)) j++;
print(" Town " + i);

View File

@@ -575,51 +575,63 @@
IsAirportTile(): false
GetHangarOfAirport(): -1
GetAirportType(): 255
IsValidAirportType(-1): false
GetAirportWidth(-1): -1
GetAirportHeight(-1): -1
GetAirportCoverageRadius(-1): -1
IsValidAirportType(0): true
GetAirportWidth(0): 4
GetAirportHeight(0): 3
GetAirportCoverageRadius(0): 4
IsValidAirportType(1): false
GetAirportWidth(1): -1
GetAirportHeight(1): -1
GetAirportCoverageRadius(1): -1
IsValidAirportType(2): false
GetAirportWidth(2): -1
GetAirportHeight(2): -1
GetAirportCoverageRadius(2): -1
IsValidAirportType(3): false
GetAirportWidth(3): -1
GetAirportHeight(3): -1
GetAirportCoverageRadius(3): -1
IsValidAirportType(4): false
GetAirportWidth(4): -1
GetAirportHeight(4): -1
GetAirportCoverageRadius(4): -1
IsValidAirportType(5): false
GetAirportWidth(5): -1
GetAirportHeight(5): -1
GetAirportCoverageRadius(5): -1
IsValidAirportType(6): false
GetAirportWidth(6): -1
GetAirportHeight(6): -1
GetAirportCoverageRadius(6): -1
IsValidAirportType(7): false
GetAirportWidth(7): -1
GetAirportHeight(7): -1
GetAirportCoverageRadius(7): -1
IsValidAirportType(8): false
GetAirportWidth(8): -1
GetAirportHeight(8): -1
GetAirportCoverageRadius(8): -1
IsValidAirportType(9): false
GetAirportWidth(9): -1
GetAirportHeight(9): -1
GetAirportCoverageRadius(9): -1
IsAirportInformationAvailable(-1): false
IsValidAirportType(-1): false
GetAirportWidth(-1): -1
GetAirportHeight(-1): -1
GetAirportCoverageRadius(-1): -1
IsAirportInformationAvailable(0): true
IsValidAirportType(0): true
GetAirportWidth(0): 4
GetAirportHeight(0): 3
GetAirportCoverageRadius(0): 4
IsAirportInformationAvailable(1): true
IsValidAirportType(1): false
GetAirportWidth(1): 6
GetAirportHeight(1): 6
GetAirportCoverageRadius(1): 5
IsAirportInformationAvailable(2): true
IsValidAirportType(2): false
GetAirportWidth(2): 1
GetAirportHeight(2): 1
GetAirportCoverageRadius(2): 4
IsAirportInformationAvailable(3): true
IsValidAirportType(3): false
GetAirportWidth(3): 6
GetAirportHeight(3): 6
GetAirportCoverageRadius(3): 6
IsAirportInformationAvailable(4): true
IsValidAirportType(4): false
GetAirportWidth(4): 7
GetAirportHeight(4): 7
GetAirportCoverageRadius(4): 8
IsAirportInformationAvailable(5): true
IsValidAirportType(5): false
GetAirportWidth(5): 5
GetAirportHeight(5): 4
GetAirportCoverageRadius(5): 4
IsAirportInformationAvailable(6): true
IsValidAirportType(6): false
GetAirportWidth(6): 2
GetAirportHeight(6): 2
GetAirportCoverageRadius(6): 4
IsAirportInformationAvailable(7): true
IsValidAirportType(7): false
GetAirportWidth(7): 9
GetAirportHeight(7): 11
GetAirportCoverageRadius(7): 10
IsAirportInformationAvailable(8): true
IsValidAirportType(8): false
GetAirportWidth(8): 4
GetAirportHeight(8): 2
GetAirportCoverageRadius(8): 4
IsAirportInformationAvailable(9): false
IsValidAirportType(9): false
GetAirportWidth(9): -1
GetAirportHeight(9): -1
GetAirportCoverageRadius(9): -1
GetBankBalance(): 100000
GetPrice(): 84
BuildAirport(): true
IsHangarTile(): false
IsAirportTile(): true
@@ -647,70 +659,70 @@
IsValidBridge(): true
GetName(): Wooden rail bridge
GetMaxSpeed(): 32
GetPrice(): 10
GetPrice(): 15
GetMaxLength(): 102
GetMinLength(): 2
Bridge 1
IsValidBridge(): true
GetName(): Concrete rail bridge
GetMaxSpeed(): 48
GetPrice(): 15
GetPrice(): 21
GetMaxLength(): 4
GetMinLength(): 2
Bridge 2
IsValidBridge(): true
GetName(): Steel girder rail bridge
GetMaxSpeed(): 64
GetPrice(): 19
GetPrice(): 27
GetMaxLength(): 7
GetMinLength(): 2
Bridge 3
IsValidBridge(): true
GetName(): Reinforced concrete suspension rail bridge
GetMaxSpeed(): 80
GetPrice(): 22
GetPrice(): 32
GetMaxLength(): 12
GetMinLength(): 4
Bridge 4
IsValidBridge(): true
GetName(): Steel suspension rail bridge
GetMaxSpeed(): 96
GetPrice(): 25
GetPrice(): 35
GetMaxLength(): 102
GetMinLength(): 5
Bridge 5
IsValidBridge(): true
GetName(): Steel suspension rail bridge
GetMaxSpeed(): 112
GetPrice(): 26
GetPrice(): 36
GetMaxLength(): 102
GetMinLength(): 5
Bridge 6
IsValidBridge(): true
GetName(): Steel cantilever rail bridge
GetMaxSpeed(): 160
GetPrice(): 30
GetPrice(): 42
GetMaxLength(): 9
GetMinLength(): 5
Bridge 7
IsValidBridge(): true
GetName(): Steel cantilever rail bridge
GetMaxSpeed(): 208
GetPrice(): 31
GetPrice(): 44
GetMaxLength(): 10
GetMinLength(): 5
Bridge 8
IsValidBridge(): true
GetName(): Steel cantilever rail bridge
GetMaxSpeed(): 240
GetPrice(): 33
GetPrice(): 47
GetMaxLength(): 11
GetMinLength(): 5
Bridge 9
IsValidBridge(): true
GetName(): Steel girder rail bridge
GetMaxSpeed(): 256
GetPrice(): 32
GetPrice(): 45
GetMaxLength(): 4
GetMinLength(): 2
Bridge 10
@@ -743,12 +755,15 @@
GetMinLength(): -1
Valid Bridges: 10
IsBridgeTile(): false
GetBridgeID(): -1
RemoveBridge(): false
GetLastErrorString(): ERR_PRECONDITION_FAILED
GetOtherBridgeEnd(): -1
BuildBridge(): true
IsBridgeTile(): true
GetBridgeID(): 5
IsBridgeTile(): true
GetBridgeID(): 5
GetOtherBridgeEnd(): 33155
BuildBridge(): false
GetLastErrorString(): ERR_ALREADY_BUILT
@@ -769,16 +784,16 @@
1 => 48
0 => 32
Price ListDump:
8 => 33
9 => 32
7 => 31
6 => 30
5 => 26
4 => 25
3 => 22
2 => 19
1 => 15
0 => 10
8 => 47
9 => 45
7 => 44
6 => 42
5 => 36
4 => 35
3 => 32
2 => 27
1 => 21
0 => 15
MaxLength ListDump:
5 => 102
4 => 102
@@ -809,9 +824,9 @@
4 => 96
0 => 32
Price ListDump:
5 => 73
4 => 70
0 => 30
5 => 220
4 => 212
0 => 91
--AICargo--
Cargo -1
@@ -824,6 +839,7 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 0
IsValidCargo(): true
GetCargoLabel(): 'PASS'
@@ -834,6 +850,7 @@
GetCargoIncome(10, 10): 3
GetCargoIncome(100, 10): 39
GetCargoIncome(10, 100): 3
GetRoadVehicleTypeForCargo(): 0
Cargo 1
IsValidCargo(): true
GetCargoLabel(): 'COAL'
@@ -844,6 +861,7 @@
GetCargoIncome(10, 10): 7
GetCargoIncome(100, 10): 75
GetCargoIncome(10, 100): 6
GetRoadVehicleTypeForCargo(): 1
Cargo 2
IsValidCargo(): true
GetCargoLabel(): 'MAIL'
@@ -854,6 +872,7 @@
GetCargoIncome(10, 10): 5
GetCargoIncome(100, 10): 58
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 3
IsValidCargo(): true
GetCargoLabel(): 'OIL_'
@@ -864,6 +883,7 @@
GetCargoIncome(10, 10): 5
GetCargoIncome(100, 10): 56
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 4
IsValidCargo(): true
GetCargoLabel(): 'LVST'
@@ -874,6 +894,7 @@
GetCargoIncome(10, 10): 5
GetCargoIncome(100, 10): 55
GetCargoIncome(10, 100): 4
GetRoadVehicleTypeForCargo(): 1
Cargo 5
IsValidCargo(): true
GetCargoLabel(): 'GOOD'
@@ -884,6 +905,7 @@
GetCargoIncome(10, 10): 7
GetCargoIncome(100, 10): 78
GetCargoIncome(10, 100): 6
GetRoadVehicleTypeForCargo(): 1
Cargo 6
IsValidCargo(): true
GetCargoLabel(): 'GRAI'
@@ -894,6 +916,7 @@
GetCargoIncome(10, 10): 6
GetCargoIncome(100, 10): 60
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 7
IsValidCargo(): true
GetCargoLabel(): 'WOOD'
@@ -904,6 +927,7 @@
GetCargoIncome(10, 10): 6
GetCargoIncome(100, 10): 63
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 8
IsValidCargo(): true
GetCargoLabel(): 'IORE'
@@ -914,6 +938,7 @@
GetCargoIncome(10, 10): 6
GetCargoIncome(100, 10): 65
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 9
IsValidCargo(): true
GetCargoLabel(): 'STEL'
@@ -924,6 +949,7 @@
GetCargoIncome(10, 10): 7
GetCargoIncome(100, 10): 72
GetCargoIncome(10, 100): 6
GetRoadVehicleTypeForCargo(): 1
Cargo 10
IsValidCargo(): true
GetCargoLabel(): 'VALU'
@@ -934,6 +960,7 @@
GetCargoIncome(10, 10): 9
GetCargoIncome(100, 10): 94
GetCargoIncome(10, 100): 7
GetRoadVehicleTypeForCargo(): 1
Cargo 11
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -944,6 +971,7 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 12
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -954,6 +982,7 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 13
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -964,6 +993,7 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 14
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -974,6 +1004,7 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
--CargoList--
Count(): 11
@@ -1052,7 +1083,7 @@
GetAutoRenewStatus(); true
SetAutoRenewStatus(true); false
SetAutoRenewStatus(false); true
GetAutoRenewMonths(); -6
GetAutoRenewMonths(); 6
SetAutoRenewMonths(-12); true
GetAutoRenewMonths(); -12
SetAutoRenewMonths(-12); false
@@ -6907,6 +6938,9 @@
GetName(): Farm
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 5
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6914,6 +6948,9 @@
GetName(): Oil Rig
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): true
HasHeliport(): true
HasDock(): true
Id: 12
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6921,6 +6958,9 @@
GetName(): Bank
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 11
IsRawIndustry(): true
ProductionCanIncrease(): false
@@ -6928,6 +6968,9 @@
GetName(): Oil Wells
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 1
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6935,6 +6978,9 @@
GetName(): Power Station
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 3
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6942,6 +6988,9 @@
GetName(): Forest
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 2
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6949,6 +6998,9 @@
GetName(): Sawmill
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 18
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6956,6 +7008,9 @@
GetName(): Iron Ore Mine
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 0
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6963,6 +7018,9 @@
GetName(): Coal Mine
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 8
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6970,6 +7028,9 @@
GetName(): Steel Mill
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 4
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6977,6 +7038,9 @@
GetName(): Oil Refinery
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 6
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6984,6 +7048,9 @@
GetName(): Factory
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
--Map--
GetMapSize(): 65536
@@ -7186,11 +7253,6 @@
BuildSign(33409, 'Some other Sign'): 2
RemoveSign(2): true
GetMaxSignID(): 3
Sign -1
IsValidSign(): false
GetName(): (null : 0x00000000)
GetLocation(): -1
Sign 0
IsValidSign(): true
GetName(): Some Sign
@@ -7199,14 +7261,6 @@
IsValidSign(): true
GetName(): Test2
GetLocation(): 33411
Sign 2
IsValidSign(): false
GetName(): (null : 0x00000000)
GetLocation(): -1
Sign 3
IsValidSign(): false
GetName(): (null : 0x00000000)
GetLocation(): -1
Valid Signs: 2
--Station--
@@ -7273,7 +7327,7 @@
Count(): 9
ListDump:
27631 => 29
27631 => 255
27631 => 65535
27631 => true
27631 => false
27888 => 13
@@ -7311,125 +7365,178 @@
--TileList--
Count(): 0
Count(): 45
Count(): 27
Height(): done
Count(): 45
Count(): 27
ListDump:
42411 => 2
42410 => 2
42409 => 2
42408 => 2
42407 => 2
42154 => 2
42153 => 2
42152 => 2
42151 => 2
41898 => 2
41897 => 2
41896 => 2
41895 => 2
41642 => 2
41641 => 2
41640 => 2
41639 => 2
41386 => 2
41385 => 2
41384 => 2
41383 => 2
42415 => 1
42414 => 1
42413 => 1
42412 => 1
42159 => 1
42158 => 1
42157 => 1
42156 => 1
42155 => 1
41903 => 1
41902 => 1
41901 => 1
41900 => 1
41899 => 1
41647 => 1
41646 => 1
41645 => 1
41644 => 1
41643 => 1
41391 => 1
41390 => 1
41389 => 1
41388 => 1
41387 => 1
34956 => 4
34700 => 4
34444 => 4
34955 => 3
34954 => 3
34953 => 3
34699 => 3
34698 => 3
34697 => 3
34693 => 3
34692 => 3
34443 => 3
34442 => 3
34441 => 3
34439 => 3
34438 => 3
34437 => 3
34436 => 3
34952 => 2
34951 => 2
34950 => 2
34949 => 2
34948 => 2
34696 => 2
34695 => 2
34694 => 2
34440 => 2
CornerHeight(North): done
Count(): 27
ListDump:
34956 => 4
34700 => 4
34444 => 4
34955 => 3
34954 => 3
34953 => 3
34699 => 3
34698 => 3
34697 => 3
34693 => 3
34692 => 3
34443 => 3
34442 => 3
34441 => 3
34439 => 3
34438 => 3
34437 => 3
34436 => 3
34952 => 2
34951 => 2
34950 => 2
34949 => 2
34948 => 2
34696 => 2
34695 => 2
34694 => 2
34440 => 2
MinHeight(): done
Count(): 27
ListDump:
34956 => 4
34700 => 4
34444 => 4
34955 => 3
34954 => 3
34953 => 3
34699 => 3
34698 => 3
34697 => 3
34443 => 3
34442 => 3
34441 => 3
34436 => 3
34952 => 2
34951 => 2
34950 => 2
34949 => 2
34948 => 2
34696 => 2
34695 => 2
34694 => 2
34693 => 2
34692 => 2
34440 => 2
34439 => 2
34438 => 2
34437 => 2
MaxHeight(): done
Count(): 27
ListDump:
34956 => 4
34955 => 4
34700 => 4
34699 => 4
34444 => 4
34443 => 4
34954 => 3
34953 => 3
34952 => 3
34951 => 3
34950 => 3
34949 => 3
34948 => 3
34698 => 3
34697 => 3
34696 => 3
34693 => 3
34692 => 3
34442 => 3
34441 => 3
34440 => 3
34439 => 3
34438 => 3
34437 => 3
34436 => 3
34695 => 2
34694 => 2
Slope(): done
KeepValue(0): done
Count(): 38
Count(): 12
ListDump:
42415 => 0
42414 => 0
42413 => 0
42410 => 0
42409 => 0
42408 => 0
42407 => 0
42159 => 0
42158 => 0
42157 => 0
42156 => 0
42153 => 0
42152 => 0
42151 => 0
41903 => 0
41902 => 0
41901 => 0
41900 => 0
41899 => 0
41897 => 0
41896 => 0
41895 => 0
41647 => 0
41646 => 0
41645 => 0
41644 => 0
41643 => 0
41641 => 0
41640 => 0
41639 => 0
41391 => 0
41390 => 0
41389 => 0
41388 => 0
41387 => 0
41385 => 0
41384 => 0
41383 => 0
34956 => 0
34954 => 0
34953 => 0
34700 => 0
34698 => 0
34697 => 0
34695 => 0
34694 => 0
34444 => 0
34442 => 0
34441 => 0
34436 => 0
Buildable(): done
KeepValue(1): done
Count(): 28
Count(): 35
BuildableRectangle(3, 3) ListDump:
42415 => 1
42414 => 1
42413 => 1
42412 => 1
42411 => 1
42410 => 1
42159 => 1
42158 => 1
42157 => 1
42156 => 1
42155 => 1
42154 => 1
41903 => 1
41902 => 1
41901 => 1
41900 => 1
41899 => 1
41898 => 1
41647 => 1
41646 => 1
41645 => 1
41644 => 1
41643 => 1
41642 => 1
41641 => 1
41391 => 1
41390 => 1
41389 => 1
41388 => 1
41387 => 1
41386 => 1
41385 => 1
42153 => 0
41897 => 0
@@ -7441,26 +7548,33 @@
42413 => 173
42158 => 173
41903 => 173
42412 => 172
42157 => 172
41902 => 172
41647 => 172
42411 => 171
42156 => 171
41901 => 171
41646 => 171
41391 => 171
42410 => 170
42155 => 170
41900 => 170
41645 => 170
41390 => 170
42154 => 169
41899 => 169
41644 => 169
41389 => 169
42153 => 168
41898 => 168
41643 => 168
41388 => 168
41897 => 167
41642 => 167
41387 => 167
41641 => 166
41386 => 166
41385 => 165
41384 => 164
DistanceSquareToTile(30000) ListDump:
@@ -7477,17 +7591,24 @@
42157 => 17834
41390 => 17812
41901 => 17741
42412 => 17680
41645 => 17650
42156 => 17585
41389 => 17561
41900 => 17492
42411 => 17433
41644 => 17401
42155 => 17338
41388 => 17312
41899 => 17245
42410 => 17188
41643 => 17154
42154 => 17093
41387 => 17065
41898 => 17000
41642 => 16909
42153 => 16850
41386 => 16820
41897 => 16757
41641 => 16666
41385 => 16577
@@ -7496,63 +7617,77 @@
42415 => -1
42414 => -1
42413 => -1
42412 => -1
42411 => -1
42410 => -1
42159 => -1
42158 => -1
42157 => -1
42156 => -1
42155 => -1
42154 => -1
42153 => -1
41903 => -1
41902 => -1
41901 => -1
41900 => -1
41899 => -1
41898 => -1
41897 => -1
41647 => -1
41646 => -1
41645 => -1
41644 => -1
41643 => -1
41642 => -1
41641 => -1
41391 => -1
41390 => -1
41389 => -1
41388 => -1
41387 => -1
41386 => -1
41385 => -1
41384 => -1
GetClosestTown() ListDump:
42415 => 3
42414 => 3
42413 => 3
42412 => 3
42411 => 3
42410 => 3
42159 => 3
42158 => 3
42157 => 3
42156 => 3
42155 => 3
42154 => 3
42153 => 3
41903 => 3
41902 => 3
41901 => 3
41900 => 3
41899 => 3
41898 => 3
41897 => 3
41647 => 3
41646 => 3
41645 => 3
41644 => 3
41643 => 3
41642 => 3
41641 => 3
41391 => 3
41390 => 3
41389 => 3
41388 => 3
41387 => 3
41386 => 3
41385 => 3
41384 => 3
CargoAcceptance(): done
KeepAboveValue(10): done
Count(): 9
Count(): 15
ListDump:
41897 => 29
41385 => 26
@@ -7560,9 +7695,15 @@
42153 => 25
41641 => 23
41899 => 17
41898 => 17
41387 => 17
41386 => 17
41643 => 14
41642 => 14
42411 => 13
42410 => 13
42155 => 13
42154 => 13
RoadTile(): done
KeepValue(1): done
Count(): 0

Binary file not shown.

View File

@@ -1,7 +1,7 @@
; $Id$
;
; This represents the original graphics as on the Transport
; Tycoon Deluxe for Windows.
; Tycoon Deluxe for Windows CD.
;
[metadata]
name = original_windows

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ log() {
}
set_default() {
released_version=""
released_version="0.7.3"
ignore_extra_parameters="0"
# We set all kinds of defaults for params. Later on the user can override
@@ -47,8 +47,8 @@ set_default() {
enable_static="1"
enable_translator="0"
enable_unicode="1"
enable_assert="1"
enable_strip="0"
enable_assert="0"
enable_strip="1"
enable_universal="1"
enable_osx_g5="0"
enable_cocoa_quartz="1"
@@ -415,7 +415,7 @@ save_params() {
configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
for p in $save_params_array; do
eval "v=\"\$$p\""
p=`echo "$p" | sed 's~_~-~g;s~\n~~g;s~ ~\\ ~g'`
p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
# Only save those params that aren't empty
configure="$configure --$p=\"$v\""
done
@@ -815,6 +815,7 @@ check_params() {
fi
if [ "$os" = "OSX" ]; then
check_osx_sdk
# Test on G5
if [ "$enable_osx_g5" != "0" ]; then
@@ -903,7 +904,7 @@ check_params() {
doc_dir="$data_dir/docs"
fi
else
doc_dir="`echo $doc_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi
if [ "$icon_theme_dir" = "1" ]; then
@@ -913,7 +914,7 @@ check_params() {
icon_theme_dir=""
fi
else
icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi
if [ "$personal_dir" = "1" ]; then
@@ -925,7 +926,7 @@ check_params() {
personal_dir=".openttd"
fi
else
personal_dir="`echo $personal_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi
if [ "$shared_dir" = "1" ]; then
@@ -936,7 +937,7 @@ check_params() {
shared_dir=""
fi
else
shared_dir="`echo $shared_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi
if [ "$man_dir" = "1" ]; then
@@ -947,7 +948,7 @@ check_params() {
man_dir=""
fi
else
man_dir="`echo $man_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi
if [ "$menu_dir" = "1" ]; then
@@ -958,7 +959,7 @@ check_params() {
menu_dir=""
fi
else
menu_dir="`echo $menu_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi
# "set_universal_binary_flags" needs to be before "detect_iconv"
@@ -1008,13 +1009,74 @@ check_params() {
fi
}
make_compiler_cflags() {
# Params:
# $1 - compiler
# $2 - the current cflags
# $3 - variable to finally write to
flags="$2"
if [ `echo $1 | cut -c 1-3` = "icc" ]; then
# Enable some things only for certain ICC versions
cc_version=`$1 -dumpversion | cut -c 1-4`
if [ "$cc_version" = "10.1" ]; then
flags="$flags -Wno-multichar"
fi
if [ "$cc_version" = "11.0" ]; then
# warning 1899: multicharacter character literal (potential portability problem) (e.g. 'FOOD')
# vec report defaults to telling where it did loop vectorisation, which is not very important
flags="$flags -vec-report=0 -wd1899"
fi
else
# Enable some things only for certain GCC versions
cc_version=`$1 -dumpversion | cut -c 1,3`
if [ $cc_version -lt 30 ]; then
log 1 "configure: error: gcc older than 3.0 can't compile OpenTTD because of its poor template support"
exit 1
fi
flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
flags="$flags -Wwrite-strings -Wpointer-arith"
flags="$flags -Wno-uninitialized"
flags="$flags -W -Wno-unused-parameter -Wformat=2"
flags="$flags -Wredundant-decls"
if [ $enable_assert -eq 0 ]; then
# Do not warn about unused variables when building without asserts
flags="$flags -Wno-unused-variable"
fi
if [ $cc_version -ge 40 ]; then
# GCC 4.0+ complains about that we break strict-aliasing.
# On most places we don't see how to fix it, and it doesn't
# break anything. So disable strict-aliasing to make the
# compiler all happy.
flags="$flags -fno-strict-aliasing"
fi
if [ $cc_version -ge 42 ]; then
# GCC 4.2+ automatically assumes that signed overflows do
# not occur in signed arithmetics, whereas we are not
# sure that they will not happen. It furthermore complains
# about it's own optimized code in some places.
flags="$flags -fno-strict-overflow"
fi
fi
eval "$3=\"$flags\""
}
make_cflags_and_ldflags() {
# General CFlags for BUILD
CFLAGS_BUILD=""
# General CFlags for HOST
CFLAGS="$CFLAGS -D$os"
# CFlags for HOST and C-Compiler
CC_FLAGS=""
# Libs to compile. In fact this is just LDFLAGS
LIBS="-lstdc++"
# LDFLAGS used for HOST
@@ -1063,58 +1125,16 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DNO_THREADS"
fi
if [ `echo $cc_host | cut -c 1-3` = "icc" ]; then
# Enable some things only for certain ICC versions
cc_version=`$cc_host -dumpversion | cut -c 1-4`
if [ "$cc_version" = "10.1" ]; then
CFLAGS="$CFLAGS -Wno-multichar"
fi
else
# Enable some things only for certain GCC versions
cc_version=`$cc_host -dumpversion | cut -c 1,3`
if [ $cc_version -ge 29 ]; then
CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
CFLAGS="$CFLAGS -Wno-uninitialized"
CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
fi
gcc295=""
if [ "$cc_version" = 29 ]; then
# Make sure we mark GCC 2.95 flag for Makefile.src.in, as we
# need a lovely hack there to make it compile correctly.
gcc295="1"
# Disable warnings about unused variables when
# compiling with asserts disabled
if [ $enable_assert -eq 0 ]; then
CFLAGS="$CFLAGS -Wno-unused"
fi
fi
if [ $cc_version -ge 30 ]; then
CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2"
CFLAGS="$CFLAGS -Wredundant-decls"
# Do not warn about unused variables when building without asserts
if [ $enable_assert -eq 0 ]; then
CFLAGS="$CFLAGS -Wno-unused-variable"
fi
fi
if [ $cc_version -ge 34 ]; then
CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition"
fi
make_compiler_cflags "$cc_build" "$CFLAGS_BUILD" "CFLAGS_BUILD"
make_compiler_cflags "$cc_host" "$CFLAGS" "CFLAGS"
if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
if [ "$os" = "CYGWIN" ]; then
CFLAGS="$CFLAGS -mwin32"
flags="$flags -mwin32"
LDFLAGS="$LDFLAGS -mwin32"
fi
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
CFLAGS="$CFLAGS -mno-cygwin"
flags="$flags -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
fi
@@ -1122,22 +1142,6 @@ make_cflags_and_ldflags() {
LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
fi
# GCC 4.0+ complains about that we break strict-aliasing.
# On most places we don't see how to fix it, and it doesn't
# break anything. So disable strict-aliasing to make the
# compiler all happy.
if [ $cc_version -ge 40 ]; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
# GCC 4.2+ automatically assumes that signed overflows do
# not occur in signed arithmetics, whereas we are not
# sure that they will not happen. It furthermore complains
# about it's own optimized code in some places.
if [ $cc_version -ge 42 ]; then
CFLAGS="$CFLAGS -fno-strict-overflow"
fi
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
@@ -1206,7 +1210,7 @@ make_cflags_and_ldflags() {
if [ -n "$sdl_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL"
# SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's~-D_GNU_SOURCE[^ ]*~~'`"
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$sdl_config --static-libs`"
@@ -1268,7 +1272,7 @@ make_cflags_and_ldflags() {
if [ "$os" = "OSX" ]; then
# fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
# Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s~-lfontconfig~~`"
LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s@-lfontconfig@@`"
else
LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
fi
@@ -1297,7 +1301,8 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWITH_ICU"
CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
LIBS="$LIBS `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
# Some icu-configs have the 'feature' of not adding a space where others do add the space
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
fi
@@ -1378,7 +1383,7 @@ make_cflags_and_ldflags() {
fi
if [ "$enable_osx_g5" != "0" ]; then
CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt"
CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
fi
if [ -n "$personal_dir" ]; then
@@ -1391,7 +1396,7 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS"
log 1 "using CFLAGS... $CFLAGS"
log 1 "using LDFLAGS... $LIBS $LDFLAGS"
# Makedepend doesn't like something like: -isysroot /OSX/blabla
@@ -1400,8 +1405,12 @@ make_cflags_and_ldflags() {
# Lovely hackish, not?
# Btw, this almost always comes from outside the configure, so it is
# not something we can control.
# Also make makedepend aware of compiler's built-in defines.
if [ "$with_makedepend" != "0" ]; then
cflags_makedep="` echo "$CFLAGS" | sed 's~ /~ -~g;s~-I[ ]*[^ ]*~~g'`"
cflags_makedep="`echo | $cxx_host -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
# Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
else
makedepend=""
fi
@@ -1580,7 +1589,7 @@ check_strip() {
elif [ "$os" = "OSX" ]; then
# Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
echo "int main(int argc, char *argv[]) { }" > strip.test.c
$cc_host strip.test.c -o strip.test
$cxx_host strip.test.c -o strip.test
check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
rm -f strip.test.c strip.test
else
@@ -1591,7 +1600,7 @@ check_strip() {
check_lipo() {
if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
echo "int main(int argc, char *argv[]) { }" > lipo.test.c
$cc_host lipo.test.c -o lipo.test
$cxx_host lipo.test.c -o lipo.test
check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
rm -f lipo.test.c lipo.test
fi
@@ -1617,6 +1626,28 @@ set_universal_binary_flags() {
fi
}
check_osx_sdk() {
cat > tmp.osx.mm << EOF
#include <Cocoa/Cocoa.h>
int main() {
kCGBitmapByteOrder32Host;
return 0;
}
EOF
execute="$cxx_host $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
eval $execute > /dev/null
ret=$?
log 2 "executing $execute"
log 2 " exit code $ret"
rm -f tmp.osx.mm tmp.osx
if [ "$ret" != "0" ]; then
log 1 "Your system SDK is probably too old"
log 1 "Please install/upgrade your Xcode to >= 2.5"
exit 1
fi
}
check_direct_music() {
echo "
#include <windows.h>
@@ -2266,9 +2297,9 @@ detect_icu() {
log 2 " returned $version"
log 2 " exit code $ret"
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -lt "20" ]; then
if [ -n "$shortversion" ] && [ "$shortversion" -lt "20" ]; then
log 1 "checking libicu... needs at least version 2.0.0, icu NOT enabled"
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -lt "22" ]; then
if [ -n "$shortversion" ] && [ "$shortversion" -lt "22" ]; then
log 1 "checking libicu... needs at least version 2.2.0, icu NOT enabled"
else
log 1 "checking libicu... not found"
fi
@@ -2405,7 +2436,7 @@ int main() {
}
EOF
execute="$cxx_host $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
eval $execute >&/dev/null
eval $execute > /dev/null
ret=$?
log 2 "executing $execute"
log 2 " exit code $ret"
@@ -2426,7 +2457,7 @@ int main() {
}
EOF
execute="$cxx_host $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
eval $execute >&/dev/null
eval $execute > /dev/null
ret=$?
log 2 "executing $execute"
log 2 " exit code $ret"
@@ -2501,7 +2532,8 @@ detect_cputype() {
log 1 "forcing cpu-type... $cpu_type bits"
return;
fi
echo "#include \"src/stdafx.h\"" > tmp.64bit.cpp
echo "#define _SQ64 1" > tmp.64bit.cpp
echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
echo "int main() { return 0; }" >> tmp.64bit.cpp
execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
@@ -2519,17 +2551,6 @@ make_sed() {
T_CFLAGS="$CFLAGS"
T_LDFLAGS="$LDFLAGS"
# We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL
# We do this here, and not sooner, so universal builds also have this
# automatically correct
# FOUR_BYTE_BOOL is needed, because C++ uses 4byte for a bool on PPC, where
# we use 1 byte per bool normally in C part. So convert that last one to 4
# bytes too, but only for PPC.
ppc=`$cc_host -dumpmachine | egrep "powerpc|ppc"`
if [ -n "$ppc" ]; then
T_CFLAGS="$T_CFLAGS -DFOUR_BYTE_BOOL"
fi
SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
# All the data needed to compile a single target
@@ -2537,104 +2558,102 @@ make_sed() {
# use multiple OBJS_DIR, because all in-between
# binaries are stored in there, and nowhere else.
SRC_REPLACE="
s~!!CC_HOST!!~$cc_host~g;
s~!!CXX_HOST!!~$cxx_host~g;
s~!!CC_BUILD!!~$cc_build~g;
s~!!CXX_BUILD!!~$cxx_build~g;
s~!!WINDRES!!~$windres~g;
s~!!STRIP!!~$strip $strip_arg~g;
s~!!LIPO!!~$lipo~g;
s~!!CC_CFLAGS!!~$CC_CFLAGS~g;
s~!!CFLAGS!!~$T_CFLAGS~g;
s~!!CFLAGS_BUILD!!~$CFLAGS_BUILD~g;
s~!!STRGEN_FLAGS!!~$strgen_flags~g;
s~!!LIBS!!~$LIBS~g;
s~!!LDFLAGS!!~$T_LDFLAGS~g;
s~!!BIN_DIR!!~$BIN_DIR~g;
s~!!ROOT_DIR!!~$ROOT_DIR~g;
s~!!MEDIA_DIR!!~$MEDIA_DIR~g;
s~!!SOURCE_LIST!!~$SOURCE_LIST~g;
s~!!SRC_OBJS_DIR!!~$SRC_OBJS_DIR~g;
s~!!LANG_OBJS_DIR!!~$LANG_OBJS_DIR~g;
s~!!SRC_DIR!!~$SRC_DIR~g;
s~!!SCRIPT_SRC_DIR!!~$SCRIPT_SRC_DIR~g;
s~!!OSXAPP!!~$OSXAPP~g;
s~!!LANG_DIR!!~$LANG_DIR~g;
s~!!TTD!!~$TTD~g;
s~!!BINARY_DIR!!~$prefix_dir/$binary_dir~g;
s~!!DATA_DIR!!~$prefix_dir/$data_dir~g;
s~!!DOC_DIR!!~$prefix_dir/$doc_dir~g;
s~!!MAN_DIR!!~$prefix_dir/$man_dir~g;
s~!!ICON_DIR!!~$prefix_dir/$icon_dir~g;
s~!!ICON_THEME_DIR!!~$prefix_dir/$icon_theme_dir~g;
s~!!PERSONAL_DIR!!~$personal_dir~g;
s~!!SHARED_DIR!!~$shared_dir~g;
s~!!INSTALL_DIR!!~$install_dir~g;
s~!!BINARY_NAME!!~$binary_name~g;
s~!!STRGEN!!~$STRGEN~g;
s~!!ENDIAN_CHECK!!~$ENDIAN_CHECK~g;
s~!!ENDIAN_FORCE!!~$endian~g;
s~!!STAGE!!~$STAGE~g;
s~!!MAKEDEPEND!!~$makedepend~g;
s~!!CFLAGS_MAKEDEP!!~$cflags_makedep~g;
s~!!SORT!!~$sort~g;
s~!!CONFIG_CACHE_COMPILER!!~config.cache.compiler~g;
s~!!CONFIG_CACHE_LINKER!!~config.cache.linker~g;
s~!!CONFIG_CACHE_ENDIAN!!~config.cache.endian~g;
s~!!CONFIG_CACHE_SOURCE!!~config.cache.source~g;
s~!!CONFIG_CACHE_VERSION!!~config.cache.version~g;
s~!!CONFIG_CACHE_SOURCE_LIST!!~config.cache.source.list~g;
s~!!CONFIG_CACHE_PWD!!~config.cache.pwd~g;
s~!!LANG_SUPPRESS!!~$lang_suppress~g;
s~!!OBJS_C!!~$OBJS_C~g;
s~!!OBJS_CPP!!~$OBJS_CPP~g;
s~!!OBJS_MM!!~$OBJS_MM~g;
s~!!OBJS_RC!!~$OBJS_RC~g;
s~!!SRCS!!~$SRCS~g;
s~!!OS!!~$os~g;
s~!!CONFIGURE_FILES!!~$CONFIGURE_FILES~g;
s~!!REVISION!!~$revision~g;
s~!!AWK!!~$awk~g;
s~!!GCC295!!~$gcc295~g;
s~!!DISTCC!!~$distcc~g;
s@!!CC_HOST!!@$cc_host@g;
s@!!CXX_HOST!!@$cxx_host@g;
s@!!CC_BUILD!!@$cc_build@g;
s@!!CXX_BUILD!!@$cxx_build@g;
s@!!WINDRES!!@$windres@g;
s@!!STRIP!!@$strip $strip_arg@g;
s@!!LIPO!!@$lipo@g;
s@!!CFLAGS!!@$T_CFLAGS@g;
s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
s@!!STRGEN_FLAGS!!@$strgen_flags@g;
s@!!LIBS!!@$LIBS@g;
s@!!LDFLAGS!!@$T_LDFLAGS@g;
s@!!BIN_DIR!!@$BIN_DIR@g;
s@!!ROOT_DIR!!@$ROOT_DIR@g;
s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
s@!!SRC_DIR!!@$SRC_DIR@g;
s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
s@!!OSXAPP!!@$OSXAPP@g;
s@!!LANG_DIR!!@$LANG_DIR@g;
s@!!TTD!!@$TTD@g;
s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
s@!!PERSONAL_DIR!!@$personal_dir@g;
s@!!SHARED_DIR!!@$shared_dir@g;
s@!!INSTALL_DIR!!@$install_dir@g;
s@!!BINARY_NAME!!@$binary_name@g;
s@!!STRGEN!!@$STRGEN@g;
s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
s@!!ENDIAN_FORCE!!@$endian@g;
s@!!STAGE!!@$STAGE@g;
s@!!MAKEDEPEND!!@$makedepend@g;
s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
s@!!SORT!!@$sort@g;
s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
s@!!LANG_SUPPRESS!!@$lang_suppress@g;
s@!!OBJS_C!!@$OBJS_C@g;
s@!!OBJS_CPP!!@$OBJS_CPP@g;
s@!!OBJS_MM!!@$OBJS_MM@g;
s@!!OBJS_RC!!@$OBJS_RC@g;
s@!!SRCS!!@$SRCS@g;
s@!!OS!!@$os@g;
s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
s@!!REVISION!!@$revision@g;
s@!!AWK!!@$awk@g;
s@!!DISTCC!!@$distcc@g;
"
if [ "$icon_theme_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE
s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g;
s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
"
else
SRC_REPLACE="$SRC_REPLACE
s#!!ICON_THEME_DIR!!##g;
s@!!ICON_THEME_DIR!!@@g;
"
fi
if [ "$man_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE
s#!!MAN_DIR!!#$prefix_dir/$man_dir#g;
s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
"
else
SRC_REPLACE="$SRC_REPLACE
s#!!MAN_DIR!!##g;
s@!!MAN_DIR!!@@g;
"
fi
if [ "$menu_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE
s#!!MENU_DIR!!#$prefix_dir/$menu_dir#g;
s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
"
else
SRC_REPLACE="$SRC_REPLACE
s#!!MENU_DIR!!##g;
s@!!MENU_DIR!!@@g;
"
fi
}
generate_menu_item() {
MENU_REPLACE="
s~!!TTD!!~$TTD~g;
s~!!MENU_GROUP!!~$menu_group~g;
s~!!MENU_NAME!!~$menu_name~g
s@!!TTD!!@$TTD@g;
s@!!MENU_GROUP!!@$menu_group@g;
s@!!MENU_NAME!!@$menu_name@g
"
log 1 "Generating menu item..."
mkdir -p media

48
configure vendored
View File

@@ -1,5 +1,13 @@
#!/bin/sh
check_path_characters() {
if [ -n "`echo $ROOT_DIR | grep '[^-_A-Za-z0-9\/\\\.:]'`" ]; then
echo "WARNING: The path contains a non-alphanumeric character that might cause"
echo " failures in subsequent build stages. Any failures with the build"
echo " will most likely be caused by this."
fi
}
CONFIGURE_EXECUTABLE="$_"
# On *nix systems those two are equal when ./configure is done
if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
@@ -14,9 +22,16 @@ if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
fi
# Find out where configure is (in what dir)
ROOT_DIR="`dirname $0`"
ROOT_DIR="`cd $ROOT_DIR && pwd`"
# For MSYS/MinGW we want to know the FULL path. This as that path is generated
# once you call an outside binary. Having the same path for the rest is needed
# for dependency checking.
# pwd -W returns said FULL path, but doesn't exist on others so fall back.
ROOT_DIR="`cd $ROOT_DIR && (pwd -W 2>/dev/null || pwd 2>/dev/null)`"
PWD="`pwd`"
check_path_characters
# Same here as for the ROOT_DIR above
PWD="`pwd -W 2>/dev/null || pwd 2>/dev/null`"
PREFIX="$PWD/bin"
. $ROOT_DIR/config.lib
@@ -37,10 +52,11 @@ if [ "$1" = "--reconfig" ] || [ "$1" = "--reconfigure" ]; then
exit 1
fi
# Make sure we don't lock config.cache
cat config.cache | sed 's~\\ ~\\\\ ~g' > cache.tmp
cat config.cache | sed 's@\\ @\\\\ @g' > cache.tmp
sh cache.tmp
RET=$?
rm -f cache.tmp
exit $?
exit $RET
fi
set_default
@@ -59,7 +75,7 @@ STRGEN="strgen$EXE"
ENDIAN_CHECK="endian_check$EXE"
if [ -z "$sort" ]; then
PIPE_SORT="sed s~a~a~"
PIPE_SORT="sed s@a@a@"
else
PIPE_SORT="$sort"
fi
@@ -70,7 +86,7 @@ if [ ! -f "$LANG_DIR/english.txt" ]; then
fi
# Read the source.list and process it
SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk '
AWKCOMMAND='
{ }
/^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; }
/^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; }
@@ -115,17 +131,21 @@ SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk '
print $0;
}
}
' | $PIPE_SORT`"
'
OBJS_C="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.c$/ { gsub(".c$", ".o", $0); print $0; }'`"
OBJS_CPP="`echo \"$SRCS\" | $awk ' { ORS = " " } /\.cpp$/ { gsub(".cpp$", ".o", $0); print $0; }'`"
OBJS_MM="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.mm$/ { gsub(".mm$", ".o", $0); print $0; }'`"
OBJS_RC="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.rc$/ { gsub(".rc$", ".o", $0); print $0; }'`"
SRCS="` echo \"$SRCS\" | $awk ' { ORS = " " } { print $0; }'`"
# Read the source.list and process it
# Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk \"$AWKCOMMAND\" | $PIPE_SORT`"
OBJS_C="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", $0); print $0; }'`"
OBJS_CPP="`echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.cpp$/ { gsub(\".cpp$\", \".o\", $0); print $0; }'`"
OBJS_MM="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.mm$/ { gsub(\".mm$\", \".o\", $0); print $0; }'`"
OBJS_RC="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.rc$/ { gsub(\".rc$\", \".o\", $0); print $0; }'`"
SRCS="` echo \"$SRCS\" | $awk ' { ORS = \" \" } { print $0; }'`"
# In makefiles, we always use -u for sort
if [ -z "$sort" ]; then
sort="sed s~a~a~"
sort="sed s@a@a@"
else
sort="$sort -u"
fi
@@ -135,3 +155,5 @@ CONFIGURE_FILES="$ROOT_DIR/configure $ROOT_DIR/config.lib $ROOT_DIR/Makefile.in
generate_main
generate_lang
generate_src
check_path_characters

View File

@@ -1,7 +1,7 @@
STRGEN USAGE
------------
This guide is only interesting for people who want to alter something
themselves without access to WT2 (translator2.openttd.org). Please note that
themselves without access to translator.openttd.org. Please note that
your compiled language file will only be compatible with the OpenTTD version
you have downloaded english.txt, the master language file, for. While this is
not always true, namely when changes in the code have not touched language

View File

@@ -26,7 +26,7 @@
[metadata]
; the name of the pack, preferably less than 16 characters
name = example
; the short name (4 characters), used to identify this set within NewGRFs
; the short name (4 characters), used to identify this set
shortname = XMPL
; the version of this graphics set (read as single integer)
version = 0
@@ -49,6 +49,8 @@ tropical = TRGH.GRF
; GRF file with extra toyland sprites
toyland = TRGT.GRF
; NewGRF file using Actions 5, 7, 9 and A to replace sprites
; Must use a GRF ID starting with FF so it cannot be selected from
; the in-game NewGRF list and (thus) be loaded twice.
extra = OPENTTDD.GRF
; The md5s section lists the MD5 checksum for the files that replace them.

View File

@@ -86,17 +86,17 @@ elif [ -d "$ROOT_DIR/.git" ]; then
fi
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
REV="g`echo $HASH | cut -c1-8`"
BRANCH=`git branch|grep '[*]' | sed 's~\* ~~;s~^master$~~'`
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s~.*(svn r\([0-9]*\)).*~\1~"`
BRANCH=`git branch|grep '[*]' | sed 's@\* @@;s@^master$@@'`
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
elif [ -d "$ROOT_DIR/.hg" ]; then
# We are a hg checkout
if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then
MODIFIED="2"
fi
HASH=`LC_ALL=C hg parents 2>/dev/null | head -n 1 | cut -d: -f3`
HASH=`LC_ALL=C hg parents --template="{node}"`
REV="h`echo $HASH | cut -c1-8`"
BRANCH=`hg branch | sed 's~^default$~~'`
REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s~.*(svn r\([0-9]*\)).*~\1~"`
BRANCH=`hg branch | sed 's@^default$@@'`
REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
else
# We don't know
MODIFIED="1"

View File

@@ -1,5 +1,18 @@
README
OpenTTD's known bugs
Last updated: 2009-10-01
Release version: 0.7.3
------------------------------------------------------------------------
Table of Contents:
------------------
1) About
2) Known bugs in the this stable release
3) Known bugs that will not be solved
1) About:
-- ------
All bugs listed below are marked as known. Please do not submit any bugs
that are the same as these. If you do, do not act surprised, because
we WILL flame you!!
@@ -8,21 +21,104 @@ Of course if you have more knowledge about any of these bugs, have more
specifics, we welcome you to report them. React to the given bug indicated
by the number below on http://bugs.openttd.org.
If the bug report is closed, it has been fixed, which then can be verified
in the latest SVN version of /trunk.
Bugs for 0.7.0-beta2
------------------------------------------------------------------------
URL: http://bugs.openttd.org
2) Known bugs in the this stable release:
-- --------------------------------------
The following bugs are known to exist in this stable release and
we intend to fix them. Some bugs are known but are not fixable or
fixing them would cause further problems. Those bugs can be found
in the "Known bugs that will not be solved" section.
- 2689 Capacity ordering of articulated vehicle in build vehicle window is wrong
- 2616 Cloning creates vehicles with invalid subcargos
The bugs in this section all refer to a ticket in our bug tracking system
that you can find at: http://bugs.openttd.org
If the bugs are closed but still listed here it means that the bug is fixed
and that the nightlies and next major release will not have that bug.
- 3198 [OSX] "Could not get system colour space" error on some Mac OS X 10.6
- 3194 [OSX] Full screen 'strobing' on some Mac OS X 10.6
- 3190 [OSX] Compiling fails on some Mac OS X 10.6
- 3159 [NewGRF] Autoreplace resets (or does not keep) value of variable F2
- 3057 Road vehicle sometimes 'forget' the need for servicing
- 3040 Not all alternatives are always shown in the "Join station" list
- 2955 With path signals depots are less likely to be visited
- 2891 Ignore signal does not keep the train running when in path signalled block till the next signal
- 2769 No offer for buying bankrupt AIs
- 2616 [NewGRF] Cloning creates vehicles with invalid subcargos
- 2613 [NewGRF] House property 15 does not work
- 2585 [OSX] OS' mouse pointer showing
- 2484 [OSX] Cannot enter CJK characters
- 2427 Vehicle owner gets paid for whole cargo feeder share
- 1944 Road vehicles not picking empty drivethrough platform
- 1762 Strange Autoreplace behaviour
- 1495 Long vehicles might block multistop drivethrough stations
- 1473 Lost trains ignore exit signals
- 1140 [OSX] Not smooth moving map with touchpad
- 1072 Text overflows in several windows
- 119 Clipping problems with vehicles on slopes
3) Known bugs that will not be solved:
-- -----------------------------------
This section lists all known bugs that we do not intend to fix and the
reasons why we think that fixing them is infeasible. We might make some
minor improvements that reduce the scope of these bugs, but we will not
be able to completely fix them.
Clipping problems
In some cases sprites are not drawn as one would expect. Examples of
this are aircraft that might be hidden below the runway or trees that
in some cases are rendered over vehicles.
The primary cause of this problem is that OpenTTD does not have enough
data (like a 3D model) to properly determine what needs to be drawn in
front of what. OpenTTD has bounding boxes but in lots of cases they
are either too big or too small and then cause problems with what
needs to be drawn in front of what. Also some visual tricks are used.
For example trains at 8 pixels high, the catenary needs to be drawn
above that. When you want to draw bridges on top of that, which are
only one height level (= 8 pixels) higher, you are getting into some
big problems.
We can not change the height levels; it would require us to either
redraw all vehicle or all landscape graphics. Doing so would mean we
leave the Transport Tycoon graphics, which in effect means OpenTTD
will not be a Transport Tycoon clone anymore.
Duplicate (station) names after renaming
After renaming stations one can create duplicate station names. This
is done giving a station the same custom name as another station with
an automatically generated name.
The major part of this problem is that station names are translatable.
Meaning that a station is called e.g. '<TOWN> Central' in English and
'<TOWN> Centraal' in Dutch. This means that in network games the
renaming of a town could cause the rename to succeed on some clients
and fail at others. This creates an inconsistent game state that will
be seen as a 'desync'. Secondly the custom names are intended to fall
completely outside of the '<TOWN> <name>' naming of stations, so when
you rename a town all station names are updated accordingly.
As a result the decision has been made that all custom names are only
compared to the other custom names in the same class and not compared
to the automatically generated names.
Forbid 90 degree turns does not work for crossing PBS paths
When you run a train through itself on a X junction with PBS turned on
the train will not obey the 'forbid 90 degree turns' setting. This is
due to the fact that we can not be sure that the setting was turned
off when the track was reserved, which means that we assume it was
turned on and that the setting does not hold at the time. We made it
this way to allow one to change the setting in-game, but it breaks
slightly when you are running your train through itself. Running a
train through means that your network is broken and is thus a user
error which OpenTTD tries to graciously handle.
Fixing this bug means that we need to record whether this particular
setting was turned on or off at the time the reservation was made. This
means adding quite a bit of data to the savegame for solving an issue
that is basically an user error. We think it is not worth the effort.
Lost trains ignore (block) exit signals
If trains are lost they ignore block exit signals, blocking junctions
with presignals. This is caused because the path finders cannot tell
where the train needs to go. As such a random direction is chosen at
each junction. This causes the trains to occasionally to make choices
that are unwanted from a player's point of view.
This will not be fixed because lost trains are in almost all cases a
network problem, e.g. a train can never reach a specific place. This
makes the impact of fixing the bug enormously small against the
amount of work needed to write a system that prevents the lost trains
from taking the wrong direction.

View File

@@ -1,7 +1,6 @@
# $Id$
# http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html
[Desktop Entry]
Encoding=UTF-8
Type=Application
Version=1.1
Name=!!MENU_NAME!!

View File

@@ -1,17 +1,88 @@
openttd (0.7~svn-1) UNRELEASED; urgency=low
openttd (0.7.3) unstable; urgency=low
* Unreleased SVN version. Versioned to allow normal upgrades to released
versions.
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 03 Sep 2008 18:56:04 +0200
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 01 Oct 2009 12:35:47 +0200
openttd (0.7.0-beta2) unstable; urgency=low
openttd (0.7.3~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 24 Sep 2009 21:30:43 +0200
openttd (0.7.3~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Sun, 13 Sep 2009 10:25:56 +0200
openttd (0.7.2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 01 Aug 2009 00:19:43 +0200
openttd (0.7.2~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 21 Jul 2009 20:25:56 +0200
openttd (0.7.2~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 15 Jul 2009 22:25:56 +0200
openttd (0.7.1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 09 Jun 2009 01:34:56 +0200
openttd (0.7.1~RC3) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 03 Jun 2009 15:34:56 +0200
openttd (0.7.1~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 21 Mar 2009 14:34:56 +0200
openttd (0.7.1~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 11 Mar 2009 17:34:56 +0200
openttd (0.7.0) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 01 Apr 2009 13:37:42 +0000
openttd (0.7.0~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 23 Mar 2009 00:42:00 +0200
openttd (0.7.0~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 16 Mar 2009 00:07:00 +0200
openttd (0.7.0~beta2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 10 Mar 2009 00:33:05 +0100
openttd (0.7.0-beta1) unstable; urgency=low
openttd (0.7.0~beta1) unstable; urgency=low
* New upstream release.

View File

@@ -7,10 +7,13 @@
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself
#
# Note: for (at least) CentOS '#' comments end '\' continue command on new line.
# So place all '#' commented parameters of e.g. configure to the end.
#
#-------------------------------------------------------------------------------
Name: openttd
Version: 0.7.0
Version: 0.7.3
Release: 1%{?dist}
Group: Amusements/Games
@@ -18,13 +21,12 @@ License: GPLv2
URL: http://www.openttd.org
Summary: OpenTTD is an Open Source clone of Chris Sawyer's Transport Tycoon Deluxe
Source: %{name}-%{version}.tar.bz2
Source: %{name}-%{version}-source.tar.bz2
Requires: fontconfig
Requires: libicu
Requires: libpng
Requires: SDL
Requires: zlib
BuildRequires: gcc-c++
BuildRequires: fontconfig-devel
BuildRequires: libpng-devel
BuildRequires: libicu-devel
@@ -35,33 +37,32 @@ BuildRequires: zlib-devel
Requires: freetype
BuildRequires: freetype-devel
%endif
%if %{_vendor}=="MandrakeSoft" || %{_vendor}=="mandriva"
Requires: freetype2
BuildRequires: libfreetype6-devel
%endif
%if %{_vendor}=="redhat" || %{_vendor}=="fedora"
Requires: freetype
BuildRequires: freetype-devel
BuildRequires: desktop-file-utils
%endif
%if %{_vendor}=="suse"
%if %{_vendor}=="suse" || %{_vendor}=="mandriva"
Requires: freetype2
BuildRequires: freetype2-devel
%endif
%if %{_vendor}=="suse"
BuildRequires: update-desktop-files
%endif
# recommends works for suse (not sles9) and mandriva, only
%if 0%{?suse_version} > 910 || %{_vendor}=="mandriva"
Recommends: opengfx
# for 0.8.0
#Recommends: opensfx
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%description
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
with lots of new features and enhancements. To play the game you need to copy
the following 6 data files from your Transport Tycoon Deluxe CD to the game
data directory in %{_datadir}/games/%{name}/data:
From the Windows version of TTD you need:
sample.cat trg1r.grf trgcr.grf trghr.grf trgir.grf trgtr.grf
Or if you have the DOS version you need:
sample.cat TRG1.GRF TRGC.GRF TRGH.GRF TRGI.GRF TRGT.GRF
with lots of new features and enhancements. To play the game you need either
the original data from the game or install the recommend package OpenGFX.
OpenTTD is licensed under the GNU General Public License version 2.0. For more
information, see the file 'COPYING' included with every release and source
@@ -71,49 +72,71 @@ download of the game.
%setup -q
%build
# suse sle <10 has no support for makedepend
%if 0%{?sles_version} == 9 || 0%{?sles_version} == 10
%define do_makedepend 0
%else
%define do_makedepend 1
%endif
./configure \
--revision=%{version} \
--prefix-dir="%{_prefix}" \
--binary-dir="bin" \
--binary-name="%{name}" \
--enable-strip \
--binary-dir="bin" \
--data-dir="share/%{name}" \
--with-makedepend="%{do_makedepend}" \
# --revision="%{ver}%{?prever:-%{prever}}" \
# --enable-debug=0 \
# --with-sdl \
# --with-zlib \
# --with-png \
# --with-freetype \
# --with-fontconfig \
# --with-icu \
# --menu_group="Game;" \
# --menu-name="OpenTTD" \
# --data-dir="share\games\%{name}" \
# --doc-dir="share\doc\%{name}" \
# --icon-dir="share/pixmaps" \
# --icon-theme-dir="share/icons/hicolor" \
# --man-dir="share/man/man6" \
# --menu-dir="share/applications" \
--enable-debug=0 \
# --menu_group="Game;" \
--with-sdl \
--with-zlib \
--with-png \
--with-freetype \
--with-fontconfig \
--with-icu \
--enable-strip
# --menu-dir="share/applications"
make %{?_smp_mflags}
%install
rm -rf "%{buildroot}"
make install INSTALL_DIR="%{buildroot}"
# Validate menu entrys (vendor specific)
%if %{_vendor} == "redhat" || %{_vendor}=="fedora"
desktop-file-install \
# --delete-original \
--vendor="%{_vendor}" \
--remove-key Version \
--dir="%{buildroot}/%{_datadir}/applications/" \
"%{buildroot}/%{_datadir}/applications/%{name}.desktop"
"%{buildroot}/%{_datadir}/applications/%{name}.desktop" \
# --delete-original
%endif
%if %{_vendor}=="suse"
%__cat > %{name}.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=OpenTTD
Comment=OpenTTD - A clone of the Microprose game 'Transport Tycoon Deluxe'
GenericName=OpenTTD
Type=Application
Terminal=false
Exec=%{name}
Icon=%{name}
Categories=Game;StrategyGame;
EOF
%suse_update_desktop_file -i %{name} Game StrategyGame
%endif
%clean
rm -rf "%{buildroot}"
#rm -rf "%{buildroot}"
%post
# Update the icon cache (vendor specific)
%if %{_vendor}=="MandrakeSoft" || %{_vendor}=="mandriva"
%if %{_vendor}=="mandriva"
%update_icon_cache hicolor
%endif
@@ -126,7 +149,7 @@ fi
%postun
# Update the icon cache (vendor specific)
%if %{_vendor}=="MandrakeSoft" || %{_vendor}=="mandriva"
%if %{_vendor}=="mandriva"
%update_icon_cache hicolor
%endif
@@ -140,37 +163,39 @@ fi
%files
%defattr(-, root, games, -)
%dir %{_datadir}/doc/%{name}
%dir %{_datadir}/games/%{name}
%dir %{_datadir}/games/%{name}/lang
%dir %{_datadir}/games/%{name}/data
%dir %{_datadir}/games/%{name}/gm
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/lang
%dir %{_datadir}/%{name}/data
%dir %{_datadir}/%{name}/gm
%dir %{_datadir}/%{name}/scripts
%attr(755, root, games) %{_bindir}/%{name}
%{_datadir}/doc/%{name}/*
%{_datadir}/games/%{name}/lang/*
%{_datadir}/games/%{name}/data/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}/lang/*
%{_datadir}/%{name}/data/*
%{_datadir}/%{name}/scripts/*
%{_datadir}/applications/*%{name}.desktop
%{_datadir}/pixmaps/*
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%doc %{_mandir}/man6/%{name}.6.gz
%{_datadir}/icons/*
%doc %{_mandir}/man6/%{name}.6.*
%changelog
* Mon Oct 20 2008 Benedikt Brüggemeier <skidd13@openttd.org>
* Sat Sep 26 2009 Marcel Gmür <ammler@openttdcoop.org> - 0.7.2
- no subfolder games for datadir
- cleanup: no post and postun anymore
- Recommends: opengfx (for suse and mandriva)
- add SUSE support
* Mon Oct 20 2008 Benedikt Brüggemeier <skidd13@openttd.org>
- Added libicu dependency
* Thu Sep 23 2008 Benedikt Brüggemeier <skidd13@openttd.org>
- Merged both versions of the spec file
* Fri Aug 29 2008 Jonathan Coome <maedhros@openttd.org>
- Rewrite spec file from scratch.
* Sat Aug 02 2008 Benedikt Brüggemeier <skidd13@openttd.org>
- Updated spec file
* Thu Mar 27 2008 Denis Burlaka <burlaka@yandex.ru>
- Universal spec file

View File

@@ -1,11 +1,11 @@
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.7.0" ; Define application version
!define INSTALLERVERSION 55 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPVERSION "0.7.3" ; Define application version
!define APPVERSIONINTERNAL "0.7.3.0" ; Define application version in X.X.X.X
!define INSTALLERVERSION 68 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define APPVERSIONINTERNAL "${APPVERSION}.0" ; Needs to be of the format X.X.X.X
!define MUI_ICON "..\..\..\media\openttd.ico"
!define MUI_UNICON "..\..\..\media\openttd.ico"
@@ -71,10 +71,6 @@ Page custom SelectCDEnter SelectCDExit ": TTD folder"
!insertmacro MUI_PAGE_INSTFILES
;-----------------------------------------------------
; New custom page to show UNICODE and MSLU information
Page custom ShowWarningsPage
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!"
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe"
@@ -112,13 +108,6 @@ Section "!OpenTTD" Section1
File ${PATH_ROOT}bin\data\*.grf
File ${PATH_ROOT}bin\data\*.obg
File ${PATH_ROOT}bin\data\opntitle.dat
; Copy scenario files (don't choke if they don't exist)
SetOutPath "$INSTDIR\scenario\"
File /nonfatal ${PATH_ROOT}bin\scenario\*.scn
; Copy heightmap files (don't choke if they don't exist)
SetOutPath "$INSTDIR\scenario\heightmap\"
File /nonfatal ${PATH_ROOT}bin\scenario\heightmap\*.*
; Copy the scripts
SetOutPath "$INSTDIR\scripts\"
@@ -140,7 +129,6 @@ Section "!OpenTTD" Section1
; Delete old files from the main dir. they are now placed in data/ and lang/
Delete "$INSTDIR\*.lng"
Delete "$INSTDIR\*.grf"
Delete "$INSTDIR\*.obg"
Delete "$INSTDIR\sample.cat"
Delete "$INSTDIR\ttd.exe"
@@ -379,23 +367,6 @@ WinNT:
ClearErrors
FunctionEnd
;----------------------------------------------------------------------------------
; Custom page function to show notices for running OpenTTD (only for win32 systems)
; We have extracted this custom page as Notice in the .onInit function
Function ShowWarningsPage
Call GetWindowsVersion
Pop $R0
; Don't show the UNICODE notice if the installer is run on Win9x systems
StrCmp $R0 "win9x" 0 WinNT
Abort
WinNT:
!insertmacro MUI_HEADER_TEXT "Installation Complete" "Important notices for OpenTTD usage."
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "notice.ini" "Notice"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "Notice"
ClearErrors
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd
;-------------------------------------------------------------------------------
; Determine windows version, returns "win9x" if Win9x/Me or "winnt" on the stack
Function GetWindowsVersion

View File

@@ -1,30 +0,0 @@
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=3
CancelEnabled=0
[Field 1]
Type=Groupbox
Text=UNICODE support
Left=8
Right=292
Top=0
Bottom=75
[Field 2]
Type=Label
Text=This version of OpenTTD has support for UNICODE, allowing users to use non-ASCII character sets such as Russian or Japanese.\r\nSelecting such a language will result in an unusable and garbled interface. You will need to specify a font that has support for these characters in openttd.cfg, or alternatively use an appropiate grf file.\r\n\r\nFor more information please refer to the readme or the wiki.
Left=13
Right=284
Top=9
Bottom=65
[Field 3]
Type=Link
Text=OpenTTD wiki
Left=238
Right=284
Top=64
Bottom=72
State=http://wiki.openttd.org/index.php/Unicode

View File

@@ -16,10 +16,10 @@ End Sub
Sub UpdateFile(modified, revision, version, cur_date, filename)
FSO.CopyFile filename & ".in", filename
FindReplaceInFile filename, "@@MODIFIED@@", modified
FindReplaceInFile filename, "@@REVISION@@", revision
FindReplaceInFile filename, "@@VERSION@@", version
FindReplaceInFile filename, "@@DATE@@", cur_date
FindReplaceInFile filename, "!!MODIFIED!!", modified
FindReplaceInFile filename, "!!REVISION!!", revision
FindReplaceInFile filename, "!!VERSION!!", version
FindReplaceInFile filename, "!!DATE!!", cur_date
End Sub
Sub UpdateFiles(version)
@@ -32,6 +32,7 @@ Sub UpdateFiles(version)
modified = Mid(version, InStrRev(version, Chr(9)) + 1)
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
Else
version = "0.7.3"
revision = 0
modified = 1
End If

View File

@@ -153,7 +153,7 @@ load_lang_data() {
Name=\"VCCustomBuildTool\"
Description=\"Generating "$i" language file\"
CommandLine=\"..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang &quot;\$(InputPath)&quot;&#x0D;&#x0A;\"
AdditionalDependencies=\"\"
AdditionalDependencies=\"..\\src\\lang\\english.txt\"
Outputs=\"..\\bin\\lang\\"$i".lng\"
/>
</FileConfiguration>

View File

@@ -203,7 +203,7 @@ Function load_lang_data(dir)
& vbCrLf & " Name=" & Chr(34) & "VCCustomBuildTool" & Chr(34) _
& vbCrLf & " Description=" & Chr(34) & "Generating " & file & " language file" & Chr(34) _
& vbCrLf & " CommandLine=" & Chr(34) & "..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;" & Chr(34) _
& vbCrLf & " AdditionalDependencies=" & Chr(34) & Chr(34) _
& vbCrLf & " AdditionalDependencies=" & Chr(34) & "..\src\lang\english.txt" & Chr(34) _
& vbCrLf & " Outputs=" & Chr(34) & "..\bin\lang\" & file & ".lng" & Chr(34) _
& vbCrLf & " />" _
& vbCrLf & " </FileConfiguration>" _

View File

@@ -56,7 +56,7 @@
Name="VCCustomBuildTool"
Description="Generating afrikaans language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\afrikaans.lng"
/>
</FileConfiguration>
@@ -71,7 +71,7 @@
Name="VCCustomBuildTool"
Description="Generating arabic_egypt language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\arabic_egypt.lng"
/>
</FileConfiguration>
@@ -86,7 +86,7 @@
Name="VCCustomBuildTool"
Description="Generating brazilian_portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\brazilian_portuguese.lng"
/>
</FileConfiguration>
@@ -101,7 +101,7 @@
Name="VCCustomBuildTool"
Description="Generating bulgarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\bulgarian.lng"
/>
</FileConfiguration>
@@ -116,7 +116,7 @@
Name="VCCustomBuildTool"
Description="Generating catalan language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\catalan.lng"
/>
</FileConfiguration>
@@ -131,7 +131,7 @@
Name="VCCustomBuildTool"
Description="Generating croatian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\croatian.lng"
/>
</FileConfiguration>
@@ -146,7 +146,7 @@
Name="VCCustomBuildTool"
Description="Generating czech language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\czech.lng"
/>
</FileConfiguration>
@@ -161,7 +161,7 @@
Name="VCCustomBuildTool"
Description="Generating danish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\danish.lng"
/>
</FileConfiguration>
@@ -176,7 +176,7 @@
Name="VCCustomBuildTool"
Description="Generating dutch language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\dutch.lng"
/>
</FileConfiguration>
@@ -191,7 +191,7 @@
Name="VCCustomBuildTool"
Description="Generating english language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\english.lng"
/>
</FileConfiguration>
@@ -206,7 +206,7 @@
Name="VCCustomBuildTool"
Description="Generating english_US language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\english_US.lng"
/>
</FileConfiguration>
@@ -221,7 +221,7 @@
Name="VCCustomBuildTool"
Description="Generating esperanto language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\esperanto.lng"
/>
</FileConfiguration>
@@ -236,7 +236,7 @@
Name="VCCustomBuildTool"
Description="Generating estonian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\estonian.lng"
/>
</FileConfiguration>
@@ -251,7 +251,7 @@
Name="VCCustomBuildTool"
Description="Generating finnish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\finnish.lng"
/>
</FileConfiguration>
@@ -266,7 +266,7 @@
Name="VCCustomBuildTool"
Description="Generating french language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\french.lng"
/>
</FileConfiguration>
@@ -281,7 +281,7 @@
Name="VCCustomBuildTool"
Description="Generating galician language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\galician.lng"
/>
</FileConfiguration>
@@ -296,7 +296,7 @@
Name="VCCustomBuildTool"
Description="Generating german language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\german.lng"
/>
</FileConfiguration>
@@ -311,7 +311,7 @@
Name="VCCustomBuildTool"
Description="Generating hebrew language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\hebrew.lng"
/>
</FileConfiguration>
@@ -326,7 +326,7 @@
Name="VCCustomBuildTool"
Description="Generating hungarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\hungarian.lng"
/>
</FileConfiguration>
@@ -341,7 +341,7 @@
Name="VCCustomBuildTool"
Description="Generating icelandic language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\icelandic.lng"
/>
</FileConfiguration>
@@ -356,7 +356,7 @@
Name="VCCustomBuildTool"
Description="Generating indonesian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\indonesian.lng"
/>
</FileConfiguration>
@@ -371,7 +371,7 @@
Name="VCCustomBuildTool"
Description="Generating italian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\italian.lng"
/>
</FileConfiguration>
@@ -386,7 +386,7 @@
Name="VCCustomBuildTool"
Description="Generating japanese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\japanese.lng"
/>
</FileConfiguration>
@@ -401,7 +401,7 @@
Name="VCCustomBuildTool"
Description="Generating korean language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\korean.lng"
/>
</FileConfiguration>
@@ -416,7 +416,7 @@
Name="VCCustomBuildTool"
Description="Generating latvian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\latvian.lng"
/>
</FileConfiguration>
@@ -431,7 +431,7 @@
Name="VCCustomBuildTool"
Description="Generating lithuanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\lithuanian.lng"
/>
</FileConfiguration>
@@ -446,7 +446,7 @@
Name="VCCustomBuildTool"
Description="Generating luxembourgish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\luxembourgish.lng"
/>
</FileConfiguration>
@@ -461,7 +461,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_bokmal language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\norwegian_bokmal.lng"
/>
</FileConfiguration>
@@ -476,7 +476,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_nynorsk language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\norwegian_nynorsk.lng"
/>
</FileConfiguration>
@@ -491,7 +491,7 @@
Name="VCCustomBuildTool"
Description="Generating piglatin language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\piglatin.lng"
/>
</FileConfiguration>
@@ -506,7 +506,7 @@
Name="VCCustomBuildTool"
Description="Generating polish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\polish.lng"
/>
</FileConfiguration>
@@ -521,7 +521,7 @@
Name="VCCustomBuildTool"
Description="Generating portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\portuguese.lng"
/>
</FileConfiguration>
@@ -536,7 +536,7 @@
Name="VCCustomBuildTool"
Description="Generating romanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\romanian.lng"
/>
</FileConfiguration>
@@ -551,11 +551,26 @@
Name="VCCustomBuildTool"
Description="Generating russian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\russian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\serbian.txt"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating serbian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\serbian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\simplified_chinese.txt"
>
@@ -566,7 +581,7 @@
Name="VCCustomBuildTool"
Description="Generating simplified_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\simplified_chinese.lng"
/>
</FileConfiguration>
@@ -581,7 +596,7 @@
Name="VCCustomBuildTool"
Description="Generating slovak language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\slovak.lng"
/>
</FileConfiguration>
@@ -596,7 +611,7 @@
Name="VCCustomBuildTool"
Description="Generating slovenian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\slovenian.lng"
/>
</FileConfiguration>
@@ -611,7 +626,7 @@
Name="VCCustomBuildTool"
Description="Generating spanish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\spanish.lng"
/>
</FileConfiguration>
@@ -626,7 +641,7 @@
Name="VCCustomBuildTool"
Description="Generating swedish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\swedish.lng"
/>
</FileConfiguration>
@@ -641,7 +656,7 @@
Name="VCCustomBuildTool"
Description="Generating traditional_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\traditional_chinese.lng"
/>
</FileConfiguration>
@@ -656,7 +671,7 @@
Name="VCCustomBuildTool"
Description="Generating turkish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\turkish.lng"
/>
</FileConfiguration>
@@ -671,7 +686,7 @@
Name="VCCustomBuildTool"
Description="Generating ukrainian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\ukrainian.lng"
/>
</FileConfiguration>
@@ -686,7 +701,7 @@
Name="VCCustomBuildTool"
Description="Generating welsh language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\welsh.lng"
/>
</FileConfiguration>

View File

@@ -57,7 +57,7 @@
Name="VCCustomBuildTool"
Description="Generating afrikaans language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\afrikaans.lng"
/>
</FileConfiguration>
@@ -72,7 +72,7 @@
Name="VCCustomBuildTool"
Description="Generating arabic_egypt language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\arabic_egypt.lng"
/>
</FileConfiguration>
@@ -87,7 +87,7 @@
Name="VCCustomBuildTool"
Description="Generating brazilian_portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\brazilian_portuguese.lng"
/>
</FileConfiguration>
@@ -102,7 +102,7 @@
Name="VCCustomBuildTool"
Description="Generating bulgarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\bulgarian.lng"
/>
</FileConfiguration>
@@ -117,7 +117,7 @@
Name="VCCustomBuildTool"
Description="Generating catalan language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\catalan.lng"
/>
</FileConfiguration>
@@ -132,7 +132,7 @@
Name="VCCustomBuildTool"
Description="Generating croatian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\croatian.lng"
/>
</FileConfiguration>
@@ -147,7 +147,7 @@
Name="VCCustomBuildTool"
Description="Generating czech language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\czech.lng"
/>
</FileConfiguration>
@@ -162,7 +162,7 @@
Name="VCCustomBuildTool"
Description="Generating danish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\danish.lng"
/>
</FileConfiguration>
@@ -177,7 +177,7 @@
Name="VCCustomBuildTool"
Description="Generating dutch language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\dutch.lng"
/>
</FileConfiguration>
@@ -192,7 +192,7 @@
Name="VCCustomBuildTool"
Description="Generating english language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\english.lng"
/>
</FileConfiguration>
@@ -207,7 +207,7 @@
Name="VCCustomBuildTool"
Description="Generating english_US language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\english_US.lng"
/>
</FileConfiguration>
@@ -222,7 +222,7 @@
Name="VCCustomBuildTool"
Description="Generating esperanto language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\esperanto.lng"
/>
</FileConfiguration>
@@ -237,7 +237,7 @@
Name="VCCustomBuildTool"
Description="Generating estonian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\estonian.lng"
/>
</FileConfiguration>
@@ -252,7 +252,7 @@
Name="VCCustomBuildTool"
Description="Generating finnish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\finnish.lng"
/>
</FileConfiguration>
@@ -267,7 +267,7 @@
Name="VCCustomBuildTool"
Description="Generating french language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\french.lng"
/>
</FileConfiguration>
@@ -282,7 +282,7 @@
Name="VCCustomBuildTool"
Description="Generating galician language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\galician.lng"
/>
</FileConfiguration>
@@ -297,7 +297,7 @@
Name="VCCustomBuildTool"
Description="Generating german language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\german.lng"
/>
</FileConfiguration>
@@ -312,7 +312,7 @@
Name="VCCustomBuildTool"
Description="Generating hebrew language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\hebrew.lng"
/>
</FileConfiguration>
@@ -327,7 +327,7 @@
Name="VCCustomBuildTool"
Description="Generating hungarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\hungarian.lng"
/>
</FileConfiguration>
@@ -342,7 +342,7 @@
Name="VCCustomBuildTool"
Description="Generating icelandic language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\icelandic.lng"
/>
</FileConfiguration>
@@ -357,7 +357,7 @@
Name="VCCustomBuildTool"
Description="Generating indonesian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\indonesian.lng"
/>
</FileConfiguration>
@@ -372,7 +372,7 @@
Name="VCCustomBuildTool"
Description="Generating italian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\italian.lng"
/>
</FileConfiguration>
@@ -387,7 +387,7 @@
Name="VCCustomBuildTool"
Description="Generating japanese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\japanese.lng"
/>
</FileConfiguration>
@@ -402,7 +402,7 @@
Name="VCCustomBuildTool"
Description="Generating korean language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\korean.lng"
/>
</FileConfiguration>
@@ -417,7 +417,7 @@
Name="VCCustomBuildTool"
Description="Generating latvian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\latvian.lng"
/>
</FileConfiguration>
@@ -432,7 +432,7 @@
Name="VCCustomBuildTool"
Description="Generating lithuanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\lithuanian.lng"
/>
</FileConfiguration>
@@ -447,7 +447,7 @@
Name="VCCustomBuildTool"
Description="Generating luxembourgish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\luxembourgish.lng"
/>
</FileConfiguration>
@@ -462,7 +462,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_bokmal language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\norwegian_bokmal.lng"
/>
</FileConfiguration>
@@ -477,7 +477,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_nynorsk language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\norwegian_nynorsk.lng"
/>
</FileConfiguration>
@@ -492,7 +492,7 @@
Name="VCCustomBuildTool"
Description="Generating piglatin language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\piglatin.lng"
/>
</FileConfiguration>
@@ -507,7 +507,7 @@
Name="VCCustomBuildTool"
Description="Generating polish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\polish.lng"
/>
</FileConfiguration>
@@ -522,7 +522,7 @@
Name="VCCustomBuildTool"
Description="Generating portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\portuguese.lng"
/>
</FileConfiguration>
@@ -537,7 +537,7 @@
Name="VCCustomBuildTool"
Description="Generating romanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\romanian.lng"
/>
</FileConfiguration>
@@ -552,11 +552,26 @@
Name="VCCustomBuildTool"
Description="Generating russian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\russian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\serbian.txt"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating serbian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\serbian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\simplified_chinese.txt"
>
@@ -567,7 +582,7 @@
Name="VCCustomBuildTool"
Description="Generating simplified_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\simplified_chinese.lng"
/>
</FileConfiguration>
@@ -582,7 +597,7 @@
Name="VCCustomBuildTool"
Description="Generating slovak language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\slovak.lng"
/>
</FileConfiguration>
@@ -597,7 +612,7 @@
Name="VCCustomBuildTool"
Description="Generating slovenian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\slovenian.lng"
/>
</FileConfiguration>
@@ -612,7 +627,7 @@
Name="VCCustomBuildTool"
Description="Generating spanish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\spanish.lng"
/>
</FileConfiguration>
@@ -627,7 +642,7 @@
Name="VCCustomBuildTool"
Description="Generating swedish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\swedish.lng"
/>
</FileConfiguration>
@@ -642,7 +657,7 @@
Name="VCCustomBuildTool"
Description="Generating traditional_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\traditional_chinese.lng"
/>
</FileConfiguration>
@@ -657,7 +672,7 @@
Name="VCCustomBuildTool"
Description="Generating turkish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\turkish.lng"
/>
</FileConfiguration>
@@ -672,7 +687,7 @@
Name="VCCustomBuildTool"
Description="Generating ukrainian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\ukrainian.lng"
/>
</FileConfiguration>
@@ -687,7 +702,7 @@
Name="VCCustomBuildTool"
Description="Generating welsh language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\welsh.lng"
/>
</FileConfiguration>

View File

@@ -60,7 +60,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -103,6 +103,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="1"
@@ -201,6 +203,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="1"
/>
<Tool
@@ -269,7 +273,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -312,6 +316,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="17"
@@ -413,6 +419,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool
@@ -947,6 +955,10 @@
RelativePath=".\..\src\driver.h"
>
</File>
<File
RelativePath=".\..\src\economy_base.h"
>
</File>
<File
RelativePath=".\..\src\economy_func.h"
>
@@ -2551,6 +2563,10 @@
RelativePath=".\..\src\ai\api\ai_cargolist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_changelog.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_company.hpp"
>
@@ -2619,6 +2635,10 @@
RelativePath=".\..\src\ai\api\ai_industrytypelist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_info_docs.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_list.hpp"
>
@@ -2659,6 +2679,10 @@
RelativePath=".\..\src\ai\api\ai_sign.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_signlist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_station.hpp"
>
@@ -2863,6 +2887,10 @@
RelativePath=".\..\src\ai\api\ai_sign.cpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_signlist.cpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_station.cpp"
>

View File

@@ -60,7 +60,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -103,6 +103,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="1"
@@ -201,6 +203,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="1"
/>
<Tool
@@ -269,7 +273,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -312,6 +316,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="17"
@@ -413,6 +419,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool

View File

@@ -61,7 +61,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -104,6 +104,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -200,6 +202,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
@@ -267,7 +271,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -310,6 +314,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
TargetMachine="17"
/>
@@ -410,6 +416,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool
@@ -944,6 +952,10 @@
RelativePath=".\..\src\driver.h"
>
</File>
<File
RelativePath=".\..\src\economy_base.h"
>
</File>
<File
RelativePath=".\..\src\economy_func.h"
>
@@ -2548,6 +2560,10 @@
RelativePath=".\..\src\ai\api\ai_cargolist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_changelog.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_company.hpp"
>
@@ -2616,6 +2632,10 @@
RelativePath=".\..\src\ai\api\ai_industrytypelist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_info_docs.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_list.hpp"
>
@@ -2656,6 +2676,10 @@
RelativePath=".\..\src\ai\api\ai_sign.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_signlist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_station.hpp"
>
@@ -2860,6 +2884,10 @@
RelativePath=".\..\src\ai\api\ai_sign.cpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_signlist.cpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_station.cpp"
>

View File

@@ -61,7 +61,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -104,6 +104,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -200,6 +202,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
@@ -267,7 +271,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -310,6 +314,8 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
TargetMachine="17"
/>
@@ -410,6 +416,8 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool

View File

@@ -1,6 +1,6 @@
OpenTTD README
Last updated: 2009-03-10
Release version: 0.7.0-beta2
Last updated: 2009-10-01
Release version: 0.7.3
------------------------------------------------------------------------
@@ -17,6 +17,7 @@ Table of Contents:
5.0) OpenTTD features
6.0) Configuration File
7.0) Compiling
* 7.1) Required/optional libraries
8.0) Translating
* 8.1 Guidelines
* 8.2 Translation
@@ -48,25 +49,41 @@ http://forum.openttd.org/
2.1) Reporting Bugs:
---- ---------------
To report a bug, please create a Flyspray account and follow the bugs
link from our homepage. Please make sure the bug is reproducible and
still occurs in the latest daily build or the current SVN version. Also
please look through the existing bug reports briefly to see whether the bug
is not already known.
First of all, check whether the bug is not already known. Do this by looking
through the file called 'known-bugs.txt' which is distributed with OpenTTD
like this readme.
The Flyspray project page URL is: http://bugs.openttd.org/
For tracking our bugs we are using a bug tracker called Flyspray. You can find
the tracker at http://bugs.openttd.org/. Before actually reporting take a look
through the already reported bugs there to see if the bug is already known.
The 'known-bugs.txt' file might be a bit outdated at the moment you are
reading it as only bugs known before the release are documented there. Also
look through the recently closed bugs.
Please include the following information in your bug report:
- OpenTTD version (PLEASE test the latest SVN/nightly build)
- Bug details, including instructions how to reproduce it
- Platform and compiler (Win32, Linux, FreeBSD, ...)
- Attach a saved game *and* a screenshot if possible
- If this bug only occurred recently please note the last
version without the bug and the first version including
the bug. That way we can fix it quicker by looking at the
changes made.
- Attach crash.dmp, crash.log and crash.sav from the data
directory if they exist.
When you are sure it is not already reported you should:
* Make sure you are running a recent version, i.e. run the latest stable or
nightly based on where you found the bug.
* Make sure you are not running a non-official binary, like a patch pack.
When you are playing with a patch pack you should report any bugs to the
forum thread related to that patch pack.
* Make it reproducable for the developers. In other words, create a savegame
in which you can reproduce the issue once loaded. It is very useful to give
us the crash.dmp, crash.sav and crash.log which are created on crashes.
* Check whether the bug is already reported on our bug tracker. This includes
searching for recently closed bug reports as the bug might already be fixed.
After you have done all that you can report the bug. Please include the
following information in your bug report:
* OpenTTD version (PLEASE test the latest SVN/nightly build)
* Bug details, including instructions how to reproduce it
* Platform (Win32, Linux, FreeBSD, ...) and compiler (including version) if
you compiled OpenTTD yourself.
* Attach a saved game *and* a screenshot if possible
* If this bug only occurred recently please note the last version without
the bug and the first version including the bug. That way we can fix it
quicker by looking at the changes made.
* Attach crash.dmp, crash.log and crash.sav. These files are usually created
next to your openttd.cfg. The crash handler will tell you the location.
2.2) Reporting Desyncs:
---- ------------------
@@ -191,6 +208,19 @@ Do NOT copy files included with OpenTTD into "shared" directories (explained in
the following sections) as sooner or later you will run into graphical glitches
when using other versions of the game.
If you want AIs use the in-game content downloader. If for some reason that is
not possible or you want to use an AI that has not been uploaded to the content
download system download the tar file and place it in the ai/ directory. If the
AI needs libraries you'll have to download those too and put them in the
ai/library/ directory. All AIs and AI Libraries that have been uploaded to
the content download system can be found at http://noai.openttd.org/downloads/
The AIs and libraries can be found their in the form of .tar.gz packages.
OpenTTD can read inside tar files but it does not extract .tar.gz files by
itself.
To figure out which libraries you need for an AI you have to start the AI and
wait for an error message to pop up. The error message will tell you
"couldn't find library 'lib-name'". Download that library and try again.
4.2) OpenTTD directories
---- -------------------------------
@@ -253,8 +283,8 @@ features known from TTDPatch (http://www.ttdpatch.net/).
Several important non-standard controls:
* Ctrl makes much commands more powerful. For example Ctrl clicking on signals
with the build signal tool on signals changes their behaviour.
* Ctrl makes many commands more powerful. For example Ctrl clicking on signals
with the build signal tool changes their behaviour.
* Ingame console. More information at
http://wiki.openttd.org/index.php/Console
* Right clicking shows tooltips
@@ -316,18 +346,12 @@ Windows:
You can also build it using the Makefile with MSYS/MinGW or Cygwin/MinGW.
Please read the Makefile for more information.
Solaris 10:
You need g++ (version 3 or higher), together with SDL. Installation of
libpng and zlib is recommended. For the first build it is required
to execute "bash configure" first. Note that ./configure does not work
yet. It is likely that you don't have a strip binary, so use the
--disable-strip option in that case. Fontconfig (>2.3.0) and freetype
are optional. "make run" will then run the program.
Solaris, FreeBSD, OpenBSD:
Use "gmake", but do a "./configure" before the first build.
Unix:
Linux/Unix:
OpenTTD can be built with GNU "make". On non-GNU systems it's called "gmake".
However, for the first build one has to do a "./configure" first.
Note that you need SDL-devel 1.2.5 (or higher) to compile OpenTTD.
MacOS X:
Use "make" or Xcode (which will then call make for you)
@@ -339,15 +363,6 @@ MacOS X:
BeOS:
Use "make", but do a "./configure" before the first build.
FreeBSD:
You need the port devel/sdl12 for a non-dedicated build.
graphics/png is optional for screenshots in the PNG format.
Use "gmake", but do a "./configure" before the first build.
OpenBSD:
Use "gmake", but do a "./configure" before the first build.
Note that you need the port devel/sdl to compile OpenTTD.
MorphOS:
Use "make". However, for the first build one has to do a "./configure" first.
Note that you need the MorphOS SDK, latest libnix updates (else C++ parts of
@@ -368,6 +383,8 @@ DOS:
will be generated that does not need cwsdpmi.exe by adding the cswdstub.exe
to the created OpenTTD binary.
7.1) Required/optional libraries:
---- -------------------
The following libraries are used by OpenTTD for:
- libSDL/liballegro: hardware access (video, sound, mouse)
- zlib: (de)compressing of savegames
@@ -376,15 +393,18 @@ The following libraries are used by OpenTTD for:
- libfontconfig: searching for fonts, resolving font names to actual fonts
- libicu: handling of right-to-left scripts (e.g. Arabic and Persian)
OpenTTD does not require any of the libraries to be present, but without
zlib you cannot open most savegames or use the content downloading system.
Without libSDL/liballegro on non-Windows and non-MacOS X machines you have
no graphical user interface; you would be building a dedicated server.
8.0) Translating:
---- -------------------
See http://www.openttd.org/development for up-to-date information.
The use of the online Translator service, located at
http://translator2.openttd.org/, is highly encouraged. For a username/password
combo you should contact the development team, either by mail, IRC or the
forums. The system is straightforward to use, and if you have any problems,
read the online help located there.
http://translator.openttd.org/, is highly encouraged. For getting an account
simply follow the guidelines in the FAQ of the translator website.
If for some reason the website is down for a longer period of time, the
information below might be of help.
@@ -479,14 +499,14 @@ The OpenTTD team (in alphabetical order):
Owen Rudge (orudge) - Forum host, OS/2 port
Peter Nelson (peter1138) - Spiritual descendant from newGRF gods
Remko Bijker (Rubidium) - Lead coder and way more
Zdenek Sojka (SmatZ) - Bug finder and fixer
Zdeněk Sojka (SmatZ) - Bug finder and fixer
Thijs Marinussen (Yexo) - AI Framework
Inactive Developers:
Tamás Faragó (Darkvater) - Ex-Lead coder
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)
Jonathan Coome (Maedhros) - High priest of the NewGRF Temple
Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host
Attila Bán (MiHaMiX) - WebTranslator 1 and 2
Christoph Mallon (Tron) - Programmer, code correctness police
Retired Developers:
@@ -494,12 +514,12 @@ Retired Developers:
Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)
Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)
Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker
Patric Stout (TrueLight) - Programmer, webhoster (0.3 - pre0.7)
Patric Stout (TrueLight) - Programmer (0.3 - pre0.7), sys op (active)
Thanks to:
Josef Drexler - For his great work on TTDPatch.
Marcin Grzegorczyk - For his TTDPatch work and documentation of TTD internals and graphics (signals and track foundations)
Petr Baudis (pasky) - Many patches, newgrf support, etc.
Petr Baudiš (pasky) - Many patches, newgrf support, etc.
Simon Sasburg (HackyKid) - For the many bugfixes he has blessed us with
Stefan Meißner (sign_de) - For his work on the console
Mike Ragsdale - OpenTTD installer
@@ -507,6 +527,8 @@ Thanks to:
Christian Rosentreter (tokai) - MorphOS / AmigaOS port
Richard Kempton (RichK67) - Additional airports, initial TGP implementation
Alberto Demichelis - Squirrel scripting language
Markus F.X.J. Oberhumer - MiniLZO for loading old savegames
L. Peter Deutsch - MD5 implementation
Michael Blunck - For revolutionizing TTD with awesome graphics
George - Canal graphics
David Dallaston (Pikka) - Tram tracks

View File

@@ -167,6 +167,7 @@ direction_func.h
direction_type.h
music/dmusic.h
driver.h
economy_base.h
economy_func.h
economy_type.h
effectvehicle_base.h
@@ -593,6 +594,7 @@ ai/api/ai_bridge.hpp
ai/api/ai_bridgelist.hpp
ai/api/ai_cargo.hpp
ai/api/ai_cargolist.hpp
ai/api/ai_changelog.hpp
ai/api/ai_company.hpp
ai/api/ai_controller.hpp
ai/api/ai_date.hpp
@@ -610,6 +612,7 @@ ai/api/ai_industry.hpp
ai/api/ai_industrylist.hpp
ai/api/ai_industrytype.hpp
ai/api/ai_industrytypelist.hpp
ai/api/ai_info_docs.hpp
ai/api/ai_list.hpp
ai/api/ai_log.hpp
ai/api/ai_map.hpp
@@ -620,6 +623,7 @@ ai/api/ai_rail.hpp
ai/api/ai_railtypelist.hpp
ai/api/ai_road.hpp
ai/api/ai_sign.hpp
ai/api/ai_signlist.hpp
ai/api/ai_station.hpp
ai/api/ai_stationlist.hpp
ai/api/ai_subsidy.hpp
@@ -672,6 +676,7 @@ ai/api/ai_rail.cpp
ai/api/ai_railtypelist.cpp
ai/api/ai_road.cpp
ai/api/ai_sign.cpp
ai/api/ai_signlist.cpp
ai/api/ai_station.cpp
ai/api/ai_stationlist.cpp
ai/api/ai_subsidy.cpp

View File

@@ -275,6 +275,7 @@ typedef struct tagSQRegFunction{
}SQRegFunction;
/*vm*/
SQUIRREL_API bool sq_can_suspend(HSQUIRRELVM v);
SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize);
SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize);
SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);
@@ -285,6 +286,7 @@ SQUIRREL_API void sq_setprintfunc(HSQUIRRELVM v, SQPRINTFUNCTION printfunc);
SQUIRREL_API SQPRINTFUNCTION sq_getprintfunc(HSQUIRRELVM v);
SQUIRREL_API SQRESULT sq_suspendvm(HSQUIRRELVM v);
SQUIRREL_API bool sq_resumecatch(HSQUIRRELVM v, int suspend = -1);
SQUIRREL_API bool sq_resumeerror(HSQUIRRELVM v);
SQUIRREL_API SQRESULT sq_wakeupvm(HSQUIRRELVM v,SQBool resumedret,SQBool retval,SQBool raiseerror);
SQUIRREL_API SQInteger sq_getvmstate(HSQUIRRELVM v);

View File

@@ -90,6 +90,11 @@ SQInteger sq_getvmstate(HSQUIRRELVM v)
}
}
bool sq_can_suspend(HSQUIRRELVM v)
{
return v->_nnativecalls <= 2;
}
void sq_seterrorhandler(HSQUIRRELVM v)
{
SQObject o = stack_get(v, -1);
@@ -1005,6 +1010,14 @@ bool sq_resumecatch(HSQUIRRELVM v, int suspend)
return v->Execute(_null_, v->_top, -1, -1, ret, SQTrue, SQVM::ET_RESUME_OPENTTD);
}
bool sq_resumeerror(HSQUIRRELVM v)
{
SQObjectPtr ret;
v->_can_suspend = true;
v->_ops_till_suspend = 1;
return v->Execute(_null_, v->_top, -1, -1, ret, SQTrue, SQVM::ET_RESUME_THROW_VM);
}
void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook)
{
if(sq_gettop(v) >= 1){

View File

@@ -128,7 +128,17 @@ public:
}
void Release() {
_uiRef++;
if (_hook) { _hook(_userpointer,0);}
try {
if (_hook) { _hook(_userpointer,0);}
} catch (...) {
_uiRef--;
if (_uiRef == 0) {
SQInteger size = _memsize;
this->~SQInstance();
SQ_FREE(this, size);
}
throw;
}
_uiRef--;
if(_uiRef > 0) return;
SQInteger size = _memsize;

View File

@@ -1110,6 +1110,23 @@ public:
case TK_STRING_LITERAL:
val = _fs->CreateString(_lex._svalue,_lex._longstr.size()-1);
break;
case '-':
Lex();
switch(_token)
{
case TK_INTEGER:
val._type = OT_INTEGER;
val._unVal.nInteger = -_lex._nvalue;
break;
case TK_FLOAT:
val._type = OT_FLOAT;
val._unVal.fFloat = -_lex._fvalue;
break;
default:
Error(_SC("scalar expected : integer,float"));
val._type = OT_NULL; // Silent compile-warning
}
break;
default:
Error(_SC("scalar expected : integer,float or string"));
val._type = OT_NULL; // Silent compile-warning

View File

@@ -189,8 +189,12 @@ SQSharedState::~SQSharedState()
SQCollectable *t = _gc_chain;
SQCollectable *nx = NULL;
while(t) {
t->UnMark();
t->_uiRef++;
t = t->_next;
}
t = _gc_chain;
while(t) {
t->UnMark();
t->Finalize();
nx = t->_next;
if(--t->_uiRef == 0)

View File

@@ -88,7 +88,7 @@ public:
}
SQUnsignedInteger capacity() { return _allocated; }
inline T &back() const { return _vals[_size - 1]; }
inline T& operator[](SQUnsignedInteger pos) const{ return _vals[pos]; }
inline T& operator[](SQUnsignedInteger pos) const{ assert(pos < _allocated); return _vals[pos]; }
T* _vals;
private:
void _realloc(SQUnsignedInteger newsize)

View File

@@ -50,7 +50,9 @@ bool SQVM::ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,
res = i1 / i2;
break;
case '*': res = i1 * i2; break;
case '%': res = i1 % i2; break;
case '%': if(i2 == 0) { Raise_Error(_SC("modulo by zero")); return false; }
res = i1 % i2;
break;
default: res = 0xDEADBEEF;
}
trg = res;
@@ -83,7 +85,7 @@ SQVM::SQVM(SQSharedState *ss)
_suspended = SQFalse;
_suspended_target=-1;
_suspended_root = SQFalse;
_suspended_traps=-1;
_suspended_traps=0;
_foreignptr=NULL;
_nnativecalls=0;
_lasterror = _null_;
@@ -321,6 +323,10 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
SQInteger ndef = func->_ndefaultparams;
if(ndef && nargs < paramssize) {
SQInteger diff = paramssize - nargs;
if (diff > ndef) {
Raise_Error(_SC("wrong number of parameters"));
return false;
}
for(SQInteger n = ndef - diff; n < ndef; n++) {
_stack._vals[stackbase + (nargs++)] = closure->_defaultparams[n];
}
@@ -682,12 +688,15 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQIn
break;
case ET_RESUME_GENERATOR: _generator(closure)->Resume(this, target); ci->_root = SQTrue; traps += ci->_etraps; break;
case ET_RESUME_VM:
case ET_RESUME_THROW_VM:
traps = _suspended_traps;
ci->_root = _suspended_root;
ci->_vargs = _suspend_varargs;
_suspended = SQFalse;
if(et == ET_RESUME_THROW_VM) { SQ_THROW(); }
break;
case ET_RESUME_OPENTTD:
traps = _suspended_traps;
_suspended = SQFalse;
break;
}
@@ -698,7 +707,7 @@ exception_restore:
for(;;)
{
DecreaseOps(1);
if (ShouldSuspend()) { _suspended = SQTrue; return true; }
if (ShouldSuspend()) { _suspended = SQTrue; _suspended_traps = traps; return true; }
const SQInstruction &_i_ = *ci->_ip++;
//dumpstack(_stackbase);
@@ -740,15 +749,23 @@ common_call:
_GUARD(gen->Yield(this));
Return(1, ct_target, clo);
STK(ct_target) = gen;
while (last_top >= _top) _stack._vals[last_top--].Null();
continue;
}
while (last_top >= _top) _stack._vals[last_top--].Null();
}
continue;
case OT_NATIVECLOSURE: {
bool suspend;
_suspended_target = ct_target;
_GUARD(CallNative(_nativeclosure(clo), arg3, ct_stackbase, clo,suspend));
try {
_GUARD(CallNative(_nativeclosure(clo), arg3, ct_stackbase, clo,suspend));
} catch (...) {
_suspended = SQTrue;
_suspended_target = ct_target;
_suspended_root = ci->_root;
_suspended_traps = traps;
_suspend_varargs = ci->_vargs;
throw;
}
if(suspend){
_suspended = SQTrue;
_suspended_target = ct_target;
@@ -928,7 +945,7 @@ common_call:
traps -= ci->_etraps;
if(sarg1 != MAX_FUNC_STACKSIZE) STK(arg1) = temp_reg;
}
else { Raise_Error(_SC("trying to yield a '%s',only genenerator can be yielded"), GetTypeName(ci->_generator)); SQ_THROW();}
else { Raise_Error(_SC("trying to yield a '%s',only genenerator can be yielded"), GetTypeName(ci->_closure)); SQ_THROW();}
if(Return(arg0, arg1, temp_reg)){
assert(traps == 0);
outres = temp_reg;
@@ -1125,6 +1142,8 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
}
/* Store the call stack size, so we can restore that */
SQInteger cstksize = _callsstacksize;
SQInteger ret;
try {
SQBool can_suspend = this->_can_suspend;
@@ -1135,6 +1154,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
_nnativecalls--;
suspend = false;
_callsstacksize = cstksize;
_stackbase = oldstackbase;
_top = oldtop;
@@ -1144,6 +1164,8 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
throw;
}
assert(cstksize == _callsstacksize);
_nnativecalls--;
suspend = false;
if( ret == SQ_SUSPEND_FLAG) suspend = true;
@@ -1486,7 +1508,19 @@ void SQVM::Pop(SQInteger n) {
}
}
void SQVM::Push(const SQObjectPtr &o) { _stack[_top++] = o; }
void SQVM::Push(const SQObjectPtr &o) {
/* Normally the stack shouldn't get this full, sometimes it might. As of now
* all cases have been bugs in "our" (OpenTTD) code. Trigger an assert for
* all debug builds and for the release builds just increase the stack size.
* This way getting a false positive isn't that bad (releases work fine) and
* if there is something fishy it can be caught in RCs/nightlies. */
#ifdef NDEBUG
if (_top >= (int)_stack.capacity()) _stack.resize(2 * _stack.capacity());
#else
assert(_top < (int)_stack.capacity());
#endif
_stack[_top++] = o;
}
SQObjectPtr &SQVM::Top() { return _stack[_top-1]; }
SQObjectPtr &SQVM::PopGet() { return _stack[--_top]; }
SQObjectPtr &SQVM::GetUp(SQInteger n) { return _stack[_top+n]; }

View File

@@ -53,7 +53,7 @@ struct SQVM : public CHAINABLE_OBJ
typedef sqvector<CallInfo> CallInfoVec;
public:
enum ExecutionType { ET_CALL, ET_RESUME_GENERATOR, ET_RESUME_VM, ET_RESUME_OPENTTD };
enum ExecutionType { ET_CALL, ET_RESUME_GENERATOR, ET_RESUME_VM, ET_RESUME_THROW_VM, ET_RESUME_OPENTTD };
SQVM(SQSharedState *ss);
~SQVM();
bool Init(SQVM *friendvm, SQInteger stacksize);

View File

@@ -103,6 +103,11 @@ struct AIListWindow : public Window {
sprintf(buf, "%d", selected_info->GetVersion());
DoDrawStringTruncated(buf, x + 5, y, TC_BLACK, this->width - x - 8);
y += 13;
if (selected_info->GetURL() != NULL) {
SetDParamStr(0, selected_info->GetURL());
DrawString(4, y, STR_AI_URL, TC_BLACK);
y += 13;
}
SetDParamStr(0, selected_info->GetDescription());
DrawStringMultiLine(4, y, STR_JUST_RAW_STRING, this->width - 8, this->widget[AIL_WIDGET_INFO_BG].bottom - y);
}
@@ -556,6 +561,7 @@ struct AIDebugWindow : public Window {
enum AIDebugWindowWidgets {
AID_WIDGET_CLOSEBOX = 0,
AID_WIDGET_CAPTION,
AID_WIDGET_STICKY,
AID_WIDGET_VIEW,
AID_WIDGET_NAME_TEXT,
AID_WIDGET_RELOAD_TOGGLE,
@@ -575,6 +581,8 @@ struct AIDebugWindow : public Window {
static CompanyID ai_debug_company;
int redraw_timer;
int last_vscroll_pos;
bool autoscroll;
AIDebugWindow(const WindowDesc *desc, WindowNumber number) : Window(desc, number)
{
@@ -587,6 +595,8 @@ struct AIDebugWindow : public Window {
this->vscroll.cap = 14;
this->vscroll.pos = 0;
this->resize.step_height = 12;
this->last_vscroll_pos = 0;
this->autoscroll = true;
if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
@@ -596,7 +606,7 @@ struct AIDebugWindow : public Window {
virtual void OnPaint()
{
/* Check if the currently selected company is still active. */
if (ai_debug_company == INVALID_COMPANY || !IsValidCompanyID(ai_debug_company)) {
if (ai_debug_company == INVALID_COMPANY || !IsValidCompanyID(ai_debug_company) || !GetCompany(ai_debug_company)->is_ai) {
if (ai_debug_company != INVALID_COMPANY) {
/* Raise and disable the widget for the previous selection. */
this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
@@ -664,13 +674,35 @@ struct AIDebugWindow : public Window {
AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();
_current_company = old_company;
SetVScrollCount(this, (log == NULL) ? 0 : log->used);
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
int scroll_count = (log == NULL) ? 0 : log->used;
if (this->vscroll.count != scroll_count) {
SetVScrollCount(this, scroll_count);
/* We need a repaint */
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
}
if (log == NULL) return;
/* Detect when the user scrolls the window. Enable autoscroll when the
* bottom-most line becomes visible. */
if (this->last_vscroll_pos != this->vscroll.pos) {
this->autoscroll = this->vscroll.pos >= log->used - this->vscroll.cap;
}
if (this->autoscroll) {
int scroll_pos = max(0, log->used - this->vscroll.cap);
if (scroll_pos != this->vscroll.pos) {
this->vscroll.pos = scroll_pos;
/* We need a repaint */
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
}
}
last_vscroll_pos = this->vscroll.pos;
int y = 6;
for (int i = this->vscroll.pos; i < (this->vscroll.cap + this->vscroll.pos); i++) {
uint pos = (log->count + log->pos - i) % log->count;
for (int i = this->vscroll.pos; i < (this->vscroll.cap + this->vscroll.pos) && i < log->used; i++) {
uint pos = (i + log->pos + 1 - log->used + log->count) % log->count;
if (log->lines[pos] == NULL) break;
TextColour colour;
@@ -693,6 +725,8 @@ struct AIDebugWindow : public Window {
this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
ai_debug_company = show_ai;
this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
this->autoscroll = true;
this->last_vscroll_pos = this->vscroll.pos;
this->SetDirty();
}
@@ -708,7 +742,7 @@ struct AIDebugWindow : public Window {
if (widget == AID_WIDGET_RELOAD_TOGGLE && !this->IsWidgetDisabled(widget)) {
/* First kill the company of the AI, then start a new one. This should start the current AI again */
DoCommandP(0, 2, ai_debug_company, CMD_COMPANY_CTRL);
DoCommandP(0, 1, 0, CMD_COMPANY_CTRL);
DoCommandP(0, 1, ai_debug_company, CMD_COMPANY_CTRL);
}
}
@@ -726,6 +760,7 @@ struct AIDebugWindow : public Window {
virtual void OnResize(Point new_size, Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
SetVScrollCount(this, this->vscroll.count); // vscroll.pos should be in a valid range
}
};
@@ -734,6 +769,7 @@ CompanyID AIDebugWindow::ai_debug_company = INVALID_COMPANY;
static const Widget _ai_debug_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // AID_WIDGET_CLOSEBOX
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 298, 0, 13, STR_AI_DEBUG, STR_018C_WINDOW_TITLE_DRAG_THIS}, // AID_WIDGET_CAPTION
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 287, 298, 0, 13, 0x0, STR_STICKY_BUTTON }, // AID_WIDGET_STICKY
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 0, 298, 14, 40, 0x0, STR_NULL}, // AID_WIDGET_VIEW
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 0, 149, 41, 60, 0x0, STR_AI_DEBUG_NAME_TIP}, // AID_WIDGET_NAME_TEXT
@@ -771,7 +807,7 @@ static const Widget _ai_debug_widgets[] = {
static const WindowDesc _ai_debug_desc(
WDP_AUTO, WDP_AUTO, 299, 241, 299, 241,
WC_AI_DEBUG, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_ai_debug_widgets
);

View File

@@ -36,6 +36,7 @@ AIFileInfo::~AIFileInfo()
free((void *)this->description);
free((void *)this->date);
free((void *)this->instance_name);
free((void *)this->url);
free(this->main_script);
free(this->SQ_instance);
}
@@ -98,6 +99,11 @@ bool AIFileInfo::CheckMethod(const char *name) const
if (!info->engine->CallIntegerMethod(*info->SQ_instance, "GetVersion", &info->version)) return SQ_ERROR;
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "CreateInstance", &info->instance_name)) return SQ_ERROR;
/* The GetURL function is optional. */
if (info->engine->MethodExists(*info->SQ_instance, "GetURL")) {
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetURL", &info->url)) return SQ_ERROR;
}
return 0;
}
@@ -125,6 +131,12 @@ bool AIFileInfo::CheckMethod(const char *name) const
} else {
info->min_loadable_version = info->GetVersion();
}
/* When there is an UseAsRandomAI function, call it. */
if (info->engine->MethodExists(*info->SQ_instance, "UseAsRandomAI")) {
if (!info->engine->CallBoolMethod(*info->SQ_instance, "UseAsRandomAI", &info->use_as_random)) return SQ_ERROR;
} else {
info->use_as_random = true;
}
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
sq_setinstanceup(vm, 2, NULL);

View File

@@ -41,7 +41,7 @@ public:
friend class AIInfo;
friend class AILibrary;
AIFileInfo() : SQ_instance(NULL), main_script(NULL), author(NULL), name(NULL), short_name(NULL), description(NULL), date(NULL), instance_name(NULL) {};
AIFileInfo() : SQ_instance(NULL), main_script(NULL), author(NULL), name(NULL), short_name(NULL), description(NULL), date(NULL), instance_name(NULL), url(NULL) {};
~AIFileInfo();
/**
@@ -84,6 +84,11 @@ public:
*/
const char *GetInstanceName() const { return this->instance_name; }
/**
* Get the website for this script.
*/
const char *GetURL() const { return this->url; }
/**
* Get the filename of the main.nut script.
*/
@@ -111,6 +116,7 @@ private:
const char *date;
const char *instance_name;
int version;
const char *url;
};
class AIInfo : public AIFileInfo {
@@ -155,9 +161,15 @@ public:
*/
int GetSettingDefaultValue(const char *name) const;
/**
* Use this AI as a random AI.
*/
bool UseAsRandomAI() const { return this->use_as_random; }
private:
AIConfigItemList config_list;
int min_loadable_version;
bool use_as_random;
};
class AILibrary : public AIFileInfo {

View File

@@ -31,7 +31,7 @@ class DummyAI extends AIController {
function Start() { \n\
AILog.Error(\"No suitable AI found to load.\"); \n\
AILog.Error(\"This AI is a dummy AI and won't do anything.\"); \n\
AILog.Error(\"You can download several via the 'Online Content' system.\"); \n\
AILog.Error(\"You can download several AIs via the 'Online Content' system.\"); \n\
} \n\
} \n\
");

View File

@@ -19,6 +19,7 @@
#define DEFINE_SCRIPT_FILES
#include "ai_info.hpp"
#include "ai_config.hpp"
#include "ai_storage.hpp"
#include "ai_instance.hpp"
#include "ai_gui.hpp"
@@ -59,6 +60,7 @@
#include "api/ai_railtypelist.hpp.sq"
#include "api/ai_road.hpp.sq"
#include "api/ai_sign.hpp.sq"
#include "api/ai_signlist.hpp.sq"
#include "api/ai_station.hpp.sq"
#include "api/ai_stationlist.hpp.sq"
#include "api/ai_subsidy.hpp.sq"
@@ -98,6 +100,7 @@ AIInstance::AIInstance(AIInfo *info) :
instance(NULL),
is_started(false),
is_dead(false),
is_save_data_on_stack(false),
suspend(0),
callback(NULL)
{
@@ -116,29 +119,35 @@ AIInstance::AIInstance(AIInfo *info) :
/* Register the AIController */
SQAIController_Register(this->engine);
/* Load and execute the script for this AI */
const char *main_script = info->GetMainScript();
if (strcmp(main_script, "%_dummy") == 0) {
extern void AI_CreateAIDummy(HSQUIRRELVM vm);
AI_CreateAIDummy(this->engine->GetVM());
} else if (!this->engine->LoadScript(main_script)) {
this->Died();
return;
}
/* Create the main-class */
this->instance = MallocT<SQObject>(1);
if (!this->engine->CreateClassInstance(info->GetInstanceName(), this->controller, this->instance)) {
this->Died();
return;
}
/* Register the API functions and classes */
this->RegisterAPI();
/* The topmost stack item is true if there is data from a savegame
* and false otherwise. */
sq_pushbool(this->engine->vm, false);
try {
AIObject::SetAllowDoCommand(false);
/* Load and execute the script for this AI */
const char *main_script = info->GetMainScript();
if (strcmp(main_script, "%_dummy") == 0) {
extern void AI_CreateAIDummy(HSQUIRRELVM vm);
AI_CreateAIDummy(this->engine->GetVM());
} else if (!this->engine->LoadScript(main_script) || this->engine->IsSuspended()) {
if (this->engine->IsSuspended()) AILog::Error("This AI took too long to load script. AI is not started.");
this->Died();
return;
}
/* Create the main-class */
this->instance = MallocT<SQObject>(1);
if (!this->engine->CreateClassInstance(info->GetInstanceName(), this->controller, this->instance)) {
this->Died();
return;
}
AIObject::SetAllowDoCommand(true);
} catch (AI_FatalError e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
}
AIInstance::~AIInstance()
@@ -211,6 +220,7 @@ void AIInstance::RegisterAPI()
SQAIRailTypeList_Register(this->engine);
SQAIRoad_Register(this->engine);
SQAISign_Register(this->engine);
SQAISignList_Register(this->engine);
SQAIStation_Register(this->engine);
SQAIStationList_Register(this->engine);
SQAIStationList_Vehicle_Register(this->engine);
@@ -255,12 +265,21 @@ void AIInstance::Died()
this->engine = NULL;
ShowAIDebugWindow(_current_company);
ShowErrorMessage(INVALID_STRING_ID, STR_AI_PLEASE_REPORT_CRASH, 0, 0);
const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
if (info != NULL) {
ShowErrorMessage(INVALID_STRING_ID, STR_AI_PLEASE_REPORT_CRASH, 0, 0);
if (info->GetURL() != NULL) {
AILog::Info("Please report the error to the following URL:");
AILog::Info(info->GetURL());
}
}
}
void AIInstance::GameLoop()
{
if (this->is_dead) return;
if (this->IsDead()) return;
if (this->engine->HasScriptCrashed()) {
/* The script crashed during saving, kill it here. */
this->Died();
@@ -274,6 +293,10 @@ void AIInstance::GameLoop()
/* If there is a callback to call, call that first */
if (this->callback != NULL) {
if (this->is_save_data_on_stack) {
sq_poptop(this->engine->GetVM());
this->is_save_data_on_stack = false;
}
try {
this->callback(this);
} catch (AI_VMSuspend e) {
@@ -292,20 +315,37 @@ void AIInstance::GameLoop()
AIObject::SetAllowDoCommand(false);
/* Run the constructor if it exists. Don't allow any DoCommands in it. */
if (this->engine->MethodExists(*this->instance, "constructor")) {
if (!this->engine->CallMethod(*this->instance, "constructor")) { this->Died(); return; }
if (!this->engine->CallMethod(*this->instance, "constructor", 100000) || this->engine->IsSuspended()) {
if (this->engine->IsSuspended()) AILog::Error("This AI took too long to initialize. AI is not started.");
this->Died();
return;
}
}
if (!this->CallLoad() || this->engine->IsSuspended()) {
if (this->engine->IsSuspended()) AILog::Error("This AI took too long in the Load function. AI is not started.");
this->Died();
return;
}
if (!this->CallLoad()) { this->Died(); return; }
AIObject::SetAllowDoCommand(true);
/* Start the AI by calling Start() */
if (!this->engine->CallMethod(*this->instance, "Start", _settings_game.ai.ai_max_opcode_till_suspend) || !this->engine->IsSuspended()) this->Died();
} catch (AI_VMSuspend e) {
this->suspend = e.GetSuspendTime();
this->callback = e.GetSuspendCallback();
} catch (AI_FatalError e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
this->is_started = true;
return;
}
if (this->is_save_data_on_stack) {
sq_poptop(this->engine->GetVM());
this->is_save_data_on_stack = false;
}
/* Continue the VM */
try {
@@ -313,12 +353,17 @@ void AIInstance::GameLoop()
} catch (AI_VMSuspend e) {
this->suspend = e.GetSuspendTime();
this->callback = e.GetSuspendCallback();
} catch (AI_FatalError e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
}
void AIInstance::CollectGarbage()
{
if (this->is_started && !this->is_dead) this->engine->CollectGarbage();
if (this->is_started && !this->IsDead()) this->engine->CollectGarbage();
}
/* static */ void AIInstance::DoCommandReturn(AIInstance *instance)
@@ -524,29 +569,38 @@ void AIInstance::Save()
}
HSQUIRRELVM vm = this->engine->GetVM();
if (!this->is_started) {
SQBool res;
sq_getbool(vm, -1, &res);
if (!res) {
SaveEmpty();
return;
}
/* Push the loaded savegame data to the top of the stack. */
sq_push(vm, -2);
if (this->is_save_data_on_stack) {
_ai_sl_byte = 1;
SlObject(NULL, _ai_byte);
/* Save the data that was just loaded. */
SaveObject(vm, -1, AISAVE_MAX_DEPTH, false);
sq_poptop(vm);
} else if (!this->is_started) {
SaveEmpty();
return;
} else if (this->engine->MethodExists(*this->instance, "Save")) {
HSQOBJECT savedata;
/* We don't want to be interrupted during the save function. */
bool backup_allow = AIObject::GetAllowDoCommand();
AIObject::SetAllowDoCommand(false);
if (!this->engine->CallMethod(*this->instance, "Save", &savedata)) {
/* The script crashed in the Save function. We can't kill
* it here, but do so in the next AI tick. */
try {
if (!this->engine->CallMethod(*this->instance, "Save", &savedata)) {
/* The script crashed in the Save function. We can't kill
* it here, but do so in the next AI tick. */
SaveEmpty();
this->engine->CrashOccurred();
return;
}
} catch (AI_FatalError e) {
/* If we don't mark the AI as dead here cleaning up the squirrel
* stack could throw AI_FatalError again. */
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
SaveEmpty();
/* We can't kill the AI here, so mark it as crashed (not dead) and
* kill it in the next AI tick. */
this->is_dead = false;
this->engine->CrashOccurred();
return;
}
AIObject::SetAllowDoCommand(backup_allow);
@@ -554,6 +608,7 @@ void AIInstance::Save()
if (!sq_istable(savedata)) {
AILog::Error("Save function should return a table.");
SaveEmpty();
this->engine->CrashOccurred();
return;
}
sq_pushobject(vm, savedata);
@@ -561,11 +616,11 @@ void AIInstance::Save()
_ai_sl_byte = 1;
SlObject(NULL, _ai_byte);
SaveObject(vm, -1, AISAVE_MAX_DEPTH, false);
this->is_save_data_on_stack = true;
} else {
_ai_sl_byte = 0;
SlObject(NULL, _ai_byte);
SaveEmpty();
this->engine->CrashOccurred();
}
sq_pop(vm, 1);
} else {
AILog::Warning("Save function is not implemented");
_ai_sl_byte = 0;
@@ -652,21 +707,18 @@ void AIInstance::Load(int version)
/* Check if there was anything saved at all. */
if (_ai_sl_byte == 0) return;
/* First remove the value "false" since we have data to load. */
sq_poptop(vm);
sq_pushinteger(vm, version);
LoadObjects(vm);
sq_pushbool(vm, true);
this->is_save_data_on_stack = true;
}
bool AIInstance::CallLoad()
{
HSQUIRRELVM vm = this->engine->GetVM();
/* Is there save data that we should load? */
SQBool res;
sq_getbool(vm, -1, &res);
sq_poptop(vm);
if (!res) return true;
if (!this->is_save_data_on_stack) return true;
/* Whatever happens, after CallLoad the savegame data is removed from the stack. */
this->is_save_data_on_stack = false;
if (!this->engine->MethodExists(*this->instance, "Load")) {
AILog::Warning("Loading failed: there was data for the AI to load, but the AI does not have a Load() function.");
@@ -690,7 +742,7 @@ bool AIInstance::CallLoad()
/* Call the AI load function. sq_call removes the arguments (but not the
* function pointer) from the stack. */
if (SQ_FAILED(sq_call(vm, 3, SQFalse, SQFalse))) return false;
if (SQ_FAILED(sq_call(vm, 3, SQFalse, SQFalse, 100000))) return false;
/* Pop 1) The version, 2) the savegame data, 3) the object instance, 4) the function pointer. */
sq_pop(vm, 4);

View File

@@ -18,7 +18,7 @@ public:
AI_VMSuspend(int time, AISuspendCallbackProc *callback) :
time(time),
callback(callback)
{}
{}
int GetSuspendTime() { return time; }
AISuspendCallbackProc *GetSuspendCallback() { return callback; }
@@ -28,8 +28,24 @@ private:
AISuspendCallbackProc *callback;
};
/**
* A throw-class that is given when the AI made a fatal error.
*/
class AI_FatalError {
public:
AI_FatalError(const char *msg) :
msg(msg)
{}
const char *GetErrorMessage() { return msg; }
private:
const char *msg;
};
class AIInstance {
public:
friend class AIObject;
AIInstance(class AIInfo *info);
~AIInstance();
@@ -79,6 +95,11 @@ public:
*/
class AIController *GetController() { return controller; }
/**
* Return the "this AI died" value
*/
inline bool IsDead() { return this->is_dead; }
/**
* Call the AI Save function and save all data in the savegame.
*/
@@ -117,6 +138,7 @@ private:
bool is_started;
bool is_dead;
bool is_save_data_on_stack;
int suspend;
AISuspendCallbackProc *callback;

View File

@@ -153,7 +153,7 @@ AIScanner::AIScanner() :
/* Create the dummy AI */
this->engine->ResetCrashed();
strcpy(this->main_script, "%_dummy");
strecpy(this->main_script, "%_dummy", lastof(this->main_script));
extern void AI_CreateAIInfoDummy(HSQUIRRELVM vm);
AI_CreateAIInfoDummy(this->engine->GetVM());
}
@@ -345,20 +345,31 @@ void AIScanner::RegisterAI(AIInfo *info)
AIInfo *AIScanner::SelectRandomAI()
{
if (this->info_single_list.size() == 0) {
uint num_random_ais = 0;
for (AIInfoList::iterator it = this->info_single_list.begin(); it != this->info_single_list.end(); it++) {
if (it->second->UseAsRandomAI()) num_random_ais++;
}
if (num_random_ais == 0) {
DEBUG(ai, 0, "No suitable AI found, loading 'dummy' AI.");
return this->info_dummy;
}
/* Find a random AI */
uint pos;
if (_networking) pos = InteractiveRandomRange((uint16)this->info_single_list.size());
else pos = RandomRange((uint16)this->info_single_list.size());
if (_networking) {
pos = InteractiveRandomRange(num_random_ais);
} else {
pos = RandomRange(num_random_ais);
}
/* Find the Nth item from the array */
AIInfoList::iterator it = this->info_single_list.begin();
for (; pos > 0; pos--) it++;
AIInfoList::iterator first_it = it;
while (!it->second->UseAsRandomAI()) it++;
for (; pos > 0; pos--) {
it++;
while (!it->second->UseAsRandomAI()) it++;
}
return (*it).second;
}
@@ -401,7 +412,7 @@ AIInfo *AIScanner::FindInfo(const char *nameParam, int versionParam)
snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetName());
strtolower(ai_name_compare);
if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam)) {
if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam) && (version == -1 || (*it).second->GetVersion() > version)) {
version = (*it).second->GetVersion();
info = (*it).second;
}

View File

@@ -31,7 +31,6 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2

View File

@@ -375,6 +375,7 @@ AIAbstractList::AIAbstractList()
this->sorter_type = SORT_BY_VALUE;
this->sort_ascending = false;
this->initialized = false;
this->modifications = 0;
}
AIAbstractList::~AIAbstractList()
@@ -389,6 +390,8 @@ bool AIAbstractList::HasItem(int32 item)
void AIAbstractList::Clear()
{
this->modifications++;
this->items.clear();
this->buckets.clear();
this->sorter->End();
@@ -396,6 +399,8 @@ void AIAbstractList::Clear()
void AIAbstractList::AddItem(int32 item)
{
this->modifications++;
if (this->HasItem(item)) return;
this->items[item] = 0;
@@ -404,6 +409,8 @@ void AIAbstractList::AddItem(int32 item)
void AIAbstractList::RemoveItem(int32 item)
{
this->modifications++;
if (!this->HasItem(item)) return;
int32 value = this->GetValue(item);
@@ -457,6 +464,8 @@ int32 AIAbstractList::GetValue(int32 item)
bool AIAbstractList::SetValue(int32 item, int32 value)
{
this->modifications++;
if (!this->HasItem(item)) return false;
int32 value_old = this->GetValue(item);
@@ -472,6 +481,8 @@ bool AIAbstractList::SetValue(int32 item, int32 value)
void AIAbstractList::Sort(SorterType sorter, bool ascending)
{
this->modifications++;
if (sorter != SORT_BY_VALUE && sorter != SORT_BY_ITEM) return;
if (sorter == this->sorter_type && ascending == this->sort_ascending) return;
@@ -506,6 +517,8 @@ void AIAbstractList::AddList(AIAbstractList *list)
void AIAbstractList::RemoveAboveValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second > value) this->items.erase(iter);
@@ -519,6 +532,8 @@ void AIAbstractList::RemoveAboveValue(int32 value)
void AIAbstractList::RemoveBelowValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second < value) this->items.erase(iter);
@@ -532,6 +547,8 @@ void AIAbstractList::RemoveBelowValue(int32 value)
void AIAbstractList::RemoveBetweenValue(int32 start, int32 end)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second > start && (*iter).second < end) this->items.erase(iter);
@@ -545,6 +562,8 @@ void AIAbstractList::RemoveBetweenValue(int32 start, int32 end)
void AIAbstractList::RemoveValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second == value) this->items.erase(iter);
@@ -558,6 +577,8 @@ void AIAbstractList::RemoveValue(int32 value)
void AIAbstractList::RemoveTop(int32 count)
{
this->modifications++;
if (!this->sort_ascending) {
this->Sort(this->sorter_type, !this->sort_ascending);
this->RemoveBottom(count);
@@ -593,6 +614,8 @@ void AIAbstractList::RemoveTop(int32 count)
void AIAbstractList::RemoveBottom(int32 count)
{
this->modifications++;
if (!this->sort_ascending) {
this->Sort(this->sorter_type, !this->sort_ascending);
this->RemoveTop(count);
@@ -627,6 +650,8 @@ void AIAbstractList::RemoveBottom(int32 count)
void AIAbstractList::RemoveList(AIAbstractList *list)
{
this->modifications++;
AIAbstractListMap *list_items = &list->items;
for (AIAbstractListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
this->RemoveItem((*iter).first);
@@ -635,6 +660,8 @@ void AIAbstractList::RemoveList(AIAbstractList *list)
void AIAbstractList::KeepAboveValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second <= value) this->items.erase(iter);
@@ -648,6 +675,8 @@ void AIAbstractList::KeepAboveValue(int32 value)
void AIAbstractList::KeepBelowValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second >= value) this->items.erase(iter);
@@ -661,6 +690,8 @@ void AIAbstractList::KeepBelowValue(int32 value)
void AIAbstractList::KeepBetweenValue(int32 start, int32 end)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second <= start || (*iter).second >= end) this->items.erase(iter);
@@ -674,6 +705,8 @@ void AIAbstractList::KeepBetweenValue(int32 start, int32 end)
void AIAbstractList::KeepValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second != value) this->items.erase(iter);
@@ -687,16 +720,22 @@ void AIAbstractList::KeepValue(int32 value)
void AIAbstractList::KeepTop(int32 count)
{
this->modifications++;
this->RemoveBottom(this->Count() - count);
}
void AIAbstractList::KeepBottom(int32 count)
{
this->modifications++;
this->RemoveTop(this->Count() - count);
}
void AIAbstractList::KeepList(AIAbstractList *list)
{
this->modifications++;
AIAbstractList tmp;
for (AIAbstractListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
tmp.AddItem((*iter).first);
@@ -746,6 +785,8 @@ SQInteger AIAbstractList::_nexti(HSQUIRRELVM vm)
SQInteger AIAbstractList::Valuate(HSQUIRRELVM vm)
{
this->modifications++;
/* The first parameter is the instance of AIAbstractList. */
int nparam = sq_gettop(vm) - 1;
@@ -771,6 +812,10 @@ SQInteger AIAbstractList::Valuate(HSQUIRRELVM vm)
/* Walk all items, and query the result */
this->buckets.clear();
/* Check for changing of items. */
int begin_modification_count = this->modifications;
for (AIAbstractListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
/* Push the root table as instance object, this is what squirrel does for meta-functions. */
sq_pushroottable(vm);
@@ -808,6 +853,15 @@ SQInteger AIAbstractList::Valuate(HSQUIRRELVM vm)
}
}
/* Was something changed? */
if (begin_modification_count != this->modifications) {
/* See below for explanation. The extra pop is the return value. */
sq_pop(vm, nparam + 4);
AIObject::SetAllowDoCommand(backup_allow);
return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function"));
}
(*iter).second = (int32)value;
this->buckets[(int32)value].insert((*iter).first);

View File

@@ -25,11 +25,17 @@ public:
SORT_BY_ITEM, //!< Sort the list based on the item itself.
};
/** Sort ascending */
static const bool SORT_ASCENDING = true;
/** Sort descnding */
static const bool SORT_DESCENDING = false;
private:
AIAbstractListSorter *sorter;
SorterType sorter_type;
bool sort_ascending;
bool initialized;
AIAbstractListSorter *sorter; //!< Sorting algorithm
SorterType sorter_type; //!< Sorting type
bool sort_ascending; //!< Whether to sort ascending or descending
bool initialized; //!< Whether an iteration has been started
int modifications; //!< Number of modification that has been done. To prevent changing data while valuating.
public:
typedef std::set<int32> AIItemList; //!< The list of items inside the bucket
@@ -123,6 +129,7 @@ public:
* @param sorter the type of sorter to use
* @param ascending if true, lowest value is on top, else at bottom.
* @note the current item stays at the same place.
* @see SORT_ASCENDING SORT_DESCENDING
*/
void Sort(SorterType sorter, bool ascending);
@@ -245,6 +252,8 @@ public:
* @param valuator_function The function which will be doing the valuation.
* @param params The params to give to the valuators (minus the first param,
* which is always the index-value we are valuating).
* @note You may not add, remove or change (setting the value of) items while
* valuating. You may also not (re)sort while valuating.
* @note You can write your own valuators and use them. Just remember that
* the first parameter should be the index-value, and it should return
* an integer.

View File

@@ -24,6 +24,9 @@ void SQAIAbstractList_Register(Squirrel *engine) {
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_BY_VALUE, "SORT_BY_VALUE");
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_BY_ITEM, "SORT_BY_ITEM");
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_ASCENDING, "SORT_ASCENDING");
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_DESCENDING, "SORT_DESCENDING");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Clear, "Clear", 1, "x");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::HasItem, "HasItem", 2, "xi");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Begin, "Begin", 1, "x");

View File

@@ -8,10 +8,24 @@
#include "../../company_func.h"
#include "../../command_type.h"
#include "../../town.h"
#include "../../economy_func.h"
/* static */ bool AIAirport::IsValidAirportType(AirportType type)
{
return type >= AT_SMALL && type <= AT_HELISTATION && HasBit(::GetValidAirports(), type);
return IsAirportInformationAvailable(type) && HasBit(::GetValidAirports(), type);
}
/* static */ bool AIAirport::IsAirportInformationAvailable(AirportType type)
{
return type >= 0 && type <= AT_HELISTATION;
}
/* static */ Money AIAirport::GetPrice(AirportType type)
{
if (!IsValidAirportType(type)) return -1;
const AirportFTAClass *afc = ::GetAirport(type);
return _price.build_airport * afc->size_x * afc->size_y;
}
/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
@@ -30,21 +44,21 @@
/* static */ int32 AIAirport::GetAirportWidth(AirportType type)
{
if (!IsValidAirportType(type)) return -1;
if (!IsAirportInformationAvailable(type)) return -1;
return ::GetAirport(type)->size_x;
}
/* static */ int32 AIAirport::GetAirportHeight(AirportType type)
{
if (!IsValidAirportType(type)) return -1;
if (!IsAirportInformationAvailable(type)) return -1;
return ::GetAirport(type)->size_y;
}
/* static */ int32 AIAirport::GetAirportCoverageRadius(AirportType type)
{
if (!IsValidAirportType(type)) return -1;
if (!IsAirportInformationAvailable(type)) return -1;
return _settings_game.station.modified_catchment ? ::GetAirport(type)->catchment : (uint)CA_UNMODIFIED;
}
@@ -127,7 +141,7 @@
extern Town *AirportGetNearestTown(const AirportFTAClass *afc, TileIndex airport_tile);
if (!::IsValidTile(tile)) return INVALID_TOWN;
if (!IsValidAirportType(type)) return INVALID_TOWN;
if (!IsAirportInformationAvailable(type)) return INVALID_TOWN;
return AirportGetNearestTown(GetAirport(type), tile)->index;
}

View File

@@ -50,9 +50,28 @@ public:
* Checks whether the given AirportType is valid and available.
* @param type The AirportType to check.
* @return True if and only if the AirportType is valid and available.
* @post return value == true -> IsAirportInformationAvailable returns true.
*/
static bool IsValidAirportType(AirportType type);
/**
* Can you get information on this airport type? As opposed to
* IsValidAirportType this will return also return true when
* an airport type is no longer buildable.
* @param type The AirportType to check.
* @return True if and only if the AirportType is valid.
* @post return value == false -> IsValidAirportType returns false.
*/
static bool IsAirportInformationAvailable(AirportType type);
/**
* Get the cost to build this AirportType.
* @param type The AirportType to check.
* @pre AirportAvailable(type).
* @return The cost of building this AirportType.
*/
static Money GetPrice(AirportType type);
/**
* Checks whether the given tile is actually a tile with a hangar.
* @param tile The tile to check.
@@ -72,6 +91,7 @@ public:
/**
* Get the width of this type of airport.
* @param type The type of airport.
* @pre IsAirportInformationAvailable(type).
* @return The width in tiles.
*/
static int32 GetAirportWidth(AirportType type);
@@ -79,6 +99,7 @@ public:
/**
* Get the height of this type of airport.
* @param type The type of airport.
* @pre IsAirportInformationAvailable(type).
* @return The height in tiles.
*/
static int32 GetAirportHeight(AirportType type);
@@ -86,6 +107,7 @@ public:
/**
* Get the coverage radius of this type of airport.
* @param type The type of airport.
* @pre IsAirportInformationAvailable(type).
* @return The radius in tiles.
*/
static int32 GetAirportCoverageRadius(AirportType type);
@@ -122,7 +144,7 @@ public:
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIError::ERR_LOCAL_AUTHORITY_REFUSES
* @exception AIStation::ERR_STATION_TOO_LARGE
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @return Whether the airport has been/can be build or not.
*/
static bool BuildAirport(TileIndex tile, AirportType type, StationID station_id);
@@ -160,6 +182,7 @@ public:
* an airport at some tile.
* @param tile The tile to check.
* @param type The AirportType to check.
* @pre IsAirportInformationAvailable(type).
* @return The TownID of the town closest to the tile.
*/
static TownID GetNearestTown(TileIndex tile, AirportType type);

View File

@@ -38,19 +38,21 @@ void SQAIAirport_Register(Squirrel *engine) {
SQAIAirport.DefSQConst(engine, AIAirport::PT_BIG_PLANE, "PT_BIG_PLANE");
SQAIAirport.DefSQConst(engine, AIAirport::PT_INVALID, "PT_INVALID");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsValidAirportType, "IsValidAirportType", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile, "IsHangarTile", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile, "IsAirportTile", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth, "GetAirportWidth", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight, "GetAirportHeight", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNumHangars, "GetNumHangars", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetHangarOfAirport, "GetHangarOfAirport", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::BuildAirport, "BuildAirport", 4, ".iii");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::RemoveAirport, "RemoveAirport", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportType, "GetAirportType", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNoiseLevelIncrease, "GetNoiseLevelIncrease", 3, ".ii");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNearestTown, "GetNearestTown", 3, ".ii");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsValidAirportType, "IsValidAirportType", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportInformationAvailable, "IsAirportInformationAvailable", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetPrice, "GetPrice", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile, "IsHangarTile", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile, "IsAirportTile", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth, "GetAirportWidth", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight, "GetAirportHeight", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNumHangars, "GetNumHangars", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetHangarOfAirport, "GetHangarOfAirport", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::BuildAirport, "BuildAirport", 4, ".iii");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::RemoveAirport, "RemoveAirport", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportType, "GetAirportType", 2, ".i");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNoiseLevelIncrease, "GetNoiseLevelIncrease", 3, ".ii");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNearestTown, "GetNearestTown", 3, ".ii");
SQAIAirport.PostRegister(engine);
}

View File

@@ -23,10 +23,15 @@
return ::IsBridgeTile(tile);
}
/* static */ BridgeID AIBridge::GetBridgeID(TileIndex tile)
{
if (!IsBridgeTile(tile)) return (BridgeID)-1;
return (BridgeID)::GetBridgeType(tile);
}
static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
{
if (!AIBridge::_BuildBridgeRoad2()) {
AIObject::SetLastCommandRes(false);
AIInstance::DoCommandReturn(instance);
return;
}
@@ -39,7 +44,6 @@ static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
{
if (!AIBridge::_BuildBridgeRoad1()) {
AIObject::SetLastCommandRes(false);
AIInstance::DoCommandReturn(instance);
return;
}
@@ -61,7 +65,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
switch (vehicle_type) {
case AIVehicle::VT_ROAD:
type |= (TRANSPORT_ROAD << 15);
type |= (RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType()) << 8);
type |= (::RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType()) << 8);
break;
case AIVehicle::VT_RAIL:
type |= (TRANSPORT_RAIL << 15);
@@ -80,10 +84,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
AIObject::SetCallbackVariable(0, start);
AIObject::SetCallbackVariable(1, end);
if (!AIObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE, NULL, &_DoCommandReturnBuildBridge1)) return false;
/* In case of test-mode, test if we can build both road pieces */
return _BuildBridgeRoad1();
return AIObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE, NULL, &_DoCommandReturnBuildBridge1);
}
/* static */ bool AIBridge::_BuildBridgeRoad1()
@@ -95,10 +96,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
DiagDirection dir_1 = (DiagDirection)((::TileX(start) == ::TileX(end)) ? (::TileY(start) < ::TileY(end) ? DIAGDIR_NW : DIAGDIR_SE) : (::TileX(start) < ::TileX(end) ? DIAGDIR_NE : DIAGDIR_SW));
DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
if (!AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &_DoCommandReturnBuildBridge2)) return false;
/* In case of test-mode, test the other road piece too */
return _BuildBridgeRoad2();
return AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &_DoCommandReturnBuildBridge2);
}
/* static */ bool AIBridge::_BuildBridgeRoad2()
@@ -141,7 +139,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
{
if (!IsValidBridge(bridge_id)) return -1;
return length * _price.build_bridge * ::GetBridgeSpec(bridge_id)->price >> 8;
return ::CalcBridgeLenCostFactor(length) * _price.build_bridge * ::GetBridgeSpec(bridge_id)->price >> 8;
}
/* static */ int32 AIBridge::GetMaxLength(BridgeID bridge_id)

View File

@@ -51,6 +51,14 @@ public:
*/
static bool IsBridgeTile(TileIndex tile);
/**
* Get the BridgeID of a bridge at a given tile.
* @param tile The tile to get the BridgeID from.
* @pre IsBridgeTile(tile).
* @return The BridgeID from the bridge at tile 'tile'.
*/
static BridgeID GetBridgeID(TileIndex tile);
/**
* Get the name of a bridge.
* @param bridge_id The bridge to get the name of.

View File

@@ -36,6 +36,7 @@ void SQAIBridge_Register(Squirrel *engine) {
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsValidBridge, "IsValidBridge", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsBridgeTile, "IsBridgeTile", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetBridgeID, "GetBridgeID", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetName, "GetName", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetPrice, "GetPrice", 3, ".ii");

View File

@@ -18,7 +18,7 @@ public:
* The classes of cargo (from newgrf_cargo.h).
*/
enum CargoClass {
CC_PASSENGERS = 1 << 0, //!< Passengers
CC_PASSENGERS = 1 << 0, //!< Passengers. Cargos of this class appear at bus stops. Cargos not of this class appear at truck stops.
CC_MAIL = 1 << 1, //!< Mail
CC_EXPRESS = 1 << 2, //!< Express cargo (Goods, Food, Candy, but also possible for passengers)
CC_ARMOURED = 1 << 3, //!< Armoured cargo (Valuables, Gold, Diamonds)
@@ -52,6 +52,7 @@ public:
/**
* Gets the string representation of the cargo label.
* @param cargo_type The cargo to get the string representation of.
* @pre AICargo::IsValidCargo(cargo_type).
* @return The cargo label.
* @note Never use this to check if it is a certain cargo. NewGRF can
* redefine all of the names.
@@ -60,7 +61,10 @@ public:
/**
* Checks whether the give cargo is a freight or not.
* This defines whether the "freight train weight multiplier" will apply to
* trains transporting this cargo.
* @param cargo_type The cargo to check on.
* @pre AICargo::IsValidCargo(cargo_type).
* @return True if and only if the cargo is freight.
*/
static bool IsFreight(CargoID cargo_type);
@@ -68,6 +72,7 @@ public:
/**
* Check if this cargo is in the requested cargo class.
* @param cargo_type The cargo to check on.
* @pre AICargo::IsValidCargo(cargo_type).
* @param cargo_class The class to check for.
* @return True if and only if the cargo is in the cargo class.
*/
@@ -76,6 +81,7 @@ public:
/**
* Get the effect this cargo has on a town.
* @param cargo_type The cargo to check on.
* @pre AICargo::IsValidCargo(cargo_type).
* @return The effect this cargo has on a town, or TE_NONE if it has no effect.
*/
static TownEffect GetTownEffect(CargoID cargo_type);
@@ -84,6 +90,7 @@ public:
* Get the income for transporting a piece of cargo over the
* given distance within the specified time.
* @param cargo_type The cargo to transport.
* @pre AICargo::IsValidCargo(cargo_type).
* @param distance The distance the cargo travels from begin to end.
* @param days_in_transit Amount of (game) days the cargo is in transit. The max value of this variable is 637. Any value higher returns the same as 637 would.
* @return The amount of money that would be earned by this trip.

View File

@@ -0,0 +1,71 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ai_changelog.hpp Lists all changes / additions to the API.
*
* Only new / renamed / deleted api functions will be listed here. A list of
* bug fixes can be found in the normal changelog. Note that removed API
* functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut.
*
* \b 0.7.3
*
* API additions:
* \li AIAbstractList::SORT_ASCENDING
* \li AIAbstractList::SORT_DESCENDING
* \li AIAirport::IsAirportInformationAvailable
* \li AICompany::GetPresidentGender
* \li AICompany::SetPresidentGender
* \li AIEngine::GetDesignDate
* \li AIStation::GetConstructionDate
*
* Other changes:
* \li AIs are now killed when they execute a DoCommand or Sleep at a time
* they are not allowed to do so.
* \li When the API requests a string as parameter you can give every squirrel
* type and it'll be converted to a string
* \li AIs can create subclasses of API classes and use API constants as part
* of their own constants
*
* \b 0.7.2
*
* API additions:
* \li AIVehicle::GetReliability
*
* Other changes:
* \li DoCommands and sleeps in call, acall, pcall and valuators are disallowed
*
* \b 0.7.1
*
* API additions:
* \li AIAirport::GetPrice
* \li AIController::GetVersion
* \li AIOrder::AIOF_DEPOT_FLAGS
* \li AIOrder::AIOF_STOP_IN_DEPOT
* \li AIOrder::IsCurrentOrderPartOfOrderList
* \li AIOrder::IsGotoDepotOrder
* \li AIOrder::IsGotoStationOrder
* \li AIOrder::IsGotoWaypointOrder
* \li AISignList
* \li AITile::CORNER_[WSEN]
* \li AITile::ERR_AREA_ALREADY_FLAT
* \li AITile::ERR_EXCAVATION_WOULD_DAMAGE
* \li AITile::GetCornerHeight
* \li AITile::GetMaxHeight
* \li AITile::GetMinHeight
* \li AIVehicle::SendVehicleToDepotForServicing
*
* Other changes:
* \li GetURL() was added as optional function to info.nut
* \li UseAsRandomAI() was added as optional function to info.nut
* \li A limit was introduced on the time the AI spends in the constructor and Load function
*
* \b 0.7.0
* \li First stable release with the NoAI framework.
*/

View File

@@ -8,6 +8,7 @@
#include "../../command_func.h"
#include "../../company_func.h"
#include "../../company_base.h"
#include "../../company_manager_face.h"
#include "../../economy_func.h"
#include "../../strings_func.h"
#include "../../tile_map.h"
@@ -71,6 +72,27 @@
return president_name;
}
/* static */ bool AICompany::SetPresidentGender(Gender gender)
{
EnforcePrecondition(false, gender == GENDER_MALE || gender == GENDER_FEMALE);
EnforcePrecondition(false, GetPresidentGender(AICompany::COMPANY_SELF) != gender);
CompanyManagerFace cmf;
GenderEthnicity ge = (GenderEthnicity)((gender == GENDER_FEMALE ? (1 << ::GENDER_FEMALE) : 0) | (::InteractiveRandom() & (1 << ETHNICITY_BLACK)));
RandomCompanyManagerFaceBits(cmf, ge, false);
return AIObject::DoCommand(0, 0, cmf, CMD_SET_COMPANY_MANAGER_FACE);
}
/* static */ AICompany::Gender AICompany::GetPresidentGender(CompanyID company)
{
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return GENDER_INVALID;
GenderEthnicity ge = (GenderEthnicity)GetCompanyManagerFaceBits(GetCompany(company)->face, CMFV_GEN_ETHN, GE_WM);
return HasBit(ge, ::GENDER_FEMALE) ? GENDER_FEMALE : GENDER_MALE;
}
/* static */ Money AICompany::GetCompanyValue(AICompany::CompanyID company)
{
company = ResolveCompanyID(company);

View File

@@ -26,6 +26,13 @@ public:
COMPANY_SELF = 254, //!< Constant that gets resolved to the correct company index for your company.
};
/** Possible genders for company presidents. */
enum Gender {
GENDER_MALE, //!< A male person.
GENDER_FEMALE, //!< A female person.
GENDER_INVALID = -1, //!< An invalid gender.
};
/**
* Resolved the given company index to the correct index for the company. If
* the company index was COMPANY_SELF it will be resolved to the index of
@@ -78,6 +85,22 @@ public:
*/
static char *GetPresidentName(CompanyID company);
/**
* Set the gender of the president of your company.
* @param gender The new gender for your president.
* @pre GetPresidentGender(AICompany.COMPANY_SELF) != gender.
* @return True if the gender was changed.
* @note When succesfull a random face will be created.
*/
static bool SetPresidentGender(Gender gender);
/**
* Get the gender of the president of the given company.
* @param company The company to get the presidents gender off.
* @return The gender of the president.
*/
static Gender GetPresidentGender(CompanyID company);
/**
* Sets the amount to loan.
* @param loan The amount to loan (multiplier of GetLoanInterval()).
@@ -153,7 +176,8 @@ public:
* Return the location of a company's HQ.
* @param company The company the get the HQ of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @return The tile of the company's HQ, this tile is the most nothern tile of that HQ, or TILE_INVALID if there is no HQ yet.
* @return The tile of the company's HQ, this tile is the most nothern tile
* of that HQ, or AIMap::TILE_INVALID if there is no HQ yet.
*/
static TileIndex GetCompanyHQ(CompanyID company);

View File

@@ -7,6 +7,8 @@ namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
template <> AICompany::CompanyID GetParam(ForceType<AICompany::CompanyID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::CompanyID)tmp; }
template <> int Return<AICompany::CompanyID>(HSQUIRRELVM vm, AICompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> AICompany::Gender GetParam(ForceType<AICompany::Gender>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::Gender)tmp; }
template <> int Return<AICompany::Gender>(HSQUIRRELVM vm, AICompany::Gender res) { sq_pushinteger(vm, (int32)res); return 1; }
/* Allow AICompany to be used as Squirrel parameter */
template <> AICompany *GetParam(ForceType<AICompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AICompany *)instance; }
@@ -25,13 +27,18 @@ void SQAICompany_Register(Squirrel *engine) {
SQAICompany.DefSQConst(engine, AICompany::COMPANY_FIRST, "COMPANY_FIRST");
SQAICompany.DefSQConst(engine, AICompany::COMPANY_LAST, "COMPANY_LAST");
SQAICompany.DefSQConst(engine, AICompany::COMPANY_SELF, "COMPANY_SELF");
SQAICompany.DefSQConst(engine, AICompany::GENDER_MALE, "GENDER_MALE");
SQAICompany.DefSQConst(engine, AICompany::GENDER_FEMALE, "GENDER_FEMALE");
SQAICompany.DefSQConst(engine, AICompany::GENDER_INVALID, "GENDER_INVALID");
SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyID, "ResolveCompanyID", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::IsMine, "IsMine", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName, "SetName", 2, ".s");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName, "SetName", 2, "..");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetName, "GetName", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, ".s");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, "..");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentName, "GetPresidentName", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentGender, "SetPresidentGender", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentGender, "GetPresidentGender", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetLoanAmount, "SetLoanAmount", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetMinimumLoanAmount, "SetMinimumLoanAmount", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanAmount, "GetLoanAmount", 1, ".");

View File

@@ -5,6 +5,7 @@
#include "../../stdafx.h"
#include "../../string_func.h"
#include "../../company_base.h"
#include "../../rev.h"
#include "table/strings.h"
#include "../ai.hpp"
@@ -22,9 +23,8 @@
/* static */ void AIController::Sleep(int ticks)
{
if (!AIObject::GetAllowDoCommand()) {
AILog::Error("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.\n");
return;
if (!AIObject::CanSuspend()) {
throw AI_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.");
}
if (ticks <= 0) {
@@ -66,6 +66,11 @@ AIController::~AIController()
return AIConfig::GetConfig(_current_company)->GetSetting(name);
}
/* static */ uint AIController::GetVersion()
{
return _openttd_newgrf_version;
}
bool AIController::LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len)
{
LoadedLibraryList::iterator iter = this->loaded_library.find(library_name);

View File

@@ -50,6 +50,18 @@ public:
*/
static int GetSetting(const char *name);
/**
* Get the OpenTTD version of this executable. The version is formatted
* with the bits having the following meaning:
* 28-31 major version
* 24-27 minor version
* 20-23 build
* 19 1 if it is a release, 0 if it is not.
* 0-18 revision number; 0 when the revision is unknown.
* @return The version in newgrf format.
*/
static uint GetVersion();
/**
* Change the minimum amount of time the AI should be put in suspend mode
* when you execute a command. Normally in SP this is 1, and in MP it is

View File

@@ -5,10 +5,11 @@
void SQAIController_Register(Squirrel *engine) {
DefSQClass <AIController> SQAIController("AIController");
SQAIController.PreRegister(engine);
SQAIController.DefSQStaticMethod(engine, &AIController::GetTick, "GetTick", 1, "?");
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, "?i");
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, "?i");
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, "?s");
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, "?bs");
SQAIController.DefSQStaticMethod(engine, &AIController::GetTick, "GetTick", 1, ".");
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, ".i");
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, ".i");
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, ".s");
SQAIController.DefSQStaticMethod(engine, &AIController::GetVersion, "GetVersion", 1, ".");
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, ".bs");
SQAIController.PostRegister(engine);
}

View File

@@ -25,7 +25,7 @@ AIDepotList::AIDepotList(AITile::TransportType transport_type)
if (st->owner == ::_current_company) {
const AirportFTAClass *afc = st->Airport();
for (uint i = 0; i < afc->nof_depots; i++) {
this->AddItem(st->xy + ToTileIndexDiff(afc->airport_depots[i]));
this->AddItem(st->airport_tile + ToTileIndexDiff(afc->airport_depots[i]));
}
}
}

View File

@@ -6,9 +6,10 @@
#include "ai_cargo.hpp"
#include "../../company_func.h"
#include "../../strings_func.h"
#include "../../aircraft.h"
#include "../../vehicle_func.h"
#include "../../settings_type.h"
#include "../../rail.h"
#include "../../engine_base.h"
#include "../../articulated_vehicles.h"
#include "table/strings.h"
@@ -77,11 +78,8 @@
} break;
case VEH_SHIP:
return e->u.ship.capacity;
break;
case VEH_AIRCRAFT:
return AircraftDefaultCargoCapacity(e->GetDefaultCargoType(), &e->u.air);
return e->GetDisplayDefaultCapacity();
break;
default: NOT_REACHED();
@@ -154,6 +152,13 @@
return ::GetEngine(engine_id)->GetDisplayMaxTractiveEffort();
}
/* static */ int32 AIEngine::GetDesignDate(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return -1;
return ::GetEngine(engine_id)->intro_date;
}
/* static */ AIVehicle::VehicleType AIEngine::GetVehicleType(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return AIVehicle::VT_INVALID;

View File

@@ -152,6 +152,14 @@ public:
*/
static int32 GetMaxTractiveEffort(EngineID engine_id);
/**
* Get the date this engine was designed.
* @param engine_id The engine to get the design date of.
* @pre IsValidEngine(engine_id).
* @return The date this engine was designed.
*/
static int32 GetDesignDate(EngineID engine_id);
/**
* Get the type of an engine.
* @param engine_id The engine to get the type of.

View File

@@ -31,6 +31,7 @@ void SQAIEngine_Register(Squirrel *engine) {
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPower, "GetPower", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetWeight, "GetWeight", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxTractiveEffort, "GetMaxTractiveEffort", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetDesignDate, "GetDesignDate", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetVehicleType, "GetVehicleType", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsWagon, "IsWagon", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanRunOnRail, "CanRunOnRail", 3, ".ii");

View File

@@ -3,9 +3,11 @@
/** @file ai_event_types.cpp Implementation of all EventTypes. */
#include "ai_event_types.hpp"
#include "../../command_type.h"
#include "../../strings_func.h"
#include "../../settings_type.h"
#include "../../aircraft.h"
#include "../../rail.h"
#include "../../engine_base.h"
#include "../../articulated_vehicles.h"
#include "table/strings.h"
@@ -41,11 +43,8 @@ int32 AIEventEnginePreview::GetCapacity()
} break;
case VEH_SHIP:
return e->u.ship.capacity;
break;
case VEH_AIRCRAFT:
return AircraftDefaultCargoCapacity(e->GetDefaultCargoType(), &e->u.air);
return e->GetDisplayDefaultCapacity();
break;
default: NOT_REACHED();

View File

@@ -35,6 +35,7 @@ public:
/**
* @param vehicle The vehicle that crashed.
* @param crash_site Where the vehicle crashed.
* @param crash_reason The reason why the vehicle crashed.
*/
AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
AIEvent(AI_ET_VEHICLE_CRASHED),

View File

@@ -4,6 +4,9 @@
#include "ai_execmode.hpp"
#include "../../command_type.h"
#include "../../company_base.h"
#include "../../company_func.h"
#include "../ai_instance.hpp"
bool AIExecMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
{
@@ -21,6 +24,12 @@ AIExecMode::AIExecMode()
AIExecMode::~AIExecMode()
{
assert(this->GetDoCommandModeInstance() == this);
if (this->GetDoCommandModeInstance() != this) {
AIInstance *instance = GetCompany(_current_company)->ai_instance;
/* Ignore this error if the AI already died. */
if (!instance->IsDead()) {
throw AI_FatalError("AIExecMode object was removed while it was not the latest AI*Mode object created.");
}
}
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

View File

@@ -17,8 +17,8 @@ void SQAIGameSettings_Register(Squirrel *engine) {
SQAIGameSettings.PreRegister(engine);
SQAIGameSettings.AddConstructor<void (AIGameSettings::*)(), 1>(engine, "x");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid, "IsValid", 2, ".s");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue, "GetValue", 2, ".s");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid, "IsValid", 2, "..");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue, "GetValue", 2, "..");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i");
SQAIGameSettings.PostRegister(engine);

View File

@@ -29,7 +29,7 @@ void SQAIGroup_Register(Squirrel *engine) {
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::CreateGroup, "CreateGroup", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::DeleteGroup, "DeleteGroup", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetVehicleType, "GetVehicleType", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName, "SetName", 3, ".is");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName, "SetName", 3, ".i.");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetName, "GetName", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::EnableAutoReplaceProtection, "EnableAutoReplaceProtection", 3, ".ib");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetAutoReplaceProtection, "GetAutoReplaceProtection", 2, ".i");

View File

@@ -91,6 +91,20 @@
return -1;
}
/* static */ int32 AIIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!AICargo::IsValidCargo(cargo_id)) return -1;
const Industry *i = ::GetIndustry(industry_id);
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == cargo_id) return i->last_month_pct_transported[j] * 100 >> 8;
}
return -1;
}
/* static */ TileIndex AIIndustry::GetLocation(IndustryID industry_id)
{
if (!IsValidIndustry(industry_id)) return INVALID_TILE;

View File

@@ -77,6 +77,16 @@ public:
*/
static int32 GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id);
/**
* Get the percentage of cargo transported from an industry last month.
* @param industry_id The index of the industry.
* @param cargo_id The index of the cargo.
* @pre IsValidIndustry(industry_id).
* @pre AICargo::IsValidCargo(cargo_id).
* @return The percentage of given cargo transported from this industry last month.
*/
static int32 GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id);
/**
* Gets the location of the industry.
* @param industry_id The index of the industry.
@@ -86,7 +96,9 @@ public:
static TileIndex GetLocation(IndustryID industry_id);
/**
* Get the number of stations around an industry.
* Get the number of stations around an industry. All stations that can
* service the industry are counted, your own stations but also your
* opponents stations.
* @param industry_id The index of the industry.
* @pre IsValidIndustry(industry_id).
* @return The number of stations around an industry.

View File

@@ -17,23 +17,24 @@ void SQAIIndustry_Register(Squirrel *engine) {
SQAIIndustry.PreRegister(engine);
SQAIIndustry.AddConstructor<void (AIIndustry::*)(), 1>(engine, "x");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryCount, "GetIndustryCount", 1, ".");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetName, "GetName", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsCargoAccepted, "IsCargoAccepted", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetStockpiledCargo, "GetStockpiledCargo", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthProduction, "GetLastMonthProduction", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransported, "GetLastMonthTransported", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLocation, "GetLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetAmountOfStationsAround, "GetAmountOfStationsAround", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasHeliport, "HasHeliport", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetHeliportLocation, "GetHeliportLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasDock, "HasDock", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDockLocation, "GetDockLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryType, "GetIndustryType", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryCount, "GetIndustryCount", 1, ".");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetName, "GetName", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsCargoAccepted, "IsCargoAccepted", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetStockpiledCargo, "GetStockpiledCargo", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthProduction, "GetLastMonthProduction", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransported, "GetLastMonthTransported", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLocation, "GetLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetAmountOfStationsAround, "GetAmountOfStationsAround", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasHeliport, "HasHeliport", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetHeliportLocation, "GetHeliportLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasDock, "HasDock", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDockLocation, "GetDockLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryType, "GetIndustryType", 2, ".i");
SQAIIndustry.PostRegister(engine);
}

View File

@@ -111,3 +111,24 @@
uint32 seed = ::InteractiveRandom();
return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
}
/* static */ bool AIIndustryType::IsBuiltOnWater(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
}
/* static */ bool AIIndustryType::HasHeliport(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
}
/* static */ bool AIIndustryType::HasDock(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
}

View File

@@ -113,6 +113,30 @@ public:
* @note If true is returned the money is paid, whether a new industry was build or not.
*/
static bool ProspectIndustry(IndustryType industry_type);
/**
* Is this type of industry built on water.
* @param industry_type The type of the industry.
* @pre IsValidIndustryType(industry_type).
* @return True when this type is built on water.
*/
static bool IsBuiltOnWater(IndustryType industry_type);
/**
* Does this type of industry have a heliport?
* @param industry_type The type of the industry.
* @pre IsValidIndustryType(industry_type).
* @return True when this type has a heliport.
*/
static bool HasHeliport(IndustryType industry_type);
/**
* Does this type of industry have a dock?
* @param industry_type The type of the industry.
* @pre IsValidIndustryType(industry_type).
* @return True when this type has a dock.
*/
static bool HasDock(IndustryType industry_type);
};
#endif /* AI_INDUSTRYTYPE_HPP */

View File

@@ -28,6 +28,9 @@ void SQAIIndustryType_Register(Squirrel *engine) {
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanProspectIndustry, "CanProspectIndustry", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::BuildIndustry, "BuildIndustry", 3, ".ii");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProspectIndustry, "ProspectIndustry", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasHeliport, "HasHeliport", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasDock, "HasDock", 2, ".i");
SQAIIndustryType.PostRegister(engine);
}

239
src/ai/api/ai_info_docs.hpp Normal file
View File

@@ -0,0 +1,239 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ai_info_docs.hpp Description of the functions an AI can/must provide in AIInfo. */
/* This file exists purely for doxygen purposes. */
#ifdef DOXYGEN_SKIP
/**
* 'Abstract' class of the class AIs/AI libraries use to register themselves.
*
* @note This class is not part of the API. It is purely to document what
* AIs must or can implemented to provide information to OpenTTD to
* base configuring/starting/loading the AI on.
*
* @note The required functions are also needed for AI Libraries. As such
* the information here can be used for libraries, but the information
* will not be shown in the GUI except for error/debug messages.
*/
class AIInfo {
public:
/**
* Gets the author name to be shown in the 'Available AIs' window.
*
* @return The author name of the AI.
* @note This function is required.
*/
string GetAuthor();
/**
* Gets the AIs name. This is shown in the 'Available AIs' window
* and at all other places where the AI is mentioned, like the debug
* window or OpenTTD's help message. The name is used to uniquely
* identify an AI within OpenTTD and this name is used in savegames
* and the configuration file.
*
* @return The name of the AI.
* @note This function is required.
*/
string GetName();
/**
* Gets a 4 ASCII character short name of the AI to uniquely
* identify it from other AIs. The short name is primarily
* used as unique identifier for the content system.
* The content system uses besides the short name also the
* MD5 checksum of all the source files to uniquely identify
* a specific version of the AI.
*
* The short name must consist of precisely four ASCII
* characters, or more precisely four non-zero bytes.
*
* @return The name of the AI.
* @note This function is required.
*/
string GetShortName();
/**
* Gets the description to be shown in the 'Available AIs' window.
*
* @return The description for the AI.
* @note This function is required.
*/
string GetDescription();
/**
* Gets the version of the AI. This is a number to (in theory)
* uniquely identify the versions of an AI. Generally the
* 'instance' of an AI with the highest version is chosen to
* be loaded.
*
* When OpenTTD finds, during starting, a duplicate AI with the
* same version number one is randomly chosen. So it is
* important that this number is regularly updated/incremented.
*
* @return The version number of the AI.
* @note This function is required.
*/
int GetVersion();
/**
* Gets the lowest version of the AI that OpenTTD can still load
* the savegame of. In other words, from which version until this
* version can the AI load the savegames.
*
* If this function does not exist OpenTTD assumes it can only
* load savegames of this version. As such it will not upgrade
* to this version upon load.
*
* @return The lowest version number we load the savegame data.
* @note This function is optional.
*/
int MinVersionToLoad();
/**
* Gets the development/release date of the AI.
*
* The intention of this is to give the user an idea how old the
* AI is and whether there might be a newer version.
*
* @return The development/release date for the AI.
* @note This function is required.
*/
string GetDate();
/**
* Can this AI be used as random AI?
*
* The idea behind this function is to 'forbid' highly
* competitive or other special AIs from running in games unless
* the user explicitly selects the AI to be loaded. This to
* try to prevent users from complaining that the AI is too
* aggressive or does not build profitable routes.
*
* If this function does not exist OpenTTD assumes the AI can
* be used as random AI. As such it will be randomly chosen.
*
* @return True if the AI can be used as random AI.
* @note This function is optional.
*/
bool UseAsRandomAI();
/**
* Gets the name of main class of the AI so OpenTTD knows
* what class to instantiate.
*
* @return The class name of the AI.
* @note This function is required.
*/
string CreateInstance();
/**
* Gets the API version this AI is written for. If this function
* does not exist API compatability with version 0.7 is assumed.
* If the function returns something OpenTTD does not understand,
* for example a newer version or a string that is not a version,
* the AI will not be loaded.
*
* Although in the future we might need to make a separate
* compatability 'wrapper' for a specific version of OpenTTD, for
* example '0.7.1', we will use only the major and minor number
* and not the bugfix number as valid return for this function.
*
* Valid return values are:
* - "0.7"
*
* @return The version this AI is compatible with.
* @note This function is optional.
*/
string GetAPIVersion();
/**
* Gets the URL to be shown in the 'this AI has crashed' message
* and in the 'Available AIs' window. If this function does not
* exist no URL will be shown.
*
* This function purely exists to redirect users of the AI to the
* right place on the internet to discuss the AI and report bugs
* of this AI.
*
* @return The URL to show.
* @note This function is optional.
*/
string GetURL();
/**
* Gets the settings that OpenTTD shows in the "AI Parameters" window
* so the user can customize the AI. This is a special function that
* doesn't need to return anything. Instead you can call AddSetting
* and AddLabels here.
*
* @note This function is optional.
*/
void GetSettings();
/** Miscellaneous flags for AI settings. */
enum AIConfigFlags {
AICONFIG_NONE, //!< Normal setting.
AICONFIG_RANDOM, //!< When randomizing the AI, pick any value between min_value and max_value.
AICONFIG_BOOLEAN, //!< This value is a boolean (either 0 (false) or 1 (true) ).
};
/**
* Add a user configurable setting for this AI. You can call this
* as many times as you have settings.
* @param setting_description A table with all information about a
* single setting. The table should have the following name/value pairs:
* - name The name of the setting, this is used in openttd.cfg to
* store the current configuration of AIs. Required.
* - description A single line describing the setting. Required.
* - min_value The minimum value of this setting. Required for integer
* settings and not allowed for boolean settings.
* - max_value The maximum value of this setting. Required for integer
* settings and not allowed for boolean settings.
* - easy_value The default value if the easy difficulty level
* is selected. Required.
* - medium_value The default value if the medium difficulty level
* is selected. Required.
* - hard_value The default value if the hard difficulty level
* is selected. Required.
* - custom_value The default value if the custom difficulty level
* is selected. Required.
* - random_deviation If this property has a nonzero value, then the
* actual value of the setting in game will be
* user_configured_value + random(-random_deviation, random_deviation).
* Not allowed if the AICONFIG_RANDOM flag is set, otherwise optional.
* - step_size The increase/decrease of the value every time the user
* clicks one of the up/down arrow buttons. Optional, default is 1.
* - flags Bitmask of some flags, see AIConfigFlags. Required.
*
* @note This is a function provided by OpenTTD, you don't have to
* include it in your AI but should just call it from GetSettings.
*/
void AddSetting(table setting_description);
/**
* Add labels for the values of a setting. Instead of a number the
* user will see the corresponding name.
* @param setting_name The name of the setting.
* @param value_names A table that maps values to names. The first
* character of every identifier is ignored and the rest should
* be the an integer of the value you define a name for. The value
* is a short description of that value.
* To define labels for a setting named "competition_level" you could
* for example call it like this:
* AddLabels("competition_level", {_0 = "no competition", _1 = "some competition",
* _2 = "a lot of competition"});
*
* @note This is a function provided by OpenTTD, you don't have to
* include it in your AI but should just call it from GetSettings.
*/
void AddLabels(const char *setting_name, table value_names);
};
#endif

View File

@@ -32,7 +32,7 @@
log->lines = CallocT<char *>(80);
log->type = CallocT<AILog::AILogType>(80);
log->count = 80;
log->pos = log->count;
log->pos = log->count - 1;
log->used = 0;
}
LogData *log = (LogData *)AIObject::GetLogPointer();

View File

@@ -17,9 +17,9 @@ void SQAILog_Register(Squirrel *engine) {
SQAILog.PreRegister(engine);
SQAILog.AddConstructor<void (AILog::*)(), 1>(engine, "x");
SQAILog.DefSQStaticMethod(engine, &AILog::Info, "Info", 2, ".s");
SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, ".s");
SQAILog.DefSQStaticMethod(engine, &AILog::Error, "Error", 2, ".s");
SQAILog.DefSQStaticMethod(engine, &AILog::Info, "Info", 2, "..");
SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, "..");
SQAILog.DefSQStaticMethod(engine, &AILog::Error, "Error", 2, "..");
SQAILog.PostRegister(engine);
}

View File

@@ -13,10 +13,11 @@
class AIMap : public AIObject {
public:
#ifdef DEFINE_SCRIPT_FILES
enum MapType {
TILE_INVALID = INVALID_TILE, //!< Invalid TileIndex.
};
static const int TILE_INVALID = INVALID_TILE; //!< Invalid TileIndex.
#endif /* DEFINE_SCRIPT_FILES */
#ifdef DOXYGEN_SKIP
const static TileIndex TILE_INVALID; //!< Invalid TileIndex.
#endif /* DOXYGEN_SKIP */
static const char *GetClassName() { return "AIMap"; }

View File

@@ -4,10 +4,6 @@
#include "ai_map.hpp"
namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
template <> AIMap::MapType GetParam(ForceType<AIMap::MapType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIMap::MapType)tmp; }
template <> int Return<AIMap::MapType>(HSQUIRRELVM vm, AIMap::MapType res) { sq_pushinteger(vm, (int32)res); return 1; }
/* Allow AIMap to be used as Squirrel parameter */
template <> AIMap *GetParam(ForceType<AIMap *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIMap *)instance; }
template <> AIMap &GetParam(ForceType<AIMap &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIMap *)instance; }

View File

@@ -55,13 +55,13 @@
DiagDirection to_other_tile = (TileX(t1) == TileX(t2)) ? DIAGDIR_SE : DIAGDIR_SW;
/* Determine the reachable tracks from the shared edge */
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
if (gtts2 == TRACK_BIT_NONE) return false;
TrackBits gtts1 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t1, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
if (gtts1 == TRACK_BIT_NONE) return false;
to_other_tile = ReverseDiagDir(to_other_tile);
TrackBits gtts1 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t1, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
return gtts1 != TRACK_BIT_NONE;
return gtts2 != TRACK_BIT_NONE;
}
/* static */ bool AIMarine::BuildWaterDepot(TileIndex tile, TileIndex front)

View File

@@ -2,6 +2,11 @@
/** @file ai_object.cpp Implementation of AIObject. */
#include "../../stdafx.h"
#include <squirrel.h>
#include "../../script/squirrel.hpp"
#include "../../company_base.h"
#include "ai_log.hpp"
#include "table/strings.h"
#include "../ai.hpp"
@@ -160,6 +165,12 @@ bool AIObject::GetAllowDoCommand()
return GetStorage()->allow_do_command;
}
bool AIObject::CanSuspend()
{
Squirrel *squirrel = GetCompany(_current_company)->ai_instance->engine;
return GetStorage()->allow_do_command && squirrel->CanSuspend();
}
void *&AIObject::GetEventPointer()
{
return GetStorage()->event_data;
@@ -183,9 +194,8 @@ int AIObject::GetCallbackVariable(int index)
bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text, AISuspendCallbackProc *callback)
{
if (AIObject::GetAllowDoCommand() == false) {
AILog::Error("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.\n");
return false;
if (!AIObject::CanSuspend()) {
throw AI_FatalError("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.");
}
CommandCost res;

View File

@@ -133,8 +133,15 @@ protected:
static GroupID GetNewGroupID();
/**
* Get the latest stored allow_do_command.
* If this is false, you are not allowed to do any DoCommands.
* Can we suspend the AI at this moment?
*/
static bool CanSuspend();
/**
* Get the internal value of allow_do_command. This can differ
* from CanSuspend() if the reason we are not allowed
* to execute a DoCommand is in squirrel and not the API.
* In that case use this function to restore the previous value.
*/
static bool GetAllowDoCommand();
@@ -143,9 +150,24 @@ protected:
*/
static void *&GetEventPointer();
/**
* Set the cost of the last command.
*/
static void SetLastCost(Money last_cost);
/**
* Get the cost of the last command.
*/
static Money GetLastCost();
/**
* Set a variable that can be used by callback functions to pass information.
*/
static void SetCallbackVariable(int index, int value);
/**
* Get the variable that is used by callback functions to pass information.
*/
static int GetCallbackVariable(int index);
public:

View File

@@ -23,7 +23,10 @@ static OrderType GetOrderTypeByTile(TileIndex t)
switch (::GetTileType(t)) {
default: break;
case MP_STATION: return OT_GOTO_STATION; break;
case MP_STATION:
if (IsHangar(t)) return OT_GOTO_DEPOT;
return OT_GOTO_STATION;
break;
case MP_WATER: if (::IsShipDepot(t)) return OT_GOTO_DEPOT; break;
case MP_ROAD: if (::GetRoadTileType(t) == ROAD_TILE_DEPOT) return OT_GOTO_DEPOT; break;
case MP_RAILWAY:
@@ -43,6 +46,47 @@ static OrderType GetOrderTypeByTile(TileIndex t)
return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::GetVehicle(vehicle_id)->GetNumOrders() || order_position == ORDER_CURRENT);
}
/**
* Get the current order the vehicle is executing. If the current order is in
* the order list, return the order from the orderlist. If the current order
* was a manual order, return the current order.
*/
static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition order_position)
{
const Vehicle *v = ::GetVehicle(vehicle_id);
if (order_position == AIOrder::ORDER_CURRENT) {
const Order *order = &v->current_order;
if (order->GetType() == OT_GOTO_DEPOT && !(order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) return order;
order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
if (order_position == AIOrder::ORDER_INVALID) return NULL;
}
return ::GetVehicleOrder(v, order_position);
}
/* static */ bool AIOrder::IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
return order != NULL && order->GetType() == OT_GOTO_STATION;
}
/* static */ bool AIOrder::IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
return order != NULL && order->GetType() == OT_GOTO_DEPOT;
}
/* static */ bool AIOrder::IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
return order != NULL && order->GetType() == OT_GOTO_WAYPOINT;
}
/* static */ bool AIOrder::IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position)
{
if (order_position == ORDER_CURRENT) return false;
@@ -52,6 +96,16 @@ static OrderType GetOrderTypeByTile(TileIndex t)
return order->GetType() == OT_CONDITIONAL;
}
/* static */ bool AIOrder::IsCurrentOrderPartOfOrderList(VehicleID vehicle_id)
{
if (AIVehicle::IsValidVehicle(vehicle_id)) return false;
if (GetOrderCount(vehicle_id) == 0) return false;
const Order *order = &::GetVehicle(vehicle_id)->current_order;
if (order->GetType() != OT_GOTO_DEPOT) return true;
return (order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0;
}
/* static */ AIOrder::OrderPosition AIOrder::ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position)
{
if (!AIVehicle::IsValidVehicle(vehicle_id)) return ORDER_INVALID;
@@ -74,7 +128,10 @@ static OrderType GetOrderTypeByTile(TileIndex t)
(((order_flags & AIOF_NO_UNLOAD) == 0) || ((order_flags & AIOF_NO_LOAD) == 0)) &&
(((order_flags & AIOF_FULL_LOAD_ANY) == 0) || ((order_flags & AIOF_NO_LOAD) == 0));
case OT_GOTO_DEPOT: return (order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_SERVICE_IF_NEEDED)) == 0;
case OT_GOTO_DEPOT:
return ((order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_DEPOT_FLAGS)) == 0) &&
(((order_flags & AIOF_SERVICE_IF_NEEDED) == 0) || ((order_flags & AIOF_STOP_IN_DEPOT) == 0));
case OT_GOTO_WAYPOINT: return (order_flags & ~(AIOF_NON_STOP_FLAGS)) == 0;
default: return false;
}
@@ -108,21 +165,41 @@ static OrderType GetOrderTypeByTile(TileIndex t)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return INVALID_TILE;
const Order *order;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
if (order == NULL || order->GetType() == OT_CONDITIONAL) return INVALID_TILE;
const Vehicle *v = ::GetVehicle(vehicle_id);
if (order_position == ORDER_CURRENT) {
order = &v->current_order;
} else {
order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position);
if (order->GetType() == OT_CONDITIONAL) return INVALID_TILE;
}
switch (order->GetType()) {
case OT_GOTO_DEPOT:
case OT_GOTO_DEPOT: {
if (v->type != VEH_AIRCRAFT) return ::GetDepot(order->GetDestination())->xy;
/* FALL THROUGH: aircraft's hangars are referenced by StationID, not DepotID */
/* Aircraft's hangars are referenced by StationID, not DepotID */
const Station *st = ::GetStation(order->GetDestination());
const AirportFTAClass *airport = st->Airport();
if (airport == NULL || airport->nof_depots == 0) return INVALID_TILE;
return st->airport_tile + ::ToTileIndexDiff(st->Airport()->airport_depots[0]);
}
case OT_GOTO_STATION: return ::GetStation(order->GetDestination())->xy;
case OT_GOTO_STATION: {
const Station *st = ::GetStation(order->GetDestination());
if (st->train_tile != INVALID_TILE) {
for (uint i = 0; i < st->trainst_w; i++) {
TileIndex t = st->train_tile + TileDiffXY(i, 0);
if (st->TileBelongsToRailStation(t)) return t;
}
} else if (st->dock_tile != INVALID_TILE) {
return st->dock_tile;
} else if (st->bus_stops != NULL) {
return st->bus_stops->xy;
} else if (st->truck_stops != NULL) {
return st->truck_stops->xy;
} else if (st->airport_tile != INVALID_TILE) {
const AirportFTAClass *fta = st->Airport();
BEGIN_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) {
if (!::IsHangar(tile)) return tile;
} END_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile)
}
return INVALID_TILE;
}
case OT_GOTO_WAYPOINT: return ::GetWaypoint(order->GetDestination())->xy;
default: return INVALID_TILE;
}
@@ -132,19 +209,15 @@ static OrderType GetOrderTypeByTile(TileIndex t)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return AIOF_INVALID;
const Order *order;
if (order_position == ORDER_CURRENT) {
order = &::GetVehicle(vehicle_id)->current_order;
} else {
order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position);
if (order->GetType() == OT_CONDITIONAL) return AIOF_INVALID;
}
const Order *order = ::ResolveOrder(vehicle_id, order_position);
if (order == NULL || order->GetType() == OT_CONDITIONAL) return AIOF_INVALID;
AIOrderFlags order_flags = AIOF_NONE;
order_flags |= (AIOrderFlags)order->GetNonStopType();
switch (order->GetType()) {
case OT_GOTO_DEPOT:
if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= AIOF_SERVICE_IF_NEEDED;
if (order->GetDepotActionType() & ODATFB_HALT) order_flags |= AIOF_STOP_IN_DEPOT;
break;
case OT_GOTO_STATION:
@@ -260,9 +333,21 @@ static OrderType GetOrderTypeByTile(TileIndex t)
Order order;
switch (::GetOrderTypeByTile(destination)) {
case OT_GOTO_DEPOT:
order.MakeGoToDepot(::GetDepotByTile(destination)->index, (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & AIOF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0)));
case OT_GOTO_DEPOT: {
OrderDepotTypeFlags odtf = (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & AIOF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0));
OrderDepotActionFlags odaf = (OrderDepotActionFlags)(ODATF_SERVICE_ONLY | ((order_flags & AIOF_STOP_IN_DEPOT) ? ODATFB_HALT : 0));
OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & AIOF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
/* Check explicitly if the order is to a station (for aircraft) or
* to a depot (other vehicle types). */
if (::GetVehicle(vehicle_id)->type == VEH_AIRCRAFT) {
if (!::IsTileType(destination, MP_STATION)) return false;
order.MakeGoToDepot(::GetStationIndex(destination), odtf, onsf, odaf);
} else {
if (::IsTileType(destination, MP_STATION)) return false;
order.MakeGoToDepot(::GetDepotByTile(destination)->index, odtf, onsf, odaf);
}
break;
}
case OT_GOTO_STATION:
order.MakeGoToStation(::GetStationIndex(destination));
@@ -356,8 +441,11 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
switch (order->GetType()) {
case OT_GOTO_DEPOT:
if ((current & AIOF_SERVICE_IF_NEEDED) != (order_flags & AIOF_SERVICE_IF_NEEDED)) {
return AIObject::DoCommand(0, vehicle_id | (order_position << 16), MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
if ((current & AIOF_DEPOT_FLAGS) != (order_flags & AIOF_DEPOT_FLAGS)) {
uint data = DA_ALWAYS_GO;
if (order_flags & AIOF_SERVICE_IF_NEEDED) data = DA_SERVICE;
if (order_flags & AIOF_STOP_IN_DEPOT) data = DA_STOP;
return AIObject::DoCommand(0, vehicle_id | (order_position << 16), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
}
break;

View File

@@ -57,6 +57,8 @@ public:
/** Service the vehicle when needed, otherwise skip this order; only for depots. */
AIOF_SERVICE_IF_NEEDED = 1 << 2,
/** Stop in the depot instead of only go there for servicing; only for depots. */
AIOF_STOP_IN_DEPOT = 1 << 3,
/** All flags related to non-stop settings. */
AIOF_NON_STOP_FLAGS = AIOF_NON_STOP_INTERMEDIATE | AIOF_NON_STOP_DESTINATION,
@@ -64,6 +66,8 @@ public:
AIOF_UNLOAD_FLAGS = AIOF_TRANSFER | AIOF_UNLOAD | AIOF_NO_UNLOAD,
/** All flags related to loading. */
AIOF_LOAD_FLAGS = AIOF_FULL_LOAD | AIOF_FULL_LOAD_ANY | AIOF_NO_LOAD,
/** All flags related to depots. */
AIOF_DEPOT_FLAGS = AIOF_SERVICE_IF_NEEDED | AIOF_STOP_IN_DEPOT,
/** For marking invalid order flags */
AIOF_INVALID = 0xFFFF,
@@ -114,6 +118,33 @@ public:
*/
static bool IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position);
/**
* Checks whether the given order is a goto-station order.
* @param vehicle_id The vehicle to check.
* @param order_position The order index to check.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @return True if and only if the order is a goto-station order.
*/
static bool IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position);
/**
* Checks whether the given order is a goto-depot order.
* @param vehicle_id The vehicle to check.
* @param order_position The order index to check.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @return True if and only if the order is a goto-depot order.
*/
static bool IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position);
/**
* Checks whether the given order is a goto-waypoint order.
* @param vehicle_id The vehicle to check.
* @param order_position The order index to check.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @return True if and only if the order is a goto-waypoint order.
*/
static bool IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position);
/**
* Checks whether the given order is a conditional order.
* @param vehicle_id The vehicle to check.
@@ -123,6 +154,17 @@ public:
*/
static bool IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position);
/**
* Checks whether the current order is part of the orderlist.
* @param vehicle_id The vehicle to check.
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @return True if and only if the current order is part of the order list.
* @note If the order is a non-'non-stop' order, and the vehicle is currently
* (un)loading at a station that is not the final destination, this function
* will still return true.
*/
static bool IsCurrentOrderPartOfOrderList(VehicleID vehicle_id);
/**
* Resolves the given order index to the correct index for the given vehicle.
* If the order index was ORDER_CURRENT it will be resolved to the index of
@@ -246,8 +288,10 @@ public:
* Sets the OrderCondition of the given order for the given vehicle.
* @param vehicle_id The vehicle to set the condition type for.
* @param order_position The order to set the condition type for.
* @param condition The condition to compare on.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
* @pre condition >= OC_LOAD_PERCENTAGE && condition <= OC_UNCONDITIONALLY.
* @return Whether the order has been/can be changed.
*/
static bool SetOrderCondition(VehicleID vehicle_id, OrderPosition order_position, OrderCondition condition);
@@ -256,8 +300,10 @@ public:
* Sets the CompareFunction of the given order for the given vehicle.
* @param vehicle_id The vehicle to set the compare function for.
* @param order_position The order to set the compare function for.
* @param compare The new compare function of the order.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
* @pre compare >= CF_EQUALS && compare <= CF_IS_FALSE.
* @return Whether the order has been/can be changed.
*/
static bool SetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position, CompareFunction compare);
@@ -266,6 +312,7 @@ public:
* Sets the value to compare against of the given order for the given vehicle.
* @param vehicle_id The vehicle to set the value for.
* @param order_position The order to set the value for.
* @param value The value to compare against.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
* @pre value >= 0 && value < 2048.
@@ -281,7 +328,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre AreOrderFlagsValid(destination, order_flags).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
* @return True if and only if the order was appended.
*/
@@ -294,7 +341,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre IsValidVehicleOrder(vehicle_id, jump_to).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @return True if and only if the order was appended.
*/
static bool AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to);
@@ -308,7 +355,7 @@ public:
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre AreOrderFlagsValid(destination, order_flags).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
* @return True if and only if the order was inserted.
*/
@@ -322,7 +369,7 @@ public:
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre IsValidVehicleOrder(vehicle_id, jump_to).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @return True if and only if the order was inserted.
*/
static bool InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to);
@@ -395,7 +442,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre AIVehicle::IsValidVehicle(main_vehicle_id).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @return True if and only if the copying succeeded.
*/
static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);

View File

@@ -42,9 +42,11 @@ void SQAIOrder_Register(Squirrel *engine) {
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_FULL_LOAD_ANY, "AIOF_FULL_LOAD_ANY");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NO_LOAD, "AIOF_NO_LOAD");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_SERVICE_IF_NEEDED, "AIOF_SERVICE_IF_NEEDED");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_STOP_IN_DEPOT, "AIOF_STOP_IN_DEPOT");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_FLAGS, "AIOF_NON_STOP_FLAGS");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_UNLOAD_FLAGS, "AIOF_UNLOAD_FLAGS");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_LOAD_FLAGS, "AIOF_LOAD_FLAGS");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_DEPOT_FLAGS, "AIOF_DEPOT_FLAGS");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_INVALID, "AIOF_INVALID");
SQAIOrder.DefSQConst(engine, AIOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE");
SQAIOrder.DefSQConst(engine, AIOrder::OC_RELIABILITY, "OC_RELIABILITY");
@@ -71,34 +73,38 @@ void SQAIOrder_Register(Squirrel *engine) {
AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_MANY, "ERR_ORDER_TOO_MANY");
AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidVehicleOrder, "IsValidVehicleOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsConditionalOrder, "IsConditionalOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ResolveOrderPosition, "ResolveOrderPosition", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AreOrderFlagsValid, "AreOrderFlagsValid", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidConditionalOrder, "IsValidConditionalOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCount, "GetOrderCount", 2, ".i");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderDestination, "GetOrderDestination", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderFlags, "GetOrderFlags", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderJumpTo, "GetOrderJumpTo", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCondition, "GetOrderCondition", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareFunction, "GetOrderCompareFunction", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareValue, "GetOrderCompareValue", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderJumpTo, "SetOrderJumpTo", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCondition, "SetOrderCondition", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareFunction, "SetOrderCompareFunction", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareValue, "SetOrderCompareValue", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendOrder, "AppendOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendConditionalOrder, "AppendConditionalOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertOrder, "InsertOrder", 5, ".iiii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder, "InsertConditionalOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder, "RemoveOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags, "SetOrderFlags", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ChangeOrder, "ChangeOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder, "MoveOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder, "SkipToOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders, "CopyOrders", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders, "ShareOrders", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders, "UnshareOrders", 2, ".i");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidVehicleOrder, "IsValidVehicleOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoStationOrder, "IsGotoStationOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoDepotOrder, "IsGotoDepotOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoWaypointOrder, "IsGotoWaypointOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsConditionalOrder, "IsConditionalOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsCurrentOrderPartOfOrderList, "IsCurrentOrderPartOfOrderList", 2, ".i");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ResolveOrderPosition, "ResolveOrderPosition", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AreOrderFlagsValid, "AreOrderFlagsValid", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidConditionalOrder, "IsValidConditionalOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCount, "GetOrderCount", 2, ".i");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderDestination, "GetOrderDestination", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderFlags, "GetOrderFlags", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderJumpTo, "GetOrderJumpTo", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCondition, "GetOrderCondition", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareFunction, "GetOrderCompareFunction", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareValue, "GetOrderCompareValue", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderJumpTo, "SetOrderJumpTo", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCondition, "SetOrderCondition", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareFunction, "SetOrderCompareFunction", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareValue, "SetOrderCompareValue", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendOrder, "AppendOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendConditionalOrder, "AppendConditionalOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertOrder, "InsertOrder", 5, ".iiii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder, "InsertConditionalOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder, "RemoveOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags, "SetOrderFlags", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ChangeOrder, "ChangeOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder, "MoveOrder", 4, ".iii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder, "SkipToOrder", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders, "CopyOrders", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders, "ShareOrders", 3, ".ii");
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders, "UnshareOrders", 2, ".i");
SQAIOrder.PostRegister(engine);
}

View File

@@ -110,7 +110,7 @@
{
if (!IsRailStationTile(tile)) return RAILTRACK_INVALID;
return (RailTrack)::GetRailStationTrack(tile);
return (RailTrack)::GetRailStationTrackBits(tile);
}
/* static */ bool AIRail::BuildRailDepot(TileIndex tile, TileIndex front)
@@ -203,6 +203,7 @@
if (IsRailWaypointTile(tile)) return ::GetRailWaypointBits(tile);
if (IsRailStationTile(tile)) return ::TrackToTrackBits(::GetRailStationTrack(tile));
if (IsLevelCrossingTile(tile)) return ::GetCrossingRailBits(tile);
if (IsRailDepotTile(tile)) return ::TRACK_BIT_NONE;
return ::GetTrackBits(tile);
}
@@ -220,7 +221,7 @@
/* static */ bool AIRail::RemoveRailTrack(TileIndex tile, RailTrack rail_track)
{
EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsTileType(tile, MP_RAILWAY) && ::IsPlainRailTile(tile));
EnforcePrecondition(false, ::IsPlainRailTile(tile) || ::IsLevelCrossingTile(tile));
EnforcePrecondition(false, GetRailTracks(tile) & rail_track);
EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
@@ -403,7 +404,7 @@ static bool IsValidSignalType(int signal_type)
/* static */ bool AIRail::BuildSignal(TileIndex tile, TileIndex front, SignalType signal)
{
EnforcePrecondition(false, AIMap::DistanceManhattan(tile, front) == 1)
EnforcePrecondition(false, ::IsTileType(tile, MP_RAILWAY) && ::IsPlainRailTile(tile));
EnforcePrecondition(false, ::IsPlainRailTile(tile));
EnforcePrecondition(false, ::IsValidSignalType(signal));
Track track = INVALID_TRACK;

View File

@@ -293,6 +293,7 @@ public:
/**
* Get all RailTracks on the given tile.
* @note A depot has no railtracks.
* @param tile The tile to check.
* @pre IsRailTile(tile).
* @return A bitmask of RailTrack with all RailTracks on the tile.

View File

@@ -5,12 +5,18 @@
#include "ai_road.hpp"
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "ai_cargo.hpp"
#include "../../station_map.h"
#include "../../command_type.h"
#include "../../settings_type.h"
#include "../../company_func.h"
#include "../../script/squirrel_helper_type.hpp"
/* static */ AIRoad::RoadVehicleType AIRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
{
return AICargo::HasCargoClass(cargo_type, AICargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
}
/* static */ bool AIRoad::IsRoadTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
@@ -69,6 +75,7 @@
{
if (!::IsValidTile(t1)) return false;
if (!::IsValidTile(t2)) return false;
if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
/* Tiles not neighbouring */
if ((abs((int)::TileX(t1) - (int)::TileX(t2)) + abs((int)::TileY(t1) - (int)::TileY(t2))) != 1) return false;
@@ -415,6 +422,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
/* static */ int32 AIRoad::GetNeighbourRoadCount(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
::RoadTypes rts = ::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType());
int32 neighbour = 0;
@@ -455,6 +463,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(end));
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
EnforcePrecondition(false, !one_way || AIObject::GetRoadType() == ::ROADTYPE_ROAD);
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (AIObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 5), CMD_BUILD_LONG_ROAD);
}
@@ -485,6 +494,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsValidTile(front));
EnforcePrecondition(false, ::TileX(tile) == ::TileX(front) || ::TileY(tile) == ::TileY(front));
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
uint entrance_dir = (::TileX(tile) == ::TileX(front)) ? (::TileY(tile) < ::TileY(front) ? 1 : 3) : (::TileX(tile) < ::TileX(front) ? 2 : 0);
@@ -499,6 +509,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::TileX(tile) == ::TileX(front) || ::TileY(tile) == ::TileY(front));
EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
EnforcePrecondition(false, road_veh_type == ROADVEHTYPE_BUS || road_veh_type == ROADVEHTYPE_TRUCK);
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
uint entrance_dir;
if (drive_through) {
@@ -530,6 +541,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(start));
EnforcePrecondition(false, ::IsValidTile(end));
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
}
@@ -539,6 +551,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(start));
EnforcePrecondition(false, ::IsValidTile(end));
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
}

View File

@@ -56,6 +56,14 @@ public:
ROADVEHTYPE_TRUCK, //!< Build objects useable for trucks and cargo trams
};
/**
* Determines whether a busstop or a truckstop is needed to transport a certain cargo.
* @param cargo_type The cargo to test.
* @pre AICargo::IsValidCargo(cargo_type).
* @return The road vehicle type needed to transport the cargo.
*/
static RoadVehicleType GetRoadVehicleTypeForCargo(CargoID cargo_type);
/**
* Checks whether the given tile is actually a tile with road that can be
* used to traverse a tile. This excludes road depots and 'normal' road
@@ -126,6 +134,7 @@ public:
* center of the second tile.
* @param tile_from The source tile.
* @param tile_to The destination tile.
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @pre AIMap::IsValidTile(tile_from).
* @pre AIMap::IsValidTile(tile_to).
* @pre 'tile_from' and 'tile_to' are directly neighbouring tiles.
@@ -189,6 +198,7 @@ public:
* Count how many neighbours are road.
* @param tile The tile to check on.
* @pre AIMap::IsValidTile(tile).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @return 0 means no neighbour road; max value is 4.
*/
static int32 GetNeighbourRoadCount(TileIndex tile);
@@ -229,6 +239,7 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_ALREADY_BUILT
* @exception AIError::ERR_LAND_SLOPED_WRONG
* @exception AIError::ERR_AREA_NOT_CLEAR
@@ -276,6 +287,7 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_ALREADY_BUILT
* @exception AIError::ERR_LAND_SLOPED_WRONG
* @exception AIError::ERR_AREA_NOT_CLEAR
@@ -320,6 +332,7 @@ public:
* @pre AIMap::IsValidTile(tile).
* @pre AIMap::IsValidTile(front).
* @pre 'tile' is not equal to 'front', but in a straight line of it.
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIError::ERR_AREA_NOT_CLEAR
* @return Whether the road depot has been/can be build or not.
@@ -336,12 +349,13 @@ public:
* @pre AIMap::IsValidTile(front).
* @pre 'tile' is not equal to 'front', but in a straight line of it.
* @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
* @pre GetCurrentRoadType() == ROADTYPE_ROAD.
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_AREA_NOT_CLEAR
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
* @exception AIError:ERR_VEHICLE_IN_THE_WAY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
@@ -351,7 +365,7 @@ public:
/**
* Builds a drive-through road bus or truck station.
* @param tile Place to build the depot.
* @param tile Place to build the station.
* @param front A tile on the same axis with 'tile' as the station shall be oriented.
* @param road_veh_type Whether to build a truck or bus station.
* @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
@@ -359,12 +373,13 @@ public:
* @pre AIMap::IsValidTile(front).
* @pre 'tile' is not equal to 'front', but in a straight line of it.
* @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_AREA_NOT_CLEAR
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
* @exception AIError:ERR_VEHICLE_IN_THE_WAY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
@@ -381,6 +396,7 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
@@ -398,6 +414,7 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS

View File

@@ -46,6 +46,7 @@ void SQAIRoad_Register(Squirrel *engine) {
AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD, "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD");
AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS");
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetRoadVehicleTypeForCargo, "GetRoadVehicleTypeForCargo", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadTile, "IsRoadTile", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadDepotTile, "IsRoadDepotTile", 2, ".i");
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadStationTile, "IsRoadStationTile", 2, ".i");

View File

@@ -30,6 +30,7 @@ public:
/**
* Gets the maximum sign index; there are no valid signs with a higher index.
* @deprecated This function is deprecated and might be removed in future versions of the API. Use AISignList() instead.
* @return The maximum sign index.
* @post Return value is always non-negative.
*/

View File

@@ -30,10 +30,10 @@ void SQAISign_Register(Squirrel *engine) {
SQAISign.DefSQStaticMethod(engine, &AISign::GetMaxSignID, "GetMaxSignID", 1, ".");
SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".is");
SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".i.");
SQAISign.DefSQStaticMethod(engine, &AISign::GetName, "GetName", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".is");
SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".i.");
SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign, "RemoveSign", 2, ".i");
SQAISign.PostRegister(engine);

View File

@@ -0,0 +1,15 @@
/* $Id$ */
/** @file ai_signlist.cpp Implementation of AISignList and friends. */
#include "ai_signlist.hpp"
#include "ai_sign.hpp"
#include "../../signs_base.h"
AISignList::AISignList()
{
Sign *s;
FOR_ALL_SIGNS(s) {
if (AISign::IsValidSign(s->index)) this->AddItem(s->index);
}
}

View File

@@ -0,0 +1,20 @@
/* $Id$ */
/** @file ai_signlist.hpp List all the signs of your company. */
#ifndef AI_SIGNLIST_HPP
#define AI_SIGNLIST_HPP
#include "ai_abstractlist.hpp"
/**
* Create a list of signs your company has created.
* @ingroup AIList
*/
class AISignList : public AIAbstractList {
public:
static const char *GetClassName() { return "AISignList"; }
AISignList();
};
#endif /* AI_SIGNLIST_HPP */

View File

@@ -0,0 +1,21 @@
/* $Id$ */
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
#include "ai_signlist.hpp"
namespace SQConvert {
/* Allow AISignList to be used as Squirrel parameter */
template <> AISignList *GetParam(ForceType<AISignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISignList *)instance; }
template <> AISignList &GetParam(ForceType<AISignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISignList *)instance; }
template <> const AISignList *GetParam(ForceType<const AISignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISignList *)instance; }
template <> const AISignList &GetParam(ForceType<const AISignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISignList *)instance; }
template <> int Return<AISignList *>(HSQUIRRELVM vm, AISignList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISignList", res, NULL, DefSQDestructorCallback<AISignList>); return 1; }
}; // namespace SQConvert
void SQAISignList_Register(Squirrel *engine) {
DefSQClass <AISignList> SQAISignList("AISignList");
SQAISignList.PreRegister(engine, "AIAbstractList");
SQAISignList.AddConstructor<void (AISignList::*)(), 1>(engine, "x");
SQAISignList.PostRegister(engine);
}

Some files were not shown because too many files have changed in this diff Show More