1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-14 01:59:09 +00:00

Compare commits

..

79 Commits

Author SHA1 Message Date
rubidium
c01a5f8727 (svn r26034) -Release: 1.3.3-RC1 2013-11-17 17:40:08 +00:00
rubidium
1c45ddd861 (svn r26033) [1.3] -Update: some documentation 2013-11-17 17:36:00 +00:00
rubidium
4a33c03a49 (svn r26032) [1.3] -Backport from trunk:
- Fix: The internal index of a character in the layout line depends on the used layouter (r26029)
- Fix: Make the installer warning about Windows XP SP3 not trigger on the 64 bit Windows XP which is not really Windows XP to start with [FS#5773] (r26028)
2013-11-17 17:31:51 +00:00
rubidium
28dfc29888 (svn r26031) [1.3] -Backport from trunk: language updates 2013-11-17 17:30:42 +00:00
rubidium
8d90a3f417 (svn r26025) [1.3] -Fix: get hotkeys working again 2013-11-17 13:53:33 +00:00
rubidium
10fdf41107 (svn r26024) [1.3] -Backport: number of prerequisites for key handling fixes/improvements 2013-11-17 13:35:48 +00:00
rubidium
c13d1d6362 (svn r26022) [1.3] -Fix: missing OS X headers 2013-11-17 11:51:33 +00:00
rubidium
9fdc7a4ec9 (svn r26021) [1.3] -Backport from trunk:
- Fix: Crash when the ICU layouter thinks a font is corrupted [FS#5711] (r26018, r26017, r26016, r26015)
- Fix: Having trains miss a platform that is just being modified is less of a problem than having trains stop twice without moving [FS#5684] (r26013)
- Fix: --help text of ./configure for packages that require pkg-config (r26011)
- Fix: The AI/GS library name to use in Import, is not the name given by GetName but GetInstanceName [FS#5662] (r26010)
2013-11-17 11:29:44 +00:00
rubidium
5a82846fb0 (svn r26020) [1.3] -Backport from trunk:
- Fix: [Windows] Conditional expression with enumeral with non-enumeral type (r26009)
- Fix: Game script showing vehicle on e.g. a goal, then the vehicle being removed and eventually being replaced by a non-user vehicle (most likely smoke) causing an assertion to trigger [FS#5804] (r26007, r26006)
- Fix: Crash when transferring savegame from server to client [FS#5478] (r26005)
2013-11-17 11:24:39 +00:00
rubidium
e026f80caa (svn r25994) [1.3] -Backport from trunk:
- Update: Debian packaging (r25976, r25783, r25782, r25781, r25780)
2013-11-13 22:14:52 +00:00
rubidium
47fe12ebc2 (svn r25993) [1.3] -Backport from trunk:
- Fix: Comma key collided with F12 key for hotkeys; also remove '+' as that is generally not a key (the '+' on the numpad is a separate one) [FS#5679] (r25973)
- Fix: Rail laying sounds of others could be heard in multiplayer [FS#5665] (r25972)
- Fix: [SDL] Recursive mutex locking when changing blitter [FS#5787] (r25970)
2013-11-13 22:04:22 +00:00
rubidium
1ffa019bb5 (svn r25992) [1.3] -Backport from trunk:
- Fix: The wrong vehicle would be taken in a shared order vehicle list window when the ID >= 65536, causing assertions triggering later on [FS#5800] (r25965)
- Fix: [OSX] Compilation under OSX 10.9 [FS#5797] (r25962, r25951, r25950, r25913)
- Fix: [NewGRF] A powered rail type implies it is compatible as well, but some NewGRF did not state that causing the path reservation code to bail out in some cases because there was no compatible path [FS#5779] (r25961)
2013-11-13 22:03:26 +00:00
rubidium
3e445b2a6d (svn r25991) [1.3] -Backport from trunk:
- Fix: Temporary persistent storage modifications, e.g. command tests or those from GUI, were not properly reset, creating the possibility of desyncs [FS#5772] (r25956)
- Fix: Train's 'force proceed' status gets reset when the track on the other side of the tile has a signal [FS#5723] (r25955)
- Fix: Wrong signal conversions for savegames from before 0.4.5 [FS#5731, FS#5732] (r25954, r25953)
- Fix: Do not skip numbers when skipping spaces and other sorting 'improving' characters [FS#5719] (r25952)
2013-11-13 22:00:46 +00:00
rubidium
a4551ff5ac (svn r25990) [1.3] -Backport from trunk: language updates 2013-11-13 22:00:02 +00:00
rubidium
c40bbef756 (svn r25989) [1.3] -Backport from trunk:
- Fix: Text direction forcing characters were not filtered out, but shown as ? when ICU was not used for layouting. These are included in chat and console messages to force them to be displayed right [FS#5683] (r25949)
- Fix: NewGRF inspect window in RTL mode (r25943)
- Fix: [NoGo] Preserve the relative town growth progress when changing the town growth rate [FS#5786] (r25931)
- Fix: Several drawing overflows in the signal GUI [FS#5733] (r25929, r25928, r25927)
2013-11-13 21:58:36 +00:00
rubidium
dff569beb6 (svn r25988) [1.3] -Backport from trunk:
- Fix: Center the edit sign window like all query windows (r25918)
- Fix: Initialization of default objects swapped cost and dates (r25868)
- Fix: Use the actual sprite dimensions for sizing the dropdown arrow of dropdown widgets (r25864)
- Fix: If the child widgets of a NWidgetHorizontal container do not fill the complete container, align them according to text direction [FS#5686] (r25862, r25729)
2013-11-13 21:56:48 +00:00
rubidium
04fc4595cf (svn r25987) [1.3] -Backport from trunk:
- Fix: When clearing font cache, also clear layout cache [FS#5737] (r25860)
- Fix: Goto button in order window was not always lowered when it should [FS#5783] (r25858, 25857)
- Fix: Searching for a suitable font failed, if one of the fonts had no '?' glyph, and no baseset is installed [FS#5704] (r25822, r25820)
- Fix: Sprite 0 was considered available, even if no baseset was loaded (r25821)
2013-11-13 21:53:40 +00:00
rubidium
33ab06a9da (svn r25986) [1.3] -Backport from trunk:
- Fix: [GS] Language file scanner considered filenames starting with '.' as valid translations, resulting in languages with empty name, which causes trouble [FS#5750] (r25818)
- Fix: [GS] Handle savegames which contain GS translations for languages with empty name more gently [FS#5750] (r25817)
- Fix: [Script] ScriptTile::IsBuildableRectangle could report true for tiles outside of the map, if they happened to wrap around into a valid area [FS#5754] (r25815)
- Fix: Ensure the vehicle bar is high enough for the start/stop vehicle graphics [FS#5740] (r25805)
2013-11-13 21:49:31 +00:00
rubidium
f2cd6d20be (svn r25985) [1.3] -Backport from trunk:
- Fix: Lower sprite and text at the vehicle bar if it is pressed [FS#5739] (r25804)
- Fix: Draw start/stop graphics of the vehicle bar at the right place in RTL mode [FS#5738] (r25803)
- Fix: [Script] Decoding JSON data with an empty array from Admin port failed (r25809)
- Fix: [NewGRF] Do not allow changing palette when it's set by the NewGRF (r25794, r25793, r25972)
2013-11-13 21:46:47 +00:00
rubidium
95569e444b (svn r25984) [1.3] -Backport from trunk:
- Fix: Some spelling corrections to Catalan and Latin American town names [FS#5746] (r25775, r25774)
- Fix: If old savegames contain bridges over owned land, keep on drawing the bridges nevertheless [FS#5725] (r25753)
- Fix: [OSX] Text input into an edit box would trigger hotkeys [FS#5705] (r25743, r25671)
- Fix: Several RTL alignment issues [FS#5692] (r25733, r25732, r25731)
2013-11-13 21:43:16 +00:00
rubidium
27bf9549d6 (svn r25983) [1.3] -Backport from trunk:
- Fix: NWidgetMatrix used pip_pre and pip_post inconsistently and incorrectly, causing misalignment for RTL [FS#5686] (r25727)
- Fix: Right side of object class string was misaligned (r25726)
- Fix: [OSX] Do not pass -mmacosx-version-min to compilers that do not support it (r25706)
- Fix: Autoreplace/renew also refits free wagons [FS#5700] (r25698)
2013-11-13 21:39:14 +00:00
rubidium
68423b35cf (svn r25982) [1.3] -Backport from trunk:
- Fix: Textbuf caret rendering for complex scripts (e.g. Tamil) (r25696, r25694, r25652, r25651, r25092, r25091)
- Fix: Vehicle::MarkDirty must be called for the front engine [FS#5700] (r25695)
- Fix: [Win32] Several issues regarding conversion of characters (r25677, r25676, r25675, r25674, r25673)
- Fix: [Win32] Handle Unicode characters from outside the BMP correctly (r25672, r25670, r25669, r25668)
2013-11-13 21:35:44 +00:00
rubidium
53fffb3bab (svn r25981) [1.3] -Backport from trunk:
- Fix: [Win32] Only forward key presses to the IME system if an edit box has the input focus (r25667)
- Fix: [OSX] Crash when unhiding the main window [FS#4689] (r25665)
- Fix: [OSX] Bootstrap downloading of a baseset did not work [FS#4847] (r25664)
- Fix: [OSX] Monospace font detection [FS#4857] (r25663, r25662)
2013-11-13 21:30:39 +00:00
rubidium
7489a5d153 (svn r25980) [1.3] -Backport from trunk:
- Fix: [OSX] Rework font detection to work even if no default font sprites are present [FS#4847] (r25661)
- Fix: [OSX] The name's OpenTTD, not OTTD (r25660)
- Fix: [OSX] System mouse cursor could become visible during dragging [FS#4420] (r25659)
- Fix: [OSX] The mouse cursor would sometimes jump near the window borders [FS#4392] (r25658)
2013-11-13 21:29:37 +00:00
rubidium
6b47e4ba24 (svn r25979) [1.3] -Backport from trunk:
- Fix: [OSX] The new 10.7 fullscreen code can now also be compiled with older SDK versions [FS#4744] (r25656)
- Fix: [OSX] Mouse cursor was not displayed properly after switching to fullscreen on 10.7+ (r25655)
- Fix: Improve character and word deletion for CJK languages and complex scripts (r25654, r25653)
- Fix: [OSX] Define version constants before they are used (r25643)
2013-11-13 21:28:21 +00:00
rubidium
38bcb67c38 (svn r25978) [1.3] -Backport from trunk:
- Fix: Some icu_config scripts are too stupid to separate two ldflags by spaces, thus only call it with one (r25642, r25638)
- Fix: Do not suggest a start date for the game when there will be no vehicles available at all (r25640, r25639)
- Fix: City list sort of population and rating are reversed compared to the icon [FS#5666] (r25630)
- Fix: [Script] Give a slightly less generic error when removing inexisting rail [FS#5651] (r25614)
2013-11-13 21:21:47 +00:00
rubidium
e57c544643 (svn r25977) [1.3] -Backport from trunk:
- Fix: [Script] Do not return ERR_UNKNOWN when trying to move an order to its current location [FS#5648] (r25612)
- Fix: Various misreferences in AI and GS changelog [FS#5649] (r25607)
- Fix: [Script] If a NewGRF returned station type that could not be built by an AI via callback 18, an unknown error would be thrown instead of falling back to the default station [FS#5641] (r25605)
- Fix: Only the front engine's date of last service was updated [FS#5550] (r25604)
2013-11-13 21:17:29 +00:00
rubidium
1c5ff9933f (svn r25957) [1.3] -Backport from trunk: language updates 2013-11-08 23:02:00 +00:00
rubidium
8ebe828137 (svn r25631) [1.3] -Update: some documentation 2013-07-27 14:55:00 +00:00
rubidium
beceab38f8 (svn r25602) [1.3] -Prepare: for 1.3.2-RC2 2013-07-13 10:39:57 +00:00
rubidium
6a91636e1a (svn r25601) [1.3] -Backport from trunk: language updates 2013-07-13 10:37:17 +00:00
rubidium
7a081330e4 (svn r25599) [1.3] -Backport from trunk:
- Fix: [Admin] End-of-rcon data could not be determined reliably for any rcon command [FS#5643] (r25598, r25588, r25587)
- Fix: [Content] When the server closed the connection, the client would for eternity try to read a packet and never timeout making it impossible to reconnect [FS#5635] (r25597)
- Fix: [Script] Changing the script difficulty level in-game would also change the settings using the default even though they were not allowed to change in-game [FS#5644] (r25592)
- Fix: [Admin] Ensure that sent and received length of json strings are the same [FS#5646] (r25590, r25589)
- Fix: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full [FS#5320] (r25585)
2013-07-13 10:13:55 +00:00
rubidium
8f6204546e (svn r25584) [1.3] -Backport from trunk: language updates 2013-07-10 19:57:02 +00:00
rubidium
909502dc41 (svn r25583) [1.3] -Backport from trunk:
- Fix: Layouter caused significant slowdown with text heavy windows, cache it to make it managable (r25574, r25570, r25569, r25567, r25564)
2013-07-10 19:41:31 +00:00
rubidium
6cde48e49f (svn r25582) [1.3] -Backport from trunk:
- Fix: [Script] Documentation implied that XXList::AddItem has a default for value if it isn't filled in [FS#5638] (r25579, r25577)
- Fix: Make content list appear faster (r25573)
- Fix: Non-ICU layouter started new lines with the space which triggered the linebreak (r25568)
- Fix: If the next order cannot be resolved, reset the current order property instead of leaving it in an intermediate state [FS#5633] (r25562)
2013-07-10 19:38:53 +00:00
rubidium
b0486a940d (svn r25560) [1.3] -Backport from trunk:
- Fix: [Squirrel] Infinite recursion loop in freeing data via a looping set of references [FS#5568] (r25558)
- Fix: One could build bridges over owned land of another company [FS#5524] (r25557)
- Fix: [Script] Texts from scripts were not validated before they were shown, causing an assertion to trigger [FS#5632] (r25555)
- Fix: Provide a warning when no vehicles are available, and tell what to do in that case [FS#5530] (r25553)
2013-07-04 21:20:05 +00:00
rubidium
526fb6fa21 (svn r25559) [1.3] -Backport from trunk:
- Fix: Possible reading of uninitialised memory due to undefined execution order (r25551)
- Fix: [Windows] Race condition between two drawing threads could crash OpenTTD [FS#5571] (r25550)
- Fix: ICU returns the width of the visual run as if the trailing space was added (in case a newline was added). This caused the width to be more than the requested width, but it would still be drawn correctly [FS#5626] (r25547)
- Fix: Two small memory leaks (r25546)
- Fix: [GS] The checks and validations for setting the extra text in the town window became too stringent [FS#5625] (r25544)
2013-07-04 21:16:35 +00:00
rubidium
441364ff91 (svn r25529) [1.3] -Backport from trunk: language updates
[1.3] -Update: documentation
2013-06-30 09:05:55 +00:00
rubidium
322abc44e0 (svn r25528) [1.3] -Backport from trunk:
- Fix: strndup should not examine strings beyond its upper limit [FS#5621] (r25527)
- Fix: SDL does not give an event when an application gets mouse focus while going to full screen, so manually force the mouse-is-in-window state [FS#5587] (r25523)
- Fix: Reworked layouting (r25526, r25525, r25524, r25513, r25512, r25511)
2013-06-30 08:58:35 +00:00
rubidium
aee85cf8b0 (svn r25503) [1.3] -Backport from trunk: language updates 2013-06-28 19:48:10 +00:00
rubidium
7e74941a73 (svn r25502) [1.3] -Backport from trunk:
- Fix: Proper support for Brahmic scripts (e.g. Tamil and Thai) [FS#5481] (r25501, r25493, r25485, r25483, r25482, r25481, r25478, r25477, r25476, r25474, r25473, r25472, r25471, r25470, r25469, r25468, r25467, r25466, r25465, r25463, r25462, r25455, r25452, r25451, r25450, r25447, r25446, r25445, r25444, r25443, r25442, r25441, r25440, r25439, r25438, r25437, r25436, r25343, r25157)
2013-06-28 19:44:28 +00:00
rubidium
79c02e4ae4 (svn r25500) [1.3] -Backport from trunk:
- Remove: SETX(Y) does not work at all with other than default fonts, so get rid of it (r25454)
- Fix: When addings bits to a (train) station, the train trying to stop there could overshoot the (new) stop location and not stop at all [FS#5553] (r25495)
- Fix: The face of the manager differed on clients when the company was started after the clients joined [FS#5610] (r25491, r25490)
2013-06-28 19:29:08 +00:00
rubidium
d271dd9566 (svn r25499) [1.3] -Backport from trunk:
- Fix: Do not send encoded texts to names, but decode them into a plain C string and then pass them on [FS#5613] (r25489, r25488)
- Fix: Do not allow control codes in names of things (signs, vehicles, towns, stations, etc), so they have a known maximum fixed size and are, by definition, the same for everyone (r25487)
- Fix: Missing length validation for town and president names in script APIs (r25486)
2013-06-28 19:24:39 +00:00
rubidium
c62e867b56 (svn r25498) [1.3] -Backport from trunk:
- Fix: [NewGRF] When cargo NewGRF define a multiplier to modify vehicle capacities, use the same multiplier to modify loading speed (r25497, r25479)
- Fix: [OSX] OS X SDK versions >= 10.5 always have a non-const iconv declaration (r25480)
- Fix: Disable the depot-refit button in the order GUI, if the consist is not refittable unless it already has a refit order (r25459, r25458, r25457)
2013-06-28 19:21:24 +00:00
rubidium
fab048a116 (svn r25496) [1.3] -Backport from trunk:
- Fix: When town creation failed, removing remnants of the construction failed on protected houses [FS#5603] (r25429)
- Fix: There were two hotkeys to toggle between 'unload' and 'unload if possible' (r25406)
- Fix: The size of station construction windows could oscillate when resizing the window moved the mouse into the window [FS#5596] (r25395)
- Fix: Restrict renaming engines to the server, just like renaming towns (r25394)
2013-06-28 19:09:47 +00:00
rubidium
906a848cdb (svn r25416) [1.3] -Backport from trunk: language updates 2013-06-15 15:43:32 +00:00
rubidium
7d779754e6 (svn r25415) [1.3] -Feature: Thai translation 2013-06-15 15:34:57 +00:00
rubidium
1924ab4b9a (svn r25341) [1.3] -Backport from trunk: language updates 2013-06-09 09:42:50 +00:00
rubidium
3b7a42bbc9 (svn r25340) [1.3] -Backport from trunk:
- Fix: Loading only 8 bits into a 16 bit variable could cause endianness problems (r25337)
- Fix: Check for zero width space in translations and fail upon finding them [FS#5589] (r25326)
- Fix: [SDL] Keyboard input stopped working after fullscreen toggle [FS#5580] (r25318)
- Fix: Proper size-estimation for numbers with n digits, i.e. not assume a particular number is the widest [FS#5562] (r25314, r25313)
2013-06-09 09:38:21 +00:00
rubidium
02fc90dfbd (svn r25339) [1.3] -Backport from trunk:
- Fix: Do not focus the editbox in the NewGRF window, if there is no editbox visible (r25307)
- Fix: Game Script APIs that execute a DoCommand were returning the same result as in TestMode during world generation [FS#5561] (r25305)
- Fix: Build railway fences next to objects, even if they are owned by the same company [FS#5565] (r25302)
- Fix: gcc4.6 removed -mno-cygwin option (r25266)
2013-06-09 09:33:06 +00:00
rubidium
3ac18d20c9 (svn r25309) [1.3] -Update: some documentation 2013-05-31 20:51:15 +00:00
rubidium
6289bb92af (svn r25308) [1.3] -Backport from trunk:
- Fix: When overbuilding a reserved track with a non-track station tile, that tile would remain reserved and eventually trigger a crash upon removal [FS#5540] (r25251)
- Doc: Update some small parts of the readme (r25278)
2013-05-31 20:49:00 +00:00
rubidium
c32de24438 (svn r25255) [1.3] -Fix: forgot running project/generate for the newly added languages 2013-05-19 14:02:50 +00:00
rubidium
011de43698 (svn r25248) [1.3] -Update: some documentation 2013-05-17 19:04:45 +00:00
rubidium
9cb01a519b (svn r25247) [1.3] -Backport from trunk:
- Fix: 'No station' error was given, even when there was a station that way occupied or not yours [FS#5546] (r25243)
- Language updates
2013-05-17 18:56:51 +00:00
rubidium
b604bbfb3d (svn r25242) [1.3] -Backport from trunk: translations 2013-05-13 19:25:53 +00:00
rubidium
37ed615df1 (svn r25241) [1.3] -Backport from trunk:
- Fix: Crash when AI is executing a command as it is bankrupted (removed from the game) [FS#5547] (r25236)
- Fix: Give bridges owned by noone (from bankrupt companies) to the first company which replaces the bridge. Everyone could have removed/rebuild the bridge anyway [FS#5541] (r25231, r25227)
- Fix: [NewGRF] Revise when vehicle running sound effects 04, 07 and 08 are played; in depot or tunnel, or when crashed or stopped: No sound. Braking: Effect 08 instead of 07 [FS#5538] (r25226)
- Fix: [NewGRF] Play vehicle sound effect also for planes (r25225)
- Fix: [NewGRF] cur_speed is only valid for the front engine, so make other engines in the consist use the speed of the front [FS#5534] (r25224)
2013-05-13 19:22:08 +00:00
rubidium
a40ad243ca (svn r25240) [1.3] -Backport from trunk:
- Fix: [NewGRF] Make tick_counters work the same for vehicles (r25223, r25222)
- Fix: [NewGRF] IsCompatibleTrainStationTile() is not a symmetric function. Clarify the parameters and fix the cases were they were swapped (r25221)
- Fix: Consider map border as water with repsect to river/canal continuation (r25220)
- Fix: [Script] Clarify on which tiles IsDesertTile and IsSnowTile work, i.e. the ones without infrastructure or buildings, and introduce GetTerrainType for the cases where IsDesertTile/IsSnowTile do not work [FS#5537] (r25213)
- Fix: The baseset description translation script did not work with any awk other than gawk (r25218)
2013-05-13 19:18:10 +00:00
rubidium
962dda2b8b (svn r25212) [1.3] -Backport from trunk:
- Feature: Translations of baseset descriptions via language files (r25209, r25205)
- Fix: The level crossing sound is an ambient sound and not a new year sound (r25200)
2013-04-29 20:50:58 +00:00
rubidium
7739f1951d (svn r25204) [1.3] -Backport from trunk:
- Change: [strgen] Allow any number of colour codes in translations (r25193, r25192, r25191)
- Feature: Faroese and Scottish Gaelic translations (r25198, r25176)
- Feature: Plural form to be used by Scottish Gaelic (1,11; 2,12; 3..10, 13..19; other) (r25078)
2013-04-24 17:54:43 +00:00
rubidium
17d90107a3 (svn r25203) [1.3] -Backport: language updates from trunk 2013-04-24 17:48:37 +00:00
rubidium
7daff778f9 (svn r25170) [1.3] -Backport from trunk:
- Fix: Original train and rv acceleration did no longer respect bridge speed limits [FS#5523] (r25167)
- Fix: [Win32] Do not statically link to SHGetFolderPath as it may not exist, and improve its emulation [FS#5522] (r25155, r25153)
- Fix: [Win32] Do not store invalid paths in the search path list (r25154)
- Fix: Remove stray reservation from savegames affected by FS#5510 et al. upon loading [FS#5520] (r25152)
- Fix: [Script] XXBase::Chance function did not work for large values (>65535) [FS#5517] (r25148)
2013-04-08 20:59:42 +00:00
rubidium
283ab728f2 (svn r25169) [1.3] -Backport from trunk:
- Fix: Several typos/inconsistencies in English strings [FS#5496] (r25144, r25143)
- Fix: When extra dynamite was disabled, towns would be allowed to clear bridges with trams (r25141)
- Fix: Towns are build as OWNER_TOWN, so they also need to be removed as OWNER_TOWN otherwise parts might remain [FS#5519] (r25140)
- Fix: Editboxes could become too small when resizing windows (r25121)
- Fix: Game script language files did not work, when inside a tar [FS#5509] (r25117, r25114)
2013-04-08 20:56:30 +00:00
rubidium
6bb922953d (svn r25168) [1.3] -Backport from trunk:
- Fix: [NewGRF] Acceleration of NewGRF aircraft was too fast, while acceleration of default aircraft was way too slow (r25115)
- Fix: Pass $LDFLAGS_BUILD to all endian_check compilations (r25108)
- Change: [Win32] MSVC 2010 comes with stdint.h (r25128)
- Change: Be slightly more lenient with trying to detect a subversion repository in case someone has a sparse tags checkout. In that case the .svn folder misses from the $ROOT_DIR because it is in the $ROOT_DIR/.. (i.e. tags) folder (r25107)
2013-04-08 20:52:32 +00:00
rubidium
7e0c0b633d (svn r25134) [1.3] -Update: some documentation 2013-03-31 20:50:46 +00:00
rubidium
585f0ef91c (svn r25133) [1.3] -Backport from trunk:
- Fix: Station rebuilding could leave reserved tiles which caused crashes later on [FS#5510, FS#5516] (r25132)
- Fix: When the count for a scrollbar was 0, the inter distance was subtracted too much causing a scrollbar with a negative size (r25123)
2013-03-31 20:32:21 +00:00
rubidium
0e692735c4 (svn r25105) [1.3] -Prepare: for 1.3.0-RC3 2013-03-18 05:53:35 +00:00
rubidium
5df60bf2a6 (svn r25103) [1.3] -Backport from trunk: language updates 2013-03-17 21:02:36 +00:00
rubidium
42e569e0d1 (svn r25102) [1.3] -Backport from trunk:
- Fix: Limit aircraft property 0D to 19, since the conversion result to km-ish/h needs to fit into a byte [FS#5492] (r25099)
- Fix: Clicking the statusbar crashed, when news were pending but no news were shown yet [FS#5486] (r25093)
- Fix: Make editbox character filters also apply to pasted content from clipboard (r25090, r25089)
- Fix: Catch exception anonymously, if the exception content is not of interest [FS#5500] (r25081)
2013-03-17 20:58:40 +00:00
rubidium
278cebf202 (svn r25101) [1.3] -Update: the intro game 2013-03-17 20:38:53 +00:00
frosch
51f4d6d357 (svn r25067) [1.3] -Update: documentation 2013-03-05 18:29:18 +00:00
frosch
b0a9f0e638 (svn r25066) [1.3] -Backport from trunk: language updates 2013-03-05 18:09:31 +00:00
frosch
eb548884b8 (svn r25065) [1.3] -Backport from trunk:
-Fix: Make sizes of the station preview list and direction selection identical in the station build window [FS#5472] (r25064)
-Fix: When allocation of the sprite cache fails, try to allocate less memory and display an error message later on (r25061)
2013-03-05 18:04:05 +00:00
rubidium
b69d02ef4f (svn r25055) [1.3] -Backport from trunk:
- Fix: Refactor Script Debug GUI to only set widget states in OnInvalidateData [FS#5490] (r25052)
- Fix: Do not let gcc include files from the "standard C" include directories; newer gcc/libc seem to otherwise automatically include some header files at the top of the preprocessed nfo files which causes NFOrenum/GRFcodec to make invalid assumptions about the NFO version (r25050)
- Fix: Minimise gaps feature caused removal to only happen at the signal build interval instead of the implicit interval of 1 [FS#5479] (r25038)
- Fix: Green path signals would be shown when building them 'under' a train, and they would keep showing green until they were passed again [FS#5480] (r25037)
2013-02-28 06:55:22 +00:00
rubidium
bb4a82c8e1 (svn r25031) [1.3] -Update: documentation 2013-02-19 19:59:08 +00:00
rubidium
8ad76d2f8d (svn r25030) [1.3] -Backport from trunk: tamil was upgraded to finished 2013-02-19 19:58:46 +00:00
rubidium
e572eecc73 (svn r25029) [1.3] -Backport from trunk: language updates 2013-02-19 19:54:06 +00:00
rubidium
f393cecbf7 (svn r25028) [1.3] -Backport from trunk:
- Feature: Searching of (missing) content via GrfCrawler (r25024, r25023)
- Fix: [SDL] Crash after bootstrap download of 32bits base set due to referencing a deleted mutex [FS#5466] (r25017)
- Fix: [SDL] Improve 8bpp hardware palette support. Instead of always requesting SDL_HWPALETTE, it is now only done for 8bp blitters in fullscreen mode (r25003, r25002, r24993)
2013-02-19 19:46:46 +00:00
rubidium
5bc674b48d (svn r25000) [1.3] -Branch: time to get this thing done and do some new stuff in trunk 2013-02-14 18:52:05 +00:00
612 changed files with 15358 additions and 41950 deletions

View File

@@ -97,7 +97,7 @@ EXCLUDE_PATTERNS = */3rdparty */.svn */script/api
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =./docs/
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
@@ -202,7 +202,7 @@ SKIP_FUNCTION_MACROS = YES
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = objs/openttd.tag
GENERATE_TAGFILE = openttd.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl

View File

@@ -75,10 +75,10 @@ $(BIN_DIR)/%.obm: $(BASESET_DIR)/%.obm $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/
$(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
# Compile extra grf
$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)/assemble_nfo.awk
$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
$(E) '$(STAGE) Assembling openttd.nfo'
$(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
$(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/openttd.nfo > $(OBJS_DIR)/sprites/openttd.nfo
$(Q) $(CC_BUILD) -nostdinc -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttd.nfo
$(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/openttd.nfo
$(E) '$(STAGE) Compiling openttd.grf'
$(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf

View File

@@ -144,9 +144,11 @@ mrproper:
# output of profiling
$(Q)rm -f $(BIN_DIR)/gmon.out
# output of generating 'API' documentation
$(Q)rm -f $(ROOT_DIR)/openttd.tag
$(Q)rm -rf $(ROOT_DIR)/docs/source
# output of generating AI API documentation
$(Q)rm -f $(SRC_DIR)/ai/api/openttd.tag
$(Q)rm -rf $(ROOT_DIR)/docs/aidocs
$(Q)rm -rf $(ROOT_DIR)/docs/gamedocs
# directories created by OpenTTD on regression testing
$(Q)rm -rf $(BIN_DIR)/ai/regression/content_download $(BIN_DIR)/ai/regression/save $(BIN_DIR)/ai/regression/scenario
distclean: mrproper

View File

@@ -229,22 +229,10 @@ $(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
$(filter-out %sse2.o, $(filter-out %ssse3.o, $(filter-out %sse4.o, $(OBJS_CPP)))): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
$(filter %sse2.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -msse2 -o $@ $<
$(filter %ssse3.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -mssse3 -o $@ $<
$(filter %sse4.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -msse4.1 -o $@ $<
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<

View File

@@ -6,5 +6,3 @@
* 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/>.
*/
AILog.Info("1.3 API compatability in effect.");

View File

@@ -1,8 +0,0 @@
/* $Id: compat_1.3.nut 23969 2012-02-19 19:14:17Z rubidium $ */
/*
* 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/>.
*/

View File

@@ -877,7 +877,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetName(): Wooden rail bridge
GetMaxSpeed(): 32
GetPrice(): 450
GetMaxLength(): 66
GetMaxLength(): 102
GetMinLength(): 2
Bridge 1
IsValidBridge(): true
@@ -905,14 +905,14 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetName(): Steel suspension rail bridge
GetMaxSpeed(): 96
GetPrice(): 1042
GetMaxLength(): 66
GetMaxLength(): 102
GetMinLength(): 5
Bridge 5
IsValidBridge(): true
GetName(): Steel suspension rail bridge
GetMaxSpeed(): 112
GetPrice(): 1081
GetMaxLength(): 66
GetMaxLength(): 102
GetMinLength(): 5
Bridge 6
IsValidBridge(): true
@@ -1012,9 +1012,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
1 => 630
0 => 450
MaxLength ListDump:
5 => 66
4 => 66
0 => 66
5 => 102
4 => 102
0 => 102
3 => 12
8 => 11
7 => 10
@@ -9118,8 +9118,8 @@ ERROR: IsEnd() is invalid as Begin() is never called
5 => 0
4 => 0
CargoRating(1) ListDump:
5 => -1
4 => -1
5 => 69
4 => 69
DistanceManhattanToTile(30000) ListDump:
5 => 106
4 => 96

View File

@@ -10,7 +10,7 @@ fallback = true
description = A music pack without actual music.
description.af_ZA = 'n Musiek stel sonder enige musiek.
description.ar_EG = مجموعة موسيقى بدون موسيقى
description.be_BY = "Пусты" набор музычнага афармлення, які не зьмяшчае ніякай музыкі.
description.be_BY = "Пусты" набор музычнага афармлення, не змяшчаючы ніякай музыкі.
description.bg_BG = Празен музикален пакет.
description.ca_ES = Un joc de música sense cap música.
description.cs_CZ = Prázná hudební sada.
@@ -35,7 +35,6 @@ description.ja_JP = 空の音楽パック
description.ko_KR = 실제 음악이 없는 음악 목록입니다.
description.lb_LU = E Musikpack ouni aktuell Musik.
description.lt_LT = Muzikos pakas be muzikos.
description.lv_LV = Mūzikas kopa bez mūzikas
description.nb_NO = En musikkpakke uten noe musikk.
description.nl_NL = Een muziekset zonder muziek.
description.nn_NO = Ei musikkpakke utan noko musikk.

View File

@@ -10,7 +10,7 @@ fallback = true
description = A sound pack without any sounds.
description.af_ZA = 'n Klank stel sonder enige klanke.
description.ar_EG = مجموعة صوت بدوت اصوات مضافة
description.be_BY = "Пусты" набор гукавога афармленьня, які не зьмяшчае ніякіх гукаў.
description.be_BY = "Пусты" набор гукавога афармленьня, не змяшчаючы ніякіх гукаў.
description.bg_BG = Празен звуков пакет.
description.ca_ES = Un joc de sons sense cap so.
description.cs_CZ = Prázdná sada zvuků.
@@ -22,7 +22,6 @@ description.en_AU = A sound pack without any sounds.
description.en_US = A sound pack without any sounds.
description.es_ES = Un conjunto de sonidos vacío.
description.et_EE = Helikogu ilma helideta.
description.eu_ES = Soinurik gabeko soinu pakete bat
description.fi_FI = Äänipaketti, jossa ei ole ääniä.
description.fr_FR = Un pack de sons sans sons.
description.gd_GB = Pacaid fhuaimean anns nach eil fuaim sam bith.

Binary file not shown.

Binary file not shown.

View File

@@ -11,7 +11,7 @@ palette = DOS
description = Original Transport Tycoon Deluxe DOS edition graphics.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS uitgawe grafieke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الرسومية نسخة الدوس
description.be_BY = Арыґінальная ґрафіка з Transport Tycoon Deluxe для DOS.
description.be_BY = Арыгінальная графіка з Transport Tycoon Deluxe для DOS.
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за DOS.
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a DOS.
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (verze pro DOS).
@@ -50,7 +50,7 @@ description.sr_RS = Originalni skup grafika Transport Tycoon Deluxe DOS izdanja.
description.sv_SE = Originalgrafiken från Transport Tycoon Deluxe, DOS-utgåvan.
description.ta_IN = அசல் டிரான்ஸ்ஃபோர்ட் டைகூன் டீலக்ஸ் DOS பதிப்பு அசைவூட்டங்கள்.
description.th_TH = กราฟฟิกต้นตำหรับของ Transport Tycoon Deluxe DOS edition
description.tr_TR = Özgün Transport Tycoon Deluxe DOS sürümü grafikleri.
description.tr_TR = Orijinal Transport Tycoon Deluxe DOS sürümü grafikleri.
description.uk_UA = Оригінальна графіка з Transport Tycoon Deluxe DOS edition.
description.vi_VN = Đồ họa gốc từ phiên bản Transport Tycoon Deluxe trên DOS
description.zh_CN = 运输大亨DOS豪华版原版图形包.
@@ -70,7 +70,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
TRGC.GRF = ed446637e034104c5559b32c18afe78d
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
OPENTTD.GRF = 75a93cea2ed455c2fd5dcbda39e53538
OPENTTD.GRF = c683a77e1a43aed7db29ef318b166dd9
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@@ -10,7 +10,7 @@ version = 0
description = Original Transport Tycoon Deluxe DOS edition sounds.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS uitgawe klanke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الصوتية نسخة الدوس
description.be_BY = Арыґінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для DOS.
description.be_BY = Арыгінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для DOS.
description.bg_BG = Оригинални звуци на Transport Tycoon Deluxe за DOS.
description.ca_ES = Sons originals de Transport Tycoon Deluxe per a DOS.
description.cs_CZ = Původní sada zvuků Transport Tycoon Deluxe (verze pro DOS).
@@ -49,7 +49,7 @@ description.sr_RS = Originalni skup zvukova Transport Tycoon Deluxe DOS izdanja.
description.sv_SE = Originalljuden från Transport Tycoon Deluxe, DOS-utgåvan.
description.ta_IN = அசல் டிரான்ஸ்ஃபோர்ட் டைகூன் டீலக்ஸ் DOS பதிப்பு ஒலிகள்.
description.th_TH = เสียงต้นตำหรับของ Transport Tycoon Deluxe DOS edition
description.tr_TR = Özgün Transport Tycoon Deluxe DOS sürümü sesleri.
description.tr_TR = Orijinal Transport Tycoon Deluxe DOS sürümü sesleri.
description.uk_UA = Оригінальний набір звуків з Transport Tycoon Deluxe DOS edition.
description.vi_VN = Âm thanh gốc từ phiên bản Transport Tycoon Deluxe trên DOS
description.zh_CN = 运输大亨DOS豪华版原版音效包.

View File

@@ -11,7 +11,7 @@ palette = DOS
description = Original Transport Tycoon Deluxe DOS (German) edition graphics.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS (German) uitgawe grafieke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الالمانية نسخة الدوس
description.be_BY = Арыґінальная ґрафіка зь нямецкай версіі Transport Tycoon Deluxe для DOS.
description.be_BY = Арыгінальная графіка з нямецкай версіі Transport Tycoon Deluxe для DOS.
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за DOS (немски) .
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a DOS (Alemany).
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (německá verze pro DOS).
@@ -50,7 +50,7 @@ description.sr_RS = Originalni skup grafika nemačkog Transport Tycoon Deluxe DO
description.sv_SE = Originalgrafiken från Transport Tycoon Deluxe, DOS-utgåvan (tyska).
description.ta_IN = அசல் டிரான்ஸ்ஃபோர்ட் டைகூன் டீலக்ஸ் DOS (செருமன்) பதிப்பு அசைவூட்டங்கள்.
description.th_TH = กราฟฟิกต้นตำหรับของ Transport Tycoon Deluxe DOS (German) edition
description.tr_TR = Özgün Transport Tycoon Deluxe DOS (Almanca) sürümü grafikleri.
description.tr_TR = Orijinal Transport Tycoon Deluxe DOS (Almanca) sürümü grafikleri.
description.uk_UA = Оригінальна графіка з Transport Tycoon Deluxe DOS edition (німецького).
description.vi_VN = Đồ họa gốc từ phiên bản Transport Tycoon Deluxe trên DOS (tiếng Đức)
description.zh_CN = 运输大亨DOS豪华德语版原版图形包.
@@ -70,7 +70,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
TRGC.GRF = ed446637e034104c5559b32c18afe78d
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
OPENTTD.GRF = 75a93cea2ed455c2fd5dcbda39e53538
OPENTTD.GRF = c683a77e1a43aed7db29ef318b166dd9
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@@ -11,7 +11,7 @@ palette = Windows
description = Original Transport Tycoon Deluxe Windows edition graphics.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe grafieke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الرسومية نسخة وندوز
description.be_BY = Арыґінальная ґрафіка з Transport Tycoon Deluxe для Windows.
description.be_BY = Арыгінальная графіка з Transport Tycoon Deluxe для Windows.
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за Windows.
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a Windows.
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (verze pro Windows).
@@ -33,7 +33,7 @@ description.id_ID = Grafik orisinil Transport Tycoon Deluxe versi Windows.
description.is_IS = Upprunalega grafíkin úr Transport Tycoon Deluxe Windows útgáfunni.
description.it_IT = Grafica originale di Transport Tycoon Deluxe, edizione Windows.
description.ja_JP = Transport Tycoon Deluxe オリジナル版 グラフィック (Windows)
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 그래픽입니다.
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 그래픽입니다.
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Grafik.
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo grafika.
description.nb_NO = Original grafikk fra Transport Tycoon Deluxe for Windows.
@@ -50,7 +50,7 @@ description.sr_RS = Originalni skup grafika Transport Tycoon Deluxe Windows izda
description.sv_SE = Originalgrafiken från Transport Tycoon Deluxe, Windows-utgåvan.
description.ta_IN = அசல் டிரான்ஸ்ஃபோர்ட் டைகூன் டீலக்ஸ் விண்டோஸ் பதிப்பு அசைவூட்டங்கள்.
description.th_TH = กราฟฟิกต้ำตำหรับของ Transport Tycoon Deluxe Windows edition
description.tr_TR = Özgün Transport Tycoon Deluxe Windows sürümü grafikleri.
description.tr_TR = Orijinal Transport Tycoon Deluxe Windows sürümü grafikleri.
description.uk_UA = Оригінальна графіка з Transport Tycoon Deluxe Windows edition.
description.vi_VN = Đồ họa gốc từ phiên bản Transport Tycoon Deluxe trên Windows
description.zh_CN = 运输大亨Windows豪华版原版图形包.
@@ -70,7 +70,7 @@ TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
OPENTTD.GRF = 75a93cea2ed455c2fd5dcbda39e53538
OPENTTD.GRF = c683a77e1a43aed7db29ef318b166dd9
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@@ -10,7 +10,7 @@ version = 1
description = Original Transport Tycoon Deluxe Windows edition music.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe musiek.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الموسيقية نسخة وندوز
description.be_BY = Арыґінальны набор музычнага афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.be_BY = Арыгінальны набор музычнага афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.bg_BG = Оригинална музика на Transport Tycoon Deluxe за Windows.
description.ca_ES = Música Original de Transport Tycoon Deluxe per a Windows.
description.cs_CZ = Původní hudba Transport Tycoon Deluxe (verze pro Windows).
@@ -32,10 +32,9 @@ description.id_ID = Musik pengiring orisinil Transport Tycoon Deluxe versi Windo
description.is_IS = Upprunalega tónlistin úr Transport Tycoon Deluxe Windows útgáfunni.
description.it_IT = Musica originale di Transport Tycoon Deluxe, edizione Windows.
description.ja_JP = Transport Tycoon Deluxe オリジナル版 音楽 (Windows)
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 음악입니다.
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 음악입니다.
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Music.
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo muzika.
description.lv_LV = Oriģinālā Transport Tycoon Deluxe Windows izdevuma mūzika.
description.nb_NO = Original musikk fra Transport Tycoon Deluxe for Windows.
description.nl_NL = Originele muziek van de Transport Tycoon Deluxe Windows-versie.
description.nn_NO = Original musikk frå Transport Tycoon Deluxe for Windows.
@@ -50,7 +49,7 @@ description.sr_RS = Originalni skup muzičkih numera Transport Tycoon Deluxe Win
description.sv_SE = Originalmusiken från Transport Tycoon Deluxe, Windows-utgåvan.
description.ta_IN = அசல் டிரான்ஸ்ஃபோர்ட் டைகூன் டீலக்ஸ் விண்டோஸ் பதிப்பு இசை.
description.th_TH = เพลงต้นตำหรับชอง Transport Tycoon Deluxe Windows edition
description.tr_TR = Özgün Transport Tycoon Deluxe Windows sürümü müzikleri.
description.tr_TR = Orijinal Transport Tycoon Deluxe Windows sürümü müzikleri.
description.uk_UA = Оригінальна музика з Transport Tycoon Deluxe Windows edition.
description.vi_VN = Nhạc gốc từ phiên bản Transport Tycoon Deluxe trên Windows
description.zh_CN = Transport Tycoon Deluxe运输大亨Windows豪华版的原版音乐包

View File

@@ -10,7 +10,7 @@ version = 0
description = Original Transport Tycoon Deluxe Windows edition sounds.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe klanke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الصوتية نسخة وندوز
description.be_BY = Арыґінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.be_BY = Арыгінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.bg_BG = Оригинални звуци на Transport Tycoon Deluxe за Windows.
description.ca_ES = Sons originals de Transport Tycoon Deluxe per a Windows.
description.cs_CZ = Původní sada zvuků Transport Tycoon Deluxe (verze pro Windows).
@@ -32,7 +32,7 @@ description.id_ID = Efek suara orisinil Transport Tycoon Deluxe versi Windows.
description.is_IS = Upprunalega hljóðið úr Transport Tycoon Deluxe Windows útgáfunni.
description.it_IT = Suoni originali di Transport Tycoon Deluxe, edizione Windows.
description.ja_JP = Transport Tycoon Deluxe オリジナル版 効果音 (Windows)
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 효과음입니다.
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 효과음입니다.
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Sound.
description.lt_LT = Originalūs Transport Tycoon Deluxe Windows leidimo garsai.
description.nb_NO = Originale lyder fra Transport Tycoon Deluxe for Windows.
@@ -49,7 +49,7 @@ description.sr_RS = Originalni skup zvukova Transport Tycoon Deluxe Windows izda
description.sv_SE = Originalljuden från Transport Tycoon Deluxe, Windows-utgåvan.
description.ta_IN = அசல் டிரான்ஸ்ஃபோர்ட் டைகூன் டீலக்ஸ் விண்டோஸ் பதிப்பு ஒலிகள்.
description.th_TH = เสียงต้นตำหรับของ Transport Tycoon Deluxe Windows edition
description.tr_TR = Özgün Transport Tycoon Deluxe Windows sürümü sesleri.
description.tr_TR = Orijinal Transport Tycoon Deluxe Windows sürümü sesleri.
description.uk_UA = Оригінальний набір звуків з Transport Tycoon Deluxe Windows edition.
description.vi_VN = Âm thanh gốc từ phiên bản Transport Tycoon Deluxe trên Windows
description.zh_CN = Transport Tycoon Deluxe Windows (运输大亨Windows豪华版)的原版音效包.

View File

@@ -8,11 +8,3 @@
*/
GSLog.Info("1.2 API compatability in effect.");
GSTown._SetGrowthRate <- GSTown.SetGrowthRate;
GSTown.SetGrowthRate <- function(town_id, days_between_town_growth)
{
/* Growth rate 0 caused resetting the custom growth rate. While this was undocumented, it was used nevertheless (ofc). */
if (days_between_town_growth == 0) days_between_town_growth = GSTown.TOWN_GROWTH_NORMAL;
return GSTown._SetGrowthRate(town_id, days_between_town_growth);
}

View File

@@ -6,13 +6,3 @@
* 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/>.
*/
GSLog.Info("1.3 API compatability in effect.");
GSTown._SetGrowthRate <- GSTown.SetGrowthRate;
GSTown.SetGrowthRate <- function(town_id, days_between_town_growth)
{
/* Growth rate 0 caused resetting the custom growth rate. While this was undocumented, it was used nevertheless (ofc). */
if (days_between_town_growth == 0) days_between_town_growth = GSTown.TOWN_GROWTH_NORMAL;
return GSTown._SetGrowthRate(town_id, days_between_town_growth);
}

View File

@@ -1,8 +0,0 @@
/* $Id: compat_1.3.nut 24469 2012-08-13 19:33:17Z yexo $ */
/*
* 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 diff suppressed because it is too large Load Diff

View File

@@ -72,7 +72,6 @@ set_default() {
with_zlib="1"
with_lzma="1"
with_lzo2="1"
with_xdg_basedir="1"
with_png="1"
enable_builtin_depend="1"
with_makedepend="0"
@@ -92,7 +91,6 @@ set_default() {
with_ccache="1"
with_nforenum="1"
with_grfcodec="1"
with_sse="1"
save_params_array="
build
@@ -147,7 +145,6 @@ set_default() {
with_zlib
with_lzma
with_lzo2
with_xdg_basedir
with_png
enable_builtin_depend
with_makedepend
@@ -167,7 +164,6 @@ set_default() {
with_ccache
with_grfcodec
with_nforenum
with_sse
CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
}
@@ -351,13 +347,6 @@ detect_params() {
--without-liblzo2) with_lzo2="0";;
--with-liblzo2=*) with_lzo2="$optarg";;
--with-xdg-basedir) with_xdg_basedir="2";;
--without-xdg-basedir) with_xdg_basedir="0";;
--with-xdg-basedir=*) with_xdg_basedir="$optarg";;
--with-libxdg-basedir) with_xdg_basedir="2";;
--without-libxdg-basedir) with_xdg_basedir="0";;
--with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
--with-png) with_png="2";;
--without-png) with_png="0";;
--with-png=*) with_png="$optarg";;
@@ -449,10 +438,6 @@ detect_params() {
--with-threads) with_threads="1";;
--with-threads=*) with_threads="$optarg";;
--without-sse) with_sse="0";;
--with-sse) with_sse="1";;
--with-sse=*) with_sse="$optarg";;
CC=* | --CC=*) CC="$optarg";;
CXX=* | --CXX=*) CXX="$optarg";;
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
@@ -593,7 +578,6 @@ check_params() {
check_makedepend
detect_cputype
detect_sse_capable_architecture
if [ "$enable_static" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
@@ -834,7 +818,6 @@ check_params() {
fi
fi
detect_xdg_basedir
detect_png
detect_freetype
detect_fontconfig
@@ -1472,16 +1455,12 @@ make_cflags_and_ldflags() {
fi
if [ $enable_debug -le 2 ]; then
cc_host_is_gcc=`basename "$cc_host" | grep "gcc" &>/dev/null`
if [ -n "$cc_host_is_gcc" ]; then
if basename "$cc_host" | grep "gcc" &>/dev/null; then
# Define only when compiling with GCC. Some GLIBC versions use GNU
# extensions in a way that breaks build with at least ICC.
# This requires -O1 or more, so debug level 3 (-O0) is excluded.
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
fi
cc_build_is_gcc=`basename "$cc_build" | grep "gcc" &>/dev/null`
if [ -n "$cc_build_is_gcc" ]; then
# Just add -O1 to the tools needed for building.
CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
fi
@@ -1501,9 +1480,6 @@ make_cflags_and_ldflags() {
if [ "$with_threads" = "0" ]; then
CFLAGS="$CFLAGS -DNO_THREADS"
fi
if [ "$with_sse" = "1" ]; then
CFLAGS="$CFLAGS -DWITH_SSE"
fi
if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
if [ "$os" = "CYGWIN" ]; then
@@ -1681,17 +1657,6 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWITH_LZO"
fi
if [ -n "$xdg_basedir_config" ]; then
CFLAGS="$CFLAGS -DWITH_XDG_BASEDIR"
CFLAGS="$CFLAGS `$xdg_basedir_config --cflags | tr '\n\r' ' '`"
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$xdg_basedir_config --libs --static | tr '\n\r' ' '`"
else
LIBS="$LIBS `$xdg_basedir_config --libs | tr '\n\r' ' '`"
fi
fi
# 64bit machines need -D_SQ64
if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
CFLAGS="$CFLAGS -D_SQ64"
@@ -1700,18 +1665,17 @@ make_cflags_and_ldflags() {
if [ -n "$png_config" ]; then
CFLAGS="$CFLAGS -DWITH_PNG"
CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`"
# The extra flags are unneeded for latest libpng-config, but some versions are so broken...
if [ "$enable_static" != "0" ]; then
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 `$png_config --variable=prefix`/lib/libpng.a `$png_config --libs --static | sed s@-lpng[0-9]*@@`"
LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
else
LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`"
fi
else
LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`"
fi
fi
@@ -2716,64 +2680,42 @@ detect_libtimidity() {
detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "" "timidity.h"
}
detect_pkg_config() {
# $1 - config-param ($with_lzma value)
# $2 - package name ('liblzma')
# $3 - config name ('lzma_config', sets $lzma_config)
# $4 - minimum module version ('2.3')
detect_lzma() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$1" = "0" ]; then
log 1 "checking $2... disabled"
if [ "$with_lzma" = "0" ]; then
log 1 "checking liblzma... disabled"
eval "$3=\"\""
lzma_config=""
return 0
fi
log 2 "detecting $2"
if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
pkg_config_call="pkg-config $2"
if [ "$with_lzma" = "1" ] || [ "$with_lzma" = "" ] || [ "$with_lzma" = "2" ]; then
lzma_config="pkg-config liblzma"
else
pkg_config_call="$1"
lzma_config="$with_lzma"
fi
version=`$pkg_config_call --modversion 2>/dev/null`
version=`$lzma_config --modversion 2>/dev/null`
ret=$?
check_version "$4" "$version"
version_ok=$?
log 2 "executing $pkg_config_call --modversion"
log 2 "executing $lzma_config --modversion"
log 2 " returned $version"
log 2 " exit code $ret"
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
log 1 "checking $2... needs at least version $4, $2 NOT enabled"
else
log 1 "checking $2... not found"
fi
if [ -z "$version" ] || [ "$ret" != "0" ]; then
log 1 "checking liblzma... not found"
# It was forced, so it should be found.
if [ "$1" != "1" ]; then
log 1 "configure: error: pkg-config $2 couldn't be found"
log 1 "configure: error: you supplied '$1', but it seems invalid"
if [ "$with_lzma" != "1" ]; then
log 1 "configure: error: pkg-config liblzma couldn't be found"
log 1 "configure: error: you supplied '$with_lzma', but it seems invalid"
exit 1
fi
eval "$3=\"\""
lzma_config=""
return 0
fi
eval "$3=\"$pkg_config_call\""
log 1 "checking $2... found"
}
detect_lzma() {
detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
}
detect_xdg_basedir() {
detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
log 1 "checking liblzma... found"
}
detect_png() {
@@ -2800,7 +2742,33 @@ detect_png() {
return 0
fi
detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ]; then
png_config="libpng-config"
else
png_config="$with_png"
fi
version=`$png_config --version 2>/dev/null`
ret=$?
log 2 "executing $png_config --version"
log 2 " returned $version"
log 2 " exit code $ret"
if [ -z "$version" ] || [ "$ret" != "0" ]; then
log 1 "checking libpng... not found"
# It was forced, so it should be found.
if [ "$with_png" != "1" ]; then
log 1 "configure: error: libpng-config couldn't be found"
log 1 "configure: error: you supplied '$with_png', but it seems invalid"
exit 1
fi
png_config=""
return 0
fi
log 1 "checking libpng... found"
}
detect_freetype() {
@@ -2895,7 +2863,39 @@ detect_fontconfig() {
return 0
fi
detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3"
if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then
fontconfig_config="pkg-config fontconfig"
else
fontconfig_config="$with_fontconfig"
fi
version=`$fontconfig_config --modversion 2>/dev/null`
ret=$?
check_version '2.3' "$version"
version_ok=$?
log 2 "executing $fontconfig_config --modversion"
log 2 " returned $version"
log 2 " exit code $ret"
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
log 1 "checking libfontconfig... needs at least version 2.3.0, fontconfig NOT enabled"
else
log 1 "checking libfontconfig... not found"
fi
# It was forced, so it should be found.
if [ "$with_fontconfig" != "1" ]; then
log 1 "configure: error: fontconfig-config couldn't be found"
log 1 "configure: error: you supplied '$with_fontconfig', but it seems invalid"
exit 1
fi
fontconfig_config=""
return 0
fi
log 1 "checking libfontconfig... found"
}
detect_icu() {
@@ -3261,40 +3261,6 @@ detect_cputype() {
rm -f tmp.64bit tmp.64bit.cpp
}
detect_sse_capable_architecture() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$with_sse" = "0" ]; then
log 1 "checking SSE... disabled"
return
fi
echo "#define _SQ64 1" > tmp.sse.cpp
echo "#include <xmmintrin.h>" >> tmp.sse.cpp
echo "#include <smmintrin.h>" >> tmp.sse.cpp
echo "#include <tmmintrin.h>" >> tmp.sse.cpp
echo "int main() { return 0; }" >> tmp.sse.cpp
execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
sse="`eval $execute 2>/dev/null`"
ret=$?
log 2 "executing $execute"
log 2 " returned $sse"
log 2 " exit code $ret"
if [ "$ret" = "0" ]; then
log 1 "detecting SSE... found"
else
# It was forced, so it should be found.
if [ "$with_sse" != "1" ]; then
log 1 "configure: error: SSE couln't be found"
log 1 "configure: error: you force enabled SSE, but it seems unavailable"
exit 1
fi
log 1 "detecting SSE... not found"
with_sse="0"
fi
rm -f tmp.sse tmp.exe tmp.sse.cpp
}
make_sed() {
T_CFLAGS="$CFLAGS"
T_CXXFLAGS="$CXXFLAGS"
@@ -3673,8 +3639,6 @@ showhelp() {
echo " enables libfreetype support"
echo " --with-fontconfig[=\"pkg-config fontconfig\"]"
echo " enables fontconfig support"
echo " --with-xdg-basedir[=\"pkg-config libxdg-basedir\"]"
echo " enables XDG base directory support"
echo " --with-icu[=icu-config] enables icu (used for right-to-left support)"
echo " --static-icu try to link statically (libsicu instead of"
echo " libicu; can fail as the new name is guessed)"
@@ -3685,8 +3649,6 @@ showhelp() {
echo " --with-ccache enables ccache support"
echo " --with-distcc enables distcc support"
echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
echo " --without-threads disable threading support"
echo " --without-sse disable SSE support (x86/x86_64 only)"
echo ""
echo "Some influential environment variables:"
echo " CC C compiler command"

1
configure vendored
View File

@@ -129,7 +129,6 @@ AWKCOMMAND='
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; }
if ($0 == "SSE" && "'$with_sse'" != "1") { next; }
skip += 1;

View File

@@ -1,262 +0,0 @@
Some explanations about Desyncs
Last updated: 2014-02-23
------------------------------------------------------------------------
Table of contents
-----------------
1.0) Desync theory
* 1.1) OpenTTD multiplayer architecture
* 1.2) What is a Desync and how is it detected
* 1.3) Typical causes of Desyncs
2.0) What to do in case of a Desync
* 2.1) Cache debugging
* 2.2) Desync recording
3.0) Evaluating the Desync records
* 3.1) Replaying
* 3.2) Evaluation the replay
* 3.3) Comparing savegames
1.1) OpenTTD multiplayer architecture
---- --------------------------------
OpenTTD has a huge gamestate, which changes all of the time.
The savegame contains the complete gamestate at a specific point
in time. But this state changes completely each tick: Vehicles move
and trees grow.
However, most of these changes in the gamestate are deterministic:
Without a player interfering a vehicle follows its orders always
in the same way, and trees always grow the same.
In OpenTTD multiplayer synchronisation works by creating a savegame
when clients join, and then transfering that savegame to the client,
so it has the complete gamestate at a fixed point in time.
Afterwards clients only receive 'commands', that is: Stuff which is
not predictable, like
- player actions
- AI actions
- GameScript actions
- Admin Port command
- rcon commands
- ...
These commands contain the information on how to execute the command,
and when to execute it. Time is measured in 'network frames'.
Mind that network frames to not match ingame time. Network frames
also run while the game is paused, to give a defined behaviour to
stuff that is executing while the game is paused.
The deterministic part of the gamestate is run by the clients on
their own. All they get from the server is the instruction to
run the gamestate up to a certain network time, which basically
says that there are no commands scheduled in that time.
When a client (which includes the server itself) wants to execute
a command (i.e. a non-predictable action), it does this by
- calling DoCommandP resp. DoCommandPInternal
- These functions first do a local test-run of the command to
check simple preconditions. (Just to give the client an
immediate response without bothering the server and waiting for
the response.) The test-run may not actually change the
gamestate, all changes must be discarded.
- If the local test-run succeeds the command is sent to the server.
- The server inserts the command into the command queue, which
assigns a network frame to the commands, i.e. when it shall be
executed on all clients.
- Enhanced with this specific timestamp, the command is send to all
clients, which execute the command simultaneously in the same
network frame in the same order.
1.2) What is a Desync and how is it detected
---- ---------------------------------------
In the ideal case all clients have the same gamestate as the server
and run in sync. That is, vehicle movement is the same on all
clients, and commands are executed the same everywhere and
have the same results.
When a Desync happens, it means that the gamestates on the clients
(including the server) are no longer the same. Just imagine
that a vehicle picks the left line instead of the right line at
a junction on one client.
The important thing here is, that noone notices when a Desync
occurs. The desync client will continue to simulate the gamestate
and execute commands from the server. Once the gamestate differs
it will increasingly spiral out of control: If a vehicle picks a
different route, it will arrive at a different time at a station,
which will load different cargo, which causes other vehicles to
load other stuff, which causes industries to notice different
servicing, which causes industries to change production, ...
the client could run all day in a different universe.
To limit how long a Desync can remain unnoticed, the server
transfers some checksums every now and then for the gamestate.
Currently this checksum is the state of the random number
generator of the game logic. A lot of things in OpenTTD depend
on the RNG, and if the gamestate differs, it is likely that the
RNG is called at different times, and the state differs when
checked.
The clients compare this 'checksum' with the checksum of their
own gamestate at the specific network frame. If they differ,
the client disconnects with a Desync error.
The important thing here is: The detection of the Desync is
only an ultimate failure detection. It does not give any
indication on when the Desync happened. The Desync may after
all have occured long ago, and just did not affect the checksum
up to now. The checksum may have matched 10 times or more
since the Desync happend, and only now the Desync has spiraled
enough to finally affect the checksum. (There was once a desync
which was only noticed by the checksum after 20 game years.)
1.3) Typical causes of Desyncs
---- -------------------------
Desyncs can be caused by the following scenarios:
- The savegame does not describe the complete gamestate.
- Some information which affects the progression of the
gamestate is not saved in the savegame.
- Some information which affects the progression of the
gamestate is not loaded from the savegame.
This includes the case that something is not completely
reset before loading the savegame, so data from the
previous game is carried over to the new one.
- The gamestate does not behave deterministic.
- Cache mismatch: The game logic depends on some cached
values, which are not invalidated properly. This is
the usual case for NewGRF-specific Desyncs.
- Undefined behaviour: The game logic performs multiple
things in an undefined order or with an undefined
result. E.g. when sorting something with a key while
some keys are equal. Or some computation that depends
on the CPU architecture (32/64 bit, little/big endian).
- The gamestate is modified when it shall not be modified.
- The test-run of a command alters the gamestate.
- The gamestate is altered by a player or script without
using commands.
2.1) Cache debugging
---- ---------------
Desyncs which are caused by inproper cache validation can
often be found by enabling cache validation:
- Start OpenTTD with '-d desync=2'.
- This will enable validation of caches every tick.
That is, cached values are recomputed every tick and compared
to the cached value.
- Differences are logged to 'commands-out.log' in the autosave
folder.
Mind that this type of debugging can also be done in singleplayer.
2.2) Desync recording
---- ----------------
If you have a server, which happens to encounter Desyncs often,
you can enable recording of the gamestate alterations. This
will later allow the replay the gamestate and locate the Desync
cause.
There are two levels of Desync recording, which are enabled
via '-d desync=2' resp. '-d desync=3'. Both will record all
commands to a file 'commands-out.log' in the autosave folder.
If you have the savegame from the start of the server, and
this command log you can replay the whole game. (see Section 3.1)
If you do not start the server from a savegame, there will
also be a savegame created just after a map has been generated.
The savegame will be named 'dmp_cmds_*.sav' and be put into
the autosave folder.
In addition to that '-d desync=3' also creates regular savegames
at defined spots in network time. (more defined than regular
autosaves). These will be created in the autosave folder
and will also be named 'dmp_cmds_*.sav'.
These saves allow comparing the gamestate with the original
gamestate during replaying, and thus greatly help debugging.
However, they also take a lot of disk space.
3.1) Replaying
---- ---------
To replay a Desync recording, you need these files:
- The savegame from when the server was started, resp.
the automatically created savegame from when the map
was generated.
- The 'commands-out.log' file.
- Optionally the 'dmp_cmds_*.sav'.
Put these files into a safe spot. (Not your autosave folder!)
Next, prepare your OpenTTD for replaying:
- Get the same version of OpenTTD as the original server was running.
- Uncomment/enable the define 'DEBUG_DUMP_COMMANDS' in
'src/network/network_func.h'.
- Put the 'commands-out.log' into the root save folder, and rename
it to 'commands.log'.
- Run 'openttd -D -d desync=3 -g startsavegame.sav'.
This replays the server log and creates new 'commands-out.log'
and 'dmp_cmds_*.sav' in your autosave folder.
3.2) Evaluation the replay
---- ---------------------
The replaying will also compare the checksums which are part of
the 'commands-out.log' with the replayed gamestate.
If they differ, it will trigger a 'NOT_REACHED'.
If the replay succeeds without mismatch, that is the replay reproduces
the original server state:
- Repeat the replay starting from incrementally later 'dmp_cmds_*.sav'
while truncating the 'commands.log' at the beginning appropriately.
The 'dmp_cmds_*.sav' can be your own ones from the first reply, or
the ones from the original server (if you have them).
(This simulates the view of joining clients during the game.)
- If one of those replays fails, you have located the Desync between
the last dmp_cmds that reproduces the replay and the first one
that fails.
If you have the original 'dmp_cmds_*.sav', you can also compare those
savegames with your own ones from the replay. You can also comment/disable
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
the replay after the mismatch has already been detected.
See Section 3.2 on how to compare savegames.
If the saves differ you have located the Desync between the last dmp_cmds
that match and the first one that does not. The difference of the saves
may point you in the direction of what causes it.
If the replay succeeds without mismatch, and you do not have any
'dmp_cmd_*.sav' from the original server, it is a lost case.
Enable creation of the 'dmp_cmd_*.sav' on the server, and wait for the
next Desync.
Finally, you can also compare the 'commands-out.log' from the original
server with the one from the replay. They will differ in stuff like
dates, and the original log will contain the chat, but otherwise they
should match.
3.2) Comparing savegames
---- -------------------
The binary form of the savegames from the original server and from
your replay will always differ:
- The savegame contains paths to used NewGRF files.
- The gamelog will log your loading of the savegame.
- The savegame data of AIs and the Gamescript will differ.
Scripts are not run during the replay, only their recorded commands
are replayed. Their internal state will thus not change in the
replay and will differ.
To compare savegame more semantically, there exist some ugly hackish
tools at:
http://devs.openttd.org/~frosch/texts/zpipe.c
http://devs.openttd.org/~frosch/texts/printhunk.c
The first one decompresses OpenTTD savegames. The second one creates
a textual representation of an uncompressed savegame, by parsing hunks
and arrays and such. With both tools you need to be a bit careful
since they work on stdin and stdout, which may not deal well with
binary data.
If you have the textual representation of the savegames, you can
compare them with regular diff tools.

View File

@@ -640,7 +640,7 @@
<ul>
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the depot</li>
<li>m2: Depot index</li>
<li>m5 bits 1..0: exit towards:
<li>m5 bits 3..0: exit towards:
<table>
<tr>
<td><tt>0</tt>&nbsp; </td>
@@ -1593,14 +1593,41 @@
<td valign=top nowrap>&nbsp;</td>
<td>
<ul>
<li>m1 bits 6..5 : Water class (sea, canal, river or land)</li>
<li>m1 bits 6..5 : Water class (sea, canal, river or land)
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the object (for lighthouses and transmitters normally <tt>10</tt>)</li>
<li>m2: index into the array of objects, bits 0 to 15 (upper bits in m5)</li>
<li>m3: random bits</li>
<li>m5: index into the array of objects, bits 16 to 23 (lower bits in m2)</li>
<li>m2: index into the array of objects
<li>m3: random bits
<li>m5: tile type:
<table>
<tr>
<td nowrap valign=top><tt>00</tt>&nbsp; </td>
<td align=left>transmitter</td>
</tr>
<tr>
<td nowrap valign=top><tt>01</tt>&nbsp; </td>
<td align=left>lighthouse</td>
</tr>
<tr>
<td nowrap valign=top><tt>02</tt>&nbsp; </td>
<td align=left>company statue
</tr>
<tr>
<td nowrap valign=top><tt>03</tt>&nbsp; </td>
<td align=left>company-owned land</td>
</tr>
<tr>
<td nowrap valign=top><tt>04</tt><tt></tt>&nbsp; </td>
<td align=left>company headquarters</td>
</tr>
</table>
</li>
<li>m6 bits 7..6 : Possibility of a bridge above, in the <a href="#bridge_direction">direction specified</a></li>
<li>m6 bits 1..0 : <a href="#tropic_zone">Tropic zone definition</a></li>
<li>m7: animation counter</li>
<li>m7: animation counter
</ul>
</td>
</tr>

View File

@@ -115,7 +115,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
<td class="bits">XX<span class="free">O</span>X <span class="free">OO</span>XX</td>
<td class="bits">XX<span class="free">O</span>X <span class="free">O</span>XXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
</tr>
@@ -208,7 +208,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX <span class="free">OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits">XX<span class="free">O</span>X XXXX</td>
</tr>
<tr>
@@ -311,7 +311,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">X<span class="free">OO</span>X XXXX</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX X<span class="free">O</span>XX</td>
</tr>
<tr>
<td>bridge ramp</td>

View File

@@ -1,30 +0,0 @@
Some clarifications about the link graph
----------------------------------------
InitializeLinkGraphs joins all threads, so if the game is abandoned
with some threads still running, they're joined as soon as the next game
(possibly the title game) is started. See also InitializeGame.
The MCF (multi-commodity flow) algorithm can be quite CPU-hungry as it's
NP-hard and takes exponential time (though with a very small constant
factor) in the number of nodes.
This is why it is run in a separate thread where possible. However after
some time the thread is joined and if it hasn't finished by then the game
will hang. This problem gets worse if we are running on a platform without
threads. However, as those are usually the ones with less CPU power I
assume the contention for the CPU would make the game hard to play even
with threads or even without cargodist (autosave ...). I might be wrong,
but I won't put any work into this before someone shows me some problem.
You can configure the link graph recalculation time. A link graph
recalculation time of X days means that each link graph job has X days
to run before it is joined. The downside is that the flow stats won't be
updated before the job is finished and thus a high value means less
updates and longer times until changes in capacities are accounted for.
If you play a very large map with a complicated link graph you may want to
raise the time setting to avoid lags. The same holds for systems with slow
CPUs.
Another option to avoid excessive lags is to reduce the accuracy of link
graph calculations. Generally the accuracy is inversely correlated to the
CPU requirements of the MCF algorithm.

View File

@@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2014-08-03
Release version: 1.4.2-RC2
Last updated: 2013-11-17
Release version: 1.3.3-RC1
------------------------------------------------------------------------
@@ -33,13 +33,12 @@ No suitable AI can be found
If you have no AIs and an AI is started the so-called 'dummy' AI will
be loaded. This AI does nothing but writing a message on the AI debug
window and showing a red warning. There are basically two solutions
for this problem: Either you set the number of AI players to 0 so that
no AI is started. You find that setting at the top of the window in the
"AI / Game Scripts Settings" window.
The other solution is acquiring (downloading) some AI. The easiest way
to do this is via the "Check Online Content" button in the main (intro)
menu or directly in the "AI / Game Scripts Settings" dialogue via the
"Check Online Content" button.
for this problem: you must change the settings so no AI is started,
this is done in the difficulty settings window. The other solution is
acquiring (downloading) some AI. The easiest way to do this is via
the "Check Online Content" button in the main (intro) menu or via
"AI Settings" -> "Select AI" -> "Check Online Content" which is also
accessed via the main menu.
After a while of playing, colours get corrupted
In Windows 7 the background slideshow corrupts the colour mapping of
@@ -445,11 +444,3 @@ Trains might not stop at platforms that are currently being changed [FS#5553]:
just anywhere in the station because then it would never leave the station
if you have the same station in the order list multiple times in a row or
if there is only one station in the order list (see FS#5684).
Some houses and industries are not affected by transparency [FS#5817]:
Some of the default houses and industries (f.e. the iron ore mine) are
not affected by the transparency options. This is because the graphics do
not (completely) separate the ground from the building.
This is a bug of the original graphics, and unfortunately cannot be
fixed with OpenGFX for the sake of maintaining compatibility with the
original graphics.

View File

@@ -1,32 +0,0 @@
# $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/>.
BEGIN {
# Very basic variant function; barely any error checking.
# Just use the first argument as the file to start from when assembling everything
path = ARGV[1];
gsub("[^/\\\\]*$", "", path);
assemble(ARGV[1]);
}
# Recursive function for assembling by means of resolving the #includes.
function assemble(filename) {
while ((getline < filename) > 0) {
if (NF == 2 && $1 == "#include" ) {
# Remove the quotes.
gsub("[\"'<>]", "", $2);
assemble(path $2);
} else {
print $0;
}
}
if (close(filename) < 0) {
print "Could not open " filename > "/dev/stderr";
exit -1;
}
}

View File

@@ -7,7 +7,7 @@
// 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/>.
//
-1 * 0 0C "OpenTTD GUI graphics"
-1 * 3 05 15 \b 175 // OPENTTD_SPRITE_COUNT
-1 * 3 05 15 \b 168 // OPENTTD_SPRITE_COUNT
-1 sprites/openttdgui.png 8bpp 66 8 64 31 -31 7 normal
-1 sprites/openttdgui.png 8bpp 146 8 64 31 -31 7 normal
-1 sprites/openttdgui.png 8bpp 226 8 64 31 -31 7 normal
@@ -176,10 +176,3 @@
-1 sprites/openttdgui.png 8bpp 296 440 8 8 0 0 normal
-1 sprites/openttdgui.png 8bpp 312 440 14 10 0 0 normal
-1 sprites/openttdgui.png 8bpp 328 440 14 10 0 0 normal
-1 sprites/openttdgui.png 8bpp 348 440 8 8 0 0 normal
-1 sprites/openttdgui.png 8bpp 362 440 20 20 0 0 normal
-1 sprites/openttdgui.png 8bpp 388 440 20 20 0 0 normal
-1 sprites/openttdgui.png 8bpp 414 440 20 20 0 0 normal
-1 sprites/openttdgui.png 8bpp 440 440 20 20 0 0 normal
-1 sprites/openttdgui.png 8bpp 466 440 20 20 0 0 normal
-1 sprites/openttdgui.png 8bpp 490 440 20 20 0 0 normal

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,87 +1,3 @@
openttd (1.4.2~RC2-0) unstable; urgency=low
* New upstream release 1.4.2-RC2
-- OpenTTD <info@openttd.org> Sun, 03 Aug 2014 18:00:00 +0200
openttd (1.4.2~RC1-0) unstable; urgency=low
* New upstream release 1.4.2-RC1
-- OpenTTD <info@openttd.org> Thu, 03 Jul 2014 21:00:00 +0200
openttd (1.4.1-0) unstable; urgency=low
* New upstream release 1.4.1
-- OpenTTD <info@openttd.org> Mon, 02 Jun 2014 21:00:00 +0200
openttd (1.4.1~RC2-0) unstable; urgency=low
* New upstream release 1.4.1-RC2
-- OpenTTD <info@openttd.org> Sun, 18 May 2014 21:00:00 +0200
openttd (1.4.1~RC1-0) unstable; urgency=low
* New upstream release 1.4.1-RC1
-- OpenTTD <info@openttd.org> Sun, 04 May 2014 21:00:00 +0200
openttd (1.4.0-0) unstable; urgency=low
* New upstream release 1.4.0
-- OpenTTD <info@openttd.org> Tue, 01 Apr 2014 21:00:00 +0200
openttd (1.4.0~RC1-0) unstable; urgency=low
* New upstream release 1.4.0-RC1
-- OpenTTD <info@openttd.org> Tue, 17 Mar 2014 21:00:00 +0100
openttd (1.4.0~beta5-0) unstable; urgency=low
* New upstream release 1.4.0-beta5
-- OpenTTD <info@openttd.org> Tue, 25 Feb 2014 10:15:00 +0100
openttd (1.4.0~beta4-0) unstable; urgency=low
* New upstream release 1.4.0-beta4
-- OpenTTD <info@openttd.org> Thu, 06 Feb 2014 21:00:00 +0100
openttd (1.4.0~beta3-0) unstable; urgency=low
* New upstream release 1.4.0-beta3
-- OpenTTD <info@openttd.org> Tue, 21 Jan 2014 21:00:00 +0100
openttd (1.4.0~beta2-0) unstable; urgency=low
* New upstream release 1.4.0-beta2
-- OpenTTD <info@openttd.org> Tue, 07 Jan 2014 21:00:00 +0100
openttd (1.4.0~beta1-0) unstable; urgency=low
* New upstream release 1.4.0-beta1
-- OpenTTD <info@openttd.org> Tue, 24 Dec 2013 00:00:00 +0100
openttd (1.3.3-0) unstable; urgency=low
* New upstream release 1.3.3
-- OpenTTD <info@openttd.org> Fri, 29 Nov 2013 19:00:00 +0100
openttd (1.3.3~RC2-0) unstable; urgency=low
* New upstream release 1.3.3-RC2
-- OpenTTD <info@openttd.org> Sun, 24 Nov 2013 19:00:00 +0100
openttd (1.3.3~RC1-0) unstable; urgency=low
* New upstream release 1.3.3-RC1

View File

@@ -29,7 +29,7 @@ include /usr/share/dpkg/buildflags.mk
# to be explicit about the dependencies, in case we're not running in a
# clean build root.
override_dh_auto_configure:
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --without-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
# Do some extra installation
override_dh_auto_install:

View File

@@ -1,6 +1,6 @@
@echo off
set OPENTTD_VERSION=1.4.0
set OPENTTD_VERSION=1.3.3-RC1
set OPENSFX_VERSION=0.8.0
set NOSOUND_VERSION=0.8.0
set OPENGFX_VERSION=1.2.0

View File

@@ -1,9 +1,9 @@
# Version numbers to update
!define APPV_MAJOR 1
!define APPV_MINOR 4
!define APPV_MAINT 2
!define APPV_BUILD 1
!define APPV_EXTRA "-RC2"
!define APPV_MINOR 3
!define APPV_MAINT 3
!define APPV_BUILD 0
!define APPV_EXTRA "-RC1"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version

View File

@@ -173,7 +173,6 @@ Function load_main_data(filename, ByRef vcxproj, ByRef filters, ByRef files)
line = "MSVC" Or _
line = "DIRECTMUSIC" Or _
line = "AI" Or _
line = "SSE" Or _
line = "HAVE_THREAD" _
) Then skip = skip + 1
deep = deep + 1

View File

@@ -102,7 +102,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -156,7 +156,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -204,7 +204,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -256,7 +256,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -296,7 +296,6 @@
<ClCompile Include="..\src\articulated_vehicles.cpp" />
<ClCompile Include="..\src\autoreplace.cpp" />
<ClCompile Include="..\src\bmp.cpp" />
<ClCompile Include="..\src\cargoaction.cpp" />
<ClCompile Include="..\src\cargomonitor.cpp" />
<ClCompile Include="..\src\cargopacket.cpp" />
<ClCompile Include="..\src\cargotype.cpp" />
@@ -304,7 +303,6 @@
<ClCompile Include="..\src\command.cpp" />
<ClCompile Include="..\src\console.cpp" />
<ClCompile Include="..\src\console_cmds.cpp" />
<ClCompile Include="..\src\cpu.cpp" />
<ClCompile Include="..\src\crashlog.cpp" />
<ClCompile Include="..\src\currency.cpp" />
<ClCompile Include="..\src\date.cpp" />
@@ -334,13 +332,6 @@
<ClCompile Include="..\src\ini.cpp" />
<ClCompile Include="..\src\ini_load.cpp" />
<ClCompile Include="..\src\landscape.cpp" />
<ClCompile Include="..\src\linkgraph\demands.cpp" />
<ClCompile Include="..\src\linkgraph\flowmapper.cpp" />
<ClCompile Include="..\src\linkgraph\linkgraph.cpp" />
<ClCompile Include="..\src\linkgraph\linkgraphjob.cpp" />
<ClCompile Include="..\src\linkgraph\linkgraphschedule.cpp" />
<ClCompile Include="..\src\linkgraph\mcf.cpp" />
<ClCompile Include="..\src\linkgraph\refresh.cpp" />
<ClCompile Include="..\src\map.cpp" />
<ClCompile Include="..\src\misc.cpp" />
<ClCompile Include="..\src\mixer.cpp" />
@@ -355,6 +346,7 @@
<ClCompile Include="..\src\network\network_udp.cpp" />
<ClCompile Include="..\src\openttd.cpp" />
<ClCompile Include="..\src\order_backup.cpp" />
<ClCompile Include="..\src\os_timer.cpp" />
<ClCompile Include="..\src\pbs.cpp" />
<ClCompile Include="..\src\progress.cpp" />
<ClCompile Include="..\src\rail.cpp" />
@@ -374,7 +366,6 @@
<ClCompile Include="..\src\string.cpp" />
<ClCompile Include="..\src\stringfilter.cpp" />
<ClCompile Include="..\src\strings.cpp" />
<ClCompile Include="..\src\story.cpp" />
<ClCompile Include="..\src\subsidy.cpp" />
<ClCompile Include="..\src\textbuf.cpp" />
<ClCompile Include="..\src\texteff.cpp" />
@@ -385,7 +376,6 @@
<ClCompile Include="..\src\vehicle.cpp" />
<ClCompile Include="..\src\vehiclelist.cpp" />
<ClCompile Include="..\src\viewport.cpp" />
<ClCompile Include="..\src\viewport_sprite_sorter_sse4.cpp" />
<ClCompile Include="..\src\waypoint.cpp" />
<ClCompile Include="..\src\widget.cpp" />
<ClCompile Include="..\src\window.cpp" />
@@ -404,7 +394,6 @@
<ClInclude Include="..\src\bmp.h" />
<ClInclude Include="..\src\bridge.h" />
<ClInclude Include="..\src\cargo_type.h" />
<ClInclude Include="..\src\cargoaction.h" />
<ClInclude Include="..\src\cargomonitor.h" />
<ClInclude Include="..\src\cargopacket.h" />
<ClInclude Include="..\src\cargotype.h" />
@@ -423,7 +412,6 @@
<ClInclude Include="..\src\console_gui.h" />
<ClInclude Include="..\src\console_internal.h" />
<ClInclude Include="..\src\console_type.h" />
<ClInclude Include="..\src\cpu.h" />
<ClInclude Include="..\src\crashlog.h" />
<ClInclude Include="..\src\currency.h" />
<ClInclude Include="..\src\date_func.h" />
@@ -483,18 +471,6 @@
<ClInclude Include="..\src\landscape.h" />
<ClInclude Include="..\src\landscape_type.h" />
<ClInclude Include="..\src\language.h" />
<ClInclude Include="..\src\linkgraph\demands.h" />
<ClInclude Include="..\src\linkgraph\flowmapper.h" />
<ClInclude Include="..\src\linkgraph\init.h" />
<ClInclude Include="..\src\linkgraph\linkgraph.h" />
<ClInclude Include="..\src\linkgraph\linkgraph_base.h" />
<ClInclude Include="..\src\linkgraph\linkgraph_gui.h" />
<ClInclude Include="..\src\linkgraph\linkgraph_type.h" />
<ClInclude Include="..\src\linkgraph\linkgraphjob.h" />
<ClInclude Include="..\src\linkgraph\linkgraphjob_base.h" />
<ClInclude Include="..\src\linkgraph\linkgraphschedule.h" />
<ClInclude Include="..\src\linkgraph\mcf.h" />
<ClInclude Include="..\src\linkgraph\refresh.h" />
<ClInclude Include="..\src\livery.h" />
<ClInclude Include="..\src\map_func.h" />
<ClInclude Include="..\src\map_type.h" />
@@ -596,8 +572,6 @@
<ClInclude Include="..\src\station_type.h" />
<ClInclude Include="..\src\statusbar_gui.h" />
<ClInclude Include="..\src\stdafx.h" />
<ClInclude Include="..\src\story_base.h" />
<ClInclude Include="..\src\story_type.h" />
<ClInclude Include="..\src\strgen\strgen.h" />
<ClInclude Include="..\src\string_base.h" />
<ClInclude Include="..\src\string_func.h" />
@@ -642,7 +616,6 @@
<ClInclude Include="..\src\vehicle_type.h" />
<ClInclude Include="..\src\vehiclelist.h" />
<ClInclude Include="..\src\viewport_func.h" />
<ClInclude Include="..\src\viewport_sprite_sorter.h" />
<ClInclude Include="..\src\viewport_type.h" />
<ClInclude Include="..\src\water.h" />
<ClInclude Include="..\src\waypoint_base.h" />
@@ -672,7 +645,6 @@
<ClCompile Include="..\src\core\math_func.cpp" />
<ClInclude Include="..\src\core\math_func.hpp" />
<ClInclude Include="..\src\core\mem_func.hpp" />
<ClInclude Include="..\src\core\multimap.hpp" />
<ClInclude Include="..\src\core\overflowsafe_type.hpp" />
<ClCompile Include="..\src\core\pool_func.cpp" />
<ClInclude Include="..\src\core\pool_func.hpp" />
@@ -680,8 +652,6 @@
<ClCompile Include="..\src\core\random_func.cpp" />
<ClInclude Include="..\src\core\random_func.hpp" />
<ClInclude Include="..\src\core\smallmap_type.hpp" />
<ClInclude Include="..\src\core\smallmatrix_type.hpp" />
<ClInclude Include="..\src\core\smallstack_type.hpp" />
<ClInclude Include="..\src\core\smallvec_type.hpp" />
<ClInclude Include="..\src\core\sort_func.hpp" />
<ClInclude Include="..\src\core\string_compare_type.hpp" />
@@ -707,7 +677,6 @@
<ClCompile Include="..\src\highscore_gui.cpp" />
<ClCompile Include="..\src\industry_gui.cpp" />
<ClCompile Include="..\src\intro_gui.cpp" />
<ClCompile Include="..\src\linkgraph\linkgraph_gui.cpp" />
<ClCompile Include="..\src\main_gui.cpp" />
<ClCompile Include="..\src\misc_gui.cpp" />
<ClCompile Include="..\src\music_gui.cpp" />
@@ -729,7 +698,6 @@
<ClCompile Include="..\src\smallmap_gui.cpp" />
<ClCompile Include="..\src\station_gui.cpp" />
<ClCompile Include="..\src\statusbar_gui.cpp" />
<ClCompile Include="..\src\story_gui.cpp" />
<ClCompile Include="..\src\subsidy_gui.cpp" />
<ClCompile Include="..\src\terraform_gui.cpp" />
<ClCompile Include="..\src\textfile_gui.cpp" />
@@ -768,7 +736,6 @@
<ClInclude Include="..\src\widgets\highscore_widget.h" />
<ClInclude Include="..\src\widgets\industry_widget.h" />
<ClInclude Include="..\src\widgets\intro_widget.h" />
<ClInclude Include="..\src\widgets\link_graph_legend_widget.h" />
<ClInclude Include="..\src\widgets\main_widget.h" />
<ClInclude Include="..\src\widgets\misc_widget.h" />
<ClInclude Include="..\src\widgets\music_widget.h" />
@@ -788,7 +755,6 @@
<ClInclude Include="..\src\widgets\smallmap_widget.h" />
<ClInclude Include="..\src\widgets\station_widget.h" />
<ClInclude Include="..\src\widgets\statusbar_widget.h" />
<ClInclude Include="..\src\widgets\story_widget.h" />
<ClInclude Include="..\src\widgets\subsidy_widget.h" />
<ClInclude Include="..\src\widgets\terraform_widget.h" />
<ClInclude Include="..\src\widgets\timetable_widget.h" />
@@ -844,7 +810,6 @@
<ClCompile Include="..\src\saveload\group_sl.cpp" />
<ClCompile Include="..\src\saveload\industry_sl.cpp" />
<ClCompile Include="..\src\saveload\labelmaps_sl.cpp" />
<ClCompile Include="..\src\saveload\linkgraph_sl.cpp" />
<ClCompile Include="..\src\saveload\map_sl.cpp" />
<ClCompile Include="..\src\saveload\misc_sl.cpp" />
<ClCompile Include="..\src\saveload\newgrf_sl.cpp" />
@@ -862,7 +827,6 @@
<ClCompile Include="..\src\saveload\station_sl.cpp" />
<ClCompile Include="..\src\saveload\storage_sl.cpp" />
<ClCompile Include="..\src\saveload\strings_sl.cpp" />
<ClCompile Include="..\src\saveload\story_sl.cpp" />
<ClCompile Include="..\src\saveload\subsidy_sl.cpp" />
<ClCompile Include="..\src\saveload\town_sl.cpp" />
<ClCompile Include="..\src\saveload\vehicle_sl.cpp" />
@@ -1035,9 +999,6 @@
<ClInclude Include="..\src\script\api\script_signlist.hpp" />
<ClInclude Include="..\src\script\api\script_station.hpp" />
<ClInclude Include="..\src\script\api\script_stationlist.hpp" />
<ClInclude Include="..\src\script\api\script_story_page.hpp" />
<ClInclude Include="..\src\script\api\script_storypagelist.hpp" />
<ClInclude Include="..\src\script\api\script_storypageelementlist.hpp" />
<ClInclude Include="..\src\script\api\script_subsidy.hpp" />
<ClInclude Include="..\src\script\api\script_subsidylist.hpp" />
<ClInclude Include="..\src\script\api\script_testmode.hpp" />
@@ -1099,9 +1060,6 @@
<ClCompile Include="..\src\script\api\script_signlist.cpp" />
<ClCompile Include="..\src\script\api\script_station.cpp" />
<ClCompile Include="..\src\script\api\script_stationlist.cpp" />
<ClCompile Include="..\src\script\api\script_story_page.cpp" />
<ClCompile Include="..\src\script\api\script_storypagelist.cpp" />
<ClCompile Include="..\src\script\api\script_storypageelementlist.cpp" />
<ClCompile Include="..\src\script\api\script_subsidy.cpp" />
<ClCompile Include="..\src\script\api\script_subsidylist.cpp" />
<ClCompile Include="..\src\script\api\script_testmode.cpp" />
@@ -1119,22 +1077,12 @@
<ClCompile Include="..\src\script\api\script_window.cpp" />
<ClCompile Include="..\src\blitter\32bpp_anim.cpp" />
<ClInclude Include="..\src\blitter\32bpp_anim.hpp" />
<ClCompile Include="..\src\blitter\32bpp_anim_sse4.cpp" />
<ClInclude Include="..\src\blitter\32bpp_anim_sse4.hpp" />
<ClCompile Include="..\src\blitter\32bpp_base.cpp" />
<ClInclude Include="..\src\blitter\32bpp_base.hpp" />
<ClCompile Include="..\src\blitter\32bpp_optimized.cpp" />
<ClInclude Include="..\src\blitter\32bpp_optimized.hpp" />
<ClCompile Include="..\src\blitter\32bpp_simple.cpp" />
<ClInclude Include="..\src\blitter\32bpp_simple.hpp" />
<ClInclude Include="..\src\blitter\32bpp_sse_func.hpp" />
<ClInclude Include="..\src\blitter\32bpp_sse_type.h" />
<ClCompile Include="..\src\blitter\32bpp_sse2.cpp" />
<ClInclude Include="..\src\blitter\32bpp_sse2.hpp" />
<ClCompile Include="..\src\blitter\32bpp_sse4.cpp" />
<ClInclude Include="..\src\blitter\32bpp_sse4.hpp" />
<ClCompile Include="..\src\blitter\32bpp_ssse3.cpp" />
<ClInclude Include="..\src\blitter\32bpp_ssse3.hpp" />
<ClCompile Include="..\src\blitter\8bpp_base.cpp" />
<ClInclude Include="..\src\blitter\8bpp_base.hpp" />
<ClCompile Include="..\src\blitter\8bpp_optimized.cpp" />
@@ -1256,7 +1204,6 @@
<ClCompile Include="..\src\pathfinder\yapf\yapf_rail.cpp" />
<ClCompile Include="..\src\pathfinder\yapf\yapf_road.cpp" />
<ClCompile Include="..\src\pathfinder\yapf\yapf_ship.cpp" />
<ClInclude Include="..\src\pathfinder\yapf\yapf_type.hpp" />
<ClCompile Include="..\src\video\dedicated_v.cpp" />
<ClCompile Include="..\src\video\null_v.cpp" />
<ClCompile Include="..\src\video\sdl_v.cpp" />

View File

@@ -117,9 +117,6 @@
<ClCompile Include="..\src\bmp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cargoaction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cargomonitor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -141,9 +138,6 @@
<ClCompile Include="..\src\console_cmds.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cpu.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\crashlog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -231,27 +225,6 @@
<ClCompile Include="..\src\landscape.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\demands.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\flowmapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\linkgraph.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\linkgraphjob.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\linkgraphschedule.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\mcf.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\refresh.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\map.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -294,6 +267,9 @@
<ClCompile Include="..\src\order_backup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\os_timer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\pbs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -351,9 +327,6 @@
<ClCompile Include="..\src\strings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\story.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\subsidy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -384,9 +357,6 @@
<ClCompile Include="..\src\viewport.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\viewport_sprite_sorter_sse4.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\waypoint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -441,9 +411,6 @@
<ClInclude Include="..\src\cargo_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cargoaction.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cargomonitor.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -498,9 +465,6 @@
<ClInclude Include="..\src\console_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cpu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\crashlog.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -678,42 +642,6 @@
<ClInclude Include="..\src\language.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\demands.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\flowmapper.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\init.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraph.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraph_base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraph_gui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraph_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraphjob.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraphjob_base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\linkgraphschedule.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\mcf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\linkgraph\refresh.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\livery.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1017,12 +945,6 @@
<ClInclude Include="..\src\stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\story_base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\story_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\strgen\strgen.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1155,9 +1077,6 @@
<ClInclude Include="..\src\viewport_func.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_sprite_sorter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_type.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1245,9 +1164,6 @@
<ClInclude Include="..\src\core\mem_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\multimap.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\overflowsafe_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
@@ -1269,12 +1185,6 @@
<ClInclude Include="..\src\core\smallmap_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\smallmatrix_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\smallstack_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\smallvec_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
@@ -1350,9 +1260,6 @@
<ClCompile Include="..\src\intro_gui.cpp">
<Filter>GUI Source Code</Filter>
</ClCompile>
<ClCompile Include="..\src\linkgraph\linkgraph_gui.cpp">
<Filter>GUI Source Code</Filter>
</ClCompile>
<ClCompile Include="..\src\main_gui.cpp">
<Filter>GUI Source Code</Filter>
</ClCompile>
@@ -1416,9 +1323,6 @@
<ClCompile Include="..\src\statusbar_gui.cpp">
<Filter>GUI Source Code</Filter>
</ClCompile>
<ClCompile Include="..\src\story_gui.cpp">
<Filter>GUI Source Code</Filter>
</ClCompile>
<ClCompile Include="..\src\subsidy_gui.cpp">
<Filter>GUI Source Code</Filter>
</ClCompile>
@@ -1533,9 +1437,6 @@
<ClInclude Include="..\src\widgets\intro_widget.h">
<Filter>Widgets</Filter>
</ClInclude>
<ClInclude Include="..\src\widgets\link_graph_legend_widget.h">
<Filter>Widgets</Filter>
</ClInclude>
<ClInclude Include="..\src\widgets\main_widget.h">
<Filter>Widgets</Filter>
</ClInclude>
@@ -1593,9 +1494,6 @@
<ClInclude Include="..\src\widgets\statusbar_widget.h">
<Filter>Widgets</Filter>
</ClInclude>
<ClInclude Include="..\src\widgets\story_widget.h">
<Filter>Widgets</Filter>
</ClInclude>
<ClInclude Include="..\src\widgets\subsidy_widget.h">
<Filter>Widgets</Filter>
</ClInclude>
@@ -1761,9 +1659,6 @@
<ClCompile Include="..\src\saveload\labelmaps_sl.cpp">
<Filter>Save/Load handlers</Filter>
</ClCompile>
<ClCompile Include="..\src\saveload\linkgraph_sl.cpp">
<Filter>Save/Load handlers</Filter>
</ClCompile>
<ClCompile Include="..\src\saveload\map_sl.cpp">
<Filter>Save/Load handlers</Filter>
</ClCompile>
@@ -1815,9 +1710,6 @@
<ClCompile Include="..\src\saveload\strings_sl.cpp">
<Filter>Save/Load handlers</Filter>
</ClCompile>
<ClCompile Include="..\src\saveload\story_sl.cpp">
<Filter>Save/Load handlers</Filter>
</ClCompile>
<ClCompile Include="..\src\saveload\subsidy_sl.cpp">
<Filter>Save/Load handlers</Filter>
</ClCompile>
@@ -2334,15 +2226,6 @@
<ClInclude Include="..\src\script\api\script_stationlist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_story_page.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_storypagelist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_storypageelementlist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_subsidy.hpp">
<Filter>Script API</Filter>
</ClInclude>
@@ -2526,15 +2409,6 @@
<ClCompile Include="..\src\script\api\script_stationlist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_story_page.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_storypagelist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_storypageelementlist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_subsidy.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
@@ -2586,12 +2460,6 @@
<ClInclude Include="..\src\blitter\32bpp_anim.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_anim_sse4.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_anim_sse4.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_base.cpp">
<Filter>Blitters</Filter>
</ClCompile>
@@ -2610,30 +2478,6 @@
<ClInclude Include="..\src\blitter\32bpp_simple.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClInclude Include="..\src\blitter\32bpp_sse_func.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClInclude Include="..\src\blitter\32bpp_sse_type.h">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_sse2.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_sse2.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_sse4.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_sse4.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_ssse3.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_ssse3.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\8bpp_base.cpp">
<Filter>Blitters</Filter>
</ClCompile>
@@ -2997,9 +2841,6 @@
<ClCompile Include="..\src\pathfinder\yapf\yapf_ship.cpp">
<Filter>YAPF</Filter>
</ClCompile>
<ClInclude Include="..\src\pathfinder\yapf\yapf_type.hpp">
<Filter>YAPF</Filter>
</ClInclude>
<ClCompile Include="..\src\video\dedicated_v.cpp">
<Filter>Video</Filter>
</ClCompile>

View File

@@ -102,7 +102,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -156,7 +156,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -204,7 +204,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -256,7 +256,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>

View File

@@ -52,7 +52,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -156,7 +156,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -257,7 +257,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -362,7 +362,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -454,10 +454,6 @@
RelativePath=".\..\src\bmp.cpp"
>
</File>
<File
RelativePath=".\..\src\cargoaction.cpp"
>
</File>
<File
RelativePath=".\..\src\cargomonitor.cpp"
>
@@ -486,10 +482,6 @@
RelativePath=".\..\src\console_cmds.cpp"
>
</File>
<File
RelativePath=".\..\src\cpu.cpp"
>
</File>
<File
RelativePath=".\..\src\crashlog.cpp"
>
@@ -606,34 +598,6 @@
RelativePath=".\..\src\landscape.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\demands.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\flowmapper.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphjob.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphschedule.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\mcf.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\refresh.cpp"
>
</File>
<File
RelativePath=".\..\src\map.cpp"
>
@@ -690,6 +654,10 @@
RelativePath=".\..\src\order_backup.cpp"
>
</File>
<File
RelativePath=".\..\src\os_timer.cpp"
>
</File>
<File
RelativePath=".\..\src\pbs.cpp"
>
@@ -766,10 +734,6 @@
RelativePath=".\..\src\strings.cpp"
>
</File>
<File
RelativePath=".\..\src\story.cpp"
>
</File>
<File
RelativePath=".\..\src\subsidy.cpp"
>
@@ -810,10 +774,6 @@
RelativePath=".\..\src\viewport.cpp"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\waypoint.cpp"
>
@@ -890,10 +850,6 @@
RelativePath=".\..\src\cargo_type.h"
>
</File>
<File
RelativePath=".\..\src\cargoaction.h"
>
</File>
<File
RelativePath=".\..\src\cargomonitor.h"
>
@@ -966,10 +922,6 @@
RelativePath=".\..\src\console_type.h"
>
</File>
<File
RelativePath=".\..\src\cpu.h"
>
</File>
<File
RelativePath=".\..\src\crashlog.h"
>
@@ -1206,54 +1158,6 @@
RelativePath=".\..\src\language.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\demands.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\flowmapper.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\init.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_base.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_gui.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_type.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphjob.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphjob_base.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphschedule.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\mcf.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\refresh.h"
>
</File>
<File
RelativePath=".\..\src\livery.h"
>
@@ -1658,14 +1562,6 @@
RelativePath=".\..\src\stdafx.h"
>
</File>
<File
RelativePath=".\..\src\story_base.h"
>
</File>
<File
RelativePath=".\..\src\story_type.h"
>
</File>
<File
RelativePath=".\..\src\strgen\strgen.h"
>
@@ -1842,10 +1738,6 @@
RelativePath=".\..\src\viewport_func.h"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter.h"
>
</File>
<File
RelativePath=".\..\src\viewport_type.h"
>
@@ -1966,10 +1858,6 @@
RelativePath=".\..\src\core\mem_func.hpp"
>
</File>
<File
RelativePath=".\..\src\core\multimap.hpp"
>
</File>
<File
RelativePath=".\..\src\core\overflowsafe_type.hpp"
>
@@ -1998,14 +1886,6 @@
RelativePath=".\..\src\core\smallmap_type.hpp"
>
</File>
<File
RelativePath=".\..\src\core\smallmatrix_type.hpp"
>
</File>
<File
RelativePath=".\..\src\core\smallstack_type.hpp"
>
</File>
<File
RelativePath=".\..\src\core\smallvec_type.hpp"
>
@@ -2110,10 +1990,6 @@
RelativePath=".\..\src\intro_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\main_gui.cpp"
>
@@ -2198,10 +2074,6 @@
RelativePath=".\..\src\statusbar_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\story_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\subsidy_gui.cpp"
>
@@ -2358,10 +2230,6 @@
RelativePath=".\..\src\widgets\intro_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\link_graph_legend_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\main_widget.h"
>
@@ -2438,10 +2306,6 @@
RelativePath=".\..\src\widgets\statusbar_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\story_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\subsidy_widget.h"
>
@@ -2670,10 +2534,6 @@
RelativePath=".\..\src\saveload\labelmaps_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\linkgraph_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\map_sl.cpp"
>
@@ -2742,10 +2602,6 @@
RelativePath=".\..\src\saveload\strings_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\story_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\subsidy_sl.cpp"
>
@@ -3474,18 +3330,6 @@
RelativePath=".\..\src\script\api\script_stationlist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_story_page.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.hpp"
>
@@ -3734,18 +3578,6 @@
RelativePath=".\..\src\script\api\script_stationlist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_story_page.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.cpp"
>
@@ -3818,14 +3650,6 @@
RelativePath=".\..\src\blitter\32bpp_anim.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_base.cpp"
>
@@ -3850,38 +3674,6 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_func.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_type.h"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\8bpp_base.cpp"
>
@@ -4402,10 +4194,6 @@
RelativePath=".\..\src\pathfinder\yapf\yapf_ship.cpp"
>
</File>
<File
RelativePath=".\..\src\pathfinder\yapf\yapf_type.hpp"
>
</File>
</Filter>
<Filter
Name="Video"

View File

@@ -52,7 +52,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -156,7 +156,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -257,7 +257,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -362,7 +362,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"

View File

@@ -53,7 +53,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -155,7 +155,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -255,7 +255,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -359,7 +359,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -451,10 +451,6 @@
RelativePath=".\..\src\bmp.cpp"
>
</File>
<File
RelativePath=".\..\src\cargoaction.cpp"
>
</File>
<File
RelativePath=".\..\src\cargomonitor.cpp"
>
@@ -483,10 +479,6 @@
RelativePath=".\..\src\console_cmds.cpp"
>
</File>
<File
RelativePath=".\..\src\cpu.cpp"
>
</File>
<File
RelativePath=".\..\src\crashlog.cpp"
>
@@ -603,34 +595,6 @@
RelativePath=".\..\src\landscape.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\demands.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\flowmapper.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphjob.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphschedule.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\mcf.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\refresh.cpp"
>
</File>
<File
RelativePath=".\..\src\map.cpp"
>
@@ -687,6 +651,10 @@
RelativePath=".\..\src\order_backup.cpp"
>
</File>
<File
RelativePath=".\..\src\os_timer.cpp"
>
</File>
<File
RelativePath=".\..\src\pbs.cpp"
>
@@ -763,10 +731,6 @@
RelativePath=".\..\src\strings.cpp"
>
</File>
<File
RelativePath=".\..\src\story.cpp"
>
</File>
<File
RelativePath=".\..\src\subsidy.cpp"
>
@@ -807,10 +771,6 @@
RelativePath=".\..\src\viewport.cpp"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\waypoint.cpp"
>
@@ -887,10 +847,6 @@
RelativePath=".\..\src\cargo_type.h"
>
</File>
<File
RelativePath=".\..\src\cargoaction.h"
>
</File>
<File
RelativePath=".\..\src\cargomonitor.h"
>
@@ -963,10 +919,6 @@
RelativePath=".\..\src\console_type.h"
>
</File>
<File
RelativePath=".\..\src\cpu.h"
>
</File>
<File
RelativePath=".\..\src\crashlog.h"
>
@@ -1203,54 +1155,6 @@
RelativePath=".\..\src\language.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\demands.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\flowmapper.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\init.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_base.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_gui.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_type.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphjob.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphjob_base.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraphschedule.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\mcf.h"
>
</File>
<File
RelativePath=".\..\src\linkgraph\refresh.h"
>
</File>
<File
RelativePath=".\..\src\livery.h"
>
@@ -1655,14 +1559,6 @@
RelativePath=".\..\src\stdafx.h"
>
</File>
<File
RelativePath=".\..\src\story_base.h"
>
</File>
<File
RelativePath=".\..\src\story_type.h"
>
</File>
<File
RelativePath=".\..\src\strgen\strgen.h"
>
@@ -1839,10 +1735,6 @@
RelativePath=".\..\src\viewport_func.h"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter.h"
>
</File>
<File
RelativePath=".\..\src\viewport_type.h"
>
@@ -1963,10 +1855,6 @@
RelativePath=".\..\src\core\mem_func.hpp"
>
</File>
<File
RelativePath=".\..\src\core\multimap.hpp"
>
</File>
<File
RelativePath=".\..\src\core\overflowsafe_type.hpp"
>
@@ -1995,14 +1883,6 @@
RelativePath=".\..\src\core\smallmap_type.hpp"
>
</File>
<File
RelativePath=".\..\src\core\smallmatrix_type.hpp"
>
</File>
<File
RelativePath=".\..\src\core\smallstack_type.hpp"
>
</File>
<File
RelativePath=".\..\src\core\smallvec_type.hpp"
>
@@ -2107,10 +1987,6 @@
RelativePath=".\..\src\intro_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\linkgraph\linkgraph_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\main_gui.cpp"
>
@@ -2195,10 +2071,6 @@
RelativePath=".\..\src\statusbar_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\story_gui.cpp"
>
</File>
<File
RelativePath=".\..\src\subsidy_gui.cpp"
>
@@ -2355,10 +2227,6 @@
RelativePath=".\..\src\widgets\intro_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\link_graph_legend_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\main_widget.h"
>
@@ -2435,10 +2303,6 @@
RelativePath=".\..\src\widgets\statusbar_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\story_widget.h"
>
</File>
<File
RelativePath=".\..\src\widgets\subsidy_widget.h"
>
@@ -2667,10 +2531,6 @@
RelativePath=".\..\src\saveload\labelmaps_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\linkgraph_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\map_sl.cpp"
>
@@ -2739,10 +2599,6 @@
RelativePath=".\..\src\saveload\strings_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\story_sl.cpp"
>
</File>
<File
RelativePath=".\..\src\saveload\subsidy_sl.cpp"
>
@@ -3471,18 +3327,6 @@
RelativePath=".\..\src\script\api\script_stationlist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_story_page.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.hpp"
>
@@ -3731,18 +3575,6 @@
RelativePath=".\..\src\script\api\script_stationlist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_story_page.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.cpp"
>
@@ -3815,14 +3647,6 @@
RelativePath=".\..\src\blitter\32bpp_anim.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_base.cpp"
>
@@ -3847,38 +3671,6 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_func.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_type.h"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\8bpp_base.cpp"
>
@@ -4399,10 +4191,6 @@
RelativePath=".\..\src\pathfinder\yapf\yapf_ship.cpp"
>
</File>
<File
RelativePath=".\..\src\pathfinder\yapf\yapf_type.hpp"
>
</File>
</Filter>
<Filter
Name="Video"

View File

@@ -53,7 +53,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -155,7 +155,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -255,7 +255,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -359,7 +359,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"

View File

@@ -23,7 +23,7 @@
</ImportGroup>
<PropertyGroup Label="UserMacros">
<SettingsCommandLine>
..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini
..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini
</SettingsCommandLine>
</PropertyGroup>
<PropertyGroup>
@@ -42,7 +42,6 @@
<None Include="..\src\table\misc_settings.ini" />
<None Include="..\src\table\settings.ini" />
<None Include="..\src\table\win32_settings.ini" />
<None Include="..\src\table\window_settings.ini" />
</ItemGroup>
<ItemGroup>
<None Include="..\src\table\settings.h.postamble" />

View File

@@ -24,9 +24,6 @@
<None Include="..\src\table\win32_settings.ini">
<Filter>INI</Filter>
</None>
<None Include="..\src\table\window_settings.ini">
<Filter>INI</Filter>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\src\table\settings.h.postamble" />

View File

@@ -24,7 +24,7 @@
Name="VCPreBuildEventTool"
Description="Generating settings.h"
CommandLine="
..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini
..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini
"
/>
<Tool
@@ -68,10 +68,6 @@
RelativePath="..\src\table\win32_settings.ini"
>
</File>
<File
RelativePath="..\src\table\window_settings.ini"
>
</File>
</Filter>
<File
RelativePath="..\src\table\settings.h.postamble"

View File

@@ -25,7 +25,7 @@
Name="VCPreBuildEventTool"
Description="Generating settings.h"
CommandLine="
..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini ..\src\table\window_settings.ini
..\objs\settings\settings_gen.exe -o ..\objs\settings\table\settings.h -b ..\src\table\settings.h.preamble -a ..\src\table\settings.h.postamble ..\src\table\company_settings.ini ..\src\table\currency_settings.ini ..\src\table\gameopt_settings.ini ..\src\table\misc_settings.ini ..\src\table\settings.ini ..\src\table\win32_settings.ini
"
/>
<Tool
@@ -69,10 +69,6 @@
RelativePath="..\src\table\win32_settings.ini"
>
</File>
<File
RelativePath="..\src\table\window_settings.ini"
>
</File>
</Filter>
<File
RelativePath="..\src\table\settings.h.postamble"

View File

@@ -1,5 +1,5 @@
Last updated: 2014-08-03
Release version: 1.4.2-RC2
Last updated: 2013-11-17
Release version: 1.3.3-RC1
------------------------------------------------------------------------
@@ -282,8 +282,7 @@ your operating system:
C:\Documents and Settings\<username>\My Documents\OpenTTD (2000, XP)
C:\Users\<username>\Documents\OpenTTD (Vista, 7)
Mac OSX: ~/Documents/OpenTTD
Linux: $XDG_DATA_HOME/openttd which is usually ~/.local/share/openttd when
built with XDG base directory support, otherwise ~/.openttd
Linux: ~/.openttd
3. The shared directory
Windows: C:\Documents and Settings\All Users\Shared Documents\OpenTTD (2000, XP)
C:\Users\Public\Documents\OpenTTD (Vista, 7)
@@ -323,13 +322,10 @@ Notes:
others.
- The previous search order is also used for NewGRFs and openttd.cfg.
- If openttd.cfg is not found, then it will be created using the 2, 4, 1, 3,
5 order. When built with XDG base directory support, openttd.cfg will be
created in $XDG_CONFIG_HOME/openttd which is usually ~/.config/openttd.
5 order.
- Savegames will be relative to the config file only if there is no save/
directory in paths with higher priority than the config file path, but
autosaves and screenshots will always be relative to the config file.
Unless the configuration file is in $XDG_CONFIG_HOME/openttd, then all
other files will be saved under $XDG_DATA_HOME/openttd.
The preferred setup:
Place 3rd party files in shared directory (or in personal directory if you do
@@ -674,47 +670,46 @@ http://homer.rice.edu/~sandmann/cwsdpmi/csdpmi5s.zip
X.X) Credits
---- -------
The OpenTTD team (in alphabetical order):
Albert Hofkamp (Alberth) - GUI expert (since 0.7)
Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)
Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)
Christoph Elsenhans (frosch) - General coding (since 0.6)
Loïc Guilloux (glx) - Windows Expert (since 0.4.5)
Michael Lutz (michi_cc) - Path based signals (since 0.7)
Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)
Peter Nelson (peter1138) - Spiritual descendant from newGRF gods (since 0.4.5)
Ingo von Borstel (planetmaker) - General coding, Support (since 1.1)
Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)
José Soler (Terkhen) - General coding (since 1.0)
Leif Linse (Zuu) - AI/Game Script (since 1.2)
Albert Hofkamp (Alberth) - GUI expert
Jean-François Claeys (Belugas) - GUI, newindustries and more
Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework
Ulf Hermann (fonsinchen) - Cargo Distribution
Christoph Elsenhans (frosch) - General coding
Loïc Guilloux (glx) - Windows Expert
Michael Lutz (michi_cc) - Path based signals
Owen Rudge (orudge) - Forum host, OS/2 port
Peter Nelson (peter1138) - Spiritual descendant from newGRF gods
Ingo von Borstel (planetmaker) - Support
Remko Bijker (Rubidium) - Lead coder and way more
Zdeněk Sojka (SmatZ) - Bug finder and fixer
José Soler (Terkhen) - General coding
Thijs Marinussen (Yexo) - AI Framework
Leif Linse (Zuu) - AI/Game Script
Inactive Developers:
Jean-François Claeys (Belugas) - GUI, newindustries and more (0.4.5 - 1.0)
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)
Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)
Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)
Attila Bán (MiHaMiX) - WebTranslator 1 and 2 (0.3 - 0.5)
Zdeněk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)
Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)
Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles
Victor Fischer (Celestar) - Programming everywhere you need him to
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 1 and 2
Christoph Mallon (Tron) - Programmer, code correctness police
Retired Developers:
Tamás Faragó (Darkvater) - Ex-Lead coder (0.3 - 0.5)
Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)
Emil Djupfeld (egladil) - MacOSX port (0.4 - 0.6)
Simon Sasburg (HackyKid) - Bug fixer (0.4 - 0.4.5)
Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)
Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)
Petr Baudiš (pasky) - Many patches, newgrf support, etc. (0.3 - 0.3)
Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)
Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)
Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)
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 (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
Thanks to:
Josef Drexler - For his great work on TTDPatch.
Marcin Grzegorczyk - For his TTDPatch work and documentation of Transport Tycoon Deluxe internals and track foundations
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
Cian Duffy (MYOB) - BeOS port / manual writing
Christian Rosentreter (tokai) - MorphOS / AmigaOS port
Richard Kempton (RichK67) - Additional airports, initial TGP implementation
Alberto Demichelis - Squirrel scripting language
@@ -723,7 +718,6 @@ Thanks to:
George - Canal graphics
Andrew Parkhouse (andythenorth) - River graphics
David Dallaston (Pikka) - Tram tracks
Fleashosio - Titlegame
All Translators - For their support to make OpenTTD a truly international game
Bug Reporters - Thanks for all bug reports
Chris Sawyer - For an amazing game!

View File

@@ -4,7 +4,6 @@ animated_tile.cpp
articulated_vehicles.cpp
autoreplace.cpp
bmp.cpp
cargoaction.cpp
cargomonitor.cpp
cargopacket.cpp
cargotype.cpp
@@ -12,7 +11,6 @@ cheat.cpp
command.cpp
console.cpp
console_cmds.cpp
cpu.cpp
crashlog.cpp
currency.cpp
date.cpp
@@ -42,13 +40,6 @@ hotkeys.cpp
ini.cpp
ini_load.cpp
landscape.cpp
linkgraph/demands.cpp
linkgraph/flowmapper.cpp
linkgraph/linkgraph.cpp
linkgraph/linkgraphjob.cpp
linkgraph/linkgraphschedule.cpp
linkgraph/mcf.cpp
linkgraph/refresh.cpp
map.cpp
misc.cpp
mixer.cpp
@@ -63,6 +54,7 @@ network/network_server.cpp
network/network_udp.cpp
openttd.cpp
order_backup.cpp
os_timer.cpp
pbs.cpp
progress.cpp
rail.cpp
@@ -84,7 +76,6 @@ strgen/strgen_base.cpp
string.cpp
stringfilter.cpp
strings.cpp
story.cpp
subsidy.cpp
textbuf.cpp
texteff.cpp
@@ -111,9 +102,6 @@ townname.cpp
vehicle.cpp
vehiclelist.cpp
viewport.cpp
#if SSE
viewport_sprite_sorter_sse4.cpp
#end
waypoint.cpp
widget.cpp
window.cpp
@@ -139,7 +127,6 @@ base_station_base.h
bmp.h
bridge.h
cargo_type.h
cargoaction.h
cargomonitor.h
cargopacket.h
cargotype.h
@@ -158,7 +145,6 @@ console_func.h
console_gui.h
console_internal.h
console_type.h
cpu.h
crashlog.h
currency.h
date_func.h
@@ -218,18 +204,6 @@ ini_type.h
landscape.h
landscape_type.h
language.h
linkgraph/demands.h
linkgraph/flowmapper.h
linkgraph/init.h
linkgraph/linkgraph.h
linkgraph/linkgraph_base.h
linkgraph/linkgraph_gui.h
linkgraph/linkgraph_type.h
linkgraph/linkgraphjob.h
linkgraph/linkgraphjob_base.h
linkgraph/linkgraphschedule.h
linkgraph/mcf.h
linkgraph/refresh.h
livery.h
map_func.h
map_type.h
@@ -331,8 +305,6 @@ station_gui.h
station_type.h
statusbar_gui.h
stdafx.h
story_base.h
story_type.h
strgen/strgen.h
string_base.h
string_func.h
@@ -377,7 +349,6 @@ vehicle_gui_base.h
vehicle_type.h
vehiclelist.h
viewport_func.h
viewport_sprite_sorter.h
viewport_type.h
water.h
waypoint_base.h
@@ -424,7 +395,6 @@ core/geometry_type.hpp
core/math_func.cpp
core/math_func.hpp
core/mem_func.hpp
core/multimap.hpp
core/overflowsafe_type.hpp
core/pool_func.cpp
core/pool_func.hpp
@@ -432,8 +402,6 @@ core/pool_type.hpp
core/random_func.cpp
core/random_func.hpp
core/smallmap_type.hpp
core/smallmatrix_type.hpp
core/smallstack_type.hpp
core/smallvec_type.hpp
core/sort_func.hpp
core/string_compare_type.hpp
@@ -461,7 +429,6 @@ group_gui.cpp
highscore_gui.cpp
industry_gui.cpp
intro_gui.cpp
linkgraph/linkgraph_gui.cpp
main_gui.cpp
misc_gui.cpp
music_gui.cpp
@@ -483,7 +450,6 @@ signs_gui.cpp
smallmap_gui.cpp
station_gui.cpp
statusbar_gui.cpp
story_gui.cpp
subsidy_gui.cpp
terraform_gui.cpp
textfile_gui.cpp
@@ -524,7 +490,6 @@ widgets/group_widget.h
widgets/highscore_widget.h
widgets/industry_widget.h
widgets/intro_widget.h
widgets/link_graph_legend_widget.h
widgets/main_widget.h
widgets/misc_widget.h
widgets/music_widget.h
@@ -544,7 +509,6 @@ widgets/sign_widget.h
widgets/smallmap_widget.h
widgets/station_widget.h
widgets/statusbar_widget.h
widgets/story_widget.h
widgets/subsidy_widget.h
widgets/terraform_widget.h
widgets/timetable_widget.h
@@ -604,7 +568,6 @@ saveload/goal_sl.cpp
saveload/group_sl.cpp
saveload/industry_sl.cpp
saveload/labelmaps_sl.cpp
saveload/linkgraph_sl.cpp
saveload/map_sl.cpp
saveload/misc_sl.cpp
saveload/newgrf_sl.cpp
@@ -622,7 +585,6 @@ saveload/signs_sl.cpp
saveload/station_sl.cpp
saveload/storage_sl.cpp
saveload/strings_sl.cpp
saveload/story_sl.cpp
saveload/subsidy_sl.cpp
saveload/town_sl.cpp
saveload/vehicle_sl.cpp
@@ -815,9 +777,6 @@ script/api/script_sign.hpp
script/api/script_signlist.hpp
script/api/script_station.hpp
script/api/script_stationlist.hpp
script/api/script_story_page.hpp
script/api/script_storypagelist.hpp
script/api/script_storypageelementlist.hpp
script/api/script_subsidy.hpp
script/api/script_subsidylist.hpp
script/api/script_testmode.hpp
@@ -881,9 +840,6 @@ script/api/script_sign.cpp
script/api/script_signlist.cpp
script/api/script_station.cpp
script/api/script_stationlist.cpp
script/api/script_story_page.cpp
script/api/script_storypagelist.cpp
script/api/script_storypageelementlist.cpp
script/api/script_subsidy.cpp
script/api/script_subsidylist.cpp
script/api/script_testmode.cpp
@@ -905,26 +861,12 @@ script/api/script_window.cpp
#else
blitter/32bpp_anim.cpp
blitter/32bpp_anim.hpp
#if SSE
blitter/32bpp_anim_sse4.cpp
blitter/32bpp_anim_sse4.hpp
#end
blitter/32bpp_base.cpp
blitter/32bpp_base.hpp
blitter/32bpp_optimized.cpp
blitter/32bpp_optimized.hpp
blitter/32bpp_simple.cpp
blitter/32bpp_simple.hpp
#if SSE
blitter/32bpp_sse_func.hpp
blitter/32bpp_sse_type.h
blitter/32bpp_sse2.cpp
blitter/32bpp_sse2.hpp
blitter/32bpp_sse4.cpp
blitter/32bpp_sse4.hpp
blitter/32bpp_ssse3.cpp
blitter/32bpp_ssse3.hpp
#end
blitter/8bpp_base.cpp
blitter/8bpp_base.hpp
blitter/8bpp_optimized.cpp
@@ -1065,7 +1007,6 @@ pathfinder/yapf/yapf_node_ship.hpp
pathfinder/yapf/yapf_rail.cpp
pathfinder/yapf/yapf_road.cpp
pathfinder/yapf/yapf_ship.cpp
pathfinder/yapf/yapf_type.hpp
# Video
video/dedicated_v.cpp

View File

@@ -30,7 +30,6 @@
#include "../hotkeys.h"
#include "ai.hpp"
#include "ai_gui.hpp"
#include "../script/api/script_log.hpp"
#include "ai_config.hpp"
#include "ai_info.hpp"
@@ -66,7 +65,7 @@ struct AIListWindow : public Window {
* @param desc The description of the window.
* @param slot The company we're changing the AI for.
*/
AIListWindow(WindowDesc *desc, CompanyID slot) : Window(desc),
AIListWindow(const WindowDesc *desc, CompanyID slot) : Window(),
slot(slot)
{
if (slot == OWNER_DEITY) {
@@ -75,9 +74,9 @@ struct AIListWindow : public Window {
this->info_list = AI::GetUniqueInfoList();
}
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_AIL_SCROLLBAR);
this->FinishInitNested(); // Initializes 'this->line_height' as side effect.
this->FinishInitNested(desc); // Initializes 'this->line_height' as side effect.
this->vscroll->SetCount((int)this->info_list->size() + 1);
@@ -111,7 +110,7 @@ struct AIListWindow : public Window {
resize->width = 1;
resize->height = this->line_height;
size->height = 5 * this->line_height;
size->height = GB(this->GetWidget<NWidgetCore>(widget)->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height;
}
}
@@ -210,7 +209,9 @@ struct AIListWindow : public Window {
virtual void OnResize()
{
this->vscroll->SetCapacityFromWidget(this, WID_AIL_LIST);
NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIL_LIST);
this->vscroll->SetCapacity(nwi->current_y / this->line_height);
nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
/**
@@ -239,10 +240,9 @@ static const NWidgetPart _nested_ai_list_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_AIL_CAPTION), SetDataTip(STR_AI_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_DEFSIZEBOX, COLOUR_MAUVE),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIL_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetMatrixDataTip(1, 0, STR_AI_LIST_TOOLTIP), SetScrollbar(WID_AIL_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIL_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP), SetScrollbar(WID_AIL_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIL_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIL_INFO_BG), SetMinimalTextLines(8, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0),
@@ -257,8 +257,8 @@ static const NWidgetPart _nested_ai_list_widgets[] = {
};
/** Window definition for the ai list window. */
static WindowDesc _ai_list_desc(
WDP_CENTER, "settings_script_list", 200, 234,
static const WindowDesc _ai_list_desc(
WDP_CENTER, 200, 234,
WC_AI_LIST, WC_NONE,
0,
_nested_ai_list_widgets, lengthof(_nested_ai_list_widgets)
@@ -296,7 +296,7 @@ struct AISettingsWindow : public Window {
* @param desc The description of the window.
* @param slot The company we're changing the settings for.
*/
AISettingsWindow(WindowDesc *desc, CompanyID slot) : Window(desc),
AISettingsWindow(const WindowDesc *desc, CompanyID slot) : Window(),
slot(slot),
clicked_button(-1),
clicked_dropdown(false),
@@ -306,9 +306,9 @@ struct AISettingsWindow : public Window {
this->ai_config = GetConfig(slot);
this->RebuildVisibleSettings();
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR);
this->FinishInitNested(slot); // Initializes 'this->line_height' as side effect.
this->FinishInitNested(desc, slot); // Initializes 'this->line_height' as side effect.
this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
@@ -349,7 +349,7 @@ struct AISettingsWindow : public Window {
resize->width = 1;
resize->height = this->line_height;
size->height = 5 * this->line_height;
size->height = GB(this->GetWidget<NWidgetCore>(widget)->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height;
}
}
@@ -476,7 +476,7 @@ struct AISettingsWindow : public Window {
DropDownList *list = new DropDownList();
for (int i = config_item.min_value; i <= config_item.max_value; i++) {
*list->Append() = new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false);
list->push_back(new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false));
}
ShowDropDownListAt(this, list, old_val, -1, wi_rect, COLOUR_ORANGE, true);
@@ -559,7 +559,9 @@ struct AISettingsWindow : public Window {
virtual void OnResize()
{
this->vscroll->SetCapacityFromWidget(this, WID_AIS_BACKGROUND);
NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIS_BACKGROUND);
this->vscroll->SetCapacity(nwi->current_y / this->line_height);
nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnTick()
@@ -586,10 +588,9 @@ static const NWidgetPart _nested_ai_settings_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_AIS_CAPTION), SetDataTip(STR_AI_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_DEFSIZEBOX, COLOUR_MAUVE),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIS_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetMatrixDataTip(1, 0, STR_NULL), SetScrollbar(WID_AIS_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIS_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(WID_AIS_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIS_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@@ -602,8 +603,8 @@ static const NWidgetPart _nested_ai_settings_widgets[] = {
};
/** Window definition for the AI settings window. */
static WindowDesc _ai_settings_desc(
WDP_CENTER, "settings_script", 500, 208,
static const WindowDesc _ai_settings_desc(
WDP_CENTER, 500, 208,
WC_AI_SETTINGS, WC_NONE,
0,
_nested_ai_settings_widgets, lengthof(_nested_ai_settings_widgets)
@@ -673,13 +674,13 @@ static const NWidgetPart _nested_ai_config_widgets[] = {
EndContainer(),
NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_AI, STR_NULL), SetPadding(0, 5, 0, 5),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetMatrixDataTip(1, 8, STR_AI_CONFIG_AILIST_TOOLTIP), SetScrollbar(WID_AIC_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_AILIST_TOOLTIP), SetScrollbar(WID_AIC_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIC_SCROLLBAR),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 9),
NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_GAMESCRIPT, STR_NULL), SetPadding(0, 5, 4, 5),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), SetMinimalSize(288, 14), SetFill(1, 0), SetMatrixDataTip(1, 1, STR_AI_CONFIG_GAMELIST_TOOLTIP),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), SetMinimalSize(288, 14), SetFill(1, 0), SetDataTip(0x101, STR_AI_CONFIG_GAMELIST_TOOLTIP),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP),
@@ -696,8 +697,8 @@ static const NWidgetPart _nested_ai_config_widgets[] = {
};
/** Window definition for the configure AI window. */
static WindowDesc _ai_config_desc(
WDP_CENTER, "settings_script_config", 0, 0,
static const WindowDesc _ai_config_desc(
WDP_CENTER, 0, 0,
WC_GAME_OPTIONS, WC_NONE,
0,
_nested_ai_config_widgets, lengthof(_nested_ai_config_widgets)
@@ -711,14 +712,15 @@ struct AIConfigWindow : public Window {
int line_height; ///< Height of a single AI-name line.
Scrollbar *vscroll; ///< Cache of the vertical scrollbar.
AIConfigWindow() : Window(&_ai_config_desc)
AIConfigWindow() : Window()
{
this->InitNested(WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
this->InitNested(&_ai_config_desc, WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
this->selected_slot = INVALID_COMPANY;
NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST);
this->vscroll->SetCapacity(nwi->current_y / this->line_height);
this->vscroll->SetCount(MAX_COMPANIES);
nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
this->OnInvalidateData(0);
}
@@ -756,13 +758,9 @@ struct AIConfigWindow : public Window {
{
switch (widget) {
case WID_AIC_GAMELIST:
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
size->height = 1 * this->line_height;
break;
case WID_AIC_LIST:
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
size->height = 8 * this->line_height;
size->height = GB(this->GetWidget<NWidgetCore>(widget)->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height;
break;
}
}
@@ -774,7 +772,7 @@ struct AIConfigWindow : public Window {
*/
static bool IsEditable(CompanyID slot)
{
if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL || Game::GetInstance() != NULL;
if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL;
if (_game_mode != GM_NORMAL) {
return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
@@ -853,7 +851,7 @@ struct AIConfigWindow : public Window {
case WID_AIC_GAMELIST: {
this->selected_slot = OWNER_DEITY;
this->InvalidateData();
if (click_count > 1 && this->selected_slot != INVALID_COMPANY && _game_mode != GM_NORMAL) ShowAIListWindow((CompanyID)this->selected_slot);
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
break;
}
@@ -922,7 +920,7 @@ struct AIConfigWindow : public Window {
this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
this->SetWidgetDisabledState(WID_AIC_CHANGE, (this->selected_slot == OWNER_DEITY && _game_mode == GM_NORMAL) || this->selected_slot == INVALID_COMPANY);
this->SetWidgetDisabledState(WID_AIC_CHANGE, this->selected_slot == INVALID_COMPANY);
this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
@@ -1044,13 +1042,13 @@ struct AIDebugWindow : public Window {
* @param desc The description of the window.
* @param number The window number (actually unused).
*/
AIDebugWindow(WindowDesc *desc, WindowNumber number) : Window(desc), break_editbox(MAX_BREAK_STR_STRING_LENGTH)
AIDebugWindow(const WindowDesc *desc, WindowNumber number) : break_editbox(MAX_BREAK_STR_STRING_LENGTH)
{
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_AID_SCROLLBAR);
this->show_break_box = _settings_client.gui.ai_developer_tools;
this->GetWidget<NWidgetStacked>(WID_AID_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL);
this->FinishInitNested(number);
this->FinishInitNested(desc, number);
if (!this->show_break_box) break_check_enabled = false;
@@ -1060,8 +1058,6 @@ struct AIDebugWindow : public Window {
this->querystrings[WID_AID_BREAK_STR_EDIT_BOX] = &this->break_editbox;
SetWidgetsDisabledState(!this->show_break_box, WID_AID_BREAK_STR_ON_OFF_BTN, WID_AID_BREAK_STR_EDIT_BOX, WID_AID_MATCH_CASE_BTN, WIDGET_LIST_END);
/* Restore the break string value from static variable */
this->break_editbox.text.Assign(this->break_string);
@@ -1307,6 +1303,23 @@ struct AIDebugWindow : public Window {
}
}
virtual EventState OnKeyPress(WChar key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
int num = CheckHotkeyMatch(aidebug_hotkeys, keycode, this);
if (num != -1) {
if (this->show_break_box && num == WID_AID_BREAK_STR_EDIT_BOX) {
this->SetFocusedWidget(WID_AID_BREAK_STR_EDIT_BOX);
SetFocusedWindow(this);
state = ES_HANDLED;
} else if (this->show_break_box || num < WID_AID_BREAK_STRING_WIDGETS) {
this->OnClick(Point(), num, 1);
state = ES_HANDLED;
}
}
return state;
}
virtual void OnEditboxChanged(int wid)
{
if (wid == WID_AID_BREAK_STR_EDIT_BOX) {
@@ -1384,7 +1397,7 @@ struct AIDebugWindow : public Window {
this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL);
}
static HotkeyList hotkeys;
static Hotkey<AIDebugWindow> aidebug_hotkeys[];
};
const int AIDebugWindow::top_offset = WD_FRAMERECT_TOP + 2;
@@ -1401,45 +1414,32 @@ NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index)
return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
}
/**
* Handler for global hotkeys of the AIDebugWindow.
* @param hotkey Hotkey
* @return ES_HANDLED if hotkey was accepted.
*/
static EventState AIDebugGlobalHotkeys(int hotkey)
{
if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
Window *w = ShowAIDebugWindow(INVALID_COMPANY);
if (w == NULL) return ES_NOT_HANDLED;
return w->OnHotkey(hotkey);
}
static Hotkey aidebug_hotkeys[] = {
Hotkey('1', "company_1", WID_AID_COMPANY_BUTTON_START),
Hotkey('2', "company_2", WID_AID_COMPANY_BUTTON_START + 1),
Hotkey('3', "company_3", WID_AID_COMPANY_BUTTON_START + 2),
Hotkey('4', "company_4", WID_AID_COMPANY_BUTTON_START + 3),
Hotkey('5', "company_5", WID_AID_COMPANY_BUTTON_START + 4),
Hotkey('6', "company_6", WID_AID_COMPANY_BUTTON_START + 5),
Hotkey('7', "company_7", WID_AID_COMPANY_BUTTON_START + 6),
Hotkey('8', "company_8", WID_AID_COMPANY_BUTTON_START + 7),
Hotkey('9', "company_9", WID_AID_COMPANY_BUTTON_START + 8),
Hotkey((uint16)0, "company_10", WID_AID_COMPANY_BUTTON_START + 9),
Hotkey((uint16)0, "company_11", WID_AID_COMPANY_BUTTON_START + 10),
Hotkey((uint16)0, "company_12", WID_AID_COMPANY_BUTTON_START + 11),
Hotkey((uint16)0, "company_13", WID_AID_COMPANY_BUTTON_START + 12),
Hotkey((uint16)0, "company_14", WID_AID_COMPANY_BUTTON_START + 13),
Hotkey((uint16)0, "company_15", WID_AID_COMPANY_BUTTON_START + 14),
Hotkey('S', "settings", WID_AID_SETTINGS),
Hotkey('0', "game_script", WID_AID_SCRIPT_GAME),
Hotkey((uint16)0, "reload", WID_AID_RELOAD_TOGGLE),
Hotkey('B', "break_toggle", WID_AID_BREAK_STR_ON_OFF_BTN),
Hotkey('F', "break_string", WID_AID_BREAK_STR_EDIT_BOX),
Hotkey('C', "match_case", WID_AID_MATCH_CASE_BTN),
Hotkey(WKC_RETURN, "continue", WID_AID_CONTINUE_BTN),
HOTKEY_LIST_END
Hotkey<AIDebugWindow> AIDebugWindow::aidebug_hotkeys[] = {
Hotkey<AIDebugWindow>('1', "company_1", WID_AID_COMPANY_BUTTON_START),
Hotkey<AIDebugWindow>('2', "company_2", WID_AID_COMPANY_BUTTON_START + 1),
Hotkey<AIDebugWindow>('3', "company_3", WID_AID_COMPANY_BUTTON_START + 2),
Hotkey<AIDebugWindow>('4', "company_4", WID_AID_COMPANY_BUTTON_START + 3),
Hotkey<AIDebugWindow>('5', "company_5", WID_AID_COMPANY_BUTTON_START + 4),
Hotkey<AIDebugWindow>('6', "company_6", WID_AID_COMPANY_BUTTON_START + 5),
Hotkey<AIDebugWindow>('7', "company_7", WID_AID_COMPANY_BUTTON_START + 6),
Hotkey<AIDebugWindow>('8', "company_8", WID_AID_COMPANY_BUTTON_START + 7),
Hotkey<AIDebugWindow>('9', "company_9", WID_AID_COMPANY_BUTTON_START + 8),
Hotkey<AIDebugWindow>((uint16)0, "company_10", WID_AID_COMPANY_BUTTON_START + 9),
Hotkey<AIDebugWindow>((uint16)0, "company_11", WID_AID_COMPANY_BUTTON_START + 10),
Hotkey<AIDebugWindow>((uint16)0, "company_12", WID_AID_COMPANY_BUTTON_START + 11),
Hotkey<AIDebugWindow>((uint16)0, "company_13", WID_AID_COMPANY_BUTTON_START + 12),
Hotkey<AIDebugWindow>((uint16)0, "company_14", WID_AID_COMPANY_BUTTON_START + 13),
Hotkey<AIDebugWindow>((uint16)0, "company_15", WID_AID_COMPANY_BUTTON_START + 14),
Hotkey<AIDebugWindow>('S', "settings", WID_AID_SETTINGS),
Hotkey<AIDebugWindow>('0', "game_script", WID_AID_SCRIPT_GAME),
Hotkey<AIDebugWindow>((uint16)0, "reload", WID_AID_RELOAD_TOGGLE),
Hotkey<AIDebugWindow>('B', "break_toggle", WID_AID_BREAK_STR_ON_OFF_BTN),
Hotkey<AIDebugWindow>('F', "break_string", WID_AID_BREAK_STR_EDIT_BOX),
Hotkey<AIDebugWindow>('C', "match_case", WID_AID_MATCH_CASE_BTN),
Hotkey<AIDebugWindow>(WKC_RETURN, "continue", WID_AID_CONTINUE_BTN),
HOTKEY_LIST_END(AIDebugWindow)
};
HotkeyList AIDebugWindow::hotkeys("aidebug", aidebug_hotkeys, AIDebugGlobalHotkeys);
Hotkey<AIDebugWindow> *_aidebug_hotkeys = AIDebugWindow::aidebug_hotkeys;
/** Widgets for the AI debug window. */
static const NWidgetPart _nested_ai_debug_widgets[] = {
@@ -1447,7 +1447,6 @@ static const NWidgetPart _nested_ai_debug_widgets[] = {
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_AI_DEBUG, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_AID_VIEW),
@@ -1487,12 +1486,11 @@ static const NWidgetPart _nested_ai_debug_widgets[] = {
};
/** Window definition for the AI debug window. */
static WindowDesc _ai_debug_desc(
WDP_AUTO, "script_debug", 600, 450,
static const WindowDesc _ai_debug_desc(
WDP_AUTO, 600, 450,
WC_AI_DEBUG, WC_NONE,
0,
_nested_ai_debug_widgets, lengthof(_nested_ai_debug_widgets),
&AIDebugWindow::hotkeys
_nested_ai_debug_widgets, lengthof(_nested_ai_debug_widgets)
);
/**
@@ -1513,6 +1511,18 @@ Window *ShowAIDebugWindow(CompanyID show_company)
return NULL;
}
/**
* Handler for global AI debug window hotkeys.
*/
EventState AIDebugGlobalHotkeys(WChar key, uint16 keycode)
{
int num = CheckHotkeyMatch<AIDebugWindow>(_aidebug_hotkeys, keycode, NULL, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowAIDebugWindow(INVALID_COMPANY);
if (w == NULL) return ES_NOT_HANDLED;
return w->OnKeyPress(key, keycode);
}
/**
* Reset the AI windows to their initial state.
*/

View File

@@ -23,7 +23,7 @@
*/
static bool CheckAPIVersion(const char *api_version)
{
return strcmp(api_version, "0.7") == 0 || strcmp(api_version, "1.0") == 0 || strcmp(api_version, "1.1") == 0 || strcmp(api_version, "1.2") == 0 || strcmp(api_version, "1.3") == 0 || strcmp(api_version, "1.4") == 0;
return strcmp(api_version, "0.7") == 0 || strcmp(api_version, "1.0") == 0 || strcmp(api_version, "1.1") == 0 || strcmp(api_version, "1.2") == 0 || strcmp(api_version, "1.3") == 0;
}
#if defined(WIN32)

View File

@@ -99,12 +99,6 @@ static const SpriteID _aircraft_sprite[] = {
0x0EBD, 0x0EC5
};
template <>
bool IsValidImageIndex<VEH_AIRCRAFT>(uint8 image_index)
{
return image_index < lengthof(_aircraft_sprite);
}
/** Helicopter rotor animation states */
enum HelicopterRotorStates {
HRS_ROTOR_STOPPED,
@@ -166,7 +160,6 @@ SpriteID Aircraft::GetImage(Direction direction, EngineImageType image_type) con
spritenum = this->GetEngine()->original_image_index;
}
assert(IsValidImageIndex<VEH_AIRCRAFT>(spritenum));
return direction + _aircraft_sprite[spritenum];
}
@@ -196,7 +189,6 @@ static SpriteID GetAircraftIcon(EngineID engine, EngineImageType image_type)
spritenum = e->original_image_index;
}
assert(IsValidImageIndex<VEH_AIRCRAFT>(spritenum));
return DIR_W + _aircraft_sprite[spritenum];
}
@@ -250,7 +242,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
/* Prevent building aircraft types at places which can't handle them */
if (!CanVehicleUseStation(e->index, st)) return CMD_ERROR;
/* Make sure all aircraft end up in the first tile of the hangar. */
/* Make sure all aircraft end up in the first tile of the hanger. */
tile = st->airport.GetHangarTile(st->airport.GetHangarNum(tile));
if (flags & DC_EXEC) {
@@ -279,16 +271,13 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
v->spritenum = avi->image_index;
v->cargo_cap = avi->passenger_capacity;
v->refit_cap = 0;
u->cargo_cap = avi->mail_capacity;
u->refit_cap = 0;
v->cargo_type = e->GetDefaultCargoType();
u->cargo_type = CT_MAIL;
v->name = NULL;
v->last_station_visited = INVALID_STATION;
v->last_loading_station = INVALID_STATION;
v->acceleration = avi->acceleration;
v->engine_type = e->index;
@@ -1032,7 +1021,7 @@ static bool HandleCrashedAircraft(Aircraft *v)
/* make aircraft crash down to the ground */
if (v->crashed_counter < 500 && st == NULL && ((v->crashed_counter % 3) == 0) ) {
int z = GetSlopePixelZ(Clamp(v->x_pos, 0, MapMaxX() * TILE_SIZE), Clamp(v->y_pos, 0, MapMaxY() * TILE_SIZE));
int z = GetSlopePixelZ(v->x_pos, v->y_pos);
v->z_pos -= 1;
if (v->z_pos == z) {
v->crashed_counter = 500;
@@ -1161,8 +1150,7 @@ TileIndex Aircraft::GetOrderStationLocation(StationID station)
void Aircraft::MarkDirty()
{
this->colourmap = PAL_NONE;
this->UpdateViewport(true, false);
this->UpdateViewport(false, false);
if (this->subtype == AIR_HELICOPTER) this->Next()->Next()->cur_image = GetRotorImage(this, EIT_ON_MAP);
}
@@ -1186,8 +1174,8 @@ static void CrashAirplane(Aircraft *v)
uint pass = v->Crash();
SetDParam(0, pass);
v->cargo.Truncate();
v->Next()->cargo.Truncate();
v->cargo.Truncate(0);
v->Next()->cargo.Truncate(0);
const Station *st = GetTargetAirportIfValid(v);
StringID newsitem;
if (st == NULL) {
@@ -1231,7 +1219,7 @@ static void MaybeCrashAirplane(Aircraft *v)
/* Crash the airplane. Remove all goods stored at the station. */
for (CargoID i = 0; i < NUM_CARGO; i++) {
st->goods[i].rating = 1;
st->goods[i].cargo.Truncate();
st->goods[i].cargo.Truncate(0);
}
CrashAirplane(v);

View File

@@ -50,7 +50,7 @@ void DrawAircraftDetails(const Aircraft *v, int left, int right, int y)
}
if (u->cargo_cap != 0) {
uint cargo_count = u->cargo.StoredCount();
uint cargo_count = u->cargo.Count();
y_offset += FONT_HEIGHT_NORMAL + 1;
if (cargo_count != 0) {

View File

@@ -20,9 +20,7 @@ static const uint MAX_TERMINALS = 8; ///< maximum number
static const uint MAX_HELIPADS = 3; ///< maximum number of helipads per airport
static const uint MAX_ELEMENTS = 255; ///< maximum number of aircraft positions at airport
static const uint NUM_AIRPORTTILES_PER_GRF = 255; ///< Number of airport tiles per NewGRF; limited to 255 to allow extending Action3 with an extended byte later on.
static const uint NUM_AIRPORTTILES = 256; ///< Total number of airport tiles.
static const uint NUM_AIRPORTTILES = 256; ///< total number of airport tiles
static const uint NEW_AIRPORTTILE_OFFSET = 74; ///< offset of first newgrf airport tile
static const uint INVALID_AIRPORTTILE = NUM_AIRPORTTILES; ///< id for an invalid airport tile
@@ -39,8 +37,7 @@ enum AirportTypes {
AT_HELISTATION = 8, ///< Heli station airport.
AT_OILRIG = 9, ///< Oilrig airport.
NEW_AIRPORT_OFFSET = 10, ///< Number of the first newgrf airport.
NUM_AIRPORTS_PER_GRF = 128, ///< Maximal number of airports per NewGRF.
NUM_AIRPORTS = 128, ///< Maximal number of airports in total.
NUM_AIRPORTS = 128, ///< Maximal number of airports.
AT_INVALID = 254, ///< Invalid airport.
AT_DUMMY = 255, ///< Dummy airport.
};

View File

@@ -27,7 +27,6 @@
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "vehicle_func.h"
#include "gui.h"
#include "widgets/airport_widget.h"
@@ -44,7 +43,7 @@ void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32
{
if (result.Failed()) return;
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
@@ -68,9 +67,9 @@ static void PlaceAirport(TileIndex tile)
struct BuildAirToolbarWindow : Window {
int last_user_action; // Last started user action.
BuildAirToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
{
this->InitNested(window_number);
this->InitNested(desc, window_number);
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
this->last_user_action = WIDGET_LIST_END;
}
@@ -100,6 +99,14 @@ struct BuildAirToolbarWindow : Window {
}
virtual EventState OnKeyPress(WChar key, uint16 keycode)
{
int num = CheckHotkeyMatch(airtoolbar_hotkeys, keycode, this);
if (num == -1) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
return ES_HANDLED;
}
virtual void OnPlaceObject(Point pt, TileIndex tile)
{
switch (this->last_user_action) {
@@ -135,28 +142,15 @@ struct BuildAirToolbarWindow : Window {
DeleteWindowById(WC_SELECT_STATION, 0);
}
static HotkeyList hotkeys;
static Hotkey<BuildAirToolbarWindow> airtoolbar_hotkeys[];
};
/**
* Handler for global hotkeys of the BuildAirToolbarWindow.
* @param hotkey Hotkey
* @return ES_HANDLED if hotkey was accepted.
*/
static EventState AirportToolbarGlobalHotkeys(int hotkey)
{
if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
Window *w = ShowBuildAirToolbar();
if (w == NULL) return ES_NOT_HANDLED;
return w->OnHotkey(hotkey);
}
static Hotkey airtoolbar_hotkeys[] = {
Hotkey('1', "airport", WID_AT_AIRPORT),
Hotkey('2', "demolish", WID_AT_DEMOLISH),
HOTKEY_LIST_END
Hotkey<BuildAirToolbarWindow> BuildAirToolbarWindow::airtoolbar_hotkeys[] = {
Hotkey<BuildAirToolbarWindow>('1', "airport", WID_AT_AIRPORT),
Hotkey<BuildAirToolbarWindow>('2', "demolish", WID_AT_DEMOLISH),
HOTKEY_LIST_END(BuildAirToolbarWindow)
};
HotkeyList BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys, AirportToolbarGlobalHotkeys);
Hotkey<BuildAirToolbarWindow> *_airtoolbar_hotkeys = BuildAirToolbarWindow::airtoolbar_hotkeys;
static const NWidgetPart _nested_air_toolbar_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -171,12 +165,11 @@ static const NWidgetPart _nested_air_toolbar_widgets[] = {
EndContainer(),
};
static WindowDesc _air_toolbar_desc(
WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
static const WindowDesc _air_toolbar_desc(
WDP_ALIGN_TOOLBAR, 0, 0,
WC_BUILD_TOOLBAR, WC_NONE,
WDF_CONSTRUCTION,
_nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets),
&BuildAirToolbarWindow::hotkeys
_nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets)
);
/**
@@ -194,6 +187,16 @@ Window *ShowBuildAirToolbar()
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
}
EventState AirportToolbarGlobalHotkeys(WChar key, uint16 keycode)
{
if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
int num = CheckHotkeyMatch<BuildAirToolbarWindow>(_airtoolbar_hotkeys, keycode, NULL, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildAirToolbar();
if (w == NULL) return ES_NOT_HANDLED;
return w->OnKeyPress(key, keycode);
}
class BuildAirportWindow : public PickerWindowBase {
SpriteID preview_sprite; ///< Cached airport preview sprite.
int line_height;
@@ -205,22 +208,22 @@ class BuildAirportWindow : public PickerWindowBase {
DropDownList *list = new DropDownList();
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
*list->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false);
list->push_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
}
return list;
}
public:
BuildAirportWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
BuildAirportWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
this->vscroll->SetCapacity(5);
this->vscroll->SetPosition(0);
this->FinishInitNested(TRANSPORT_AIR);
this->FinishInitNested(desc, TRANSPORT_AIR);
this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
@@ -284,7 +287,7 @@ public:
}
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
size->height = 5 * this->line_height;
size->height = this->vscroll->GetCapacity() * this->line_height;
break;
}
@@ -524,9 +527,8 @@ static const NWidgetPart _nested_build_airport_widgets[] = {
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@@ -534,6 +536,7 @@ static const NWidgetPart _nested_build_airport_widgets[] = {
NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
EndContainer(),
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
EndContainer(),
/* Bottom panel. */
@@ -553,8 +556,8 @@ static const NWidgetPart _nested_build_airport_widgets[] = {
EndContainer(),
};
static WindowDesc _build_airport_desc(
WDP_AUTO, "build_station_air", 0, 0,
static const WindowDesc _build_airport_desc(
WDP_AUTO, 0, 0,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
WDF_CONSTRUCTION,
_nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)

View File

@@ -355,7 +355,6 @@ void AddArticulatedParts(Vehicle *first)
t->cargo_type = front->cargo_type; // Needed for livery selection
t->cargo_cap = 0;
}
t->refit_cap = 0;
t->SetArticulatedPart();
break;
@@ -382,7 +381,6 @@ void AddArticulatedParts(Vehicle *first)
rv->cargo_type = front->cargo_type; // Needed for livery selection
rv->cargo_cap = 0;
}
rv->refit_cap = 0;
rv->SetArticulatedPart();
break;

View File

@@ -91,32 +91,27 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company)
/**
* Check the capacity of all vehicles in a chain and spread cargo if needed.
* @param v The vehicle to check.
* @pre You can only do this if the consist is not loading or unloading. It
* must not carry reserved cargo, nor cargo to be unloaded or transferred.
*/
void CheckCargoCapacity(Vehicle *v)
{
assert(v == NULL || v->First() == v);
for (Vehicle *src = v; src != NULL; src = src->Next()) {
assert(src->cargo.TotalCount() == src->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
/* Do we need to more cargo away? */
if (src->cargo.TotalCount() <= src->cargo_cap) continue;
if (src->cargo.Count() <= src->cargo_cap) continue;
/* We need to move a particular amount. Try that on the other vehicles. */
uint to_spread = src->cargo.TotalCount() - src->cargo_cap;
uint to_spread = src->cargo.Count() - src->cargo_cap;
for (Vehicle *dest = v; dest != NULL && to_spread != 0; dest = dest->Next()) {
assert(dest->cargo.TotalCount() == dest->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
if (dest->cargo.TotalCount() >= dest->cargo_cap || dest->cargo_type != src->cargo_type) continue;
if (dest->cargo.Count() >= dest->cargo_cap || dest->cargo_type != src->cargo_type) continue;
uint amount = min(to_spread, dest->cargo_cap - dest->cargo.TotalCount());
src->cargo.Shift(amount, &dest->cargo);
uint amount = min(to_spread, dest->cargo_cap - dest->cargo.Count());
src->cargo.MoveTo(&dest->cargo, amount, VehicleCargoList::MTA_UNLOAD, NULL);
to_spread -= amount;
}
/* Any left-overs will be thrown away, but not their feeder share. */
if (src->cargo_cap < src->cargo.TotalCount()) src->cargo.Truncate(src->cargo.TotalCount() - src->cargo_cap);
src->cargo.Truncate(src->cargo_cap);
}
}
@@ -125,26 +120,21 @@ void CheckCargoCapacity(Vehicle *v)
* @param old_veh Old vehicle that will be sold
* @param new_head Head of the completely constructed new vehicle chain
* @param part_of_chain The vehicle is part of a train
* @pre You can only do this if both consists are not loading or unloading.
* They must not carry reserved cargo, nor cargo to be unloaded or
* transferred.
*/
static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chain)
{
assert(!part_of_chain || new_head->IsPrimaryVehicle());
/* Loop through source parts */
for (Vehicle *src = old_veh; src != NULL; src = src->Next()) {
assert(src->cargo.TotalCount() == src->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
if (!part_of_chain && src->type == VEH_TRAIN && src != old_veh && src != Train::From(old_veh)->other_multiheaded_part && !src->IsArticulatedPart()) {
/* Skip vehicles, which do not belong to old_veh */
src = src->GetLastEnginePart();
continue;
}
if (src->cargo_type >= NUM_CARGO || src->cargo.TotalCount() == 0) continue;
if (src->cargo_type >= NUM_CARGO || src->cargo.Count() == 0) continue;
/* Find free space in the new chain */
for (Vehicle *dest = new_head; dest != NULL && src->cargo.TotalCount() > 0; dest = dest->Next()) {
assert(dest->cargo.TotalCount() == dest->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
for (Vehicle *dest = new_head; dest != NULL && src->cargo.Count() > 0; dest = dest->Next()) {
if (!part_of_chain && dest->type == VEH_TRAIN && dest != new_head && dest != Train::From(new_head)->other_multiheaded_part && !dest->IsArticulatedPart()) {
/* Skip vehicles, which do not belong to new_head */
dest = dest->GetLastEnginePart();
@@ -152,15 +142,15 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
}
if (dest->cargo_type != src->cargo_type) continue;
uint amount = min(src->cargo.TotalCount(), dest->cargo_cap - dest->cargo.TotalCount());
uint amount = min(src->cargo.Count(), dest->cargo_cap - dest->cargo.Count());
if (amount <= 0) continue;
src->cargo.Shift(amount, &dest->cargo);
src->cargo.MoveTo(&dest->cargo, amount, VehicleCargoList::MTA_UNLOAD, NULL);
}
}
/* Update train weight etc., the old vehicle will be sold anyway */
if (part_of_chain && new_head->type == VEH_TRAIN) Train::From(new_head)->ConsistChanged(CCF_LOADUNLOAD);
if (part_of_chain && new_head->type == VEH_TRAIN) Train::From(new_head)->ConsistChanged(true);
}
/**

View File

@@ -164,21 +164,10 @@ class ReplaceVehicleWindow : public Window {
this->engines[1].Clear();
this->sel_engine[1] = INVALID_ENGINE;
} else {
if (this->reset_sel_engine && this->sel_engine[0] != INVALID_ENGINE) {
/* Select the current replacement for sel_engine[0]. */
const Company *c = Company::Get(_local_company);
this->sel_engine[1] = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group);
}
/* Regenerate the list on the right. Note: This resets sel_engine[1] to INVALID_ENGINE, if it is no longer available. */
this->GenerateReplaceVehList(false);
this->vscroll[1]->SetCount(this->engines[1].Length());
if (this->reset_sel_engine && this->sel_engine[1] != INVALID_ENGINE) {
int position = 0;
for (EngineID *it = this->engines[1].Begin(); it != this->engines[1].End(); ++it) {
if (*it == this->sel_engine[1]) break;
++position;
}
this->vscroll[1]->ScrollTowards(position);
if (this->reset_sel_engine && this->sel_engine[1] == INVALID_ENGINE && this->engines[1].Length() != 0) {
this->sel_engine[1] = this->engines[1][0];
}
}
}
@@ -200,7 +189,7 @@ class ReplaceVehicleWindow : public Window {
}
public:
ReplaceVehicleWindow(WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc)
ReplaceVehicleWindow(const WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window()
{
if (vehicletype == VEH_TRAIN) {
/* For rail vehicles find the most used vehicle type, which is usually
@@ -228,10 +217,10 @@ public:
this->sel_engine[0] = INVALID_ENGINE;
this->sel_engine[1] = INVALID_ENGINE;
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll[0] = this->GetScrollbar(WID_RV_LEFT_SCROLLBAR);
this->vscroll[1] = this->GetScrollbar(WID_RV_RIGHT_SCROLLBAR);
this->FinishInitNested(vehicletype);
this->FinishInitNested(desc, vehicletype);
this->owner = _local_company;
this->sel_group = id_g;
@@ -276,8 +265,10 @@ public:
}
case WID_RV_INFO_TAB: {
Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING);
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
SetDParam(0, STR_REPLACE_NOT_REPLACING);
Dimension d = GetStringBoundingBox(STR_BLACK_STRING);
SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
d.width += WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
*size = maxdim(*size, d);
@@ -349,21 +340,20 @@ public:
switch (widget) {
case WID_RV_INFO_TAB: {
const Company *c = Company::Get(_local_company);
StringID str;
if (this->sel_engine[0] != INVALID_ENGINE) {
if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) {
str = STR_REPLACE_NOT_REPLACING;
SetDParam(0, STR_REPLACE_NOT_REPLACING);
} else {
bool when_old = false;
EngineID e = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group, &when_old);
str = when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME;
SetDParam(0, e);
SetDParam(0, when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME);
SetDParam(1, e);
}
} else {
str = STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED;
SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
}
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_BLACK, SA_HOR_CENTER);
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER);
break;
}
@@ -519,6 +509,9 @@ public:
{
this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
this->vscroll[1]->SetCapacityFromWidget(this, WID_RV_RIGHT_MATRIX);
this->GetWidget<NWidgetCore>(WID_RV_LEFT_MATRIX)->widget_data =
this->GetWidget<NWidgetCore>(WID_RV_RIGHT_MATRIX)->widget_data = (this->vscroll[0]->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
/**
@@ -542,13 +535,12 @@ static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
@@ -571,8 +563,8 @@ static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
EndContainer(),
};
static WindowDesc _replace_rail_vehicle_desc(
WDP_AUTO, "replace_vehicle_train", 500, 140,
static const WindowDesc _replace_rail_vehicle_desc(
WDP_AUTO, 500, 140,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_replace_rail_vehicle_widgets, lengthof(_nested_replace_rail_vehicle_widgets)
@@ -583,13 +575,12 @@ static const NWidgetPart _nested_replace_vehicle_widgets[] = {
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
@@ -604,8 +595,8 @@ static const NWidgetPart _nested_replace_vehicle_widgets[] = {
EndContainer(),
};
static WindowDesc _replace_vehicle_desc(
WDP_AUTO, "replace_vehicle", 456, 118,
static const WindowDesc _replace_vehicle_desc(
WDP_AUTO, 456, 118,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_replace_vehicle_widgets, lengthof(_nested_replace_vehicle_widgets)

View File

@@ -100,7 +100,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
/* Then find the MD5 checksum */
item = md5s->GetItem(filename, false);
if (item == NULL || item->value == NULL) {
if (item == NULL) {
DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
return false;
}
@@ -125,7 +125,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
}
/* Then find the warning message when the file's missing */
item = origin->GetItem(filename, false);
item = filename == NULL ? NULL : origin->GetItem(filename, false);
if (item == NULL) item = origin->GetItem("default", false);
if (item == NULL) {
DEBUG(grf, 1, "No origin warning message specified for: %s", filename);

View File

@@ -103,7 +103,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
* @param available will return false if ever the variable asked for does not exist
* @return the value stored in the corresponding variable
*/
virtual uint32 GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const = 0;
virtual uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const = 0;
/**
* Update the coordinated of the sign (as shown in the viewport).

View File

@@ -133,46 +133,6 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
}
break;
case BM_CRASH_REMAP:
if (src_px->a == 255) {
do {
uint m = *src_n;
if (m == 0) {
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
*anim = 0;
} else {
uint r = remap[GB(m, 0, 8)];
*anim = r | (m & 0xFF00);
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
}
anim++;
dst++;
src_px++;
src_n++;
} while (--n != 0);
} else {
do {
uint m = *src_n;
if (m == 0) {
if (src_px->a != 0) {
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
*anim = 0;
}
} else {
uint r = remap[GB(m, 0, 8)];
*anim = 0;
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
}
anim++;
dst++;
src_px++;
src_n++;
} while (--n != 0);
}
break;
case BM_TRANSPARENT:
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
@@ -248,7 +208,6 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
}
}
@@ -480,7 +439,7 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
}
/* Make sure the backend redraws the whole screen */
VideoDriver::GetInstance()->MakeDirty(0, 0, _screen.width, _screen.height);
_video_driver->MakeDirty(0, 0, _screen.width, _screen.height);
}
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()

View File

@@ -15,8 +15,8 @@
#include "32bpp_optimized.hpp"
/** The optimised 32 bpp blitter with palette animation. */
class Blitter_32bppAnim : public Blitter_32bppOptimized {
protected:
class Blitter_32bppAnim FINAL : public Blitter_32bppOptimized {
private:
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
int anim_buf_width; ///< The width of the animation buffer.
int anim_buf_height; ///< The height of the animation buffer.
@@ -56,9 +56,10 @@ public:
};
/** Factory for the 32bpp blitter with animation. */
class FBlitter_32bppAnim : public BlitterFactory {
class FBlitter_32bppAnim: public BlitterFactory<FBlitter_32bppAnim> {
public:
FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
/* virtual */ const char *GetName() { return "32bpp-anim"; }
/* virtual */ const char *GetDescription() { return "32bpp Animation Blitter (palette animation)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
};

View File

@@ -1,399 +0,0 @@
/* $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 32bpp_sse4_anim.cpp Implementation of the SSE4 32 bpp blitter with animation support. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../video/video_driver.hpp"
#include "../table/sprites.h"
#include "32bpp_anim_sse4.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;
/**
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
*
* @tparam mode blitter mode
* @param bp further blitting parameters
* @param zoom zoom level at which we are drawing
*/
IGNORE_UNINITIALIZED_WARNING_START
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent, bool animated>
inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
{
const byte * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
uint16 *anim_line = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
int effective_width = bp->width;
/* Find where to start reading in the source sprite. */
const Blitter_32bppSSE_Base::SpriteData * const sd = (const Blitter_32bppSSE_Base::SpriteData *) bp->sprite;
const SpriteInfo * const si = &sd->infos[zoom];
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
if (read_mode != RM_WITH_MARGIN) {
src_rgba_line += bp->skip_left;
src_mv_line += bp->skip_left;
}
const MapValue *src_mv = src_mv_line;
/* Load these variables into register before loop. */
const __m128i a_cm = ALPHA_CONTROL_MASK;
const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK;
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
for (int y = bp->height; y != 0; y--) {
Colour *dst = dst_line;
const Colour *src = src_rgba_line + META_LENGTH;
if (mode != BM_TRANSPARENT) src_mv = src_mv_line;
uint16 *anim = anim_line;
if (read_mode == RM_WITH_MARGIN) {
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
anim += src_rgba_line[0].data;
src += src_rgba_line[0].data;
dst += src_rgba_line[0].data;
if (mode != BM_TRANSPARENT) src_mv += src_rgba_line[0].data;
const int width_diff = si->sprite_width - bp->width;
effective_width = bp->width - (int) src_rgba_line[0].data;
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
const int new_width = effective_width - delta_diff;
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) goto next_line;
}
switch (mode) {
default:
if (!translucent) {
for (uint x = (uint) effective_width; x > 0; x--) {
if (src->a) {
if (animated) {
*anim = *(const uint16*) src_mv;
*dst = (src_mv->m >= PALETTE_ANIM_START) ? AdjustBrightneSSE(this->LookupColourInPalette(src_mv->m), src_mv->v) : src->data;
} else {
*anim = 0;
*dst = *src;
}
}
if (animated) src_mv++;
anim++;
src++;
dst++;
}
break;
}
for (uint x = (uint) effective_width/2; x != 0; x--) {
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
if (animated) {
/* Remap colours. */
const byte m0 = mvX2;
if (m0 >= PALETTE_ANIM_START) {
const Colour c0 = (this->LookupColourInPalette(m0).data & 0x00FFFFFF) | (src[0].data & 0xFF000000);
InsertFirstUint32(AdjustBrightneSSE(c0, (byte) (mvX2 >> 8)).data, srcABCD);
}
const byte m1 = mvX2 >> 16;
if (m1 >= PALETTE_ANIM_START) {
const Colour c1 = (this->LookupColourInPalette(m1).data & 0x00FFFFFF) | (src[1].data & 0xFF000000);
InsertSecondUint32(AdjustBrightneSSE(c1, (byte) (mvX2 >> 24)).data, srcABCD);
}
/* Update anim buffer. */
const byte a0 = src[0].a;
const byte a1 = src[1].a;
uint32 anim01 = 0;
if (a0 == 255) {
if (a1 == 255) {
*(uint32*) anim = mvX2;
goto bmno_full_opacity;
}
anim01 = (uint16) mvX2;
} else if (a0 == 0) {
if (a1 == 0) {
goto bmno_full_transparency;
} else {
if (a1 == 255) anim[1] = (uint16) (mvX2 >> 16);
goto bmno_alpha_blend;
}
}
if (a1 > 0) {
if (a1 == 255) anim01 |= mvX2 & 0xFFFF0000;
*(uint32*) anim = anim01;
} else {
anim[0] = (uint16) anim01;
}
} else {
if (src[0].a) anim[0] = 0;
if (src[1].a) anim[1] = 0;
}
/* Blend colours. */
bmno_alpha_blend:
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
bmno_full_opacity:
_mm_storel_epi64((__m128i *) dst, srcABCD);
bmno_full_transparency:
src_mv += 2;
src += 2;
anim += 2;
dst += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
if (src->a == 0) {
} else if (src->a == 255) {
*anim = *(const uint16*) src_mv;
*dst = (src_mv->m >= PALETTE_ANIM_START) ? AdjustBrightneSSE(LookupColourInPalette(src_mv->m), src_mv->v) : *src;
} else {
*anim = 0;
__m128i srcABCD;
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
if (src_mv->m >= PALETTE_ANIM_START) {
Colour colour = AdjustBrightneSSE(LookupColourInPalette(src_mv->m), src_mv->v);
colour.a = src->a;
srcABCD = _mm_cvtsi32_si128(colour.data);
} else {
srcABCD = _mm_cvtsi32_si128(src->data);
}
dst->data = _mm_cvtsi128_si32(AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm));
}
}
break;
case BM_COLOUR_REMAP:
for (uint x = (uint) effective_width / 2; x != 0; x--) {
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
/* Remap colours. */
const uint m0 = (byte) mvX2;
const uint r0 = remap[m0];
const uint m1 = (byte) (mvX2 >> 16);
const uint r1 = remap[m1];
if (mvX2 & 0x00FF00FF) {
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
/* Written so the compiler uses CMOV. */ \
Colour m_colour = m_colour_init; \
{ \
const Colour srcm = (Colour) (m_src); \
const uint m = (byte) (m_m); \
const uint r = remap[m]; \
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
m_colour = r == 0 ? m_colour : cmap; \
m_colour = m != 0 ? m_colour : srcm; \
}
#ifdef _SQ64
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
uint64 dsts;
if (animated) dsts = _mm_cvtsi128_si64(dstABCD);
uint64 remapped_src = 0;
CMOV_REMAP(c0, animated ? dsts : 0, srcs, mvX2);
remapped_src = c0.data;
CMOV_REMAP(c1, animated ? dsts >> 32 : 0, srcs >> 32, mvX2 >> 16);
remapped_src |= (uint64) c1.data << 32;
srcABCD = _mm_cvtsi64_si128(remapped_src);
#else
Colour remapped_src[2];
CMOV_REMAP(c0, animated ? _mm_cvtsi128_si32(dstABCD) : 0, _mm_cvtsi128_si32(srcABCD), mvX2);
remapped_src[0] = c0.data;
CMOV_REMAP(c1, animated ? dst[1] : 0, src[1], mvX2 >> 16);
remapped_src[1] = c1.data;
srcABCD = _mm_loadl_epi64((__m128i*) &remapped_src);
#endif
if ((mvX2 & 0xFF00FF00) != 0x80008000) srcABCD = AdjustBrightnessOfTwoPixels(srcABCD, mvX2);
}
/* Update anim buffer. */
if (animated) {
const byte a0 = src[0].a;
const byte a1 = src[1].a;
uint32 anim01 = mvX2 & 0xFF00FF00;
if (a0 == 255) {
anim01 |= r0;
if (a1 == 255) {
*(uint32*) anim = anim01 | (r1 << 16);
goto bmcr_full_opacity;
}
} else if (a0 == 0) {
if (a1 == 0) {
goto bmcr_full_transparency;
} else {
if (a1 == 255) {
anim[1] = r1 | (anim01 >> 16);
}
goto bmcr_alpha_blend;
}
}
if (a1 > 0) {
if (a1 == 255) anim01 |= r1 << 16;
*(uint32*) anim = anim01;
} else {
anim[0] = (uint16) anim01;
}
} else {
if (src[0].a) anim[0] = 0;
if (src[1].a) anim[1] = 0;
}
/* Blend colours. */
bmcr_alpha_blend:
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
bmcr_full_opacity:
_mm_storel_epi64((__m128i *) dst, srcABCD);
bmcr_full_transparency:
src_mv += 2;
dst += 2;
src += 2;
anim += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
/* In case the m-channel is zero, do not remap this pixel in any way. */
__m128i srcABCD;
if (src->a == 0) break;
if (src_mv->m) {
const uint r = remap[src_mv->m];
*anim = (animated && src->a == 255) ? r | ((uint16) src_mv->v << 8 ) : 0;
if (r != 0) {
Colour remapped_colour = AdjustBrightneSSE(this->LookupColourInPalette(r), src_mv->v);
if (src->a == 255) {
*dst = remapped_colour;
} else {
remapped_colour.a = src->a;
srcABCD = _mm_cvtsi32_si128(remapped_colour.data);
goto bmcr_alpha_blend_single;
}
}
} else {
*anim = 0;
srcABCD = _mm_cvtsi32_si128(src->data);
if (src->a < 255) {
bmcr_alpha_blend_single:
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
}
dst->data = _mm_cvtsi128_si32(srcABCD);
}
}
break;
case BM_TRANSPARENT:
/* Make the current colour a bit more black, so it looks like this image is transparent. */
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
_mm_storel_epi64((__m128i *) dst, DarkenTwoPixels(srcABCD, dstABCD, a_cm, tr_nom_base));
src += 2;
dst += 2;
anim += 2;
if (src[-2].a) anim[-2] = 0;
if (src[-1].a) anim[-1] = 0;
}
if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, a_cm, tr_nom_base));
if (src[0].a) anim[0] = 0;
}
break;
case BM_CRASH_REMAP:
for (uint x = (uint) bp->width; x > 0; x--) {
if (src_mv->m == 0) {
if (src->a != 0) {
uint8 g = MakeDark(src->r, src->g, src->b);
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
*anim = 0;
}
} else {
uint r = remap[src_mv->m];
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
}
src_mv++;
dst++;
src++;
anim++;
}
break;
}
next_line:
if (mode != BM_TRANSPARENT) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
anim_line += this->anim_buf_width;
}
}
IGNORE_UNINITIALIZED_WARNING_STOP
/**
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
*
* @param bp further blitting parameters
* @param mode blitter mode
* @param zoom zoom level at which we are drawing
*/
void Blitter_32bppSSE4_Anim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const Blitter_32bppSSE_Base::SpriteFlags sprite_flags = ((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags;
switch (mode) {
default: {
bm_normal:
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
const BlockType bt_last = (BlockType) (bp->width & 1);
if (bt_last == BT_EVEN) {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, true>(bp, zoom);
} else {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, true>(bp, zoom);
}
} else {
#ifdef _SQ64
if (sprite_flags & SF_TRANSLUCENT) {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
} else {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, true>(bp, zoom);
}
#else
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
#endif
}
break;
}
case BM_COLOUR_REMAP:
if (sprite_flags & SF_NO_REMAP) goto bm_normal;
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, false>(bp, zoom);
else Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, true>(bp, zoom);
} else {
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
else Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
}
break;
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
}
}
#endif /* WITH_SSE */

View File

@@ -1,53 +0,0 @@
/* $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 32bpp_sse4_anim.hpp A SSE4 32 bpp blitter with animation support. */
#ifndef BLITTER_32BPP_SSE4_ANIM_HPP
#define BLITTER_32BPP_SSE4_ANIM_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 4
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 1
#endif
#include "32bpp_anim.hpp"
#include "32bpp_sse4.hpp"
#undef MARGIN_NORMAL_THRESHOLD
#define MARGIN_NORMAL_THRESHOLD 4
/** The SSE4 32 bpp blitter with palette animation. */
class Blitter_32bppSSE4_Anim FINAL : public Blitter_32bppAnim, public Blitter_32bppSSE_Base {
private:
public:
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent, bool animated>
/* virtual */ void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
}
/* virtual */ const char *GetName() { return "32bpp-sse4-anim"; }
};
/** Factory for the SSE4 32 bpp blitter (with palette animation). */
class FBlitter_32bppSSE4_Anim: public BlitterFactory {
public:
FBlitter_32bppSSE4_Anim() : BlitterFactory("32bpp-sse4-anim", "SSE4 Blitter (palette animation)", HasCPUIDFlag(1, 2, 19)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4_Anim(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE4_ANIM_HPP */

View File

@@ -112,19 +112,6 @@ public:
return Colour(r * nom / denom, g * nom / denom, b * nom / denom);
}
/**
* Make a colour dark grey, for specialized 32bpp remapping.
* @param r red component
* @param g green component
* @param b blue component
* @return the brightness value of the new colour, now dark grey.
*/
static inline uint8 MakeDark(uint8 r, uint8 g, uint8 b)
{
/* Magic-numbers are ~66% of those used in MakeGrey() */
return ((r * 13063) + (g * 25647) + (b * 4981)) / 65536;
}
/**
* Make a colour grey - based.
* @param colour the colour to make grey.

View File

@@ -141,40 +141,6 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
}
break;
case BM_CRASH_REMAP:
if (src_px->a == 255) {
do {
uint m = *src_n;
if (m == 0) {
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
} else {
uint r = remap[GB(m, 0, 8)];
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
}
dst++;
src_px++;
src_n++;
} while (--n != 0);
} else {
do {
uint m = *src_n;
if (m == 0) {
if (src_px->a != 0) {
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
}
} else {
uint r = remap[GB(m, 0, 8)];
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
}
dst++;
src_px++;
src_n++;
} while (--n != 0);
}
break;
case BM_TRANSPARENT:
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
@@ -238,7 +204,6 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
}
}

View File

@@ -32,9 +32,10 @@ public:
};
/** Factory for the optimised 32 bpp blitter (without palette animation). */
class FBlitter_32bppOptimized : public BlitterFactory {
class FBlitter_32bppOptimized: public BlitterFactory<FBlitter_32bppOptimized> {
public:
FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
/* virtual */ const char *GetDescription() { return "32bpp Optimized Blitter (no palette animation)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppOptimized(); }
};

View File

@@ -45,17 +45,6 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
}
break;
case BM_CRASH_REMAP:
if (src->m == 0) {
if (src->a != 0) {
uint8 g = MakeDark(src->r, src->g, src->b);
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
}
} else {
if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->AdjustBrightness(this->LookupColourInPalette(bp->remap[src->m]), src->v), src->a, *dst);
}
break;
case BM_TRANSPARENT:
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
@@ -106,7 +95,7 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
Blitter_32bppSimple::Pixel *dst;
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite->height * (size_t)sprite->width * sizeof(*dst));
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(*dst));
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;

View File

@@ -34,9 +34,10 @@ public:
};
/** Factory for the simple 32 bpp blitter. */
class FBlitter_32bppSimple : public BlitterFactory {
class FBlitter_32bppSimple: public BlitterFactory<FBlitter_32bppSimple> {
public:
FBlitter_32bppSimple() : BlitterFactory("32bpp-simple", "32bpp Simple Blitter (no palette animation)") {}
/* virtual */ const char *GetName() { return "32bpp-simple"; }
/* virtual */ const char *GetDescription() { return "32bpp Simple Blitter (no palette animation)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
};

View File

@@ -1,141 +0,0 @@
/* $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 32bpp_sse2.cpp Implementation of the SSE2 32 bpp blitter. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "32bpp_sse2.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSE2 32bpp blitter factory. */
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
/* First uint32 of a line = the number of transparent pixels from the left.
* Second uint32 of a line = the number of transparent pixels from the right.
* Then all RGBA then all MV.
*/
ZoomLevel zoom_min = ZOOM_LVL_NORMAL;
ZoomLevel zoom_max = ZOOM_LVL_NORMAL;
if (sprite->type != ST_FONT) {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = _settings_client.gui.zoom_max;
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
}
/* Calculate sizes and allocate. */
SpriteData sd;
memset(&sd, 0, sizeof(sd));
uint all_sprites_size = 0;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_sprite = &sprite[z];
sd.infos[z].sprite_width = src_sprite->width;
sd.infos[z].sprite_offset = all_sprites_size;
sd.infos[z].sprite_line_size = sizeof(Colour) * src_sprite->width + sizeof(uint32) * META_LENGTH;
const uint rgba_size = sd.infos[z].sprite_line_size * src_sprite->height;
sd.infos[z].mv_offset = all_sprites_size + rgba_size;
const uint mv_size = sizeof(MapValue) * src_sprite->width * src_sprite->height;
all_sprites_size += rgba_size + mv_size;
}
Sprite *dst_sprite = (Sprite *) allocator(sizeof(Sprite) + sizeof(SpriteData) + all_sprites_size);
dst_sprite->height = sprite->height;
dst_sprite->width = sprite->width;
dst_sprite->x_offs = sprite->x_offs;
dst_sprite->y_offs = sprite->y_offs;
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
/* Copy colours and determine flags. */
bool has_remap = false;
bool has_anim = false;
bool has_translucency = false;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_sprite = &sprite[z];
const SpriteLoader::CommonPixel *src = (const SpriteLoader::CommonPixel *) src_sprite->data;
Colour *dst_rgba_line = (Colour *) &dst_sprite->data[sizeof(SpriteData) + sd.infos[z].sprite_offset];
MapValue *dst_mv = (MapValue *) &dst_sprite->data[sizeof(SpriteData) + sd.infos[z].mv_offset];
for (uint y = src_sprite->height; y != 0; y--) {
Colour *dst_rgba = dst_rgba_line + META_LENGTH;
for (uint x = src_sprite->width; x != 0; x--) {
if (src->a != 0) {
dst_rgba->a = src->a;
if (src->a != 0 && src->a != 255) has_translucency = true;
dst_mv->m = src->m;
if (src->m != 0) {
/* Do some accounting for flags. */
has_remap = true;
if (src->m >= PALETTE_ANIM_START) has_anim = true;
/* Get brightest value (or default brightness if it's a black pixel). */
const uint8 rgb_max = max(src->r, max(src->g, src->b));
dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max;
/* Pre-convert the mapping channel to a RGB value. */
const Colour colour = AdjustBrightneSSE(Blitter_32bppBase::LookupColourInPalette(src->m), dst_mv->v);
dst_rgba->r = colour.r;
dst_rgba->g = colour.g;
dst_rgba->b = colour.b;
} else {
dst_rgba->r = src->r;
dst_rgba->g = src->g;
dst_rgba->b = src->b;
dst_mv->v = Blitter_32bppBase::DEFAULT_BRIGHTNESS;
}
} else {
dst_rgba->data = 0;
*(uint16*) dst_mv = 0;
}
dst_rgba++;
dst_mv++;
src++;
}
/* Count the number of transparent pixels from the left. */
dst_rgba = dst_rgba_line + META_LENGTH;
uint32 nb_pix_transp = 0;
for (uint x = src_sprite->width; x != 0; x--) {
if (dst_rgba->a == 0) nb_pix_transp++;
else break;
dst_rgba++;
}
(*dst_rgba_line).data = nb_pix_transp;
Colour *nb_right = dst_rgba_line + 1;
dst_rgba_line = (Colour*) ((byte*) dst_rgba_line + sd.infos[z].sprite_line_size);
/* Count the number of transparent pixels from the right. */
dst_rgba = dst_rgba_line - 1;
nb_pix_transp = 0;
for (uint x = src_sprite->width; x != 0; x--) {
if (dst_rgba->a == 0) nb_pix_transp++;
else break;
dst_rgba--;
}
(*nb_right).data = nb_pix_transp;
}
}
/* Store sprite flags. */
sd.flags = SF_NONE;
if (has_translucency) sd.flags |= SF_TRANSLUCENT;
if (!has_remap) sd.flags |= SF_NO_REMAP;
if (!has_anim) sd.flags |= SF_NO_ANIM;
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
return dst_sprite;
}
#endif /* WITH_SSE */

View File

@@ -1,104 +0,0 @@
/* $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 32bpp_sse2.hpp SSE2 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE2_HPP
#define BLITTER_32BPP_SSE2_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 2
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 0
#endif
#include "32bpp_sse_type.h"
/** Base methods for 32bpp SSE blitters. */
class Blitter_32bppSSE_Base {
public:
virtual ~Blitter_32bppSSE_Base() {}
struct MapValue {
uint8 m;
uint8 v;
};
assert_compile(sizeof(MapValue) == 2);
/** Helper for creating specialised functions for specific optimisations. */
enum ReadMode {
RM_WITH_SKIP, ///< Use normal code for skipping empty pixels.
RM_WITH_MARGIN, ///< Use cached number of empty pixels at begin and end of line to reduce work.
RM_NONE, ///< No specialisation.
};
/** Helper for creating specialised functions for the case where the sprite width is odd or even. */
enum BlockType {
BT_EVEN, ///< An even number of pixels in the width; no need for a special case for the last pixel.
BT_ODD, ///< An odd number of pixels in the width; special case for the last pixel.
BT_NONE, ///< No specialisation for either case.
};
/** Helper for using specialised functions designed to prevent whenever it's possible things like:
* - IO (reading video buffer),
* - calculations (alpha blending),
* - heavy branching (remap lookups and animation buffer handling).
*/
enum SpriteFlags {
SF_NONE = 0,
SF_TRANSLUCENT = 1 << 1, ///< The sprite has at least 1 translucent pixel.
SF_NO_REMAP = 1 << 2, ///< The sprite has no remappable colour pixel.
SF_NO_ANIM = 1 << 3, ///< The sprite has no palette animated pixel.
};
/** Data stored about a (single) sprite. */
struct SpriteInfo {
uint32 sprite_offset; ///< The offset to the sprite data.
uint32 mv_offset; ///< The offset to the map value data.
uint16 sprite_line_size; ///< The size of a single line (pitch).
uint16 sprite_width; ///< The width of the sprite.
};
struct SpriteData {
SpriteFlags flags;
SpriteInfo infos[ZOOM_LVL_COUNT];
byte data[]; ///< Data, all zoomlevels.
};
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
};
DECLARE_ENUM_AS_BIT_SET(Blitter_32bppSSE_Base::SpriteFlags);
/** The SSE2 32 bpp blitter (without palette animation). */
class Blitter_32bppSSE2 : public Blitter_32bppSimple, public Blitter_32bppSSE_Base {
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
}
/* virtual */ const char *GetName() { return "32bpp-sse2"; }
};
/** Factory for the SSE2 32 bpp blitter (without palette animation). */
class FBlitter_32bppSSE2 : public BlitterFactory {
public:
FBlitter_32bppSSE2() : BlitterFactory("32bpp-sse2", "32bpp SSE2 Blitter (no palette animation)", HasCPUIDFlag(1, 3, 26)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE2(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE2_HPP */

View File

@@ -1,23 +0,0 @@
/* $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 32bpp_sse4.cpp Implementation of the SSE4 32 bpp blitter. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "32bpp_sse4.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
#endif /* WITH_SSE */

View File

@@ -1,44 +0,0 @@
/* $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 32bpp_sse4.hpp SSE4 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE4_HPP
#define BLITTER_32BPP_SSE4_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 4
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 0
#endif
#include "32bpp_ssse3.hpp"
/** The SSE4 32 bpp blitter (without palette animation). */
class Blitter_32bppSSE4 : public Blitter_32bppSSSE3 {
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ const char *GetName() { return "32bpp-sse4"; }
};
/** Factory for the SSE4 32 bpp blitter (without palette animation). */
class FBlitter_32bppSSE4: public BlitterFactory {
public:
FBlitter_32bppSSE4() : BlitterFactory("32bpp-sse4", "32bpp SSE4 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 19)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE4_HPP */

View File

@@ -1,455 +0,0 @@
/* $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 32bpp_sse_func.hpp Functions related to SSE 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE_FUNC_HPP
#define BLITTER_32BPP_SSE_FUNC_HPP
#ifdef WITH_SSE
static inline void InsertFirstUint32(const uint32 value, __m128i &into)
{
#if (SSE_VERSION >= 4)
into = _mm_insert_epi32(into, value, 0);
#else
into = _mm_insert_epi16(into, value, 0);
into = _mm_insert_epi16(into, value >> 16, 1);
#endif
}
static inline void InsertSecondUint32(const uint32 value, __m128i &into)
{
#if (SSE_VERSION >= 4)
into = _mm_insert_epi32(into, value, 1);
#else
into = _mm_insert_epi16(into, value, 2);
into = _mm_insert_epi16(into, value >> 16, 3);
#endif
}
static inline void LoadUint64(const uint64 value, __m128i &into)
{
#ifdef _SQ64
into = _mm_cvtsi64_si128(value);
#else
#if (SSE_VERSION >= 4)
into = _mm_cvtsi32_si128(value);
InsertSecondUint32(value >> 32, into);
#else
(*(um128i*) &into).m128i_u64[0] = value;
#endif
#endif
}
static inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
{
#if (SSE_VERSION == 2)
from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing
return _mm_packus_epi16(from, from); // PACKUSWB, pack 2 colours (with saturation)
#else
return _mm_shuffle_epi8(from, mask);
#endif
}
static inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
{
#if (SSE_VERSION == 2)
__m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1
return _mm_shufflehi_epi16(alphaAB, 0x3F); // PSHUFHW, put alpha2 in front of each rgb2
#else
return _mm_shuffle_epi8(from, mask);
#endif
}
static inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask)
{
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8 into uint16
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
__m128i alphaAB = _mm_cmpgt_epi16(srcAB, _mm_setzero_si128()); // PCMPGTW, if (alpha > 0) a++;
alphaAB = _mm_srli_epi16(alphaAB, 15);
alphaAB = _mm_add_epi16(alphaAB, srcAB);
alphaAB = DistributeAlpha(alphaAB, distribution_mask);
srcAB = _mm_sub_epi16(srcAB, dstAB); // PSUBW, (r - Cr)
srcAB = _mm_mullo_epi16(srcAB, alphaAB); // PMULLW, a*(r - Cr)
srcAB = _mm_srli_epi16(srcAB, 8); // PSRLW, a*(r - Cr)/256
srcAB = _mm_add_epi16(srcAB, dstAB); // PADDW, a*(r - Cr)/256 + Cr
return PackUnsaturated(srcAB, pack_mask);
}
/* Darken 2 pixels.
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
*/
static inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
{
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
__m128i alphaAB = DistributeAlpha(srcAB, distribution_mask);
alphaAB = _mm_srli_epi16(alphaAB, 2); // Reduce to 64 levels of shades so the max value fits in 16 bits.
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
dstAB = _mm_mullo_epi16(dstAB, nom);
dstAB = _mm_srli_epi16(dstAB, 8);
return _mm_packus_epi16(dstAB, dstAB);
}
IGNORE_UNINITIALIZED_WARNING_START
static Colour ReallyAdjustBrightness(Colour colour, uint8 brightness)
{
uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
c16 *= brightness;
uint64 c16_ob = c16; // Helps out of order execution.
c16 /= Blitter_32bppBase::DEFAULT_BRIGHTNESS;
c16 &= 0x01FF01FF01FFULL;
/* Sum overbright (maximum for each rgb is 508, 9 bits, -255 is changed in -256 so we just have to take the 8 lower bits into account). */
c16_ob = (((c16_ob >> (8 + 7)) & 0x0100010001ULL) * 0xFF) & c16;
const uint ob = ((uint16) c16_ob + (uint16) (c16_ob >> 16) + (uint16) (c16_ob >> 32)) / 2;
const uint32 alpha32 = colour.data & 0xFF000000;
__m128i ret;
LoadUint64(c16, ret);
if (ob != 0) {
__m128i ob128 = _mm_cvtsi32_si128(ob);
ob128 = _mm_shufflelo_epi16(ob128, 0xC0);
__m128i white = OVERBRIGHT_VALUE_MASK;
__m128i c128 = ret;
ret = _mm_subs_epu16(white, c128); // PSUBUSW, (255 - rgb)
ret = _mm_mullo_epi16(ret, ob128); // PMULLW, ob*(255 - rgb)
ret = _mm_srli_epi16(ret, 8); // PSRLW, ob*(255 - rgb)/256
ret = _mm_add_epi16(ret, c128); // PADDW, ob*(255 - rgb)/256 + rgb
}
ret = _mm_packus_epi16(ret, ret); // PACKUSWB, saturate and pack.
return alpha32 | _mm_cvtsi128_si32(ret);
}
IGNORE_UNINITIALIZED_WARNING_STOP
/** ReallyAdjustBrightness() is not called that often.
* Inlining this function implies a far jump, which has a huge latency.
*/
static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
{
/* Shortcut for normal brightness. */
if (brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS) return colour;
return ReallyAdjustBrightness(colour, brightness);
}
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32 brightness)
{
#if (SSE_VERSION < 3)
NOT_REACHED();
#else
/* The following dataflow differs from the one of AdjustBrightness() only for alpha.
* In order to keep alpha in colAB, insert a 1 in a unused brightness byte (a*1->a).
* OK, not a 1 but DEFAULT_BRIGHTNESS to compensate the div.
*/
brightness &= 0xFF00FF00;
brightness += Blitter_32bppBase::DEFAULT_BRIGHTNESS;
__m128i colAB = _mm_unpacklo_epi8(from, _mm_setzero_si128());
__m128i briAB = _mm_cvtsi32_si128(brightness);
briAB = _mm_shuffle_epi8(briAB, BRIGHTNESS_LOW_CONTROL_MASK); // DEFAULT_BRIGHTNESS in 0, 0x00 in 2.
colAB = _mm_mullo_epi16(colAB, briAB);
__m128i colAB_ob = _mm_srli_epi16(colAB, 8+7);
colAB = _mm_srli_epi16(colAB, 7);
/* Sum overbright.
* Maximum for each rgb is 508 => 9 bits. The highest bit tells if there is overbright.
* -255 is changed in -256 so we just have to take the 8 lower bits into account.
*/
colAB = _mm_and_si128(colAB, BRIGHTNESS_DIV_CLEANER);
colAB_ob = _mm_and_si128(colAB_ob, OVERBRIGHT_PRESENCE_MASK);
colAB_ob = _mm_mullo_epi16(colAB_ob, OVERBRIGHT_VALUE_MASK);
colAB_ob = _mm_and_si128(colAB_ob, colAB);
__m128i obAB = _mm_hadd_epi16(_mm_hadd_epi16(colAB_ob, _mm_setzero_si128()), _mm_setzero_si128());
obAB = _mm_srli_epi16(obAB, 1); // Reduce overbright strength.
obAB = _mm_shuffle_epi8(obAB, OVERBRIGHT_CONTROL_MASK);
__m128i retAB = OVERBRIGHT_VALUE_MASK; // ob_mask is equal to white.
retAB = _mm_subs_epu16(retAB, colAB); // (255 - rgb)
retAB = _mm_mullo_epi16(retAB, obAB); // ob*(255 - rgb)
retAB = _mm_srli_epi16(retAB, 8); // ob*(255 - rgb)/256
retAB = _mm_add_epi16(retAB, colAB); // ob*(255 - rgb)/256 + rgb
return _mm_packus_epi16(retAB, retAB);
#endif
}
#if FULL_ANIMATION == 0
/**
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
*
* @tparam mode blitter mode
* @param bp further blitting parameters
* @param zoom zoom level at which we are drawing
*/
IGNORE_UNINITIALIZED_WARNING_START
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent>
#if (SSE_VERSION == 2)
inline void Blitter_32bppSSE2::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#elif (SSE_VERSION == 3)
inline void Blitter_32bppSSSE3::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#elif (SSE_VERSION == 4)
inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#endif
{
const byte * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
int effective_width = bp->width;
/* Find where to start reading in the source sprite. */
const SpriteData * const sd = (const SpriteData *) bp->sprite;
const SpriteInfo * const si = &sd->infos[zoom];
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
if (read_mode != RM_WITH_MARGIN) {
src_rgba_line += bp->skip_left;
src_mv_line += bp->skip_left;
}
const MapValue *src_mv = src_mv_line;
/* Load these variables into register before loop. */
#if (SSE_VERSION == 2)
const __m128i clear_hi = CLEAR_HIGH_BYTE_MASK;
#define ALPHA_BLEND_PARAM_1 clear_hi
#define ALPHA_BLEND_PARAM_2 clear_hi
#define DARKEN_PARAM_1 tr_nom_base
#define DARKEN_PARAM_2 tr_nom_base
#else
const __m128i a_cm = ALPHA_CONTROL_MASK;
const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK;
#define ALPHA_BLEND_PARAM_1 a_cm
#define ALPHA_BLEND_PARAM_2 pack_low_cm
#define DARKEN_PARAM_1 a_cm
#define DARKEN_PARAM_2 tr_nom_base
#endif
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
for (int y = bp->height; y != 0; y--) {
Colour *dst = dst_line;
const Colour *src = src_rgba_line + META_LENGTH;
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv = src_mv_line;
if (read_mode == RM_WITH_MARGIN) {
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
src += src_rgba_line[0].data;
dst += src_rgba_line[0].data;
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv += src_rgba_line[0].data;
const int width_diff = si->sprite_width - bp->width;
effective_width = bp->width - (int) src_rgba_line[0].data;
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
const int new_width = effective_width - delta_diff;
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) goto next_line;
}
switch (mode) {
default:
if (!translucent) {
for (uint x = (uint) effective_width; x > 0; x--) {
if (src->a) *dst = *src;
src++;
dst++;
}
break;
}
for (uint x = (uint) effective_width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
_mm_storel_epi64((__m128i*) dst, AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
src += 2;
dst += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
dst->data = _mm_cvtsi128_si32(AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
}
break;
case BM_COLOUR_REMAP:
#if (SSE_VERSION >= 3)
for (uint x = (uint) effective_width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
/* Remap colours. */
if (mvX2 & 0x00FF00FF) {
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
/* Written so the compiler uses CMOV. */ \
Colour m_colour = m_colour_init; \
{ \
const Colour srcm = (Colour) (m_src); \
const uint m = (byte) (m_m); \
const uint r = remap[m]; \
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
m_colour = r == 0 ? m_colour : cmap; \
m_colour = m != 0 ? m_colour : srcm; \
}
#ifdef _SQ64
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
uint64 remapped_src = 0;
CMOV_REMAP(c0, 0, srcs, mvX2);
remapped_src = c0.data;
CMOV_REMAP(c1, 0, srcs >> 32, mvX2 >> 16);
remapped_src |= (uint64) c1.data << 32;
srcABCD = _mm_cvtsi64_si128(remapped_src);
#else
Colour remapped_src[2];
CMOV_REMAP(c0, 0, _mm_cvtsi128_si32(srcABCD), mvX2);
remapped_src[0] = c0.data;
CMOV_REMAP(c1, 0, src[1], mvX2 >> 16);
remapped_src[1] = c1.data;
srcABCD = _mm_loadl_epi64((__m128i*) &remapped_src);
#endif
if ((mvX2 & 0xFF00FF00) != 0x80008000) srcABCD = AdjustBrightnessOfTwoPixels(srcABCD, mvX2);
}
/* Blend colours. */
_mm_storel_epi64((__m128i *) dst, AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
dst += 2;
src += 2;
src_mv += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
#else
for (uint x = (uint) effective_width; x > 0; x--) {
#endif
/* In case the m-channel is zero, do not remap this pixel in any way. */
__m128i srcABCD;
if (src_mv->m) {
const uint r = remap[src_mv->m];
if (r != 0) {
Colour remapped_colour = AdjustBrightneSSE(this->LookupColourInPalette(r), src_mv->v);
if (src->a == 255) {
*dst = remapped_colour;
} else {
remapped_colour.a = src->a;
srcABCD = _mm_cvtsi32_si128(remapped_colour.data);
goto bmcr_alpha_blend_single;
}
}
} else {
srcABCD = _mm_cvtsi32_si128(src->data);
if (src->a < 255) {
bmcr_alpha_blend_single:
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2);
}
dst->data = _mm_cvtsi128_si32(srcABCD);
}
#if (SSE_VERSION == 2)
src_mv++;
dst++;
src++;
#endif
}
break;
case BM_TRANSPARENT:
/* Make the current colour a bit more black, so it looks like this image is transparent. */
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
_mm_storel_epi64((__m128i *) dst, DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
src += 2;
dst += 2;
}
if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
}
break;
case BM_CRASH_REMAP:
for (uint x = (uint) bp->width; x > 0; x--) {
if (src_mv->m == 0) {
if (src->a != 0) {
uint8 g = MakeDark(src->r, src->g, src->b);
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
}
} else {
uint r = remap[src_mv->m];
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
}
src_mv++;
dst++;
src++;
}
break;
}
next_line:
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
}
}
IGNORE_UNINITIALIZED_WARNING_STOP
/**
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
*
* @param bp further blitting parameters
* @param mode blitter mode
* @param zoom zoom level at which we are drawing
*/
#if (SSE_VERSION == 2)
void Blitter_32bppSSE2::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
#elif (SSE_VERSION == 3)
void Blitter_32bppSSSE3::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
#elif (SSE_VERSION == 4)
void Blitter_32bppSSE4::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
#endif
{
switch (mode) {
default: {
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
bm_normal:
const BlockType bt_last = (BlockType) (bp->width & 1);
switch (bt_last) {
default: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true>(bp, zoom); return;
}
} else {
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_TRANSLUCENT) {
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom);
} else {
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false>(bp, zoom);
}
return;
}
break;
}
case BM_COLOUR_REMAP:
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_NO_REMAP) goto bm_normal;
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true>(bp, zoom); return;
} else {
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom); return;
}
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true>(bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
}
}
#endif /* FULL_ANIMATION */
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE_FUNC_HPP */

View File

@@ -1,56 +0,0 @@
/* $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 32bpp_sse_type.hpp Types related to SSE 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE_TYPE_HPP
#define BLITTER_32BPP_SSE_TYPE_HPP
#ifdef WITH_SSE
#include "32bpp_simple.hpp"
#if (SSE_VERSION == 2)
#include <emmintrin.h>
#elif (SSE_VERSION == 3)
#include <tmmintrin.h>
#elif (SSE_VERSION == 4)
#include <smmintrin.h>
#endif
#define META_LENGTH 2 ///< Number of uint32 inserted before each line of pixels in a sprite.
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_32X ? 8 : 4) ///< Minimum width to use margins with BM_NORMAL.
#define MARGIN_REMAP_THRESHOLD 4 ///< Minimum width to use margins with BM_COLOUR_REMAP.
#ifdef _MSC_VER
#define ALIGN(n) __declspec(align(n))
#else
#define ALIGN(n) __attribute__ ((aligned (n)))
#endif
typedef union ALIGN(16) um128i {
__m128i m128i;
uint8 m128i_u8[16];
uint16 m128i_u16[8];
uint32 m128i_u32[4];
uint64 m128i_u64[2];
} um128i;
#define CLEAR_HIGH_BYTE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0)
#define ALPHA_CONTROL_MASK _mm_setr_epi8( 6, 7, 6, 7, 6, 7, -1, -1, 14, 15, 14, 15, 14, 15, -1, -1)
#define PACK_LOW_CONTROL_MASK _mm_setr_epi8( 0, 2, 4, -1, 8, 10, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1)
#define PACK_HIGH_CONTROL_MASK _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 0, 2, 4, -1, 8, 10, 12, -1)
#define BRIGHTNESS_LOW_CONTROL_MASK _mm_setr_epi8( 1, 2, 1, 2, 1, 2, 0, 2, 3, 2, 3, 2, 3, 2, 0, 2)
#define BRIGHTNESS_DIV_CLEANER _mm_setr_epi8(-1, 1, -1, 1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, -1, 0)
#define OVERBRIGHT_PRESENCE_MASK _mm_setr_epi8( 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0)
#define OVERBRIGHT_VALUE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, 0, 0)
#define OVERBRIGHT_CONTROL_MASK _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 7, 7, 2, 3, 2, 3, 2, 3, 7, 7)
#define TRANSPARENT_NOM_BASE _mm_setr_epi16(256, 256, 256, 256, 256, 256, 256, 256)
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE_TYPE_HPP */

View File

@@ -1,23 +0,0 @@
/* $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 32bpp_ssse3.cpp Implementation of the SSSE3 32 bpp blitter. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "32bpp_ssse3.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSSE3 32bpp blitter factory. */
static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3;
#endif /* WITH_SSE */

View File

@@ -1,44 +0,0 @@
/* $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 32bpp_ssse3.hpp SSSE3 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSSE3_HPP
#define BLITTER_32BPP_SSSE3_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 3
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 0
#endif
#include "32bpp_sse2.hpp"
/** The SSSE3 32 bpp blitter (without palette animation). */
class Blitter_32bppSSSE3 : public Blitter_32bppSSE2 {
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ const char *GetName() { return "32bpp-ssse3"; }
};
/** Factory for the SSSE3 32 bpp blitter (without palette animation). */
class FBlitter_32bppSSSE3: public BlitterFactory {
public:
FBlitter_32bppSSSE3() : BlitterFactory("32bpp-ssse3", "32bpp SSSE3 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 9)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSSE3(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSSE3_HPP */

View File

@@ -83,8 +83,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
width -= pixels;
switch (mode) {
case BM_COLOUR_REMAP:
case BM_CRASH_REMAP: {
case BM_COLOUR_REMAP: {
const uint8 *remap = bp->remap;
do {
uint m = remap[*src];

View File

@@ -31,9 +31,10 @@ public:
};
/** Factory for the 8bpp blitter optimised for speed. */
class FBlitter_8bppOptimized : public BlitterFactory {
class FBlitter_8bppOptimized: public BlitterFactory<FBlitter_8bppOptimized> {
public:
FBlitter_8bppOptimized() : BlitterFactory("8bpp-optimized", "8bpp Optimized Blitter (compression + all-ZoomLevel cache)") {}
/* virtual */ const char *GetName() { return "8bpp-optimized"; }
/* virtual */ const char *GetDescription() { return "8bpp Optimized Blitter (compression + all-ZoomLevel cache)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppOptimized(); }
};

View File

@@ -37,7 +37,6 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
switch (mode) {
case BM_COLOUR_REMAP:
case BM_CRASH_REMAP:
colour = bp->remap[*src];
break;
@@ -59,7 +58,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
Sprite *Blitter_8bppSimple::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
Sprite *dest_sprite;
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite->height * (size_t)sprite->width);
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;

View File

@@ -25,9 +25,10 @@ public:
};
/** Factory for the most trivial 8bpp blitter. */
class FBlitter_8bppSimple : public BlitterFactory {
class FBlitter_8bppSimple: public BlitterFactory<FBlitter_8bppSimple> {
public:
FBlitter_8bppSimple() : BlitterFactory("8bpp-simple", "8bpp Simple Blitter (relative slow, but never wrong)") {}
/* virtual */ const char *GetName() { return "8bpp-simple"; }
/* virtual */ const char *GetDescription() { return "8bpp Simple Blitter (relative slow, but never wrong)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppSimple(); }
};

View File

@@ -13,7 +13,7 @@
#include "base.hpp"
#include "../core/math_func.hpp"
void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width)
{
int dy;
int dx;
@@ -59,9 +59,6 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
}
}
int gap = dash;
if (dash == 0) dash = 1;
int dash_count = 0;
if (dx > dy) {
int y_low = y;
int y_high = y;
@@ -79,7 +76,7 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
x2 += stepx;
while (x != x2) {
if (dash_count < dash && x >= 0 && x < screen_width) {
if (x >= 0 && x < screen_width) {
for (int y = y_low; y != y_high; y += stepy) {
if (y >= 0 && y < screen_height) this->SetPixel(video, x, y, colour);
}
@@ -95,7 +92,6 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
x += stepx;
frac_low += dy;
frac_high += dy;
if (++dash_count >= dash + gap) dash_count = 0;
}
} else {
int x_low = x;
@@ -114,7 +110,7 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
y2 += stepy;
while (y != y2) {
if (dash_count < dash && y >= 0 && y < screen_height) {
if (y >= 0 && y < screen_height) {
for (int x = x_low; x != x_high; x += stepx) {
if (x >= 0 && x < screen_width) this->SetPixel(video, x, y, colour);
}
@@ -130,7 +126,6 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
y += stepy;
frac_low += dx;
frac_high += dx;
if (++dash_count >= dash + gap) dash_count = 0;
}
}
}

View File

@@ -20,7 +20,6 @@ enum BlitterMode {
BM_NORMAL, ///< Perform the simple blitting.
BM_COLOUR_REMAP, ///< Perform a colour remapping.
BM_TRANSPARENT, ///< Perform transparency colour remapping.
BM_CRASH_REMAP, ///< Perform a crash remapping.
};
/**
@@ -119,9 +118,8 @@ public:
* @param screen_height The height of the screen you are drawing in (to avoid buffer-overflows).
* @param colour A 8bpp mapping colour.
* @param width Line width.
* @param dash Length of dashes for dashed lines. 0 means solid line.
*/
virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash = 0);
virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width);
/**
* Copy from a buffer to the screen.

View File

@@ -25,12 +25,11 @@ bool QZ_CanDisplay8bpp();
/**
* The base factory, keeping track of all blitters.
*/
class BlitterFactory {
class BlitterFactoryBase {
private:
const char *name; ///< The name of the blitter factory.
const char *description; ///< The description of the blitter.
const char *name; ///< The name of the blitter factory.
typedef std::map<const char *, BlitterFactory *, StringCompare> Blitters; ///< Map of blitter factories.
typedef std::map<const char *, BlitterFactoryBase *, StringCompare> Blitters; ///< Map of blitter factories.
/**
* Get the map with currently known blitters.
@@ -54,38 +53,32 @@ private:
protected:
/**
* Construct the blitter, and register it.
* @param name The name of the blitter.
* @param description A longer description for the blitter.
* @param usable Whether the blitter is usable (on the current computer). For example for disabling SSE blitters when the CPU can't handle them.
* @pre name != NULL.
* @pre description != NULL.
* @pre There is no blitter registered with this name.
* Register a blitter internally, based on his name.
* @param name the name of the blitter.
* @note an assert() will be trigger if 2 blitters with the same name try to register.
*/
BlitterFactory(const char *name, const char *description, bool usable = true) :
name(strdup(name)), description(strdup(description))
void RegisterBlitter(const char *name)
{
if (usable) {
/*
* Only add when the blitter is usable. Do not bail out or
* do more special things since the blitters are always
* instantiated upon start anyhow and freed upon shutdown.
*/
std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(this->name, this));
assert(P.second);
} else {
DEBUG(driver, 1, "Not registering blitter %s as it is not usable", name);
}
/* Don't register nameless Blitters */
if (name == NULL) return;
this->name = strdup(name);
std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(name, this));
assert(P.second);
}
public:
virtual ~BlitterFactory()
BlitterFactoryBase() :
name(NULL)
{}
virtual ~BlitterFactoryBase()
{
if (this->name == NULL) return;
GetBlitters().erase(this->name);
if (GetBlitters().empty()) delete &GetBlitters();
free(this->name);
free(this->description);
}
/**
@@ -94,24 +87,6 @@ public:
* @post Sets the blitter so GetCurrentBlitter() returns it too.
*/
static Blitter *SelectBlitter(const char *name)
{
BlitterFactory *b = GetBlitterFactory(name);
if (b == NULL) return NULL;
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
*GetActiveBlitter() = newb;
DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", newb->GetName());
return newb;
}
/**
* Get the blitter factory with the given name.
* @param name the blitter factory to select.
* @return The blitter factory, or NULL when there isn't one with the wanted name.
*/
static BlitterFactory *GetBlitterFactory(const char *name)
{
#if defined(DEDICATED)
const char *default_blitter = "null";
@@ -133,9 +108,14 @@ public:
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
BlitterFactoryBase *b = (*it).second;
if (strcasecmp(bname, b->name) == 0) {
return b;
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
*GetActiveBlitter() = newb;
DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", bname);
return newb;
}
}
return NULL;
@@ -160,7 +140,7 @@ public:
p += seprintf(p, last, "List of blitters:\n");
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
BlitterFactoryBase *b = (*it).second;
p += seprintf(p, last, "%18s: %s\n", b->name, b->GetDescription());
}
p += seprintf(p, last, "\n");
@@ -168,21 +148,10 @@ public:
return p;
}
/**
* Get the long, human readable, name for the Blitter-class.
*/
const char *GetName() const
{
return this->name;
}
/**
* Get a nice description of the blitter-class.
*/
const char *GetDescription() const
{
return this->description;
}
virtual const char *GetDescription() = 0;
/**
* Create an instance of this Blitter-class.
@@ -190,6 +159,20 @@ public:
virtual Blitter *CreateInstance() = 0;
};
/**
* A template factory, so ->GetName() works correctly. This because else some compiler will complain.
*/
template <class T>
class BlitterFactory: public BlitterFactoryBase {
public:
BlitterFactory() { this->RegisterBlitter(((T *)this)->GetName()); }
/**
* Get the long, human readable, name for the Blitter-class.
*/
const char *GetName();
};
extern char *_ini_blitter;
extern bool _blitter_autodetected;

View File

@@ -24,7 +24,7 @@ public:
/* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; };
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) {};
/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width) {};
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height) {};
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height) {};
/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) {};
@@ -38,9 +38,10 @@ public:
};
/** Factory for the blitter that does nothing. */
class FBlitter_Null : public BlitterFactory {
class FBlitter_Null: public BlitterFactory<FBlitter_Null> {
public:
FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
/* virtual */ const char *GetName() { return "null"; }
/* virtual */ const char *GetDescription() { return "Null Blitter (does nothing)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_Null(); }
};

View File

@@ -25,24 +25,18 @@ void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file)
static inline void AdvanceBuffer(BmpBuffer *buffer)
{
if (buffer->read < 0) return;
buffer->read = (int)fread(buffer->data, 1, BMP_BUFFER_SIZE, buffer->file);
buffer->pos = 0;
}
static inline bool EndOfBuffer(BmpBuffer *buffer)
{
if (buffer->read < 0) return false;
if (buffer->pos == buffer->read || buffer->pos < 0) AdvanceBuffer(buffer);
return buffer->pos == buffer->read;
}
static inline byte ReadByte(BmpBuffer *buffer)
{
if (buffer->read < 0) return 0;
if (buffer->pos == buffer->read || buffer->pos < 0) AdvanceBuffer(buffer);
buffer->real_pos++;
return buffer->data[buffer->pos++];
@@ -68,9 +62,7 @@ static inline void SkipBytes(BmpBuffer *buffer, int bytes)
static inline void SetStreamOffset(BmpBuffer *buffer, int offset)
{
if (fseek(buffer->file, offset, SEEK_SET) < 0) {
buffer->read = -1;
}
fseek(buffer->file, offset, SEEK_SET);
buffer->pos = -1;
buffer->real_pos = offset;
AdvanceBuffer(buffer);

View File

@@ -37,8 +37,8 @@ static const struct NWidgetPart _background_widgets[] = {
/**
* Window description for the background window to prevent smearing.
*/
static WindowDesc _background_desc(
WDP_MANUAL, NULL, 0, 0,
static const WindowDesc _background_desc(
WDP_MANUAL, 0, 0,
WC_BOOTSTRAP, WC_NONE,
0,
_background_widgets, lengthof(_background_widgets)
@@ -47,9 +47,9 @@ static WindowDesc _background_desc(
/** The background for the game. */
class BootstrapBackground : public Window {
public:
BootstrapBackground() : Window(&_background_desc)
BootstrapBackground() : Window()
{
this->InitNested(0);
this->InitNested(&_background_desc, 0);
CLRBITS(this->flags, WF_WHITE_BORDER);
ResizeWindow(this, _screen.width, _screen.height);
}
@@ -70,8 +70,8 @@ static const NWidgetPart _nested_boostrap_download_status_window_widgets[] = {
};
/** Window description for the download window */
static WindowDesc _bootstrap_download_status_window_desc(
WDP_CENTER, NULL, 0, 0,
static const WindowDesc _bootstrap_download_status_window_desc(
WDP_CENTER, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL,
_nested_boostrap_download_status_window_widgets, lengthof(_nested_boostrap_download_status_window_widgets)
@@ -115,8 +115,8 @@ static const NWidgetPart _bootstrap_query_widgets[] = {
};
/** The window description for the query. */
static WindowDesc _bootstrap_query_desc(
WDP_CENTER, NULL, 0, 0,
static const WindowDesc _bootstrap_query_desc(
WDP_CENTER, 0, 0,
WC_CONFIRM_POPUP_QUERY, WC_NONE,
0,
_bootstrap_query_widgets, lengthof(_bootstrap_query_widgets)
@@ -128,9 +128,9 @@ class BootstrapAskForDownloadWindow : public Window, ContentCallback {
public:
/** Start listening to the content client events. */
BootstrapAskForDownloadWindow() : Window(&_bootstrap_query_desc)
BootstrapAskForDownloadWindow() : Window()
{
this->InitNested(WN_CONFIRM_POPUP_QUERY_BOOTSTRAP);
this->InitNested(&_bootstrap_query_desc, WN_CONFIRM_POPUP_QUERY_BOOTSTRAP);
_network_content_client.AddCallback(this);
}
@@ -215,7 +215,7 @@ bool HandleBootstrap()
if (BaseGraphics::GetUsedSet() != NULL) return true;
/* No user interface, bail out with an error. */
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
/* If there is no network or no freetype, then there is nothing we can do. Go straight to failure. */
#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(WIN32) || defined(__APPLE__))
@@ -244,7 +244,7 @@ bool HandleBootstrap()
new BootstrapAskForDownloadWindow();
/* Process the user events. */
VideoDriver::GetInstance()->MainLoop();
_video_driver->MainLoop();
/* _exit_game is used to get out of the video driver's main loop.
* In case GM_BOOTSTRAP is still set we did not exit it via the

View File

@@ -76,6 +76,7 @@ void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uin
class BuildBridgeWindow : public Window {
private:
/* Runtime saved values */
static uint16 last_size; ///< Last size of the bridge GUI window.
static Listing last_sorting; ///< Last setting of the sort.
/* Constants for sorting the bridges */
@@ -133,17 +134,17 @@ private:
}
public:
BuildBridgeWindow(WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) : Window(desc),
BuildBridgeWindow(const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) : Window(),
start_tile(start),
end_tile(end),
type(br_type),
bridges(bl)
{
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_BBS_SCROLLBAR);
/* Change the data, or the caption of the gui. Set it to road or rail, accordingly. */
this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->widget_data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION;
this->FinishInitNested(GB(br_type, 15, 2)); // Initializes 'this->bridgetext_offset'.
this->FinishInitNested(desc, GB(br_type, 15, 2)); // Initializes 'this->bridgetext_offset'.
this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2));
this->bridges->SetListing(this->last_sorting);
@@ -152,6 +153,13 @@ public:
this->SortBridgeList();
this->vscroll->SetCount(bl->Length());
if (this->last_size < this->vscroll->GetCapacity()) this->last_size = this->vscroll->GetCapacity();
if (this->last_size > this->vscroll->GetCount()) this->last_size = this->vscroll->GetCount();
/* Resize the bridge selection window if we used a bigger one the last time. */
if (this->last_size > this->vscroll->GetCapacity()) {
ResizeWindow(this, 0, (this->last_size - this->vscroll->GetCapacity()) * this->resize.step_height);
}
this->GetWidget<NWidgetCore>(WID_BBS_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
~BuildBridgeWindow()
@@ -205,7 +213,7 @@ public:
}
}
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
{
/* Position the window so hopefully the first bridge from the list is under the mouse pointer. */
NWidgetBase *list = this->GetWidget<NWidgetBase>(WID_BBS_BRIDGE_LIST);
@@ -289,9 +297,14 @@ public:
virtual void OnResize()
{
this->vscroll->SetCapacityFromWidget(this, WID_BBS_BRIDGE_LIST);
this->GetWidget<NWidgetCore>(WID_BBS_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
this->last_size = max(this->vscroll->GetCapacity(), this->last_size);
}
};
/** Set the default size of the Build Bridge Window. */
uint16 BuildBridgeWindow::last_size = 4;
/** Set the default sorting for the bridges */
Listing BuildBridgeWindow::last_sorting = {true, 2};
@@ -316,7 +329,6 @@ static const NWidgetPart _nested_build_bridge_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BBS_CAPTION), SetDataTip(STR_SELECT_RAIL_BRIDGE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@@ -327,7 +339,7 @@ static const NWidgetPart _nested_build_bridge_widgets[] = {
NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, WID_BBS_DROPDOWN_CRITERIA), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
EndContainer(),
/* Matrix. */
NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, WID_BBS_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetMatrixDataTip(1, 0, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(WID_BBS_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, WID_BBS_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(WID_BBS_SCROLLBAR),
EndContainer(),
/* scrollbar + resize button */
@@ -339,8 +351,8 @@ static const NWidgetPart _nested_build_bridge_widgets[] = {
};
/** Window definition for the rail bridge selection window. */
static WindowDesc _build_bridge_desc(
WDP_AUTO, "build_bridge", 200, 114,
static const WindowDesc _build_bridge_desc(
WDP_AUTO, 200, 114,
WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR,
WDF_CONSTRUCTION,
_nested_build_bridge_widgets, lengthof(_nested_build_bridge_widgets)

View File

@@ -52,7 +52,6 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = {
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_BV_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
@@ -69,7 +68,7 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = {
EndContainer(),
/* Vehicle list. */
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_BV_LIST), SetResize(1, 1), SetFill(1, 0), SetMatrixDataTip(1, 0, STR_NULL), SetScrollbar(WID_BV_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_BV_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL), SetScrollbar(WID_BV_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_BV_SCROLLBAR),
EndContainer(),
/* Panel with details. */
@@ -772,14 +771,13 @@ static uint ShowAdditionalText(int left, int right, int y, EngineID engine)
{
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL);
if (callback == CALLBACK_FAILED || callback == 0x400) return y;
const GRFFile *grffile = Engine::Get(engine)->GetGRF();
if (callback > 0x400) {
ErrorUnknownCallbackResult(grffile->grfid, CBID_VEHICLE_ADDITIONAL_TEXT, callback);
ErrorUnknownCallbackResult(Engine::Get(engine)->GetGRFID(), CBID_VEHICLE_ADDITIONAL_TEXT, callback);
return y;
}
StartTextRefStackUsage(grffile, 6);
uint result = DrawStringMultiLine(left, right, y, INT32_MAX, GetGRFStringID(grffile->grfid, 0xD000 + callback), TC_BLACK);
StartTextRefStackUsage(6);
uint result = DrawStringMultiLine(left, right, y, INT32_MAX, GetGRFStringID(Engine::Get(engine)->GetGRFID(), 0xD000 + callback), TC_BLACK);
StopTextRefStackUsage();
return result;
}
@@ -941,7 +939,7 @@ struct BuildVehicleWindow : Window {
int details_height; ///< Minimal needed height of the details panels (found so far).
Scrollbar *vscroll;
BuildVehicleWindow(WindowDesc *desc, TileIndex tile, VehicleType type) : Window(desc)
BuildVehicleWindow(const WindowDesc *desc, TileIndex tile, VehicleType type) : Window()
{
this->vehicle_type = type;
this->window_number = tile == INVALID_TILE ? (int)type : tile;
@@ -965,7 +963,7 @@ struct BuildVehicleWindow : Window {
this->listview_mode = (this->window_number <= VEH_END);
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_BV_SCROLLBAR);
@@ -989,7 +987,7 @@ struct BuildVehicleWindow : Window {
this->details_height = ((this->vehicle_type == VEH_TRAIN) ? 10 : 9) * FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
this->FinishInitNested(tile == INVALID_TILE ? (int)type : tile);
this->FinishInitNested(desc, tile == INVALID_TILE ? (int)type : tile);
this->owner = (tile != INVALID_TILE) ? GetTileOwner(tile) : _local_company;
@@ -1406,11 +1404,12 @@ struct BuildVehicleWindow : Window {
virtual void OnResize()
{
this->vscroll->SetCapacityFromWidget(this, WID_BV_LIST);
this->GetWidget<NWidgetCore>(WID_BV_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
};
static WindowDesc _build_vehicle_desc(
WDP_AUTO, "build_vehicle", 240, 268,
static const WindowDesc _build_vehicle_desc(
WDP_AUTO, 240, 268,
WC_BUILD_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_build_vehicle_widgets, lengthof(_nested_build_vehicle_widgets)

View File

@@ -1,238 +0,0 @@
/* $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 cargoaction.cpp Implementation of cargo actions. */
#include "stdafx.h"
#include "economy_base.h"
#include "cargoaction.h"
#include "station_base.h"
/**
* Decides if a packet needs to be split.
* @param cp Packet to be either split or moved in one piece.
* @return Either new packet if splitting was necessary or the given one
* otherwise.
*/
template<class Tsource, class Tdest>
CargoPacket *CargoMovement<Tsource, Tdest>::Preprocess(CargoPacket *cp)
{
if (this->max_move < cp->Count()) {
cp = cp->Split(this->max_move);
this->max_move = 0;
} else {
this->max_move -= cp->Count();
}
return cp;
}
/**
* Determines the amount of cargo to be removed from a packet and removes that
* from the metadata of the list.
* @param cp Packet to be removed completely or partially.
* @return Amount of cargo to be removed.
*/
template<class Tsource>
uint CargoRemoval<Tsource>::Preprocess(CargoPacket *cp)
{
if (this->max_move >= cp->Count()) {
this->max_move -= cp->Count();
return cp->Count();
} else {
uint ret = this->max_move;
this->max_move = 0;
return ret;
}
}
/**
* Finalize cargo removal. Either delete the packet or reduce it.
* @param cp Packet to be removed or reduced.
* @param remove Amount of cargo to be removed.
* @return True if the packet was deleted, False if it was reduced.
*/
template<class Tsource>
bool CargoRemoval<Tsource>::Postprocess(CargoPacket *cp, uint remove)
{
if (remove == cp->Count()) {
delete cp;
return true;
} else {
cp->Reduce(remove);
return false;
}
}
/**
* Removes some cargo from a StationCargoList.
* @param cp Packet to be removed.
* @return True if the packet was completely delivered, false if only part of
* it was.
*/
template<>
bool CargoRemoval<StationCargoList>::operator()(CargoPacket *cp)
{
uint remove = this->Preprocess(cp);
this->source->RemoveFromCache(cp, remove);
return this->Postprocess(cp, remove);
}
/**
* Removes some cargo from a VehicleCargoList.
* @param cp Packet to be removed.
* @return True if the packet was completely delivered, false if only part of
* it was.
*/
template<>
bool CargoRemoval<VehicleCargoList>::operator()(CargoPacket *cp)
{
uint remove = this->Preprocess(cp);
this->source->RemoveFromMeta(cp, VehicleCargoList::MTA_KEEP, remove);
return this->Postprocess(cp, remove);
}
/**
* Delivers some cargo.
* @param cp Packet to be delivered.
* @return True if the packet was completely delivered, false if only part of
* it was.
*/
bool CargoDelivery::operator()(CargoPacket *cp)
{
uint remove = this->Preprocess(cp);
this->source->RemoveFromMeta(cp, VehicleCargoList::MTA_DELIVER, remove);
this->payment->PayFinalDelivery(cp, remove);
return this->Postprocess(cp, remove);
}
/**
* Loads some cargo onto a vehicle.
* @param cp Packet to be loaded.
* @return True if the packet was completely loaded, false if part of it was.
*/
bool CargoLoad::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) return false;
cp_new->SetLoadPlace(this->load_place);
this->source->RemoveFromCache(cp_new, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP);
return cp_new == cp;
}
/**
* Reserves some cargo for loading.
* @param cp Packet to be reserved.
* @return True if the packet was completely reserved, false if part of it was.
*/
bool CargoReservation::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) return false;
cp_new->SetLoadPlace(this->load_place);
this->source->reserved_count += cp_new->Count();
this->source->RemoveFromCache(cp_new, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_LOAD);
return cp_new == cp;
}
/**
* Returns some reserved cargo.
* @param cp Packet to be returned.
* @return True if the packet was completely returned, false if part of it was.
*/
bool CargoReturn::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) cp_new = cp;
assert(cp_new->Count() <= this->destination->reserved_count);
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_LOAD, cp_new->Count());
this->destination->reserved_count -= cp_new->Count();
this->destination->Append(cp_new, this->next);
return cp_new == cp;
}
/**
* Transfers some cargo from a vehicle to a station.
* @param cp Packet to be transfered.
* @return True if the packet was completely reserved, false if part of it was.
*/
bool CargoTransfer::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) return false;
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count());
/* No transfer credits here as they were already granted during Stage(). */
this->destination->Append(cp_new, cp_new->NextStation());
return cp_new == cp;
}
/**
* Shifts some cargo from a vehicle to another one.
* @param cp Packet to be shifted.
* @return True if the packet was completely shifted, false if part of it was.
*/
bool CargoShift::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) cp_new = cp;
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_KEEP, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP);
return cp_new == cp;
}
/**
* Reroutes some cargo from one Station sublist to another.
* @param cp Packet to be rerouted.
* @return True if the packet was completely rerouted, false if part of it was.
*/
bool StationCargoReroute::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) cp_new = cp;
StationID next = this->ge->GetVia(cp_new->SourceStation(), this->avoid, this->avoid2);
assert(next != this->avoid && next != this->avoid2);
if (this->source != this->destination) {
this->source->RemoveFromCache(cp_new, cp_new->Count());
this->destination->AddToCache(cp_new);
}
/* Legal, as insert doesn't invalidate iterators in the MultiMap, however
* this might insert the packet between range.first and range.second (which might be end())
* This is why we check for GetKey above to avoid infinite loops. */
this->destination->packets.Insert(next, cp_new);
return cp_new == cp;
}
/**
* Reroutes some cargo in a VehicleCargoList.
* @param cp Packet to be rerouted.
* @return True if the packet was completely rerouted, false if part of it was.
*/
bool VehicleCargoReroute::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == NULL) cp_new = cp;
if (cp_new->NextStation() == this->avoid || cp_new->NextStation() == this->avoid2) {
cp->SetNextStation(this->ge->GetVia(cp_new->SourceStation(), this->avoid, this->avoid2));
}
if (this->source != this->destination) {
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count());
this->destination->AddToMeta(cp_new, VehicleCargoList::MTA_TRANSFER);
}
/* Legal, as front pushing doesn't invalidate iterators in std::list. */
this->destination->packets.push_front(cp_new);
return cp_new == cp;
}
template uint CargoRemoval<VehicleCargoList>::Preprocess(CargoPacket *cp);
template uint CargoRemoval<StationCargoList>::Preprocess(CargoPacket *cp);
template bool CargoRemoval<VehicleCargoList>::Postprocess(CargoPacket *cp, uint remove);
template bool CargoRemoval<StationCargoList>::Postprocess(CargoPacket *cp, uint remove);

View File

@@ -1,146 +0,0 @@
/* $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 cargoaction.h Actions to be applied to cargo packets. */
#ifndef CARGOACTION_H
#define CARGOACTION_H
#include "cargopacket.h"
/**
* Abstract action of removing cargo from a vehicle or a station.
* @tparam Tsource CargoList subclass to remove cargo from.
*/
template<class Tsource>
class CargoRemoval {
protected:
Tsource *source; ///< Source of the cargo.
uint max_move; ///< Maximum amount of cargo to be removed with this action.
uint Preprocess(CargoPacket *cp);
bool Postprocess(CargoPacket *cp, uint remove);
public:
CargoRemoval(Tsource *source, uint max_move) : source(source), max_move(max_move) {}
/**
* Returns how much more cargo can be removed with this action.
* @return Amount of cargo this action can still remove.
*/
uint MaxMove() { return this->max_move; }
bool operator()(CargoPacket *cp);
};
/** Action of final delivery of cargo. */
class CargoDelivery : public CargoRemoval<VehicleCargoList> {
protected:
CargoPayment *payment; ///< Payment object where payments will be registered.
public:
CargoDelivery(VehicleCargoList *source, uint max_move, CargoPayment *payment) :
CargoRemoval<VehicleCargoList>(source, max_move), payment(payment) {}
bool operator()(CargoPacket *cp);
};
/**
* Abstract action for moving cargo from one list to another.
* @tparam Tsource CargoList subclass to remove cargo from.
* @tparam Tdest CargoList subclass to add cargo to.
*/
template<class Tsource, class Tdest>
class CargoMovement {
protected:
Tsource *source; ///< Source of the cargo.
Tdest *destination; ///< Destination for the cargo.
uint max_move; ///< Maximum amount of cargo to be moved with this action.
CargoPacket *Preprocess(CargoPacket *cp);
public:
CargoMovement(Tsource *source, Tdest *destination, uint max_move) : source(source), destination(destination), max_move(max_move) {}
/**
* Returns how much more cargo can be moved with this action.
* @return Amount of cargo this action can still move.
*/
uint MaxMove() { return this->max_move; }
};
/** Action of transferring cargo from a vehicle to a station. */
class CargoTransfer : public CargoMovement<VehicleCargoList, StationCargoList> {
public:
CargoTransfer(VehicleCargoList *source, StationCargoList *destination, uint max_move) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move) {}
bool operator()(CargoPacket *cp);
};
/** Action of loading cargo from a station onto a vehicle. */
class CargoLoad : public CargoMovement<StationCargoList, VehicleCargoList> {
protected:
TileIndex load_place; ///< TileIndex to be saved in the packets' loaded_at_xy.
public:
CargoLoad(StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex load_place) :
CargoMovement<StationCargoList, VehicleCargoList>(source, destination, max_move), load_place(load_place) {}
bool operator()(CargoPacket *cp);
};
/** Action of reserving cargo from a station to be loaded onto a vehicle. */
class CargoReservation : public CargoLoad {
public:
CargoReservation(StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex load_place) :
CargoLoad(source, destination, max_move, load_place) {}
bool operator()(CargoPacket *cp);
};
/** Action of returning previously reserved cargo from the vehicle to the station. */
class CargoReturn : public CargoMovement<VehicleCargoList, StationCargoList> {
StationID next;
public:
CargoReturn(VehicleCargoList *source, StationCargoList *destination, uint max_move, StationID next) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move), next(next) {}
bool operator()(CargoPacket *cp);
};
/** Action of shifting cargo from one vehicle to another. */
class CargoShift : public CargoMovement<VehicleCargoList, VehicleCargoList> {
public:
CargoShift(VehicleCargoList *source, VehicleCargoList *destination, uint max_move) :
CargoMovement<VehicleCargoList, VehicleCargoList>(source, destination, max_move) {}
bool operator()(CargoPacket *cp);
};
/** Action of rerouting cargo between different cargo lists and/or next hops. */
template<class Tlist>
class CargoReroute : public CargoMovement<Tlist, Tlist> {
protected:
StationID avoid;
StationID avoid2;
const GoodsEntry *ge;
public:
CargoReroute(Tlist *source, Tlist *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) :
CargoMovement<Tlist, Tlist>(source, dest, max_move), avoid(avoid), avoid2(avoid2), ge(ge) {}
};
/** Action of rerouting cargo in a station. */
class StationCargoReroute : public CargoReroute<StationCargoList> {
public:
StationCargoReroute(StationCargoList *source, StationCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) :
CargoReroute<StationCargoList>(source, dest, max_move, avoid, avoid2, ge) {}
bool operator()(CargoPacket *cp);
};
/** Action of rerouting cargo staged for transfer in a vehicle. */
class VehicleCargoReroute : public CargoReroute<VehicleCargoList> {
public:
VehicleCargoReroute(VehicleCargoList *source, VehicleCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) :
CargoReroute<VehicleCargoList>(source, dest, max_move, avoid, avoid2, ge)
{
assert(this->max_move <= source->ActionCount(VehicleCargoList::MTA_TRANSFER));
}
bool operator()(CargoPacket *cp);
};
#endif /* CARGOACTION_H */

View File

@@ -67,7 +67,7 @@ void ClearCargoDeliveryMonitoring(CompanyID company)
* @param keep_monitoring After returning from this call, continue monitoring.
* @return Amount collected since last query/activation for the monitored combination.
*/
static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
{
CargoMonitorMap::iterator iter = monitor_map.find(monitor);
if (iter == monitor_map.end()) {
@@ -77,7 +77,7 @@ static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, boo
}
return 0;
} else {
int32 result = iter->second;
uint32 result = iter->second;
iter->second = 0;
if (!keep_monitoring) monitor_map.erase(iter);
return result;
@@ -90,7 +90,7 @@ static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, boo
* @param keep_monitoring After returning from this call, continue monitoring.
* @return Amount of delivered cargo for the monitored combination.
*/
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
{
return GetAmount(_cargo_deliveries, monitor, keep_monitoring);
}
@@ -102,7 +102,7 @@ int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
* @return Amount of picked up cargo for the monitored combination.
* @note Cargo pick up is counted on final delivery, to prevent users getting credit for picking up cargo without delivering it.
*/
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
uint32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
{
return GetAmount(_cargo_pickups, monitor, keep_monitoring);
}

View File

@@ -16,7 +16,6 @@
#include "company_func.h"
#include "industry.h"
#include "town.h"
#include "core/overflowsafe_type.hpp"
#include <map>
struct Station;
@@ -32,7 +31,7 @@ struct Station;
typedef uint32 CargoMonitorID; ///< Type of the cargo monitor number.
/** Map type for storing and updating active cargo monitor numbers and their amounts. */
typedef std::map<CargoMonitorID, OverflowSafeInt32> CargoMonitorMap;
typedef std::map<CargoMonitorID, uint32> CargoMonitorMap;
extern CargoMonitorMap _cargo_pickups;
extern CargoMonitorMap _cargo_deliveries;
@@ -142,8 +141,8 @@ static inline TownID DecodeMonitorTown(CargoMonitorID num)
void ClearCargoPickupMonitoring(CompanyID company = INVALID_OWNER);
void ClearCargoDeliveryMonitoring(CompanyID company = INVALID_OWNER);
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring);
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring);
uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring);
uint32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring);
void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st);
#endif /* CARGOMONITOR_H */

View File

@@ -10,12 +10,8 @@
/** @file cargopacket.cpp Implementation of the cargo packets. */
#include "stdafx.h"
#include "station_base.h"
#include "core/pool_func.hpp"
#include "core/random_func.hpp"
#include "economy_base.h"
#include "cargoaction.h"
#include "order_type.h"
/* Initialize the cargopacket-pool */
CargoPacketPool _cargopacket_pool("CargoPacket");
@@ -83,14 +79,14 @@ CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, T
/**
* Split this packet in two and return the split off part.
* @param new_size Size of the split part.
* @param new_size Size of the remaining part.
* @return Split off part, or NULL if no packet could be allocated!
*/
CargoPacket *CargoPacket::Split(uint new_size)
inline CargoPacket *CargoPacket::Split(uint new_size)
{
if (!CargoPacket::CanAllocateItem()) return NULL;
Money fs = this->FeederShare(new_size);
Money fs = this->feeder_share * new_size / static_cast<uint>(this->count);
CargoPacket *cp_new = new CargoPacket(new_size, this->days_in_transit, this->source, this->source_xy, this->loaded_at_xy, fs, this->source_type, this->source_id);
this->feeder_share -= fs;
this->count -= new_size;
@@ -101,24 +97,13 @@ CargoPacket *CargoPacket::Split(uint new_size)
* Merge another packet into this one.
* @param cp Packet to be merged in.
*/
void CargoPacket::Merge(CargoPacket *cp)
inline void CargoPacket::Merge(CargoPacket *cp)
{
this->count += cp->count;
this->feeder_share += cp->feeder_share;
delete cp;
}
/**
* Reduce the packet by the given amount and remove the feeder share.
* @param count Amount to be removed.
*/
void CargoPacket::Reduce(uint count)
{
assert(count < this->count);
this->feeder_share -= this->FeederShare(count);
this->count -= count;
}
/**
* Invalidates (sets source_id to INVALID_SOURCE) all cargo packets from given source.
* @param src_type Type of source.
@@ -153,8 +138,8 @@ void CargoPacket::Reduce(uint count)
/**
* Destroy the cargolist ("frees" all cargo packets).
*/
template <class Tinst, class Tcont>
CargoList<Tinst, Tcont>::~CargoList()
template <class Tinst>
CargoList<Tinst>::~CargoList()
{
for (Iterator it(this->packets.begin()); it != this->packets.end(); ++it) {
delete *it;
@@ -165,24 +150,22 @@ CargoList<Tinst, Tcont>::~CargoList()
* Empty the cargo list, but don't free the cargo packets;
* the cargo packets are cleaned by CargoPacket's CleanPool.
*/
template <class Tinst, class Tcont>
void CargoList<Tinst, Tcont>::OnCleanPool()
template <class Tinst>
void CargoList<Tinst>::OnCleanPool()
{
this->packets.clear();
}
/**
* Update the cached values to reflect the removal of this packet or part of it.
* Update the cached values to reflect the removal of this packet.
* Decreases count and days_in_transit.
* @param cp Packet to be removed from cache.
* @param count Amount of cargo from the given packet to be removed.
*/
template <class Tinst, class Tcont>
void CargoList<Tinst, Tcont>::RemoveFromCache(const CargoPacket *cp, uint count)
template <class Tinst>
void CargoList<Tinst>::RemoveFromCache(const CargoPacket *cp)
{
assert(count <= cp->count);
this->count -= count;
this->cargo_days_in_transit -= cp->days_in_transit * count;
this->count -= cp->count;
this->cargo_days_in_transit -= cp->days_in_transit * cp->count;
}
/**
@@ -190,16 +173,176 @@ void CargoList<Tinst, Tcont>::RemoveFromCache(const CargoPacket *cp, uint count)
* Increases count and days_in_transit.
* @param cp New packet to be inserted.
*/
template <class Tinst, class Tcont>
void CargoList<Tinst, Tcont>::AddToCache(const CargoPacket *cp)
template <class Tinst>
void CargoList<Tinst>::AddToCache(const CargoPacket *cp)
{
this->count += cp->count;
this->cargo_days_in_transit += cp->days_in_transit * cp->count;
}
/**
* Appends the given cargo packet. Tries to merge it with another one in the
* packets list. If no fitting packet is found, appends it.
* @warning After appending this packet may not exist anymore!
* @note Do not use the cargo packet anymore after it has been appended to this CargoList!
* @param cp Cargo packet to add.
* @pre cp != NULL
*/
template <class Tinst>
void CargoList<Tinst>::Append(CargoPacket *cp)
{
assert(cp != NULL);
static_cast<Tinst *>(this)->AddToCache(cp);
for (List::reverse_iterator it(this->packets.rbegin()); it != this->packets.rend(); it++) {
CargoPacket *icp = *it;
if (Tinst::AreMergable(icp, cp) && icp->count + cp->count <= CargoPacket::MAX_COUNT) {
icp->Merge(cp);
return;
}
}
/* The packet could not be merged with another one */
this->packets.push_back(cp);
}
/**
* Truncates the cargo in this list to the given amount. It leaves the
* first count cargo entities and removes the rest.
* @param max_remaining Maximum amount of entities to be in the list after the command.
*/
template <class Tinst>
void CargoList<Tinst>::Truncate(uint max_remaining)
{
for (Iterator it(packets.begin()); it != packets.end(); /* done during loop*/) {
CargoPacket *cp = *it;
if (max_remaining == 0) {
/* Nothing should remain, just remove the packets. */
it = this->packets.erase(it);
static_cast<Tinst *>(this)->RemoveFromCache(cp);
delete cp;
continue;
}
uint local_count = cp->count;
if (local_count > max_remaining) {
uint diff = local_count - max_remaining;
this->count -= diff;
this->cargo_days_in_transit -= cp->days_in_transit * diff;
cp->count = max_remaining;
max_remaining = 0;
} else {
max_remaining -= local_count;
}
++it;
}
}
/**
* Moves the given amount of cargo to another list.
* Depending on the value of mta the side effects of this function differ:
* - MTA_FINAL_DELIVERY: Destroys the packets that do not originate from a specific station.
* - MTA_CARGO_LOAD: Sets the loaded_at_xy value of the moved packets.
* - MTA_TRANSFER: Just move without side effects.
* - MTA_UNLOAD: Just move without side effects.
* @param dest Destination to move the cargo to.
* @param max_move Amount of cargo entities to move.
* @param mta How to handle the moving (side effects).
* @param data Depending on mta the data of this variable differs:
* - MTA_FINAL_DELIVERY - Station ID of packet's origin not to remove.
* - MTA_CARGO_LOAD - Station's tile index of load.
* - MTA_TRANSFER - Unused.
* - MTA_UNLOAD - Unused.
* @param payment The payment helper.
*
* @pre mta == MTA_FINAL_DELIVERY || dest != NULL
* @pre mta == MTA_UNLOAD || mta == MTA_CARGO_LOAD || payment != NULL
* @return True if there are still packets that might be moved from this cargo list.
*/
template <class Tinst>
template <class Tother_inst>
bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, MoveToAction mta, CargoPayment *payment, uint data)
{
assert(mta == MTA_FINAL_DELIVERY || dest != NULL);
assert(mta == MTA_UNLOAD || mta == MTA_CARGO_LOAD || payment != NULL);
Iterator it(this->packets.begin());
while (it != this->packets.end() && max_move > 0) {
CargoPacket *cp = *it;
if (cp->source == data && mta == MTA_FINAL_DELIVERY) {
/* Skip cargo that originated from this station. */
++it;
continue;
}
if (cp->count <= max_move) {
/* Can move the complete packet */
max_move -= cp->count;
it = this->packets.erase(it);
static_cast<Tinst *>(this)->RemoveFromCache(cp);
switch (mta) {
case MTA_FINAL_DELIVERY:
payment->PayFinalDelivery(cp, cp->count);
delete cp;
continue; // of the loop
case MTA_CARGO_LOAD:
cp->loaded_at_xy = data;
break;
case MTA_TRANSFER:
cp->feeder_share += payment->PayTransfer(cp, cp->count);
break;
case MTA_UNLOAD:
break;
}
dest->Append(cp);
continue;
}
/* Can move only part of the packet */
if (mta == MTA_FINAL_DELIVERY) {
/* Final delivery doesn't need package splitting. */
payment->PayFinalDelivery(cp, max_move);
/* Remove the delivered data from the cache */
uint left = cp->count - max_move;
cp->count = max_move;
static_cast<Tinst *>(this)->RemoveFromCache(cp);
/* Final delivery payment pays the feeder share, so we have to
* reset that so it is not 'shown' twice for partial unloads. */
cp->feeder_share = 0;
cp->count = left;
} else {
/* But... the rest needs package splitting. */
CargoPacket *cp_new = cp->Split(max_move);
/* We could not allocate a CargoPacket? Is the map that full? */
if (cp_new == NULL) return false;
static_cast<Tinst *>(this)->RemoveFromCache(cp_new); // this reflects the changes in cp.
if (mta == MTA_TRANSFER) {
/* Add the feeder share before inserting in dest. */
cp_new->feeder_share += payment->PayTransfer(cp_new, max_move);
} else if (mta == MTA_CARGO_LOAD) {
cp_new->loaded_at_xy = data;
}
dest->Append(cp_new);
}
max_move = 0;
}
return it != packets.end();
}
/** Invalidates the cached data and rebuilds it. */
template <class Tinst, class Tcont>
void CargoList<Tinst, Tcont>::InvalidateCache()
template <class Tinst>
void CargoList<Tinst>::InvalidateCache()
{
this->count = 0;
this->cargo_days_in_transit = 0;
@@ -210,132 +353,14 @@ void CargoList<Tinst, Tcont>::InvalidateCache()
}
/**
* Tries to merge the second packet into the first and return if that was
* successful.
* @param icp Packet to be merged into.
* @param cp Packet to be eliminated.
* @return If the packets could be merged.
*/
template <class Tinst, class Tcont>
/* static */ bool CargoList<Tinst, Tcont>::TryMerge(CargoPacket *icp, CargoPacket *cp)
{
if (Tinst::AreMergable(icp, cp) &&
icp->count + cp->count <= CargoPacket::MAX_COUNT) {
icp->Merge(cp);
return true;
} else {
return false;
}
}
/*
*
* Vehicle cargo list implementation.
*
*/
/**
* Appends the given cargo packet. Tries to merge it with another one in the
* packets list. If no fitting packet is found, appends it. You can only append
* packets to the ranges of packets designated for keeping or loading.
* Furthermore if there are already packets reserved for loading you cannot
* directly add packets to the "keep" list. You first have to load the reserved
* ones.
* @warning After appending this packet may not exist anymore!
* @note Do not use the cargo packet anymore after it has been appended to this CargoList!
* @param cp Cargo packet to add.
* @param action Either MTA_KEEP if you want to add the packet directly or MTA_LOAD
* if you want to reserve it first.
* @pre cp != NULL
* @pre action == MTA_LOAD || (action == MTA_KEEP && this->designation_counts[MTA_LOAD] == 0)
*/
void VehicleCargoList::Append(CargoPacket *cp, MoveToAction action)
{
assert(cp != NULL);
assert(action == MTA_LOAD ||
(action == MTA_KEEP && this->action_counts[MTA_LOAD] == 0));
this->AddToMeta(cp, action);
if (this->count == cp->count) {
this->packets.push_back(cp);
return;
}
uint sum = cp->count;
for (ReverseIterator it(this->packets.rbegin()); it != this->packets.rend(); it++) {
CargoPacket *icp = *it;
if (VehicleCargoList::TryMerge(icp, cp)) return;
sum += icp->count;
if (sum >= this->action_counts[action]) {
this->packets.push_back(cp);
return;
}
}
NOT_REACHED();
}
/**
* Shifts cargo from the front of the packet list and applies some action to it.
* @tparam Taction Action class or function to be used. It should define
* "bool operator()(CargoPacket *)". If true is returned the
* cargo packet will be removed from the list. Otherwise it
* will be kept and the loop will be aborted.
* @param action Action instance to be applied.
*/
template<class Taction>
void VehicleCargoList::ShiftCargo(Taction action)
{
Iterator it(this->packets.begin());
while (it != this->packets.end() && action.MaxMove() > 0) {
CargoPacket *cp = *it;
if (action(cp)) {
it = this->packets.erase(it);
} else {
break;
}
}
}
/**
* Pops cargo from the back of the packet list and applies some action to it.
* @tparam Taction Action class or function to be used. It should define
* "bool operator()(CargoPacket *)". If true is returned the
* cargo packet will be removed from the list. Otherwise it
* will be kept and the loop will be aborted.
* @param action Action instance to be applied.
*/
template<class Taction>
void VehicleCargoList::PopCargo(Taction action)
{
if (this->packets.empty()) return;
Iterator it(--(this->packets.end()));
Iterator begin(this->packets.begin());
while (action.MaxMove() > 0) {
CargoPacket *cp = *it;
if (action(cp)) {
if (it != begin) {
this->packets.erase(it--);
} else {
this->packets.erase(it);
break;
}
} else {
break;
}
}
}
/**
* Update the cached values to reflect the removal of this packet or part of it.
* Update the cached values to reflect the removal of this packet.
* Decreases count, feeder share and days_in_transit.
* @param cp Packet to be removed from cache.
* @param count Amount of cargo from the given packet to be removed.
*/
void VehicleCargoList::RemoveFromCache(const CargoPacket *cp, uint count)
void VehicleCargoList::RemoveFromCache(const CargoPacket *cp)
{
this->feeder_share -= cp->FeederShare(count);
this->Parent::RemoveFromCache(cp, count);
this->feeder_share -= cp->feeder_share;
this->Parent::RemoveFromCache(cp);
}
/**
@@ -349,33 +374,6 @@ void VehicleCargoList::AddToCache(const CargoPacket *cp)
this->Parent::AddToCache(cp);
}
/**
* Removes a packet or part of it from the metadata.
* @param cp Packet to be removed.
* @param action MoveToAction of the packet (for updating the counts).
* @param count Amount of cargo to be removed.
*/
void VehicleCargoList::RemoveFromMeta(const CargoPacket *cp, MoveToAction action, uint count)
{
this->AssertCountConsistency();
this->RemoveFromCache(cp, count);
this->action_counts[action] -= count;
this->AssertCountConsistency();
}
/**
* Adds a packet to the metadata.
* @param cp Packet to be added.
* @param action MoveToAction of the packet.
*/
void VehicleCargoList::AddToMeta(const CargoPacket *cp, MoveToAction action)
{
this->AssertCountConsistency();
this->AddToCache(cp);
this->action_counts[action] += cp->count;
this->AssertCountConsistency();
}
/**
* Ages the all cargo in this list.
*/
@@ -391,150 +389,6 @@ void VehicleCargoList::AgeCargo()
}
}
/**
* Sets loaded_at_xy to the current station for all cargo to be transfered.
* This is done when stopping or skipping while the vehicle is unloading. In
* that case the vehicle will get part of its transfer credits early and it may
* get more transfer credits than it's entitled to.
* @param xy New loaded_at_xy for the cargo.
*/
void VehicleCargoList::SetTransferLoadPlace(TileIndex xy)
{
uint sum = 0;
for (Iterator it = this->packets.begin(); sum < this->action_counts[MTA_TRANSFER]; ++it) {
CargoPacket *cp = *it;
cp->loaded_at_xy = xy;
sum += cp->count;
}
}
/**
* Choose action to be performed with the given cargo packet.
* @param cp The packet.
* @param cargo_next Next hop the cargo wants to pass.
* @param current_station Current station of the vehicle carrying the cargo.
* @param accepted If the cargo is accepted at the current station.
* @param next_station Next station(s) the vehicle may stop at.
* @return MoveToAction to be performed.
*/
/* static */ VehicleCargoList::MoveToAction VehicleCargoList::ChooseAction(const CargoPacket *cp, StationID cargo_next,
StationID current_station, bool accepted, StationIDStack next_station)
{
if (cargo_next == INVALID_STATION) {
return (accepted && cp->source != current_station) ? MTA_DELIVER : MTA_KEEP;
} else if (cargo_next == current_station) {
return MTA_DELIVER;
} else if (next_station.Contains(cargo_next)) {
return MTA_KEEP;
} else {
return MTA_TRANSFER;
}
}
/**
* Stages cargo for unloading. The cargo is sorted so that packets to be
* transferred, delivered or kept are in consecutive chunks in the list. At the
* same time the designation_counts are updated to reflect the size of those
* chunks.
* @param accepted If the cargo will be accepted at the station.
* @param current_station ID of the station.
* @param next_station ID of the station the vehicle will go to next.
* @param order_flags OrderUnloadFlags that will apply to the unload operation.
* @param ge GoodsEntry for getting the flows.
* @param payment Payment object for registering transfers.
* return If any cargo will be unloaded.
*/
bool VehicleCargoList::Stage(bool accepted, StationID current_station, StationIDStack next_station, uint8 order_flags, const GoodsEntry *ge, CargoPayment *payment)
{
this->AssertCountConsistency();
assert(this->action_counts[MTA_LOAD] == 0);
this->action_counts[MTA_TRANSFER] = this->action_counts[MTA_DELIVER] = this->action_counts[MTA_KEEP] = 0;
Iterator deliver = this->packets.end();
Iterator it = this->packets.begin();
uint sum = 0;
bool force_keep = (order_flags & OUFB_NO_UNLOAD) != 0;
bool force_unload = (order_flags & OUFB_UNLOAD) != 0;
bool force_transfer = (order_flags & (OUFB_TRANSFER | OUFB_UNLOAD)) != 0;
assert(this->count > 0 || it == this->packets.end());
while (sum < this->count) {
CargoPacket *cp = *it;
this->packets.erase(it++);
StationID cargo_next = INVALID_STATION;
MoveToAction action = MTA_LOAD;
if (force_keep) {
action = MTA_KEEP;
} else if (force_unload && accepted && cp->source != current_station) {
action = MTA_DELIVER;
} else if (force_transfer) {
action = MTA_TRANSFER;
/* We cannot send the cargo to any of the possible next hops and
* also not to the current station. */
FlowStatMap::const_iterator flow_it(ge->flows.find(cp->source));
if (flow_it == ge->flows.end()) {
cargo_next = INVALID_STATION;
} else {
FlowStat new_shares = flow_it->second;
new_shares.ChangeShare(current_station, INT_MIN);
StationIDStack excluded = next_station;
while (!excluded.IsEmpty() && !new_shares.GetShares()->empty()) {
new_shares.ChangeShare(excluded.Pop(), INT_MIN);
}
if (new_shares.GetShares()->empty()) {
cargo_next = INVALID_STATION;
} else {
cargo_next = new_shares.GetVia();
}
}
} else {
/* Rewrite an invalid source station to some random other one to
* avoid keeping the cargo in the vehicle forever. */
if (cp->source == INVALID_STATION && !ge->flows.empty()) {
cp->source = ge->flows.begin()->first;
}
bool restricted = false;
FlowStatMap::const_iterator flow_it(ge->flows.find(cp->source));
if (flow_it == ge->flows.end()) {
cargo_next = INVALID_STATION;
} else {
cargo_next = flow_it->second.GetViaWithRestricted(restricted);
}
action = VehicleCargoList::ChooseAction(cp, cargo_next, current_station, accepted, next_station);
if (restricted && action == MTA_TRANSFER) {
/* If the flow is restricted we can't transfer to it. Choose an
* unrestricted one instead. */
cargo_next = flow_it->second.GetVia();
action = VehicleCargoList::ChooseAction(cp, cargo_next, current_station, accepted, next_station);
}
}
Money share;
switch (action) {
case MTA_KEEP:
this->packets.push_back(cp);
if (deliver == this->packets.end()) --deliver;
break;
case MTA_DELIVER:
this->packets.insert(deliver, cp);
break;
case MTA_TRANSFER:
this->packets.push_front(cp);
/* Add feeder share here to allow reusing field for next station. */
share = payment->PayTransfer(cp, cp->count);
cp->AddFeederShare(share);
this->feeder_share += share;
cp->next_station = cargo_next;
break;
default:
NOT_REACHED();
}
this->action_counts[action] += cp->count;
sum += cp->count;
}
this->AssertCountConsistency();
return this->action_counts[MTA_DELIVER] > 0 || this->action_counts[MTA_TRANSFER] > 0;
}
/** Invalidates the cached data and rebuild it. */
void VehicleCargoList::InvalidateCache()
{
@@ -542,330 +396,15 @@ void VehicleCargoList::InvalidateCache()
this->Parent::InvalidateCache();
}
/**
* Moves some cargo from one designation to another. You can only move
* between adjacent designations. E.g. you can keep cargo that was previously
* reserved (MTA_LOAD), but you can't reserve cargo that's marked as to be
* delivered. Furthermore, as this method doesn't change the actual packets,
* you cannot move cargo from or to MTA_TRANSFER. You need a specialized
* template method for that.
* @tparam from Previous designation of cargo.
* @tparam to New designation of cargo.
* @param max_move Maximum amount of cargo to reassign.
* @return Amount of cargo actually reassigned.
*/
template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
uint VehicleCargoList::Reassign(uint max_move, TileOrStationID)
{
assert_tcompile(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER);
assert_tcompile(Tfrom - Tto == 1 || Tto - Tfrom == 1);
max_move = min(this->action_counts[Tfrom], max_move);
this->action_counts[Tfrom] -= max_move;
this->action_counts[Tto] += max_move;
return max_move;
}
/**
* Reassign cargo from MTA_DELIVER to MTA_TRANSFER and take care of the next
* station the cargo wants to visit.
* @param max_move Maximum amount of cargo to reassign.
* @param next_station Station to record as next hop in the reassigned packets.
* @return Amount of cargo actually reassigned.
*/
template<>
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move, TileOrStationID next_station)
{
max_move = min(this->action_counts[MTA_DELIVER], max_move);
uint sum = 0;
for (Iterator it(this->packets.begin()); sum < this->action_counts[MTA_TRANSFER] + max_move;) {
CargoPacket *cp = *it++;
sum += cp->Count();
if (sum <= this->action_counts[MTA_TRANSFER]) continue;
if (sum > this->action_counts[MTA_TRANSFER] + max_move) {
CargoPacket *cp_split = cp->Split(sum - this->action_counts[MTA_TRANSFER] + max_move);
sum -= cp_split->Count();
this->packets.insert(it, cp_split);
}
cp->next_station = next_station;
}
this->action_counts[MTA_DELIVER] -= max_move;
this->action_counts[MTA_TRANSFER] += max_move;
return max_move;
}
/**
* Returns reserved cargo to the station and removes it from the cache.
* @param max_move Maximum amount of cargo to move.
* @param dest Station the cargo is returned to.
* @param ID of next the station the cargo wants to go next.
* @return Amount of cargo actually returned.
*/
uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID next)
{
max_move = min(this->action_counts[MTA_LOAD], max_move);
this->PopCargo(CargoReturn(this, dest, max_move, next));
return max_move;
}
/**
* Shifts cargo between two vehicles.
* @param dest Other vehicle's cargo list.
* @param max_move Maximum amount of cargo to be moved.
* @return Amount of cargo actually moved.
*/
uint VehicleCargoList::Shift(uint max_move, VehicleCargoList *dest)
{
max_move = min(this->count, max_move);
this->PopCargo(CargoShift(this, dest, max_move));
return max_move;
}
/**
* Unloads cargo at the given station. Deliver or transfer, depending on the
* ranges defined by designation_counts.
* @param dest StationCargoList to add transferred cargo to.
* @param max_move Maximum amount of cargo to move.
* @param payment Payment object to register payments in.
* @return Amount of cargo actually unloaded.
*/
uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPayment *payment)
{
uint moved = 0;
if (this->action_counts[MTA_TRANSFER] > 0) {
uint move = min(this->action_counts[MTA_TRANSFER], max_move);
this->ShiftCargo(CargoTransfer(this, dest, move));
moved += move;
}
if (this->action_counts[MTA_TRANSFER] == 0 && this->action_counts[MTA_DELIVER] > 0 && moved < max_move) {
uint move = min(this->action_counts[MTA_DELIVER], max_move - moved);
this->ShiftCargo(CargoDelivery(this, move, payment));
moved += move;
}
return moved;
}
/**
* Truncates the cargo in this list to the given amount. It leaves the
* first cargo entities and removes max_move from the back of the list.
* @param max_move Maximum amount of entities to be removed from the list.
* @return Amount of entities actually moved.
*/
uint VehicleCargoList::Truncate(uint max_move)
{
max_move = min(this->count, max_move);
this->PopCargo(CargoRemoval<VehicleCargoList>(this, max_move));
return max_move;
}
/**
* Routes packets with station "avoid" as next hop to a different place.
* @param max_move Maximum amount of cargo to move.
* @param dest List to prepend the cargo to.
* @param avoid Station to exclude from routing and current next hop of packets to reroute.
* @param avoid2 Additional station to exclude from routing.
* @oaram ge GoodsEntry to get the routing info from.
*/
uint VehicleCargoList::Reroute(uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge)
{
max_move = min(this->action_counts[MTA_TRANSFER], max_move);
this->ShiftCargo(VehicleCargoReroute(this, dest, max_move, avoid, avoid2, ge));
return max_move;
}
/*
*
* Station cargo list implementation.
*
*/
/**
* Appends the given cargo packet to the range of packets with the same next station
* @warning After appending this packet may not exist anymore!
* @note Do not use the cargo packet anymore after it has been appended to this CargoList!
* @param next the next hop
* @param cp the cargo packet to add
* @pre cp != NULL
*/
void StationCargoList::Append(CargoPacket *cp, StationID next)
{
assert(cp != NULL);
this->AddToCache(cp);
StationCargoPacketMap::List &list = this->packets[next];
for (StationCargoPacketMap::List::reverse_iterator it(list.rbegin());
it != list.rend(); it++) {
if (StationCargoList::TryMerge(*it, cp)) return;
}
/* The packet could not be merged with another one */
list.push_back(cp);
}
/**
* Shifts cargo from the front of the packet list for a specific station and
* applies some action to it.
* @tparam Taction Action class or function to be used. It should define
* "bool operator()(CargoPacket *)". If true is returned the
* cargo packet will be removed from the list. Otherwise it
* will be kept and the loop will be aborted.
* @param action Action instance to be applied.
* @param next Next hop the cargo wants to visit.
* @return True if all packets with the given next hop have been removed,
* False otherwise.
*/
template <class Taction>
bool StationCargoList::ShiftCargo(Taction &action, StationID next)
{
std::pair<Iterator, Iterator> range(this->packets.equal_range(next));
for (Iterator it(range.first); it != range.second && it.GetKey() == next;) {
if (action.MaxMove() == 0) return false;
CargoPacket *cp = *it;
if (action(cp)) {
it = this->packets.erase(it);
} else {
return false;
}
}
return true;
}
/**
* Shifts cargo from the front of the packet list for a specific station and
* and optional also from the list for "any station", then applies some action
* to it.
* @tparam Taction Action class or function to be used. It should define
* "bool operator()(CargoPacket *)". If true is returned the
* cargo packet will be removed from the list. Otherwise it
* will be kept and the loop will be aborted.
* @param action Action instance to be applied.
* @param next Next hop the cargo wants to visit.
* @param include_invalid If cargo from the INVALID_STATION list should be
* used if necessary.
* @return Amount of cargo actually moved.
*/
template <class Taction>
uint StationCargoList::ShiftCargo(Taction action, StationIDStack next, bool include_invalid)
{
uint max_move = action.MaxMove();
while (!next.IsEmpty()) {
this->ShiftCargo(action, next.Pop());
if (action.MaxMove() == 0) break;
}
if (include_invalid && action.MaxMove() > 0) {
this->ShiftCargo(action, INVALID_STATION);
}
return max_move - action.MaxMove();
}
/**
* Truncates where each destination loses roughly the same percentage of its
* cargo. This is done by randomizing the selection of packets to be removed.
* Optionally count the cargo by origin station.
* @param max_move Maximum amount of cargo to remove.
* @param cargo_per_source Container for counting the cargo by origin.
* @return Amount of cargo actually moved.
*/
uint StationCargoList::Truncate(uint max_move, StationCargoAmountMap *cargo_per_source)
{
max_move = min(max_move, this->count);
uint prev_count = this->count;
uint moved = 0;
uint loop = 0;
bool do_count = cargo_per_source != NULL;
while (max_move > moved) {
for (Iterator it(this->packets.begin()); it != this->packets.end();) {
CargoPacket *cp = *it;
if (prev_count > max_move && RandomRange(prev_count) < prev_count - max_move) {
if (do_count && loop == 0) {
(*cargo_per_source)[cp->source] += cp->count;
}
++it;
continue;
}
uint diff = max_move - moved;
if (cp->count > diff) {
if (diff > 0) {
this->RemoveFromCache(cp, diff);
cp->Reduce(diff);
moved += diff;
}
if (loop > 0) {
if (do_count) (*cargo_per_source)[cp->source] -= diff;
return moved;
} else {
if (do_count) (*cargo_per_source)[cp->source] += cp->count;
++it;
}
} else {
it = this->packets.erase(it);
if (do_count && loop > 0) {
(*cargo_per_source)[cp->source] -= cp->count;
}
moved += cp->count;
this->RemoveFromCache(cp, cp->count);
delete cp;
}
}
loop++;
}
return moved;
}
/**
* Reserves cargo for loading onto the vehicle.
* @param max_move Maximum amount of cargo to reserve.
* @param dest VehicleCargoList to reserve for.
* @param load_place Tile index of the current station.
* @param next_station Next station(s) the loading vehicle will visit.
* @return Amount of cargo actually reserved.
*/
uint StationCargoList::Reserve(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next_station)
{
return this->ShiftCargo(CargoReservation(this, dest, max_move, load_place), next_station, true);
}
/**
* Loads cargo onto a vehicle. If the vehicle has reserved cargo load that.
* Otherwise load cargo from the station.
* @param max_move Amount of cargo to load.
* @param dest Vehicle cargo list where the cargo resides.
* @param load_place The new loaded_at_xy to be assigned to packets being moved.
* @param next_station Next station(s) the loading vehicle will visit.
* @return Amount of cargo actually loaded.
* @note Vehicles may or may not reserve, depending on their orders. The two
* modes of loading are exclusive, though. If cargo is reserved we don't
* need to load unreserved cargo.
*/
uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next_station)
{
uint move = min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move);
if (move > 0) {
this->reserved_count -= move;
dest->Reassign<VehicleCargoList::MTA_LOAD, VehicleCargoList::MTA_KEEP>(move);
return move;
} else {
return this->ShiftCargo(CargoLoad(this, dest, max_move, load_place), next_station, true);
}
}
/**
* Routes packets with station "avoid" as next hop to a different place.
* @param max_move Maximum amount of cargo to move.
* @param dest List to append the cargo to.
* @param avoid Station to exclude from routing and current next hop of packets to reroute.
* @param avoid2 Additional station to exclude from routing.
* @oaram ge GoodsEntry to get the routing info from.
*/
uint StationCargoList::Reroute(uint max_move, StationCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge)
{
return this->ShiftCargo(StationCargoReroute(this, dest, max_move, avoid, avoid2, ge), avoid, false);
}
/*
* We have to instantiate everything we want to be usable.
*/
template class CargoList<VehicleCargoList, CargoPacketList>;
template class CargoList<StationCargoList, StationCargoPacketMap>;
template uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(uint, TileOrStationID);
template class CargoList<VehicleCargoList>;
template class CargoList<StationCargoList>;
/** Autoreplace Vehicle -> Vehicle 'transfer'. */
template bool CargoList<VehicleCargoList>::MoveTo(VehicleCargoList *, uint max_move, MoveToAction mta, CargoPayment *payment, uint data);
/** Cargo unloading at a station. */
template bool CargoList<VehicleCargoList>::MoveTo(StationCargoList *, uint max_move, MoveToAction mta, CargoPayment *payment, uint data);
/** Cargo loading at a station. */
template bool CargoList<StationCargoList>::MoveTo(VehicleCargoList *, uint max_move, MoveToAction mta, CargoPayment *payment, uint data);

View File

@@ -15,10 +15,8 @@
#include "core/pool_type.hpp"
#include "economy_type.h"
#include "station_type.h"
#include "order_type.h"
#include "cargo_type.h"
#include "vehicle_type.h"
#include "core/multimap.hpp"
#include <list>
/** Unique identifier for a single cargo packet. */
@@ -30,14 +28,9 @@ typedef Pool<CargoPacket, CargoPacketID, 1024, 0xFFF000, PT_NORMAL, true, false>
/** The actual pool with cargo packets. */
extern CargoPacketPool _cargopacket_pool;
struct GoodsEntry; // forward-declare for Stage() and RerouteStalePackets()
template <class Tinst, class Tcont> class CargoList;
class StationCargoList; // forward-declare, so we can use it in VehicleCargoList.
template <class Tinst> class CargoList;
extern const struct SaveLoad *GetCargoPacketDesc();
typedef uint32 TileOrStationID;
/**
* Container for cargo from the same location and time.
*/
@@ -50,13 +43,10 @@ private:
SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid.
StationID source; ///< The station where the cargo came from first.
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain).
union {
TileOrStationID loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle.
TileOrStationID next_station; ///< Station where the cargo wants to go next.
};
TileIndex loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle.
/** The CargoList caches, thus needs to know about it. */
template <class Tinst, class Tcont> friend class CargoList;
template <class Tinst> friend class CargoList;
friend class VehicleCargoList;
friend class StationCargoList;
/** We want this to be saved, right? */
@@ -74,25 +64,6 @@ public:
CargoPacket *Split(uint new_size);
void Merge(CargoPacket *cp);
void Reduce(uint count);
/**
* Sets the tile where the packet was loaded last.
* @param load_place Tile where the packet was loaded last.
*/
void SetLoadPlace(TileIndex load_place) { this->loaded_at_xy = load_place; }
/**
* Sets the station where the packet is supposed to go next.
* @param next_station Next station the packet should go to.
*/
void SetNextStation(StationID next_station) { this->next_station = next_station; }
/**
* Adds some feeder share to the packet.
* @param new_share Feeder share to be added.
*/
void AddFeederShare(Money new_share) { this->feeder_share += new_share; }
/**
* Gets the number of 'items' in this packet.
@@ -113,17 +84,6 @@ public:
return this->feeder_share;
}
/**
* Gets part of the amount of money already paid to earlier vehicles in
* the feeder chain.
* @param part Amount of cargo to get the share for.
* @return Feeder share for the given amount of cargo.
*/
inline Money FeederShare(uint part) const
{
return this->feeder_share * part / static_cast<uint>(this->count);
}
/**
* Gets the number of days this cargo has been in transit.
* This number isn't really in days, but in 2.5 days (CARGO_AGING_TICKS = 185 ticks) and
@@ -157,7 +117,7 @@ public:
* Gets the ID of the station where the cargo was loaded for the first time.
* @return StationID.
*/
inline StationID SourceStation() const
inline SourceID SourceStation() const
{
return this->source;
}
@@ -180,14 +140,6 @@ public:
return this->loaded_at_xy;
}
/**
* Gets the ID of station the cargo wants to go next.
* @return Next station for this packets.
*/
inline StationID NextStation() const
{
return this->next_station;
}
static void InvalidateAllFrom(SourceType src_type, SourceID src);
static void InvalidateAllFrom(StationID sid);
@@ -211,40 +163,33 @@ public:
* Simple collection class for a list of cargo packets.
* @tparam Tinst Actual instantiation of this cargo list.
*/
template <class Tinst, class Tcont>
template <class Tinst>
class CargoList {
public:
/** Container with cargo packets. */
typedef std::list<CargoPacket *> List;
/** The iterator for our container. */
typedef typename Tcont::iterator Iterator;
/** The reverse iterator for our container. */
typedef typename Tcont::reverse_iterator ReverseIterator;
typedef List::iterator Iterator;
/** The const iterator for our container. */
typedef typename Tcont::const_iterator ConstIterator;
/** The const reverse iterator for our container. */
typedef typename Tcont::const_reverse_iterator ConstReverseIterator;
typedef List::const_iterator ConstIterator;
/** Kind of actions that could be done with packets on move. */
enum MoveToAction {
MTA_BEGIN = 0,
MTA_TRANSFER = 0, ///< Transfer the cargo to the station.
MTA_DELIVER, ///< Deliver the cargo to some town or industry.
MTA_KEEP, ///< Keep the cargo in the vehicle.
MTA_LOAD, ///< Load the cargo from the station.
MTA_END,
NUM_MOVE_TO_ACTION = MTA_END
MTA_FINAL_DELIVERY, ///< "Deliver" the packet to the final destination, i.e. destroy the packet.
MTA_CARGO_LOAD, ///< Load the packet onto a vehicle, i.e. set the last loaded station ID.
MTA_TRANSFER, ///< The cargo is moved as part of a transfer.
MTA_UNLOAD, ///< The cargo is moved as part of a forced unload.
};
protected:
uint count; ///< Cache for the number of cargo entities.
uint cargo_days_in_transit; ///< Cache for the sum of number of days in transit of each entity; comparable to man-hours.
Tcont packets; ///< The cargo packets in this list.
List packets; ///< The cargo packets in this list.
void AddToCache(const CargoPacket *cp);
void RemoveFromCache(const CargoPacket *cp, uint count);
static bool TryMerge(CargoPacket *cp, CargoPacket *icp);
void RemoveFromCache(const CargoPacket *cp);
public:
/** Create the cargo list. */
@@ -258,11 +203,38 @@ public:
* Returns a pointer to the cargo packet list (so you can iterate over it etc).
* @return Pointer to the packet list.
*/
inline const Tcont *Packets() const
inline const List *Packets() const
{
return &this->packets;
}
/**
* Checks whether this list is empty.
* @return True if and only if the list is empty.
*/
inline bool Empty() const
{
return this->count == 0;
}
/**
* Returns the number of cargo entities in this list.
* @return The before mentioned number.
*/
inline uint Count() const
{
return this->count;
}
/**
* Returns source of the first cargo packet in this list.
* @return The before mentioned source.
*/
inline StationID Source() const
{
return this->Empty() ? INVALID_STATION : this->packets.front()->source;
}
/**
* Returns average number of days in transit for a cargo entity.
* @return The before mentioned number.
@@ -272,73 +244,35 @@ public:
return this->count == 0 ? 0 : this->cargo_days_in_transit / this->count;
}
void Append(CargoPacket *cp);
void Truncate(uint max_remaining);
template <class Tother_inst>
bool MoveTo(Tother_inst *dest, uint count, MoveToAction mta, CargoPayment *payment, uint data = 0);
void InvalidateCache();
};
typedef std::list<CargoPacket *> CargoPacketList;
/**
* CargoList that is used for vehicles.
*/
class VehicleCargoList : public CargoList<VehicleCargoList, CargoPacketList> {
class VehicleCargoList : public CargoList<VehicleCargoList> {
protected:
/** The (direct) parent of this class. */
typedef CargoList<VehicleCargoList, CargoPacketList> Parent;
typedef CargoList<VehicleCargoList> Parent;
Money feeder_share; ///< Cache for the feeder share.
uint action_counts[NUM_MOVE_TO_ACTION]; ///< Counts of cargo to be transfered, delivered, kept and loaded.
template<class Taction>
void ShiftCargo(Taction action);
template<class Taction>
void PopCargo(Taction action);
/**
* Assert that the designation counts add up.
*/
inline void AssertCountConsistency() const
{
assert(this->action_counts[MTA_KEEP] +
this->action_counts[MTA_DELIVER] +
this->action_counts[MTA_TRANSFER] +
this->action_counts[MTA_LOAD] == this->count);
}
Money feeder_share; ///< Cache for the feeder share.
void AddToCache(const CargoPacket *cp);
void RemoveFromCache(const CargoPacket *cp, uint count);
void AddToMeta(const CargoPacket *cp, MoveToAction action);
void RemoveFromMeta(const CargoPacket *cp, MoveToAction action, uint count);
static MoveToAction ChooseAction(const CargoPacket *cp, StationID cargo_next,
StationID current_station, bool accepted, StationIDStack next_station);
void RemoveFromCache(const CargoPacket *cp);
public:
/** The station cargo list needs to control the unloading. */
friend class StationCargoList;
/** The super class ought to know what it's doing. */
friend class CargoList<VehicleCargoList, CargoPacketList>;
friend class CargoList<VehicleCargoList>;
/** The vehicles have a cargo list (and we want that saved). */
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
friend class CargoShift;
friend class CargoTransfer;
friend class CargoDelivery;
template<class Tsource>
friend class CargoRemoval;
friend class CargoReturn;
friend class VehicleCargoReroute;
/**
* Returns source of the first cargo packet in this list.
* @return The before mentioned source.
*/
inline StationID Source() const
{
return this->count == 0 ? INVALID_STATION : this->packets.front()->source;
}
/**
* Returns total sum of the feeder share for all packets.
* @return The before mentioned number.
@@ -348,95 +282,10 @@ public:
return this->feeder_share;
}
/**
* Returns the amount of cargo designated for a given purpose.
* @param action Action the cargo is designated for.
* @return Amount of cargo designated for the given action.
*/
inline uint ActionCount(MoveToAction action) const
{
return this->action_counts[action];
}
/**
* Returns sum of cargo on board the vehicle (ie not only
* reserved).
* @return Cargo on board the vehicle.
*/
inline uint StoredCount() const
{
return this->count - this->action_counts[MTA_LOAD];
}
/**
* Returns sum of cargo, including reserved cargo.
* @return Sum of cargo.
*/
inline uint TotalCount() const
{
return this->count;
}
/**
* Returns sum of reserved cargo.
* @return Sum of reserved cargo.
*/
inline uint ReservedCount() const
{
return this->action_counts[MTA_LOAD];
}
/**
* Returns sum of cargo to be moved out of the vehicle at the current station.
* @return Cargo to be moved.
*/
inline uint UnloadCount() const
{
return this->action_counts[MTA_TRANSFER] + this->action_counts[MTA_DELIVER];
}
/**
* Returns the sum of cargo to be kept in the vehicle at the current station.
* @return Cargo to be kept or loaded.
*/
inline uint RemainingCount() const
{
return this->action_counts[MTA_KEEP] + this->action_counts[MTA_LOAD];
}
void Append(CargoPacket *cp, MoveToAction action = MTA_KEEP);
void AgeCargo();
void InvalidateCache();
void SetTransferLoadPlace(TileIndex xy);
bool Stage(bool accepted, StationID current_station, StationIDStack next_station, uint8 order_flags, const GoodsEntry *ge, CargoPayment *payment);
/**
* Marks all cargo in the vehicle as to be kept. This is mostly useful for
* loading old savegames. When loading is aborted the reserved cargo has
* to be returned first.
*/
inline void KeepAll()
{
this->action_counts[MTA_DELIVER] = this->action_counts[MTA_TRANSFER] = this->action_counts[MTA_LOAD] = 0;
this->action_counts[MTA_KEEP] = this->count;
}
/* Methods for moving cargo around. First parameter is always maximum
* amount of cargo to be moved. Second parameter is destination (if
* applicable), return value is amount of cargo actually moved. */
template<MoveToAction Tfrom, MoveToAction Tto>
uint Reassign(uint max_move, TileOrStationID update = INVALID_TILE);
uint Return(uint max_move, StationCargoList *dest, StationID next_station);
uint Unload(uint max_move, StationCargoList *dest, CargoPayment *payment);
uint Shift(uint max_move, VehicleCargoList *dest);
uint Truncate(uint max_move = UINT_MAX);
uint Reroute(uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge);
/**
* Are two the two CargoPackets mergeable in the context of
* a list of CargoPackets for a Vehicle?
@@ -454,104 +303,16 @@ public:
}
};
typedef MultiMap<StationID, CargoPacket *> StationCargoPacketMap;
typedef std::map<StationID, uint> StationCargoAmountMap;
/**
* CargoList that is used for stations.
*/
class StationCargoList : public CargoList<StationCargoList, StationCargoPacketMap> {
protected:
/** The (direct) parent of this class. */
typedef CargoList<StationCargoList, StationCargoPacketMap> Parent;
uint reserved_count; ///< Amount of cargo being reserved for loading.
class StationCargoList : public CargoList<StationCargoList> {
public:
/** The super class ought to know what it's doing. */
friend class CargoList<StationCargoList, StationCargoPacketMap>;
friend class CargoList<StationCargoList>;
/** The stations, via GoodsEntry, have a CargoList. */
friend const struct SaveLoad *GetGoodsDesc();
friend class CargoLoad;
friend class CargoTransfer;
template<class Tsource>
friend class CargoRemoval;
friend class CargoReservation;
friend class CargoReturn;
friend class StationCargoReroute;
static void InvalidateAllFrom(SourceType src_type, SourceID src);
template<class Taction>
bool ShiftCargo(Taction &action, StationID next);
template<class Taction>
uint ShiftCargo(Taction action, StationIDStack next, bool include_invalid);
void Append(CargoPacket *cp, StationID next);
/**
* Check for cargo headed for a specific station.
* @param next Station the cargo is headed for.
* @return If there is any cargo for that station.
*/
inline bool HasCargoFor(StationIDStack next) const
{
while (!next.IsEmpty()) {
if (this->packets.find(next.Pop()) != this->packets.end()) return true;
}
/* Packets for INVALID_STTION can go anywhere. */
return this->packets.find(INVALID_STATION) != this->packets.end();
}
/**
* Returns source of the first cargo packet in this list.
* @return The before mentioned source.
*/
inline StationID Source() const
{
return this->count == 0 ? INVALID_STATION : this->packets.begin()->second.front()->source;
}
/**
* Returns sum of cargo still available for loading at the sation.
* (i.e. not counting cargo which is already reserved for loading)
* @return Cargo on board the vehicle.
*/
inline uint AvailableCount() const
{
return this->count;
}
/**
* Returns sum of cargo reserved for loading onto vehicles.
* @return Cargo reserved for loading.
*/
inline uint ReservedCount() const
{
return this->reserved_count;
}
/**
* Returns total count of cargo at the station, including
* cargo which is already reserved for loading.
* @return Total cargo count.
*/
inline uint TotalCount() const
{
return this->count + this->reserved_count;
}
/* Methods for moving cargo around. First parameter is always maximum
* amount of cargo to be moved. Second parameter is destination (if
* applicable), return value is amount of cargo actually moved. */
uint Reserve(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next);
uint Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next);
uint Truncate(uint max_move = UINT_MAX, StationCargoAmountMap *cargo_per_source = NULL);
uint Reroute(uint max_move, StationCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge);
/**
* Are two the two CargoPackets mergeable in the context of
* a list of CargoPackets for a Vehicle?

View File

@@ -24,7 +24,6 @@
#include "rail_gui.h"
#include "settings_gui.h"
#include "company_gui.h"
#include "linkgraph/linkgraphschedule.h"
#include "widgets/cheat_widget.h"
@@ -101,9 +100,7 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
p1 = Clamp(p1, MIN_YEAR, MAX_YEAR);
if (p1 == _cur_year) return _cur_year;
Date new_date = ConvertYMDToDate(p1, ymd.month, ymd.day);
LinkGraphSchedule::Instance()->ShiftDates(new_date - _date);
SetDate(new_date, _date_fract);
SetDate(ConvertYMDToDate(p1, ymd.month, ymd.day), _date_fract);
EnginesMonthlyLoop();
SetWindowDirty(WC_STATUS_BAR, 0);
InvalidateWindowClassesData(WC_BUILD_STATION, 0);
@@ -173,9 +170,9 @@ struct CheatWindow : Window {
int clicked;
int header_height;
CheatWindow(WindowDesc *desc) : Window(desc)
CheatWindow(const WindowDesc *desc) : Window()
{
this->InitNested();
this->InitNested(desc);
}
virtual void DrawWidget(const Rect &r, int widget) const
@@ -351,8 +348,8 @@ struct CheatWindow : Window {
};
/** Window description of the cheats GUI. */
static WindowDesc _cheats_desc(
WDP_AUTO, "cheats", 0, 0,
static const WindowDesc _cheats_desc(
WDP_AUTO, 0, 0,
WC_CHEATS, WC_NONE,
0,
_nested_cheat_widgets, lengthof(_nested_cheat_widgets)

View File

@@ -65,33 +65,33 @@ static void DrawClearLandFence(const TileInfo *ti)
int maxz = GetSlopeMaxPixelZ(ti->tileh);
uint fence_nw = GetFence(ti->tile, DIAGDIR_NW);
if (fence_nw != 0) {
bool fence_nw = GetFenceNW(ti->tile) != 0;
if (fence_nw) {
int z = GetSlopePixelZInCorner(ti->tileh, CORNER_W);
SpriteID sprite = _clear_land_fence_sprites[fence_nw - 1] + _fence_mod_by_tileh_nw[ti->tileh];
SpriteID sprite = _clear_land_fence_sprites[GetFenceNW(ti->tile) - 1] + _fence_mod_by_tileh_nw[ti->tileh];
AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x, ti->y - 15, 16, 31, maxz - z + 4, ti->z + z, false, 0, 15, -z);
}
uint fence_ne = GetFence(ti->tile, DIAGDIR_NE);
if (fence_ne != 0) {
bool fence_ne = GetFenceNE(ti->tile) != 0;
if (fence_ne) {
int z = GetSlopePixelZInCorner(ti->tileh, CORNER_E);
SpriteID sprite = _clear_land_fence_sprites[fence_ne - 1] + _fence_mod_by_tileh_ne[ti->tileh];
SpriteID sprite = _clear_land_fence_sprites[GetFenceNE(ti->tile) - 1] + _fence_mod_by_tileh_ne[ti->tileh];
AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x - 15, ti->y, 31, 16, maxz - z + 4, ti->z + z, false, 15, 0, -z);
}
uint fence_sw = GetFence(ti->tile, DIAGDIR_SW);
uint fence_se = GetFence(ti->tile, DIAGDIR_SE);
bool fence_sw = GetFenceSW(ti->tile) != 0;
bool fence_se = GetFenceSE(ti->tile) != 0;
if (fence_sw != 0 || fence_se != 0) {
if (fence_sw || fence_se) {
int z = GetSlopePixelZInCorner(ti->tileh, CORNER_S);
if (fence_sw != 0) {
SpriteID sprite = _clear_land_fence_sprites[fence_sw - 1] + _fence_mod_by_tileh_sw[ti->tileh];
if (fence_sw) {
SpriteID sprite = _clear_land_fence_sprites[GetFenceSW(ti->tile) - 1] + _fence_mod_by_tileh_sw[ti->tileh];
AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x, ti->y, 16, 16, maxz - z + 4, ti->z + z, false, 0, 0, -z);
}
if (fence_se != 0) {
SpriteID sprite = _clear_land_fence_sprites[fence_se - 1] + _fence_mod_by_tileh_se[ti->tileh];
if (fence_se) {
SpriteID sprite = _clear_land_fence_sprites[GetFenceSE(ti->tile) - 1] + _fence_mod_by_tileh_se[ti->tileh];
AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x, ti->y, 16, 16, maxz - z + 4, ti->z + z, false, 0, 0, -z);
}
}
@@ -146,26 +146,26 @@ static void UpdateFences(TileIndex tile)
bool dirty = false;
bool neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_SW) == 0) {
SetFence(tile, DIAGDIR_SW, 3);
if (!neighbour && GetFenceSW(tile) == 0) {
SetFenceSW(tile, 3);
dirty = true;
}
neighbour = (IsTileType(TILE_ADDXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, 1), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_SE) == 0) {
SetFence(tile, DIAGDIR_SE, 3);
if (!neighbour && GetFenceSE(tile) == 0) {
SetFenceSE(tile, 3);
dirty = true;
}
neighbour = (IsTileType(TILE_ADDXY(tile, -1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, -1, 0), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_NE) == 0) {
SetFence(tile, DIAGDIR_NE, 3);
if (!neighbour && GetFenceNE(tile) == 0) {
SetFenceNE(tile, 3);
dirty = true;
}
neighbour = (IsTileType(TILE_ADDXY(tile, 0, -1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, -1), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_NW) == 0) {
SetFence(tile, DIAGDIR_NW, 3);
if (!neighbour && GetFenceNW(tile) == 0) {
SetFenceNW(tile, 3);
dirty = true;
}
@@ -249,7 +249,8 @@ static void TileLoop_Clear(TileIndex tile)
/* If the tile is at any edge flood it to prevent maps without water. */
if (_settings_game.construction.freeform_edges && DistanceFromEdge(tile) == 1) {
int z;
if (IsTileFlat(tile, &z) && z == 0) {
Slope slope = GetTileSlope(tile, &z);
if (z == 0 && slope == SLOPE_FLAT) {
DoFloodTile(tile);
MarkTileDirtyByTile(tile);
return;

View File

@@ -214,41 +214,103 @@ static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
/**
* Is there a fence at the given border?
* Is there a fence at the south eastern border?
* @param t the tile to check for fences
* @param side the border to check
* @pre IsClearGround(t, CLEAR_FIELDS)
* @return 0 if there is no fence, otherwise the fence type
*/
static inline uint GetFence(TileIndex t, DiagDirection side)
static inline uint GetFenceSE(TileIndex t)
{
assert(IsClearGround(t, CLEAR_FIELDS));
switch (side) {
default: NOT_REACHED();
case DIAGDIR_SE: return GB(_m[t].m4, 2, 3);
case DIAGDIR_SW: return GB(_m[t].m4, 5, 3);
case DIAGDIR_NE: return GB(_m[t].m3, 5, 3);
case DIAGDIR_NW: return GB(_m[t].m6, 2, 3);
}
return GB(_m[t].m4, 2, 3);
}
/**
* Sets the type of fence (and whether there is one) for the given border.
* Sets the type of fence (and whether there is one) for the south
* eastern border.
* @param t the tile to check for fences
* @param side the border to check
* @param h 0 if there is no fence, otherwise the fence type
* @pre IsClearGround(t, CLEAR_FIELDS)
*/
static inline void SetFence(TileIndex t, DiagDirection side, uint h)
static inline void SetFenceSE(TileIndex t, uint h)
{
assert(IsClearGround(t, CLEAR_FIELDS));
switch (side) {
default: NOT_REACHED();
case DIAGDIR_SE: SB(_m[t].m4, 2, 3, h); break;
case DIAGDIR_SW: SB(_m[t].m4, 5, 3, h); break;
case DIAGDIR_NE: SB(_m[t].m3, 5, 3, h); break;
case DIAGDIR_NW: SB(_m[t].m6, 2, 3, h); break;
}
SB(_m[t].m4, 2, 3, h);
}
/**
* Is there a fence at the south western border?
* @param t the tile to check for fences
* @pre IsClearGround(t, CLEAR_FIELDS)
* @return 0 if there is no fence, otherwise the fence type
*/
static inline uint GetFenceSW(TileIndex t)
{
assert(IsClearGround(t, CLEAR_FIELDS));
return GB(_m[t].m4, 5, 3);
}
/**
* Sets the type of fence (and whether there is one) for the south
* western border.
* @param t the tile to check for fences
* @param h 0 if there is no fence, otherwise the fence type
* @pre IsClearGround(t, CLEAR_FIELDS)
*/
static inline void SetFenceSW(TileIndex t, uint h)
{
assert(IsClearGround(t, CLEAR_FIELDS));
SB(_m[t].m4, 5, 3, h);
}
/**
* Is there a fence at the north eastern border?
* @param t the tile to check for fences
* @pre IsClearGround(t, CLEAR_FIELDS)
* @return 0 if there is no fence, otherwise the fence type
*/
static inline uint GetFenceNE(TileIndex t)
{
assert(IsClearGround(t, CLEAR_FIELDS));
return GB(_m[t].m3, 5, 3);
}
/**
* Sets the type of fence (and whether there is one) for the north
* eastern border.
* @param t the tile to check for fences
* @param h 0 if there is no fence, otherwise the fence type
* @pre IsClearGround(t, CLEAR_FIELDS)
*/
static inline void SetFenceNE(TileIndex t, uint h)
{
assert(IsClearGround(t, CLEAR_FIELDS));
SB(_m[t].m3, 5, 3, h);
}
/**
* Is there a fence at the north western border?
* @param t the tile to check for fences
* @pre IsClearGround(t, CLEAR_FIELDS)
* @return 0 if there is no fence, otherwise the fence type
*/
static inline uint GetFenceNW(TileIndex t)
{
assert(IsClearGround(t, CLEAR_FIELDS));
return GB(_m[t].m6, 2, 3);
}
/**
* Sets the type of fence (and whether there is one) for the north
* western border.
* @param t the tile to check for fences
* @param h 0 if there is no fence, otherwise the fence type
* @pre IsClearGround(t, CLEAR_FIELDS)
*/
static inline void SetFenceNW(TileIndex t, uint h)
{
assert(IsClearGround(t, CLEAR_FIELDS));
SB(_m[t].m6, 2, 3, h);
}

View File

@@ -142,7 +142,6 @@ CommandProc CmdClearArea;
CommandProc CmdGiveMoney;
CommandProc CmdMoneyCheat;
CommandProc CmdChangeBankBalance;
CommandProc CmdBuildCanal;
CommandProc CmdBuildLock;
@@ -151,19 +150,8 @@ CommandProc CmdCompanyCtrl;
CommandProc CmdCustomNewsItem;
CommandProc CmdCreateGoal;
CommandProc CmdRemoveGoal;
CommandProc CmdSetGoalText;
CommandProc CmdSetGoalProgress;
CommandProc CmdSetGoalCompleted;
CommandProc CmdGoalQuestion;
CommandProc CmdGoalQuestionAnswer;
CommandProc CmdCreateStoryPage;
CommandProc CmdCreateStoryPageElement;
CommandProc CmdUpdateStoryPageElement;
CommandProc CmdSetStoryPageTitle;
CommandProc CmdSetStoryPageDate;
CommandProc CmdShowStoryPage;
CommandProc CmdRemoveStoryPage;
CommandProc CmdRemoveStoryPageElement;
CommandProc CmdLevelLand;
@@ -221,7 +209,7 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdRemoveFromRailStation, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_FROM_RAIL_STATION
DEF_CMD(CmdConvertRail, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_CONVERT_RAILD
DEF_CMD(CmdBuildRailWaypoint, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_RAIL_WAYPOINT
DEF_CMD(CmdRenameWaypoint, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_WAYPOINT
DEF_CMD(CmdRenameWaypoint, CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_WAYPOINT
DEF_CMD(CmdRemoveFromRailWaypoint, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_FROM_RAIL_WAYPOINT
DEF_CMD(CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_ROAD_STOP
@@ -246,7 +234,7 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdForceTrainProceed, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_FORCE_TRAIN_PROCEED
DEF_CMD(CmdReverseTrainDirection, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_REVERSE_TRAIN_DIRECTION
DEF_CMD(CmdClearOrderBackup, CMD_CLIENT_ID, CMDT_SERVER_SETTING ), // CMD_CLEAR_ORDER_BACKUP
DEF_CMD(CmdClearOrderBackup, CMD_CLIENT_ID, CMDT_ROUTE_MANAGEMENT ), // CMD_CLEAR_ORDER_BACKUP
DEF_CMD(CmdModifyOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_MODIFY_ORDER
DEF_CMD(CmdSkipToOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_SKIP_TO_ORDER
DEF_CMD(CmdDeleteOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_DELETE_ORDER
@@ -283,8 +271,8 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdSellShareInCompany, 0, CMDT_MONEY_MANAGEMENT ), // CMD_SELL_SHARE_IN_COMPANY
DEF_CMD(CmdBuyCompany, 0, CMDT_MONEY_MANAGEMENT ), // CMD_BUY_COMANY
DEF_CMD(CmdFoundTown, CMD_DEITY | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_FOUND_TOWN; founding random town can fail only in exec run
DEF_CMD(CmdRenameTown, CMD_DEITY | CMD_SERVER, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_TOWN
DEF_CMD(CmdFoundTown, CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_FOUND_TOWN; founding random town can fail only in exec run
DEF_CMD(CmdRenameTown, CMD_SERVER, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_TOWN
DEF_CMD(CmdDoTownAction, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_DO_TOWN_ACTION
DEF_CMD(CmdTownCargoGoal, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_TOWN_CARGO_GOAL
DEF_CMD(CmdTownGrowthRate, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_TOWN_GROWTH_RATE
@@ -298,26 +286,14 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdClearArea, CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_CLEAR_AREA; destroying multi-tile houses makes town rating differ between test and execution
DEF_CMD(CmdMoneyCheat, CMD_OFFLINE, CMDT_CHEAT ), // CMD_MONEY_CHEAT
DEF_CMD(CmdChangeBankBalance, CMD_DEITY, CMDT_MONEY_MANAGEMENT ), // CMD_CHANGE_BANK_BALANCE
DEF_CMD(CmdBuildCanal, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_CANAL
DEF_CMD(CmdCreateSubsidy, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_SUBSIDY
DEF_CMD(CmdCompanyCtrl, CMD_SPECTATOR | CMD_CLIENT_ID, CMDT_SERVER_SETTING ), // CMD_COMPANY_CTRL
DEF_CMD(CmdCustomNewsItem, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CUSTOM_NEWS_ITEM
DEF_CMD(CmdCreateGoal, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_GOAL
DEF_CMD(CmdRemoveGoal, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_GOAL
DEF_CMD(CmdSetGoalText, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_GOAL_TEXT
DEF_CMD(CmdSetGoalProgress, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_GOAL_PROGRESS
DEF_CMD(CmdSetGoalCompleted, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_GOAL_COMPLETED
DEF_CMD(CmdGoalQuestion, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_GOAL_QUESTION
DEF_CMD(CmdGoalQuestionAnswer, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_GOAL_QUESTION_ANSWER
DEF_CMD(CmdCreateStoryPage, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_STORY_PAGE
DEF_CMD(CmdCreateStoryPageElement, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_STORY_PAGE_ELEMENT
DEF_CMD(CmdUpdateStoryPageElement, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_UPDATE_STORY_PAGE_ELEMENT
DEF_CMD(CmdSetStoryPageTitle, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_STORY_PAGE_TITLE
DEF_CMD(CmdSetStoryPageDate, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_STORY_PAGE_DATE
DEF_CMD(CmdShowStoryPage, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SHOW_STORY_PAGE
DEF_CMD(CmdRemoveStoryPage, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_STORY_PAGE
DEF_CMD(CmdRemoveStoryPageElement, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_STORY_ELEMENT_PAGE
DEF_CMD(CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once
@@ -575,7 +551,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Only show the error when it's for us. */
StringID error_part1 = GB(cmd, 16, 16);
if (estimate_only || (IsLocalCompany() && error_part1 != 0 && my_cmd)) {
ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y, res.GetTextRefStackGRF(), res.GetTextRefStackSize(), res.GetTextRefStack());
ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y, res.GetTextRefStackSize(), res.GetTextRefStack());
}
} else if (estimate_only) {
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
@@ -601,7 +577,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
* @param cmd the command cost to return.
* @param clear whether to keep the storage changes or not.
*/
#define return_dcpi(cmd) { _docommand_recursive = 0; return cmd; }
#define return_dcpi(cmd, clear) { _docommand_recursive = 0; ClearStorageChanges(clear); return cmd; }
/*!
* Helper function for the toplevel network safe docommand function for the current company.
@@ -645,7 +621,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
#endif
/* Do not even think about executing out-of-bounds tile-commands */
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return_dcpi(CMD_ERROR);
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return_dcpi(CMD_ERROR, false);
/* Always execute server and spectator commands as spectator */
bool exec_as_spectator = (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) != 0;
@@ -654,7 +630,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* The server will ditch any server commands a client sends to it, so effectively
* this guards the server from executing functions for an invalid company. */
if (_game_mode == GM_NORMAL && !exec_as_spectator && !Company::IsValidID(_current_company) && !(_current_company == OWNER_DEITY && (cmd_flags & CMD_DEITY) != 0)) {
return_dcpi(CMD_ERROR);
return_dcpi(CMD_ERROR, false);
}
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
@@ -665,9 +641,8 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Test the command. */
_cleared_object_areas.Clear();
SetTownRatingTestMode(true);
BasePersistentStorageArray::SwitchMode(PSM_ENTER_TESTMODE);
ClearStorageChanges(false);
CommandCost res = proc(tile, flags, p1, p2, text);
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_TESTMODE);
SetTownRatingTestMode(false);
/* Make sure we're not messing things up here. */
@@ -686,7 +661,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
DEBUG(desync, 1, "cmdf: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
}
cur_company.Restore();
return_dcpi(res);
return_dcpi(res, false);
}
#ifdef ENABLE_NETWORK
@@ -702,7 +677,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* This way it's not handled by DoCommand and only the
* actual execution of the command causes messages. Also
* reset the storages as we've not executed the command. */
return_dcpi(CommandCost());
return_dcpi(CommandCost(), false);
}
#endif /* ENABLE_NETWORK */
DEBUG(desync, 1, "cmd: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
@@ -710,9 +685,8 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Actually try and execute the command. If no cost-type is given
* use the construction one */
_cleared_object_areas.Clear();
BasePersistentStorageArray::SwitchMode(PSM_ENTER_COMMAND);
ClearStorageChanges(false);
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_COMMAND);
if (cmd_id == CMD_COMPANY_CTRL) {
cur_company.Trash();
@@ -733,7 +707,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
if (!test_and_exec_can_differ) {
assert(res.GetCost() == res2.GetCost() && res.Failed() == res2.Failed()); // sanity check
} else if (res2.Failed()) {
return_dcpi(res2);
return_dcpi(res2, false);
}
/* If we're needing more money and we haven't done
@@ -743,7 +717,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* So make sure the signal buffer is empty even in this case */
UpdateSignalsInBuffer();
SetDParam(0, _additional_cash_required);
return_dcpi(CommandCost(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY));
return_dcpi(CommandCost(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY), false);
}
/* update last build coordinate of company. */
@@ -757,7 +731,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* update signals if needed */
UpdateSignalsInBuffer();
return_dcpi(res2);
return_dcpi(res2, true);
}
#undef return_dcpi
@@ -785,15 +759,13 @@ uint32 CommandCost::textref_stack[16];
/**
* Activate usage of the NewGRF #TextRefStack for the error message.
* @param grffile NewGRF that provides the #TextRefStack
* @param num_registers number of entries to copy from the temporary NewGRF registers
* @param number of entries to copy from the temporary NewGRF registers
*/
void CommandCost::UseTextRefStack(const GRFFile *grffile, uint num_registers)
void CommandCost::UseTextRefStack(uint num_registers)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
assert(num_registers < lengthof(textref_stack));
this->textref_stack_grffile = grffile;
this->textref_stack_size = num_registers;
for (uint i = 0; i < num_registers; i++) {
textref_stack[i] = _temp_store.GetValue(0x100 + i);

View File

@@ -16,8 +16,6 @@
#include "strings_type.h"
#include "tile_type.h"
struct GRFFile;
/**
* Common return value for all commands. Wraps the cost and
* a possible error message/state together.
@@ -27,7 +25,6 @@ class CommandCost {
Money cost; ///< The cost of this action
StringID message; ///< Warning message for when success is unset
bool success; ///< Whether the comment went fine up to this moment
const GRFFile *textref_stack_grffile; ///< NewGRF providing the #TextRefStack content.
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
static uint32 textref_stack[16];
@@ -36,25 +33,25 @@ public:
/**
* Creates a command cost return with no cost and no error
*/
CommandCost() : expense_type(INVALID_EXPENSES), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_grffile(NULL), textref_stack_size(0) {}
CommandCost() : expense_type(INVALID_EXPENSES), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_size(0) {}
/**
* Creates a command return value the is failed with the given message
*/
explicit CommandCost(StringID msg) : expense_type(INVALID_EXPENSES), cost(0), message(msg), success(false), textref_stack_grffile(NULL), textref_stack_size(0) {}
explicit CommandCost(StringID msg) : expense_type(INVALID_EXPENSES), cost(0), message(msg), success(false), textref_stack_size(0) {}
/**
* Creates a command cost with given expense type and start cost of 0
* @param ex_t the expense type
*/
explicit CommandCost(ExpensesType ex_t) : expense_type(ex_t), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_grffile(NULL), textref_stack_size(0) {}
explicit CommandCost(ExpensesType ex_t) : expense_type(ex_t), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_size(0) {}
/**
* Creates a command return value with the given start cost and expense type
* @param ex_t the expense type
* @param cst the initial cost of this command
*/
CommandCost(ExpensesType ex_t, const Money &cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true), textref_stack_grffile(NULL), textref_stack_size(0) {}
CommandCost(ExpensesType ex_t, const Money &cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true), textref_stack_size(0) {}
/**
@@ -106,16 +103,7 @@ public:
this->message = message;
}
void UseTextRefStack(const GRFFile *grffile, uint num_registers);
/**
* Returns the NewGRF providing the #TextRefStack of the error message.
* @return the NewGRF.
*/
const GRFFile *GetTextRefStackGRF() const
{
return this->textref_stack_grffile;
}
void UseTextRefStack(uint num_registers);
/**
* Returns the number of uint32 values for the #TextRefStack of the error message.
@@ -271,7 +259,6 @@ enum Commands {
CMD_CLEAR_AREA, ///< clear an area
CMD_MONEY_CHEAT, ///< do the money cheat
CMD_CHANGE_BANK_BALANCE, ///< change bank balance to charge costs or give money from a GS
CMD_BUILD_CANAL, ///< build a canal
CMD_CREATE_SUBSIDY, ///< create a new subsidy
@@ -279,19 +266,8 @@ enum Commands {
CMD_CUSTOM_NEWS_ITEM, ///< create a custom news message
CMD_CREATE_GOAL, ///< create a new goal
CMD_REMOVE_GOAL, ///< remove a goal
CMD_SET_GOAL_TEXT, ///< update goal text of a goal
CMD_SET_GOAL_PROGRESS, ///< update goal progress text of a goal
CMD_SET_GOAL_COMPLETED, ///< update goal completed status of a goal
CMD_GOAL_QUESTION, ///< ask a goal related question
CMD_GOAL_QUESTION_ANSWER, ///< answer(s) to CMD_GOAL_QUESTION
CMD_CREATE_STORY_PAGE, ///< create a new story page
CMD_CREATE_STORY_PAGE_ELEMENT, ///< create a new story page element
CMD_UPDATE_STORY_PAGE_ELEMENT, ///< update a story page element
CMD_SET_STORY_PAGE_TITLE, ///< update title of a story page
CMD_SET_STORY_PAGE_DATE, ///< update date of a story page
CMD_SHOW_STORY_PAGE, ///< show a story page
CMD_REMOVE_STORY_PAGE, ///< remove a story page
CMD_REMOVE_STORY_PAGE_ELEMENT, ///< remove a story page element
CMD_LEVEL_LAND, ///< level land
CMD_BUILD_LOCK, ///< build a lock

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