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

Compare commits

..

81 Commits

Author SHA1 Message Date
rubidium
2e4ae0588a (svn r26135) [1.3] -Update documentation
[1.3] -Backport from trunk:
- Fix: Aircraft crashing near the map's border due to a lack of airports could trigger a crash [FS#5820] (r26134)
2013-11-29 12:10:22 +00:00
rubidium
184a94510b (svn r26095) [1.3] -Update: documentation 2013-11-24 19:59:51 +00:00
rubidium
c4273e5d93 (svn r26094) [1.3] -Backport from trunk:
- Fix: [Script] Prevent scripts from crashing OpenTTD when they send text with command codes to user editable texts such as sign and station names [FS#5818] (r26093, r26092)
- Fix: Occasional hanging when client joins [FS#5811] (r26043)
- Fix: Multi line text was handled incorrectly causing glitches [FS#5809] (r26037, r26036)
- Language updates
2013-11-24 19:57:23 +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
539 changed files with 9547 additions and 31424 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

@@ -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

@@ -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.

Binary file not shown.

Binary file not shown.

View File

@@ -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

@@ -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

@@ -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

@@ -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

@@ -35,7 +35,6 @@ description.ja_JP = Transport Tycoon Deluxe オリジナル版 音楽 (Windows)
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

@@ -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/>.
*/

View File

@@ -1,105 +1,3 @@
1.4.0-beta2 (2014-01-07)
------------------------------------------------------------------------
- Feature: Blitter autoselection is now based on full animation state, so a non-animated specialised blitter will generally be chosen when animation is turned off (r26217)
- Feature: Specialised animated SSE4 blitter, and non-animated SSE4.1, SSSE3 and SSE2 blitters, improving the blitting significantly in many situations (r26214, r26213, r26212, r26211)
- Feature: Specialised SSE 4.1 sprite sorter, improving the sorting performance significantly (r26205)
- Fix: Validate everything from ini, obg, obs, obs, ... files [FS#5829] (r26206)
- Fix: Allow refitting at station if cargo has already been reserved (r26187)
- Fix: Visual effects did not work for articulated RV parts (r26180)
1.4.0-beta1 (2013-12-24)
------------------------------------------------------------------------
- Feature: [NewGRF] Vehicle variable 4D for determining the position within an articulated vehicle (r26157)
- Feature: [NewGRF] Invalidate vehicle colour palette when leaving a station [FS#5669] (r26027)
- Feature: [NoGo] New goal type that show a story page when clicked (r26012)
- Feature: Optional filter parameter to the 'content state' console command, to limit the content list to only content where the name match the filter (r26000)
- Feature: When calling the 'content select' console command without args, display all selected content (r25999)
- Feature: XDG base directory support [FS#5385] (r25975)
- Feature: [Script] ScriptTown::GetFundBuildingsDuration (r25969)
- Feature: [Script] ScriptTown::TOWN_GROWTH_NONE to indicate no town growth via ScriptTown::SetGrowthRate and GetGrowthRate (r25968)
- Feature: [NoGo] GSTown::TOWN_GROWTH_NORMAL to reset a town growth rate set previously via GSTown::SetGrowthRate (r25967)
- Feature: [NewGRF Debugging] Inspecting other vehicles in a chain (r25946)
- Feature: [NewGRF] Object property 0x18 to allow specifying the number of objects of that type being placed upon map creation (r25878)
- Feature: [NewGRF] Object property 0x10, bit 13 indicating that object amount scales with water content of map border (e.g. used for lighthouses) (r25874)
- Feature: Highlight active goto item in order list dropdown [FS#5784] (r25859)
- Feature: [Admin] Send info on bankruptcy quarters also in ADMIN_PACKET_SERVER_COMPANY_INFO [FS#5756] (r25845)
- Feature: Increase maximum number of object instances on the map from 64k to about 16M (r25844)
- Feature: Increase the total number of object types from 256 to 64000 (r25835)
- Feature: [NewGRF] Increase the object class limit from 32 to 255 (r25831)
- Feature: Toggle button for wrapping lines in the textfile GUI [FS#5748] (r25816)
- Feature: [NoGo] Game Scripts can now charge fees and give money to companies (r25788)
- Feature: [Script] Allow AIs and GS to found towns. Allow GS to rename towns (r25785)
- Feature: Add keywords to the openttd.desktop.in file (r25783)
- Feature: Sticky and shade buttons for jukebox window [FS#5743] (r25776)
- Feature: Additional layered main toolbar arrangements (r25772)
- Feature: Allow implicit orders even if no explicit ones are given (r25735)
- Feature: [OSX] Pinch gesture support for zooming [FS#4760] (r25666)
- Feature: Split unit localisation choice into a choice per type of unit, and move it to the advanced settings (r25508)
- Feature: Have tractive effort in imperial (lbf) and metric (kgf) units, have weights and volumes in imperial units (short tons, gallons) [FS#5482] (r25508)
- Feature: Differentiate between total waiting cargo count and available (not reserved) cargo count in the station list and sort based on the cargo count, not the cargo value (r25405)
- Feature: Timetable spreading of vehicles by Ctrl+Click when setting a start date (r25377)
- Feature: Allow opening a goal list and story window specific to a company (r25372, r25369)
- Feature: Show cargo by next hops and final destinations in the station GUI (r25365)
- Feature: Consider cargo waiting at other stations for rating at the origin station (r25362)
- Feature: Distribute cargo according to plan given by linkgraph (r25361)
- Feature: [NoGo] GUI for viewing story pages (r25344)
- Feature: Add industry list to scenario editor's map menu (r25335)
- Feature: [NoGo] Allow more concurrent goals in a game (r25299)
- Feature: [NoGo] Goals can now have a progress text and/or be marked as completed (r25296)
- Feature: Allow saving window sizes as default sizes (r25295)
- Feature: Add another button to window title bars to resize the window to its default size (r25294)
- Feature: Save stickyness of windows when Ctrl+Clicking the sticky button (r25292)
- Feature: When opening the object-build window, restore the object build-window to the previous state (r25284)
- Feature: Show the approximate monthly supply to a station of the different cargoes (r25272)
- Feature: [Win32] Driver param for the DirectMusic driver to specify the ouput port to use [FS#5552] (r25269)
- Feature: Linkgraph overlay over main viewport (r25264)
- Feature: Linkgraph overlay for smallmap (r25262)
- Feature: Display imminent closure of an industry in its view window (r25238)
- Feature: [NewGRF] Expose sprite base of foundation and shore sprites via Action D Game Variables (r25230)
- Feature: [NewGRF] Variable 0x82 for canals and rivers (dike map) (r25229)
- Feature: [Script] ScriptStation::HasRating [FS#5514] (r25150)
- Feature: Add sorting on rating for the town directory window [FS#5288] (r25097)
- Feature: Introduce dropdown for selecting the sort criterion in the town directory window (r25094)
- Feature: Georgian Lari and Iranian Rial as currencies [FS#5212] (r25076)
- Feature: Collapse subtypes in the refit GUI and only expand them after selecting the cargo type (r25044)
- Feature: Only display subtypes in the refit GUI which are available for all selected vehicles. Also add a generic list item to refit while keeping the subtypes of individual vehicles [FS#3764] (r25043)
- Feature: Show the amount of cargo that has already been reserved by full loading vehicles in the station (r25013)
- Change: [NewGRF] Reset the temporary storage registers for every sprite resolving (r26173)
- Change: Improve layout of build-airport GUI [FS#5832] (r26165)
- Change: Make it slightly more clear what ports are coming from where in the debug output when listening (r25997)
- Change: Preselect the current replacement in the right-side list of the autoreplace GUI, instead of selecting the first resp. previous item [FS#5734] (r25919)
- Change: Unify behaviour when clicking on different items in the goto dropdown list when giving orders (r25894)
- Change: Do not offer subsidies for auto-distributed cargo [FS#5766] (r25882)
- Change: Allow to remove unowned objects unless they have the 'unremovable' flag (r25879)
- Change: In scenario editor allow to build all objects which were available at any point in the past to support building scenarios with historic items (r25875)
- Change: Display the cost to upgrade a bridge at the end of bridge that was clicked and not the other end, which could be outside of the screen in some cases (r25854)
- Change: [NewGRF] Lower the limit of airport tile types, house types, industry tile types and object types per NewGRF from 256 to 255 to prevent usage of ID 0xFF in Action3, and thus allowing it to become an extended byte somewhen (r25841, r25839, r25837, r25834)
- Change: Clarify the relevance of the permissible palettes (r25792)
- Change: [NewGRF] Invalidate vehicle recolour palette during (un)loading [FS#5669] (r25648)
- Change: If an editbox is configured to be cleared with ESC, but the editbox is already empty, unselect the editbox instead (r25647)
- Change: Make the bridge and object picker not restore their previous size, but the previously saved size (r25543)
- Change: Right align the infrastructure statistics [FS#5595] (r25515)
- Change: Clarify the meaning of the server advertisement settings (r25252)
- Fix: Unify the time a RV needs to travel through a curve [FS#5831] (r26169)
- Fix: Certain hotkeys crashed the content GUI when the list was empty [FS#5834] (r26167)
- Fix: Backup data of altered persistent storage arrays was freed twice [FS#5830] (r26161)
- Fix: [Script] Various API functions did not check whether ScrtipRoad::SetCurrentRoadType was called appropiately [FS#5825] (r26149)
- Fix: [Script] API failed for vehicles with only implicit orders [FS#5824] (r26148)
- Fix: Several fixes found by static code analysis (r26132, r26130-r26097, r26091-r26077, r26073-r26046)
- Fix: Invalidate vehicle colour palette again when rearranging consist, reversing, etc (r26026)
- Fix: [NoGo] Properly validate the range of the growth rate passed to GSTown::SetGrowthRate, instead of masking it to 16 bit (r25966)
- Fix: [Admin] The frame of a command packet was not set for the packets that were sent via the admin interface (r25770)
- Fix: [OSX] The new 10.7 fullscreen code can now also be compiled with older SDK versions [FS#4744] (r25657)
- Fix: Under certain circumstances a track type change would make the end-of-line-is-red setting ineffective [FS#5216] (r25609)
- Fix: Highlight the right entry in the sorting selector in station view window (r25426)
- Fix: Suppress focussing editboxes which are not visible (r25413)
- Fix: Add missing compatibility settings in afterload (r25390)
- Fix: Allow changing GS settings in-game via the AI/GS config window [FS#5507] (r25104)
- Fix: [NewGRF] Do not compare GRF local cargo subtype IDs from different GRFs (r25042)
- Remove: Ordered refit with subtypes, since the cases where it worked were corner cases rather than the general case [FS#3764] (r25041)
1.3.3 (2013-11-29)
------------------------------------------------------------------------
- Fix: Aircraft crashing near the map's border due to a lack of airports could trigger a crash [CVE-2013-6411] [FS#5820] (r26134)
@@ -198,7 +96,7 @@
- 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)
- Fix: [Script] Documentation implied that XXList::AddItem has a default for value if it is not filled in [FS#5638] (r25579, r25577)
- Fix: [Script] Documentation implied that XXList::AddItem has a default for value if it isn't filled in [FS#5638] (r25579, r25577)
- Fix: Layouter caused significant slowdown with text heavy windows, cache it to make it manageable (r25574, r25570, r25569, r25567, r25564)
- Fix: Make content list appear faster (r25573)
- Fix: Non-ICU layouter started new lines with the space which triggered the linebreak (r25568)
@@ -730,7 +628,7 @@
- Feature: [NoGo] Allow to chose the goal question window's title from a (small) set of options [FS#4992] (r23827)
- Feature: [NewGRF] Enhance some fatal NewGRF errors with the spritenumber that caused the problem (r23809)
- Fix: Loading empty GS strings/translations failed [FS#4996] (r23829)
- Fix: Return early from SlString() for empty strings, before doing invalid things which surprisingly do not break everything (r23828)
- Fix: Return early from SlString() for empty strings, before doing invalid things which surprisingly do not break everything. (r23828)
- Fix: The detailed performance rating window showed the cargo count of the current quarter instead of the last quarter like the tooltip says [FS#4972] (r23826)
- Fix: Removal of towns with 0 population failed during map generation [FS#4951] (r23819)
- Fix: [Network] Desync due to different NewGRF version at client and server [FS#4962] (r23817)

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"
@@ -2753,44 +2718,6 @@ detect_lzma() {
log 1 "checking liblzma... found"
}
detect_xdg_basedir() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$with_xdg_basedir" = "0" ]; then
log 1 "checking libxdg_basedir... disabled"
xdg_basedir_config=""
return 0
fi
if [ "$with_xdg_basedir" = "1" ] || [ "$with_xdg_basedir" = "" ] || [ "$with_xdg_basedir" = "2" ]; then
xdg_basedir_config="pkg-config libxdg-basedir"
else
xdg_basedir_config="$with_xdg_basedir"
fi
version=`$xdg_basedir_config --modversion 2>/dev/null`
ret=$?
log 2 "executing $xdg_basedir_config --modversion"
log 2 " returned $version"
log 2 " exit code $ret"
if [ -z "$version" ] || [ "$ret" != "0" ]; then
log 1 "checking libxdg_basedir... not found"
# It was forced, so it should be found.
if [ "$with_xdg_basedir" != "1" ]; then
log 1 "configure: error: pkg-config libxdg_basedir couldn't be found"
log 1 "configure: error: you supplied '$with_xdg_basedir', but it seems invalid"
exit 1
fi
xdg_basedir_config=""
return 0
fi
log 1 "checking libxdg_basedir... found"
}
detect_png() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$with_png" = "0" ]; then
@@ -3334,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"
@@ -3746,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)"
@@ -3758,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

@@ -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-01-07
Release version: 1.4.0-beta2
Last updated: 2013-11-29
Release version: 1.3.3
------------------------------------------------------------------------

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,15 +1,3 @@
openttd (1.4.0~beta2) 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) 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

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
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 0
!define APPV_BUILD 1
!define APPV_EXTRA "-beta2"
!define APPV_MINOR 3
!define APPV_MAINT 3
!define APPV_BUILD 2
!define APPV_EXTRA ""
!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,7 +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_subsidy.hpp" />
<ClInclude Include="..\src\script\api\script_subsidylist.hpp" />
<ClInclude Include="..\src\script\api\script_testmode.hpp" />
@@ -1097,7 +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_subsidy.cpp" />
<ClCompile Include="..\src\script\api\script_subsidylist.cpp" />
<ClCompile Include="..\src\script\api\script_testmode.cpp" />
@@ -1115,20 +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" />
<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" />
@@ -1250,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,9 +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_subsidy.hpp">
<Filter>Script API</Filter>
</ClInclude>
@@ -2520,9 +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_subsidy.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
@@ -2574,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>
@@ -2598,24 +2478,6 @@
<ClInclude Include="..\src\blitter\32bpp_simple.hpp">
<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>
@@ -2979,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,10 +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_subsidy.hpp"
>
@@ -3726,10 +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_subsidy.cpp"
>
@@ -3802,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"
>
@@ -3834,30 +3674,6 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
</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"
>
@@ -4378,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,10 +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_subsidy.hpp"
>
@@ -3723,10 +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_subsidy.cpp"
>
@@ -3799,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"
>
@@ -3831,30 +3671,6 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
</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"
>
@@ -4375,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-01-07
Release version: 1.4.0-beta2
Last updated: 2013-11-29
Release version: 1.3.3
------------------------------------------------------------------------
@@ -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

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,7 +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_subsidy.hpp
script/api/script_subsidylist.hpp
script/api/script_testmode.hpp
@@ -879,7 +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_subsidy.cpp
script/api/script_subsidylist.cpp
script/api/script_testmode.cpp
@@ -901,24 +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_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
@@ -1059,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;
@@ -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;
@@ -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"
@@ -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,10 +142,10 @@ 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);
}
}

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;
@@ -520,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);
}
/**
@@ -543,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),
@@ -572,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)
@@ -584,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),
@@ -605,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

@@ -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

@@ -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,405 +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"
/** 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>
inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
{
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 byte * const remap = bp->remap;
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;
}
/* 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 briAB_cm = BRIGHTNESS_LOW_CONTROL_MASK;
const __m128i div_cleaner = BRIGHTNESS_DIV_CLEANER;
const __m128i ob_check = OVERBRIGHT_PRESENCE_MASK;
const __m128i ob_mask = OVERBRIGHT_VALUE_MASK;
const __m128i ob_cm = OVERBRIGHT_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;
const MapValue *src_mv = src_mv_line;
uint16 *anim = anim_line;
switch (mode) {
default: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
dst += src_rgba_line[0].data;
src_mv += src_rgba_line[0].data;
anim += 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 & ~1);
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) effective_width/2; x != 0; x--) {
/* Remap colours. */
const byte m0 = mvX2;
if (m0 >= PALETTE_ANIM_START) {
const Colour c0 = (this->LookupColourInPalette(m0).data & 0x00FFFFFF) | (src[0].data & 0xFF000000);
INSR32(AdjustBrightness(c0, (byte) (mvX2 >> 8)).data, srcABCD, 0);
}
const byte m1 = mvX2 >> 16;
if (m1 >= PALETTE_ANIM_START) {
const Colour c1 = (this->LookupColourInPalette(m1).data & 0x00FFFFFF) | (src[1].data & 0xFF000000);
INSR32(AdjustBrightness(c1, (byte) (mvX2 >> 24)).data, srcABCD, 1);
}
/* 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;
}
/* Blend colours. */
bmno_alpha_blend:
ALPHA_BLEND_2(pack_low_cm);
bmno_full_opacity:
srcABCD = _mm_blend_epi16(srcABCD, dstABCD, 0xF0);
src_mv += 2;
mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
src += 2;
anim += 2;
dstABCD = _mm_loadu_si128((__m128i*) (dst+2));
_mm_storeu_si128((__m128i *) dst, srcABCD);
srcABCD = _mm_loadu_si128((const __m128i*) src);
dst += 2;
continue;
bmno_full_transparency:
src_mv += 2;
mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
dst += 2;
src += 2;
anim += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (bt_last == BT_ODD) {
if (src->a == 0) {
} else if (src->a == 255) {
*anim = (uint16) mvX2;
*dst = ((byte) mvX2 >= PALETTE_ANIM_START) ? AdjustBrightness(LookupColourInPalette((byte) mvX2), (byte) (mvX2 >> 8)) : *src;
} else {
*anim = 0;
if ((byte) mvX2 >= PALETTE_ANIM_START) {
ALIGN(16) Colour colour = AdjustBrightness(LookupColourInPalette((byte) mvX2), (byte) (mvX2 >> 8));
colour.a = src->a;
srcABCD = _mm_load_si128((__m128i*) &colour);
}
ALPHA_BLEND_2(pack_low_cm);
(*dst).data = EXTR32(srcABCD, 0);
}
}
break;
}
default: NOT_REACHED();
}
break;
}
case BM_COLOUR_REMAP: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
src_mv += src_rgba_line[0].data;
dst += src_rgba_line[0].data;
anim += 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 nd = effective_width - delta_diff;
effective_width = delta_diff > 0 ? nd : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) effective_width / 2; x != 0; x--) {
/* 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) {
/* Written so the compiler uses CMOV. */
const Colour src0 = src[0];
const Colour c0map = (this->LookupColourInPalette(r0).data & 0x00FFFFFF) | (src0.data & 0xFF000000);
Colour c0 = dst[0];
c0 = r0 == 0 ? c0 : c0map;
c0 = m0 != 0 ? c0 : src0;
INSR32(c0.data, srcABCD, 0);
const Colour src1 = src[1];
const Colour c1map = (this->LookupColourInPalette(r1).data & 0x00FFFFFF) | (src1.data & 0xFF000000);
Colour c1 = dst[1];
c1 = r1 == 0 ? c1 : c1map;
c1 = m1 != 0 ? c1 : src1;
INSR32(c1.data, srcABCD, 1);
if ((mvX2 & 0xFF00FF00) != 0x80008000) {
ADJUST_BRIGHTNESS_2(srcABCD, mvX2);
}
}
/* Update anim buffer. */
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;
}
/* Blend colours. */
bmcr_alpha_blend:
ALPHA_BLEND_2(pack_low_cm);
bmcr_full_opacity:
srcABCD = _mm_blend_epi16(srcABCD, dstABCD, 0xF0);
src += 2;
src_mv += 2;
anim += 2;
mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
dstABCD = _mm_loadu_si128((__m128i*) (dst+2));
_mm_storeu_si128((__m128i *) dst, srcABCD);
srcABCD = _mm_loadu_si128((const __m128i*) src);
dst += 2;
continue;
bmcr_full_transparency:
src_mv += 2;
mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
dst += 2;
src += 2;
anim += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (effective_width & 1) {
/* In case the m-channel is zero, do not remap this pixel in any way. */
if (src->a == 0) {
} else if ((byte) mvX2 != 0) {
const uint r = remap[(byte) mvX2];
*anim = (src->a == 255) ? (r | ((uint16) mvX2 & 0xFF00)) : 0;
if (r != 0) {
Colour remapped_colour = AdjustBrightness(LookupColourInPalette(r), (byte) (mvX2 >> 8));
if (src->a == 255) {
*dst = remapped_colour;
} else {
remapped_colour.a = src->a;
INSR32(remapped_colour.data, srcABCD, 0);
goto bmcr_alpha_blend_single;
}
}
} else {
*anim = 0;
if (src->a == 255) {
*dst = *src;
} else {
bmcr_alpha_blend_single:
ALPHA_BLEND_2(pack_low_cm);
(*dst).data = EXTR32(srcABCD, 0);
}
}
}
break;
}
default: NOT_REACHED();
}
break;
}
case BM_TRANSPARENT: {
/* Make the current colour a bit more black, so it looks like this image is transparent. */
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i dstCD = _mm_unpackhi_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shuffle_epi8(srcAB, a_cm);
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);
dstAB = _mm_packus_epi16(dstAB, dstCD);
Colour *old_dst = dst;
src += 2;
dst += 2;
anim += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, dstAB);
srcABCD = _mm_loadu_si128((const __m128i*) src);
if (src[-2].a) anim[-2] = 0;
if (src[-1].a) anim[-1] = 0;
}
if (bp->width & 1) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shuffle_epi8(srcAB, a_cm);
alphaAB = _mm_srli_epi16(alphaAB, 2);
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
dstAB = _mm_mullo_epi16(dstAB, nom);
dstAB = _mm_srli_epi16(dstAB, 8);
dstAB = _mm_packus_epi16(dstAB, dstAB);
(*dst).data = EXTR32(dstAB, 0);
if (src[0].a) anim[0] = 0;
}
break;
}
}
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)
{
switch (mode) {
case BM_NORMAL: {
const BlockType bt_last = (BlockType) (bp->width & 1);
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
} else {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
}
break;
}
case BM_COLOUR_REMAP:
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE>(bp, zoom); return;
} else {
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE>(bp, zoom); return;
}
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE>(bp, zoom); return;
default: NOT_REACHED();
}
}
/** Same code as seen in 32bpp_sse2.cpp but some macros are not the same. */
inline Colour Blitter_32bppSSE4_Anim::AdjustBrightness(Colour colour, uint8 brightness)
{
/* Shortcut for normal brightness. */
if (brightness == DEFAULT_BRIGHTNESS) return colour;
return Blitter_32bppSSE4::ReallyAdjustBrightness(colour, brightness);
}
#endif /* WITH_SSE */

View File

@@ -1,47 +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
#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>
/* virtual */ void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
/* virtual */ Colour AdjustBrightness(Colour colour, uint8 brightness);
/* 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

@@ -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

@@ -95,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,379 +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"
/** Instantiation of the SSE2 32bpp blitter factory. */
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
/**
* 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>
inline void Blitter_32bppSSE2::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
{
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;
}
/* Load these variables into register before loop. */
const __m128i clear_hi = CLEAR_HIGH_BYTE_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;
const MapValue *src_mv = src_mv_line;
switch (mode) {
default: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
dst += 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 & ~1);
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
for (uint x = (uint) effective_width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
ALPHA_BLEND_2();
*(uint64*) dst = EXTR64(srcABCD, 0);
src += 2;
dst += 2;
}
if (bt_last == BT_ODD) {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
ALPHA_BLEND_2();
(*dst).data = EXTR32(srcABCD, 0);
}
break;
}
default: NOT_REACHED();
}
break;
}
case BM_COLOUR_REMAP: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
src_mv += src_rgba_line[0].data;
dst += 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 nd = effective_width - delta_diff;
effective_width = delta_diff > 0 ? nd : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
const byte *remap = bp->remap;
for (uint x = (uint) effective_width; x != 0; x--) {
/* In case the m-channel is zero, do not remap this pixel in any way */
if (src_mv->m == 0) {
if (src->a < 255) {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
ALPHA_BLEND_2();
(*dst).data = EXTR32(srcABCD, 0);
} else {
*dst = src->data;
}
} else {
const uint r = remap[src_mv->m];
if (r != 0) {
Colour remapped_colour = AdjustBrightness(this->LookupColourInPalette(r), src_mv->v);
if (src->a < 255) {
__m128i srcABCD;
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
remapped_colour.a = src->a;
INSR32(remapped_colour.data, srcABCD, 0);
ALPHA_BLEND_2();
(*dst).data = EXTR32(srcABCD, 0);
} else
*dst = remapped_colour;
}
}
src_mv++;
dst++;
src++;
}
break;
}
default: NOT_REACHED();
}
src_mv_line += si->sprite_width;
break;
}
case BM_TRANSPARENT: {
/* Make the current colour a bit more black, so it looks like this image is transparent.
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
*/
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i dstCD = _mm_unpackhi_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shufflelo_epi16(srcAB, 0x3F);
alphaAB = _mm_shufflehi_epi16(alphaAB, 0x3F);
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);
dstAB = _mm_packus_epi16(dstAB, dstCD);
Colour *old_dst = dst;
src += 2;
dst += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, dstAB);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (bp->width & 1) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shufflelo_epi16(srcAB, 0x3F);
alphaAB = _mm_shufflehi_epi16(alphaAB, 0x3F);
alphaAB = _mm_srli_epi16(alphaAB, 2);
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
dstAB = _mm_mullo_epi16(dstAB, nom);
dstAB = _mm_srli_epi16(dstAB, 8);
dstAB = _mm_packus_epi16(dstAB, dstAB);
(*dst).data = EXTR32(dstAB, 0);
}
break;
}
}
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
*/
void Blitter_32bppSSE2::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
switch (mode) {
case BM_NORMAL: {
const BlockType bt_last = (BlockType) (bp->width & 1);
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
} else {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
}
break;
}
case BM_COLOUR_REMAP:
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE>(bp, zoom); return;
} else {
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE>(bp, zoom); return;
}
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE>(bp, zoom); return;
default: NOT_REACHED();
}
}
Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
/* First uint32 of a line = ~1 & 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;
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. */
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;
dst_mv->m = src->m;
if (src->m != 0) {
/* 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 = AdjustBrightness(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 & ~1; // "& ~1" to preserve the last block type
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; // no "& ~1" here, must be done when we know bp->width
}
}
return dst_sprite;
}
/** ReallyAdjustBrightness() is not called that often.
* Inlining this function implies a far jump, which has a huge latency.
*/
inline Colour Blitter_32bppSSE2::AdjustBrightness(Colour colour, uint8 brightness)
{
/* Shortcut for normal brightness. */
if (brightness == DEFAULT_BRIGHTNESS) return colour;
return Blitter_32bppSSE2::ReallyAdjustBrightness(colour, brightness);
}
IGNORE_UNINITIALIZED_WARNING_START
/* static */ Colour Blitter_32bppSSE2::ReallyAdjustBrightness(Colour colour, uint8 brightness)
{
ALIGN(16) uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
c16 *= brightness;
uint64 c16_ob = c16; // Helps out of order execution.
c16 /= DEFAULT_BRIGHTNESS;
c16 &= 0x01FF01FF01FF;
/* 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)) & 0x0100010001) * 0xFF) & c16;
uint64 ob = (uint16) c16_ob + (uint16) (c16_ob >> 16) + (uint16) (c16_ob >> 32);
const uint32 alpha32 = colour.data & 0xFF000000;
__m128i ret;
INSR64(c16, ret, 0);
if (ob != 0) {
/* Reduce overbright strength. */
ob /= 2;
__m128i ob128;
INSR64(ob | ob << 16 | ob << 32, ob128, 0);
__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 | EXTR32(ret, 0);
}
IGNORE_UNINITIALIZED_WARNING_STOP
#endif /* WITH_SSE */

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.hpp SSE2 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE2_HPP
#define BLITTER_32BPP_SSE2_HPP
#ifdef WITH_SSE
#include "32bpp_simple.hpp"
#include "emmintrin.h"
#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)
#define EXTR32(from, rank) (*(um128i*) &from).m128i_u32[rank]
#define EXTR64(from, rank) (*(um128i*) &from).m128i_u64[rank]
#define INSR32(val, into, rank) { \
(*(um128i*) &into).m128i = _mm_insert_epi16((*(um128i*) &into).m128i, val, (rank)*2); \
(*(um128i*) &into).m128i = _mm_insert_epi16((*(um128i*) &into).m128i, (val) >> 16, (rank)*2 + 1); \
}
#define INSR64(val, into, rank) (*(um128i*) &into).m128i_u64[rank] = (val)
/* Alpha blend 2 pixels. */
#define ALPHA_BLEND_2() { \
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128()); /* PUNPCKLBW, expand each uint8 into uint16 */ \
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _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 = _mm_shufflelo_epi16(alphaAB, 0x3F); /* PSHUFLW, put alpha1 in front of each rgb1 */ \
alphaAB = _mm_shufflehi_epi16(alphaAB, 0x3F); /* PSHUFHW, put alpha2 in front of each rgb2 */ \
\
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 */ \
srcAB = _mm_and_si128(srcAB, clear_hi); /* PAND, wipe high bytes to keep low bytes when packing */ \
srcABCD = _mm_packus_epi16(srcAB, srcAB); /* PACKUSWB, pack 2 colours (with saturation) */ \
}
/** 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.
};
/** 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 {
SpriteInfo infos[ZOOM_LVL_COUNT];
byte data[]; ///< Data, all zoomlevels.
};
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
virtual Colour AdjustBrightness(Colour colour, uint8 brightness) = 0;
};
/** The SSE2 32 bpp blitter (without palette animation). */
class Blitter_32bppSSE2 : public Blitter_32bppSimple, public Blitter_32bppSSE_Base {
public:
virtual Colour AdjustBrightness(Colour colour, uint8 brightness);
static Colour ReallyAdjustBrightness(Colour colour, uint8 brightness);
/* 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>
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,324 +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"
/** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
/**
* 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>
inline void Blitter_32bppSSE4::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;
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;
}
/* 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 briAB_cm = BRIGHTNESS_LOW_CONTROL_MASK;
const __m128i div_cleaner = BRIGHTNESS_DIV_CLEANER;
const __m128i ob_check = OVERBRIGHT_PRESENCE_MASK;
const __m128i ob_mask = OVERBRIGHT_VALUE_MASK;
const __m128i ob_cm = OVERBRIGHT_CONTROL_MASK;
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
for (int y = bp->height; y != 0; y--) {
const Colour *src = src_rgba_line + META_LENGTH;
Colour *dst = dst_line;
const MapValue *src_mv = src_mv_line;
switch (mode) {
default: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
dst += 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 & ~1);
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) effective_width / 2; x > 0; x--) {
ALPHA_BLEND_2(pack_low_cm);
srcABCD = _mm_blend_epi16(srcABCD, dstABCD, 0xF0);
Colour *old_dst = dst;
src += 2;
dst += 2;
/* It is VERY important to read next data before it gets invalidated in cpu cache.
* And PEXTR latency is a real problem here.
*/
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, srcABCD);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (bt_last == BT_ODD) {
ALPHA_BLEND_2(pack_low_cm);
*dst = (Colour) EXTR32(srcABCD, 0);
}
break;
}
default: NOT_REACHED();
}
break;
}
case BM_COLOUR_REMAP: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
src_mv += src_rgba_line[0].data;
dst += 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 nd = effective_width - delta_diff;
effective_width = delta_diff > 0 ? nd : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
for (uint x = (uint) effective_width / 2; x > 0; x--) {
/* Remap colours. */
if (mvX2 & 0x00FF00FF) {
/* Written so the compiler uses CMOV. */
const Colour src0 = src[0];
const uint m0 = (byte) mvX2;
const uint r0 = remap[m0];
const Colour c0map = (this->LookupColourInPalette(r0).data & 0x00FFFFFF) | (src0.data & 0xFF000000);
Colour c0 = 0; // Use alpha of 0 to keep dst as is.
c0 = r0 == 0 ? c0 : c0map;
c0 = m0 != 0 ? c0 : src0;
INSR32(c0.data, srcABCD, 0);
const Colour src1 = src[1];
const uint m1 = (byte) (mvX2 >> 16);
const uint r1 = remap[m1];
const Colour c1map = (this->LookupColourInPalette(r1).data & 0x00FFFFFF) | (src1.data & 0xFF000000);
Colour c1 = 0;
c1 = r1 == 0 ? c1 : c1map;
c1 = m1 != 0 ? c1 : src1;
INSR32(c1.data, srcABCD, 1);
if ((mvX2 & 0xFF00FF00) != 0x80008000) {
ADJUST_BRIGHTNESS_2(srcABCD, mvX2);
}
}
/* Blend colours. */
ALPHA_BLEND_2(pack_low_cm);
srcABCD = _mm_blend_epi16(srcABCD, dstABCD, 0xF0);
Colour *old_dst = dst;
dst += 2;
src += 2;
src_mv += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, srcABCD);
mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (effective_width & 1) {
/* In case the m-channel is zero, do not remap this pixel in any way. */
if ((byte) mvX2 == 0) {
if (src->a < 255) {
ALPHA_BLEND_2(pack_low_cm);
(*dst).data = EXTR32(srcABCD, 0);
} else
*dst = *src;
} else {
const uint r = remap[(byte) mvX2];
if (r != 0) {
Colour remapped_colour = AdjustBrightness(this->LookupColourInPalette(r), (byte) (mvX2 >> 8));
if (src->a == 255) {
*dst = remapped_colour;
} else {
remapped_colour.a = src->a;
INSR32(remapped_colour.data, srcABCD, 0);
ALPHA_BLEND_2(pack_low_cm);
(*dst).data = EXTR32(srcABCD, 0);
}
}
}
}
break;
}
default: NOT_REACHED();
}
src_mv_line += si->sprite_width;
break;
}
case BM_TRANSPARENT: {
/* Make the current colour a bit more black, so it looks like this image is transparent.
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
*/
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i dstCD = _mm_unpackhi_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shuffle_epi8(srcAB, a_cm);
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);
dstAB = _mm_packus_epi16(dstAB, dstCD);
Colour *old_dst = dst;
src += 2;
dst += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, dstAB);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (bp->width & 1) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shuffle_epi8(srcAB, a_cm);
alphaAB = _mm_srli_epi16(alphaAB, 2);
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
dstAB = _mm_mullo_epi16(dstAB, nom);
dstAB = _mm_srli_epi16(dstAB, 8);
dstAB = _mm_packus_epi16(dstAB, dstAB);
(*dst).data = EXTR32(dstAB, 0);
}
break;
}
}
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
*/
void Blitter_32bppSSE4::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const BlockType bt_last = (BlockType) (bp->width & 1);
switch (mode) {
case BM_NORMAL: {
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
} else {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
}
break;
}
case BM_COLOUR_REMAP:
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE>(bp, zoom); return;
} else {
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE>(bp, zoom); return;
}
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE>(bp, zoom); return;
default: NOT_REACHED();
}
}
/** Same code as seen in 32bpp_sse2.cpp but some macros are not the same. */
inline Colour Blitter_32bppSSE4::AdjustBrightness(Colour colour, uint8 brightness)
{
/* Shortcut for normal brightness. */
if (brightness == DEFAULT_BRIGHTNESS) return colour;
return Blitter_32bppSSE4::ReallyAdjustBrightness(colour, brightness);
}
IGNORE_UNINITIALIZED_WARNING_START
/* static */ Colour Blitter_32bppSSE4::ReallyAdjustBrightness(Colour colour, uint8 brightness)
{
ALIGN(16) uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
c16 *= brightness;
uint64 c16_ob = c16; // Helps out of order execution.
c16 /= DEFAULT_BRIGHTNESS;
c16 &= 0x01FF01FF01FF;
/* 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)) & 0x0100010001) * 0xFF) & c16;
uint64 ob = (uint16) c16_ob + (uint16) (c16_ob >> 16) + (uint16) (c16_ob >> 32);
const uint32 alpha32 = colour.data & 0xFF000000;
__m128i ret;
INSR64(c16, ret, 0);
if (ob != 0) {
/* Reduce overbright strength. */
ob /= 2;
__m128i ob128;
INSR64(ob | ob << 16 | ob << 32, ob128, 0);
__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 | EXTR32(ret, 0);
}
IGNORE_UNINITIALIZED_WARNING_STOP
#endif /* WITH_SSE */

View File

@@ -1,61 +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
#include "32bpp_ssse3.hpp"
#include "smmintrin.h"
#undef EXTR32
#define EXTR32(from, rank) _mm_extract_epi32((*(um128i*) &from).m128i, rank)
#undef INSR32
#define INSR32(val, into, rank) (*(um128i*) &into).m128i = _mm_insert_epi32((*(um128i*) &into).m128i, val, rank)
IGNORE_UNINITIALIZED_WARNING_START
#ifdef _SQ64
#undef INSR64
#define INSR64(val, into, rank) (*(um128i*) &into).m128i = _mm_insert_epi64((*(um128i*) &into).m128i, val, rank)
#else
typedef union { uint64 u64; struct _u32 { uint32 low, high; } u32; } u6432;
#undef INSR64
#define INSR64(val, into, rank) { \
u6432 v; \
v.u64 = val; \
(*(um128i*) &into).m128i = _mm_insert_epi32((*(um128i*) &into).m128i, v.u32.low, (rank)*2); \
(*(um128i*) &into).m128i = _mm_insert_epi32((*(um128i*) &into).m128i, v.u32.high, (rank)*2 + 1); \
}
#endif
IGNORE_UNINITIALIZED_WARNING_STOP
/** The SSE4 32 bpp blitter (without palette animation). */
class Blitter_32bppSSE4 : public Blitter_32bppSSSE3 {
public:
Colour AdjustBrightness(Colour colour, uint8 brightness);
static Colour ReallyAdjustBrightness(Colour colour, uint8 brightness);
/* 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>
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,287 +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"
/** Instantiation of the SSSE3 32bpp blitter factory. */
static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3;
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
/**
* 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
*/
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last>
inline void Blitter_32bppSSSE3::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;
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;
}
/* Load these variables into register before loop. */
const __m128i a_cm = ALPHA_CONTROL_MASK;
const __m128i pack_hi_cm = PACK_HIGH_CONTROL_MASK;
const __m128i briAB_cm = BRIGHTNESS_LOW_CONTROL_MASK;
const __m128i div_cleaner = BRIGHTNESS_DIV_CLEANER;
const __m128i ob_check = OVERBRIGHT_PRESENCE_MASK;
const __m128i ob_mask = OVERBRIGHT_VALUE_MASK;
const __m128i ob_cm = OVERBRIGHT_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;
const MapValue *src_mv = src_mv_line;
switch (mode) {
default: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
dst += 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 & ~1);
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) effective_width / 2; x > 0; x--) {
ALPHA_BLEND_2(pack_hi_cm);
/* With high repack, srcABCD have its 2 blended pixels like: [S0 S1 S2 S3] -> [-- -- BS0 BS1]
* dstABCD shuffled: [D0 D1 D2 D3] -> [D2 D3 D0 D0]
* PALIGNR takes what's in (): [-- -- (BS0 BS1] [D2 D3) D0 D0]
*/
dstABCD = _mm_shuffle_epi32(dstABCD, 0x0E);
srcABCD = _mm_alignr_epi8(dstABCD, srcABCD, 8);
Colour *old_dst = dst;
src += 2;
dst += 2;
/* It is VERY important to read next data before it gets invalidated in cpu cache. */
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, srcABCD);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (bt_last == BT_ODD) {
ALPHA_BLEND_2(pack_hi_cm);
(*dst).data = EXTR32(srcABCD, 2);
}
break;
}
default: NOT_REACHED();
}
break;
}
case BM_COLOUR_REMAP: {
switch (read_mode) {
case RM_WITH_MARGIN: {
src += src_rgba_line[0].data;
src_mv += src_rgba_line[0].data;
dst += 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 nd = effective_width - delta_diff;
effective_width = delta_diff > 0 ? nd : effective_width;
if (effective_width <= 0) break;
/* FALLTHROUGH */
}
case RM_WITH_SKIP: {
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
for (uint x = (uint) effective_width / 2; x > 0; x--) {
/* Remap colours. */
if (mvX2 & 0x00FF00FF) {
/* Written so the compiler uses CMOV. */
const Colour src0 = src[0];
const uint m0 = (byte) mvX2;
const uint r0 = remap[m0];
const Colour c0map = (this->LookupColourInPalette(r0).data & 0x00FFFFFF) | (src0.data & 0xFF000000);
Colour c0 = 0; // Use alpha of 0 to keep dst as is.
c0 = r0 == 0 ? c0 : c0map;
c0 = m0 != 0 ? c0 : src0;
INSR32(c0.data, srcABCD, 0);
const Colour src1 = src[1];
const uint m1 = (byte) (mvX2 >> 16);
const uint r1 = remap[m1];
const Colour c1map = (this->LookupColourInPalette(r1).data & 0x00FFFFFF) | (src1.data & 0xFF000000);
Colour c1 = 0;
c1 = r1 == 0 ? c1 : c1map;
c1 = m1 != 0 ? c1 : src1;
INSR32(c1.data, srcABCD, 1);
if ((mvX2 & 0xFF00FF00) != 0x80008000) {
ADJUST_BRIGHTNESS_2(srcABCD, mvX2);
}
}
/* Blend colours. */
ALPHA_BLEND_2(pack_hi_cm);
dstABCD = _mm_shuffle_epi32(dstABCD, 0x0E);
srcABCD = _mm_alignr_epi8(dstABCD, srcABCD, 8);
Colour *old_dst = dst;
dst += 2;
src += 2;
src_mv += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, srcABCD);
mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (effective_width & 1) {
/* In case the m-channel is zero, do not remap this pixel in any way */
if (src_mv->m == 0) {
if (src->a < 255) {
ALPHA_BLEND_2(pack_hi_cm);
(*dst).data = EXTR32(srcABCD, 2);
} else {
*dst = src->data;
}
} else {
const uint r = remap[src_mv->m];
if (r != 0) {
Colour remapped_colour = AdjustBrightness(this->LookupColourInPalette(r), src_mv->v);
if (src->a < 255) {
remapped_colour.a = src->a;
INSR32(remapped_colour.data, srcABCD, 0);
ALPHA_BLEND_2(pack_hi_cm);
(*dst).data = EXTR32(srcABCD, 2);
} else
*dst = remapped_colour;
}
}
}
break;
}
default: NOT_REACHED();
}
src_mv_line += si->sprite_width;
break;
}
case BM_TRANSPARENT: {
/* Make the current colour a bit more black, so it looks like this image is transparent.
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
*/
__m128i srcABCD = _mm_loadu_si128((const __m128i*) src);
__m128i dstABCD = _mm_loadu_si128((__m128i*) dst);
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i dstCD = _mm_unpackhi_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shuffle_epi8(srcAB, a_cm);
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);
dstAB = _mm_packus_epi16(dstAB, dstCD);
Colour *old_dst = dst;
src += 2;
dst += 2;
dstABCD = _mm_loadu_si128((__m128i*) dst);
_mm_storeu_si128((__m128i *) old_dst, dstAB);
srcABCD = _mm_loadu_si128((const __m128i*) src);
}
if (bp->width & 1) {
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _mm_setzero_si128());
__m128i alphaAB = _mm_shuffle_epi8(srcAB, a_cm);
alphaAB = _mm_srli_epi16(alphaAB, 2);
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
dstAB = _mm_mullo_epi16(dstAB, nom);
dstAB = _mm_srli_epi16(dstAB, 8);
dstAB = _mm_packus_epi16(dstAB, dstAB);
(*dst).data = EXTR32(dstAB, 0);
}
break;
}
}
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
/**
* 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_32bppSSSE3::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
switch (mode) {
case BM_NORMAL: {
const BlockType bt_last = (BlockType) (bp->width & 1);
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
} else {
switch (bt_last) {
case BT_EVEN: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_EVEN>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_MARGIN, BT_ODD>(bp, zoom); return;
default: NOT_REACHED();
}
}
break;
}
case BM_COLOUR_REMAP:
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE>(bp, zoom); return;
} else {
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE>(bp, zoom); return;
}
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE>(bp, zoom); return;
default: NOT_REACHED();
}
}
#endif /* WITH_SSE */

View File

@@ -1,94 +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
#include "32bpp_sse2.hpp"
#include "tmmintrin.h"
/* Alpha blend 2 pixels. */
#undef ALPHA_BLEND_2
#define ALPHA_BLEND_2(m_pack_mask) { \
__m128i srcAB = _mm_unpacklo_epi8(srcABCD, _mm_setzero_si128()); /* PUNPCKLBW, expand each uint8 into uint16 */ \
__m128i dstAB = _mm_unpacklo_epi8(dstABCD, _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 = _mm_shuffle_epi8(alphaAB, a_cm); /* PSHUFB, put alpha in front of each rgb */ \
\
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 */ \
srcABCD = _mm_shuffle_epi8(srcAB, m_pack_mask); /* PSHUFB, pack 2 Colour (without saturation) */ \
}
/* Adjust brightness of 2 pixels. */
#define ADJUST_BRIGHTNESS_2(colourX2, brightnessX2) \
/* 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.
*/ \
brightnessX2 &= 0xFF00FF00; \
brightnessX2 += DEFAULT_BRIGHTNESS; \
\
__m128i zero = _mm_setzero_si128(); \
__m128i colAB = _mm_unpacklo_epi8(colourX2, zero); \
\
__m128i briAB; \
INSR64(brightnessX2, briAB, 0); \
briAB = _mm_shuffle_epi8(briAB, briAB_cm); /* 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, div_cleaner); \
colAB_ob = _mm_and_si128(colAB_ob, ob_check); \
colAB_ob = _mm_mullo_epi16(colAB_ob, ob_mask); \
colAB_ob = _mm_and_si128(colAB_ob, colAB); \
__m128i obAB = _mm_hadd_epi16(_mm_hadd_epi16(colAB_ob, zero), zero); \
\
obAB = _mm_srli_epi16(obAB, 1); /* Reduce overbright strength. */ \
obAB = _mm_shuffle_epi8(obAB, ob_cm); \
__m128i retAB = ob_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 */ \
\
colourX2 = _mm_packus_epi16(retAB, retAB);
/** 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>
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

@@ -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

@@ -58,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

@@ -118,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__))

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. */
@@ -940,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;
@@ -964,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);
@@ -988,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;
@@ -1405,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,239 +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->source->AddToMeta(cp_new, VehicleCargoList::MTA_TRANSFER);
this->destination->action_counts[VehicleCargoList::MTA_TRANSFER] += cp_new->Count();
}
/* 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

@@ -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,292 +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) or you can mark cargo to be transferred
* that was previously marked as to be delivered, but you can't reserve
* cargo that's marked as to be delivered.
*/
uint VehicleCargoList::Reassign(uint max_move, MoveToAction from, MoveToAction to)
{
max_move = min(this->action_counts[from], max_move);
assert(Delta((int)from, (int)to) == 1);
this->action_counts[from] -= max_move;
this->action_counts[to] += 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(move, VehicleCargoList::MTA_LOAD, VehicleCargoList::MTA_KEEP);
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 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
@@ -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,94 +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. */
uint Reassign(uint max_move, MoveToAction from, MoveToAction to);
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?
@@ -453,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,17 +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 CmdShowStoryPage;
CommandProc CmdRemoveStoryPage;
CommandProc CmdLevelLand;
@@ -281,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
@@ -296,24 +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(CmdShowStoryPage, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SHOW_STORY_PAGE
DEF_CMD(CmdRemoveStoryPage, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_STORY_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
@@ -597,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, clear) { _docommand_recursive = 0; ClearPersistentStorageChanges(clear); 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.
@@ -661,7 +641,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Test the command. */
_cleared_object_areas.Clear();
SetTownRatingTestMode(true);
ClearPersistentStorageChanges(false);
ClearStorageChanges(false);
CommandCost res = proc(tile, flags, p1, p2, text);
SetTownRatingTestMode(false);
@@ -705,7 +685,7 @@ 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();
ClearPersistentStorageChanges(false);
ClearStorageChanges(false);
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
if (cmd_id == CMD_COMPANY_CTRL) {

View File

@@ -259,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
@@ -267,17 +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_SHOW_STORY_PAGE, ///< show a story page
CMD_REMOVE_STORY_PAGE, ///< remove a story page
CMD_LEVEL_LAND, ///< level land
CMD_BUILD_LOCK, ///< build a lock

View File

@@ -34,8 +34,6 @@
#include "vehicle_func.h"
#include "smallmap_gui.h"
#include "game/game.hpp"
#include "goal_base.h"
#include "story_base.h"
#include "table/strings.h"
@@ -84,7 +82,6 @@ void Company::PostDestructor(size_t index)
InvalidateWindowData(WC_GRAPH_LEGEND, 0, (int)index);
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, (int)index);
InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0);
InvalidateWindowData(WC_LINKGRAPH_LEGEND, 0);
/* If the currently shown error message has this company in it, then close it. */
InvalidateWindowData(WC_ERRMSG, 0);
}
@@ -562,7 +559,6 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY)
SetWindowDirty(WC_GRAPH_LEGEND, 0);
SetWindowClassesDirty(WC_CLIENT_LIST_POPUP);
SetWindowDirty(WC_CLIENT_LIST, 0);
InvalidateWindowData(WC_LINKGRAPH_LEGEND, 0);
BuildOwnerLegend();
InvalidateWindowData(WC_SMALLMAP, 0, 1);
@@ -936,8 +932,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
AI::BroadcastNewEvent(new ScriptEventCompanyBankrupt(c_index));
Game::NewEvent(new ScriptEventCompanyBankrupt(c_index));
CompanyAdminRemove(c_index, (CompanyRemoveReason)reason);
if (StoryPage::GetNumItems() == 0 || Goal::GetNumItems() == 0) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
break;
}
@@ -1058,7 +1052,6 @@ CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1,
InvalidateWindowData(WC_DELIVERED_CARGO, 0);
InvalidateWindowData(WC_PERFORMANCE_HISTORY, 0);
InvalidateWindowData(WC_COMPANY_VALUE, 0);
InvalidateWindowData(WC_LINKGRAPH_LEGEND, 0);
/* The smallmap owner view also stores the company colours. */
BuildOwnerLegend();
InvalidateWindowData(WC_SMALLMAP, 0, 1);

View File

@@ -273,12 +273,12 @@ struct CompanyFinancesWindow : Window {
static Money max_money; ///< The maximum amount of money a company has had this 'run'
bool small; ///< Window is toggled to 'small'.
CompanyFinancesWindow(WindowDesc *desc, CompanyID company) : Window(desc)
CompanyFinancesWindow(const WindowDesc *desc, CompanyID company) : Window()
{
this->small = false;
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->SetupWidgets();
this->FinishInitNested(company);
this->FinishInitNested(desc, company);
this->owner = (Owner)this->window_number;
}
@@ -463,8 +463,8 @@ struct CompanyFinancesWindow : Window {
/** First conservative estimate of the maximum amount of money */
Money CompanyFinancesWindow::max_money = INT32_MAX;
static WindowDesc _company_finances_desc(
WDP_AUTO, "company_finances", 0, 0,
static const WindowDesc _company_finances_desc(
WDP_AUTO, 0, 0,
WC_FINANCES, WC_NONE,
0,
_nested_company_finances_widgets, lengthof(_nested_company_finances_widgets)
@@ -574,14 +574,14 @@ private:
DropDownList *list = new DropDownList();
for (uint i = 0; i < lengthof(_colour_dropdown); i++) {
*list->Append() = new DropDownListColourItem(i, HasBit(used_colours, i));
list->push_back(new DropDownListColourItem(i, HasBit(used_colours, i)));
}
ShowDropDownList(this, list, widget == WID_SCL_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget);
}
public:
SelectCompanyLiveryWindow(WindowDesc *desc, CompanyID company) : Window(desc)
SelectCompanyLiveryWindow(const WindowDesc *desc, CompanyID company) : Window()
{
this->livery_class = LC_OTHER;
this->sel = 1;
@@ -590,7 +590,7 @@ public:
this->box = maxdim(GetSpriteSize(SPR_BOX_CHECKED), GetSpriteSize(SPR_BOX_EMPTY));
this->line_height = max(max(this->square.height, this->box.height), (uint)FONT_HEIGHT_NORMAL) + 4;
this->InitNested(company);
this->InitNested(desc, company);
this->owner = company;
this->LowerWidget(WID_SCL_CLASS_GENERAL);
this->InvalidateData(1);
@@ -838,11 +838,11 @@ static const NWidgetPart _nested_select_company_livery_widgets [] = {
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1),
SetDataTip(STR_BLACK_STRING, STR_LIVERY_SECONDARY_TOOLTIP),
EndContainer(),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_SCL_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetMatrixDataTip(1, 1, STR_LIVERY_PANEL_TOOLTIP),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_SCL_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP),
};
static WindowDesc _select_company_livery_desc(
WDP_AUTO, "company_livery", 0, 0,
static const WindowDesc _select_company_livery_desc(
WDP_AUTO, 0, 0,
WC_COMPANY_COLOUR, WC_NONE,
0,
_nested_select_company_livery_widgets, lengthof(_nested_select_company_livery_widgets)
@@ -1077,12 +1077,12 @@ class SelectCompanyManagerFaceWindow : public Window
}
public:
SelectCompanyManagerFaceWindow(WindowDesc *desc, Window *parent) : Window(desc)
SelectCompanyManagerFaceWindow(const WindowDesc *desc, Window *parent) : Window()
{
this->advanced = false;
this->CreateNestedTree();
this->CreateNestedTree(desc);
this->SelectDisplayPlanes(this->advanced);
this->FinishInitNested(parent->window_number);
this->FinishInitNested(desc, parent->window_number);
this->parent = parent;
this->owner = (Owner)this->window_number;
this->face = Company::Get((CompanyID)this->window_number)->face;
@@ -1479,8 +1479,8 @@ const StringID SelectCompanyManagerFaceWindow::PART_TEXTS[] = {
};
/** Company manager face selection window description */
static WindowDesc _select_company_manager_face_desc(
WDP_AUTO, "company_face", 0, 0,
static const WindowDesc _select_company_manager_face_desc(
WDP_AUTO, 0, 0,
WC_COMPANY_MANAGER_FACE, WC_NONE,
WDF_CONSTRUCTION,
_nested_select_company_manager_face_widgets, lengthof(_nested_select_company_manager_face_widgets)
@@ -1545,11 +1545,11 @@ struct CompanyInfrastructureWindow : Window
uint total_width; ///< String width of the total cost line.
CompanyInfrastructureWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
CompanyInfrastructureWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
{
this->UpdateRailRoadTypes();
this->InitNested(window_number);
this->InitNested(desc, window_number);
this->owner = (Owner)this->window_number;
}
@@ -1692,19 +1692,15 @@ struct CompanyInfrastructureWindow : Window
max_cost = max(max_cost, AirportMaintenanceCost(c->index));
SetDParamMaxValue(0, max_val);
uint count_width = GetStringBoundingBox(STR_WHITE_COMMA).width + 20; // Reserve some wiggle room
SetDParamMaxValue(1, max_cost * 12); // Convert to per year
size->width = max(size->width, GetStringBoundingBox(_settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA).width + 20); // Reserve some wiggle room.
if (_settings_game.economy.infrastructure_maintenance) {
SetDParamMaxValue(0, this->GetTotalMaintenanceCost() * 12); // Convert to per year
this->total_width = GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL).width + 20;
size->width = max(size->width, this->total_width);
SetDParamMaxValue(0, max_cost * 12); // Convert to per year
count_width += max(this->total_width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL).width);
}
size->width = max(size->width, count_width);
/* Set height of the total line. */
if (widget == WID_CI_TOTAL) {
size->height = _settings_game.economy.infrastructure_maintenance ? max(size->height, EXP_LINESPACE + FONT_HEIGHT_NORMAL) : 0;
@@ -1714,25 +1710,6 @@ struct CompanyInfrastructureWindow : Window
}
}
/**
* Helper for drawing the counts line.
* @param r The bounds to draw in.
* @param y The y position to draw at.
* @param count The count to show on this line.
* @param monthly_cost The monthly costs.
*/
void DrawCountLine(const Rect &r, int &y, int count, Money monthly_cost) const
{
SetDParam(0, count);
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, STR_WHITE_COMMA, TC_FROMSTRING, SA_RIGHT);
if (_settings_game.economy.infrastructure_maintenance) {
SetDParam(0, monthly_cost * 12); // Convert to per year
int left = _current_text_dir == TD_RTL ? r.right - this->total_width : r.left;
DrawString(left, left + this->total_width, y, STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL, TC_FROMSTRING, SA_RIGHT);
}
}
virtual void DrawWidget(const Rect &r, int widget) const
{
const Company *c = Company::Get((CompanyID)this->window_number);
@@ -1766,11 +1743,15 @@ struct CompanyInfrastructureWindow : Window
uint32 rail_total = c->infrastructure.GetRailTotal();
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
if (HasBit(this->railtypes, rt)) {
this->DrawCountLine(r, y, c->infrastructure.rail[rt], RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total));
SetDParam(0, c->infrastructure.rail[rt]);
SetDParam(1, RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
}
}
if (this->railtypes != RAILTYPES_NONE) {
this->DrawCountLine(r, y, c->infrastructure.signal, SignalMaintenanceCost(c->infrastructure.signal));
SetDParam(0, c->infrastructure.signal);
SetDParam(1, SignalMaintenanceCost(c->infrastructure.signal) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
}
break;
}
@@ -1790,10 +1771,14 @@ struct CompanyInfrastructureWindow : Window
case WID_CI_ROAD_COUNT:
if (HasBit(this->roadtypes, ROADTYPE_ROAD)) {
this->DrawCountLine(r, y, c->infrastructure.road[ROADTYPE_ROAD], RoadMaintenanceCost(ROADTYPE_ROAD, c->infrastructure.road[ROADTYPE_ROAD]));
SetDParam(0, c->infrastructure.road[ROADTYPE_ROAD]);
SetDParam(1, RoadMaintenanceCost(ROADTYPE_ROAD, c->infrastructure.road[ROADTYPE_ROAD]) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
}
if (HasBit(this->roadtypes, ROADTYPE_TRAM)) {
this->DrawCountLine(r, y, c->infrastructure.road[ROADTYPE_TRAM], RoadMaintenanceCost(ROADTYPE_TRAM, c->infrastructure.road[ROADTYPE_TRAM]));
SetDParam(0, c->infrastructure.road[ROADTYPE_TRAM]);
SetDParam(1, RoadMaintenanceCost(ROADTYPE_TRAM, c->infrastructure.road[ROADTYPE_TRAM]) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
}
break;
@@ -1803,16 +1788,17 @@ struct CompanyInfrastructureWindow : Window
break;
case WID_CI_WATER_COUNT:
this->DrawCountLine(r, y, c->infrastructure.water, CanalMaintenanceCost(c->infrastructure.water));
SetDParam(0, c->infrastructure.water);
SetDParam(1, CanalMaintenanceCost(c->infrastructure.water) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
break;
case WID_CI_TOTAL:
if (_settings_game.economy.infrastructure_maintenance) {
int left = _current_text_dir == TD_RTL ? r.right - this->total_width : r.left;
GfxFillRect(left, y, left + this->total_width, y, PC_WHITE);
GfxFillRect(r.left, y, r.left + this->total_width, y, PC_WHITE);
y += EXP_LINESPACE;
SetDParam(0, this->GetTotalMaintenanceCost() * 12); // Convert to per year
DrawString(left, left + this->total_width, y, STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL, TC_FROMSTRING, SA_RIGHT);
DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL);
}
break;
@@ -1823,8 +1809,12 @@ struct CompanyInfrastructureWindow : Window
break;
case WID_CI_STATION_COUNT:
this->DrawCountLine(r, y, c->infrastructure.station, StationMaintenanceCost(c->infrastructure.station));
this->DrawCountLine(r, y, c->infrastructure.airport, AirportMaintenanceCost(c->index));
SetDParam(0, c->infrastructure.station);
SetDParam(1, StationMaintenanceCost(c->infrastructure.station) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
SetDParam(0, c->infrastructure.airport);
SetDParam(1, AirportMaintenanceCost(c->index) * 12); // Convert to per year
DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
break;
}
}
@@ -1843,8 +1833,8 @@ struct CompanyInfrastructureWindow : Window
}
};
static WindowDesc _company_infrastructure_desc(
WDP_AUTO, "company_infrastructure", 0, 0,
static const WindowDesc _company_infrastructure_desc(
WDP_AUTO, 0, 0,
WC_COMPANY_INFRASTRUCTURE, WC_NONE,
0,
_nested_company_infrastructure_widgets, lengthof(_nested_company_infrastructure_widgets)
@@ -1993,9 +1983,9 @@ struct CompanyWindow : Window
CWP_BUTTONS_OTHER, ///< Buttons of the other companies.
};
CompanyWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
CompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
{
this->InitNested(window_number);
this->InitNested(desc, window_number);
this->owner = (Owner)this->window_number;
this->OnInvalidateData();
}
@@ -2420,8 +2410,8 @@ struct CompanyWindow : Window
}
};
static WindowDesc _company_desc(
WDP_AUTO, "company", 0, 0,
static const WindowDesc _company_desc(
WDP_AUTO, 0, 0,
WC_COMPANY, WC_NONE,
0,
_nested_company_widgets, lengthof(_nested_company_widgets)
@@ -2449,9 +2439,9 @@ void DirtyCompanyInfrastructureWindows(CompanyID company)
}
struct BuyCompanyWindow : Window {
BuyCompanyWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
BuyCompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
{
this->InitNested(window_number);
this->InitNested(desc, window_number);
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
@@ -2532,8 +2522,8 @@ static const NWidgetPart _nested_buy_company_widgets[] = {
EndContainer(),
};
static WindowDesc _buy_company_desc(
WDP_AUTO, NULL, 0, 0,
static const WindowDesc _buy_company_desc(
WDP_AUTO, 0, 0,
WC_BUY_COMPANY, WC_NONE,
WDF_CONSTRUCTION,
_nested_buy_company_widgets, lengthof(_nested_buy_company_widgets)

View File

@@ -21,6 +21,7 @@
#include <stdarg.h>
static const uint ICON_TOKEN_COUNT = 20; ///< Maximum number of tokens in one command
static const uint ICON_MAX_ALIAS_LINES = 40; ///< Maximum number of commands executed by one alias
/* console parser */
IConsoleCmd *_iconsole_cmds; ///< list of registered commands
@@ -315,6 +316,17 @@ IConsoleAlias *IConsoleAliasGet(const char *name)
return NULL;
}
/** copy in an argument into the aliasstream */
static inline int IConsoleCopyInParams(char *dst, const char *src, uint bufpos)
{
/* len is the amount of bytes to add excluding the '\0'-termination */
int len = min(ICON_MAX_STREAMSIZE - bufpos - 1, (uint)strlen(src));
strecpy(dst, src, dst + len);
return len;
}
/**
* An alias is just another name for a command, or for more commands
* Execute it as well.
@@ -324,23 +336,28 @@ IConsoleAlias *IConsoleAliasGet(const char *name)
*/
static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[ICON_TOKEN_COUNT])
{
char alias_buffer[ICON_MAX_STREAMSIZE] = { '\0' };
char *alias_stream = alias_buffer;
const char *cmdptr;
char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE];
uint i;
uint a_index, astream_i;
memset(&aliases, 0, sizeof(aliases));
memset(&aliasstream, 0, sizeof(aliasstream));
DEBUG(console, 6, "Requested command is an alias; parsing...");
for (const char *cmdptr = alias->cmdline; *cmdptr != '\0'; cmdptr++) {
aliases[0] = aliasstream;
for (cmdptr = alias->cmdline, a_index = 0, astream_i = 0; *cmdptr != '\0'; cmdptr++) {
if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break;
switch (*cmdptr) {
case '\'': // ' will double for ""
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
aliasstream[astream_i++] = '"';
break;
case ';': // Cmd separator; execute previous and start new command
IConsoleCmdExec(alias_buffer);
alias_stream = alias_buffer;
*alias_stream = '\0'; // Make sure the new command is terminated.
case ';': // Cmd separator, start new command
aliasstream[astream_i] = '\0';
aliases[++a_index] = &aliasstream[++astream_i];
cmdptr++;
break;
@@ -348,22 +365,22 @@ static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char
cmdptr++;
switch (*cmdptr) {
case '+': { // All parameters separated: "[param 1]" "[param 2]"
for (uint i = 0; i != tokencount; i++) {
if (i != 0) alias_stream = strecpy(alias_stream, " ", lastof(alias_buffer));
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
alias_stream = strecpy(alias_stream, tokens[i], lastof(alias_buffer));
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
for (i = 0; i != tokencount; i++) {
aliasstream[astream_i++] = '"';
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
aliasstream[astream_i++] = '"';
aliasstream[astream_i++] = ' ';
}
break;
}
case '!': { // Merge the parameters to one: "[param 1] [param 2] [param 3...]"
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
for (uint i = 0; i != tokencount; i++) {
if (i != 0) alias_stream = strecpy(alias_stream, " ", lastof(alias_buffer));
alias_stream = strecpy(alias_stream, tokens[i], lastof(alias_buffer));
aliasstream[astream_i++] = '"';
for (i = 0; i != tokencount; i++) {
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
aliasstream[astream_i++] = ' ';
}
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
aliasstream[astream_i++] = '"';
break;
}
@@ -376,27 +393,21 @@ static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char
return;
}
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
alias_stream = strecpy(alias_stream, tokens[param], lastof(alias_buffer));
alias_stream = strecpy(alias_stream, "\"", lastof(alias_buffer));
aliasstream[astream_i++] = '"';
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[param], astream_i);
aliasstream[astream_i++] = '"';
break;
}
}
break;
default:
*alias_stream++ = *cmdptr;
*alias_stream = '\0';
aliasstream[astream_i++] = *cmdptr;
break;
}
if (alias_stream >= lastof(alias_buffer) - 1) {
IConsoleError("Requested alias execution would overflow execution buffer");
return;
}
}
IConsoleCmdExec(alias_buffer);
for (i = 0; i <= a_index; i++) IConsoleCmdExec(aliases[i]); // execute each alias in turn
}
/**

View File

@@ -965,7 +965,7 @@ DEF_CONSOLE_CMD(ConExec)
}
if (ferror(script_file)) {
IConsoleError("Encountered error while trying to read from script file");
IConsoleError("Encountered errror while trying to read from script file");
}
_script_running = false;
@@ -1716,22 +1716,6 @@ struct ConsoleContentCallback : public ContentCallback {
}
};
/**
* Outputs content state information to console
* @param ci the content info
*/
static void OutputContentState(const ContentInfo *const ci)
{
static const char * const types[] = { "Base graphics", "NewGRF", "AI", "AI library", "Scenario", "Heightmap", "Base sound", "Base music", "Game script", "GS library" };
assert_compile(lengthof(types) == CONTENT_TYPE_END - CONTENT_TYPE_BEGIN);
static const char * const states[] = { "Not selected", "Selected", "Dep Selected", "Installed", "Unknown" };
static const TextColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR };
char buf[sizeof(ci->md5sum) * 2 + 1];
md5sumToString(buf, lastof(buf), ci->md5sum);
IConsolePrintF(state_to_colour[ci->state], "%d, %s, %s, %s, %08X, %s", ci->id, types[ci->type - 1], states[ci->state], ci->name, ci->unique_id, buf);
}
DEF_CONSOLE_CMD(ConContent)
{
static ContentCallback *cb = NULL;
@@ -1741,12 +1725,12 @@ DEF_CONSOLE_CMD(ConContent)
}
if (argc <= 1) {
IConsoleHelp("Query, select and download content. Usage: 'content update|upgrade|select [all|id]|unselect [all|id]|state [filter]|download'");
IConsoleHelp("Query, select and download content. Usage: 'content update|upgrade|select [all|id]|unselect [all|id]|state|download'");
IConsoleHelp(" update: get a new list of downloadable content; must be run first");
IConsoleHelp(" upgrade: select all items that are upgrades");
IConsoleHelp(" select: select a specific item given by its id or 'all' to select all. If no parameter is given, all selected content will be listed");
IConsoleHelp(" select: select a specific item given by its id or 'all' to select all");
IConsoleHelp(" unselect: unselect a specific item given by its id or 'all' to unselect all");
IConsoleHelp(" state: show the download/select state of all downloadable content. Optionally give a filter string");
IConsoleHelp(" state: show the download/select state of all downloadable content");
IConsoleHelp(" download: download all content you've selected");
return true;
}
@@ -1763,13 +1747,10 @@ DEF_CONSOLE_CMD(ConContent)
if (strcasecmp(argv[1], "select") == 0) {
if (argc <= 2) {
/* List selected content */
IConsolePrintF(CC_WHITE, "id, type, state, name");
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
if ((*iter)->state != ContentInfo::SELECTED && (*iter)->state != ContentInfo::AUTOSELECTED) continue;
OutputContentState(*iter);
}
} else if (strcasecmp(argv[2], "all") == 0) {
IConsoleError("You must enter the id.");
return false;
}
if (strcasecmp(argv[2], "all") == 0) {
_network_content_client.SelectAll();
} else {
_network_content_client.Select((ContentID)atoi(argv[2]));
@@ -1793,8 +1774,15 @@ DEF_CONSOLE_CMD(ConContent)
if (strcasecmp(argv[1], "state") == 0) {
IConsolePrintF(CC_WHITE, "id, type, state, name");
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
if (argc > 2 && strcasestr((*iter)->name, argv[2]) == NULL) continue;
OutputContentState(*iter);
static const char * const types[] = { "Base graphics", "NewGRF", "AI", "AI library", "Scenario", "Heightmap", "Base sound", "Base music", "Game script", "GS library" };
assert_compile(lengthof(types) == CONTENT_TYPE_END - CONTENT_TYPE_BEGIN);
static const char * const states[] = { "Not selected", "Selected", "Dep Selected", "Installed", "Unknown" };
static const TextColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR };
const ContentInfo *ci = *iter;
char buf[sizeof(ci->md5sum) * 2 + 1];
md5sumToString(buf, lastof(buf), ci->md5sum);
IConsolePrintF(state_to_colour[ci->state], "%d, %s, %s, %s, %08X, %s", ci->id, types[ci->type - 1], states[ci->state], ci->name, ci->unique_id, buf);
}
return true;
}

View File

@@ -159,8 +159,8 @@ static const struct NWidgetPart _nested_console_window_widgets[] = {
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_BACKGROUND), SetResize(1, 1),
};
static WindowDesc _console_window_desc(
WDP_MANUAL, NULL, 0, 0,
static const WindowDesc _console_window_desc(
WDP_MANUAL, 0, 0,
WC_CONSOLE, WC_NONE,
0,
_nested_console_window_widgets, lengthof(_nested_console_window_widgets)
@@ -172,13 +172,13 @@ struct IConsoleWindow : Window
int line_height; ///< Height of one line of text in the console.
int line_offset;
IConsoleWindow() : Window(&_console_window_desc)
IConsoleWindow() : Window()
{
_iconsole_mode = ICONSOLE_OPENED;
this->line_height = FONT_HEIGHT_NORMAL + ICON_LINE_SPACING;
this->line_offset = GetStringBoundingBox("] ").width + 5;
this->InitNested(0);
this->InitNested(&_console_window_desc, 0);
ResizeWindow(this, _screen.width, _screen.height / 3);
}

View File

@@ -47,27 +47,6 @@ int GreatestCommonDivisor(int a, int b)
}
/**
* Deterministic approximate division.
* Cancels out division errors stemming from the integer nature of the division over multiple runs.
* @param a Dividend.
* @param b Divisor.
* @return a/b or (a/b)+1.
*/
int DivideApprox(int a, int b)
{
int random_like = ((a + b) * (a - b)) % b;
int remainder = a % b;
int ret = a / b;
if (abs(random_like) < abs(remainder)) {
ret += ((a < 0) ^ (b < 0)) ? -1 : 1;
}
return ret;
}
/**
* Compute the integer square root.
* @param num Radicand.

View File

@@ -317,7 +317,6 @@ static inline uint ToPercent16(uint i)
int LeastCommonMultiple(int a, int b);
int GreatestCommonDivisor(int a, int b);
int DivideApprox(int a, int b);
/**
* Computes ceil(a / b) for non-negative a and b.

View File

@@ -1,388 +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 multimap.hpp Multimap with deterministic ordering of items with equal keys. */
#ifndef MULTIMAP_HPP
#define MULTIMAP_HPP
#include <map>
#include <list>
template<typename Tkey, typename Tvalue, typename Tcompare>
class MultiMap;
/**
* STL-style iterator for MultiMap.
* @tparam Tmap_iter Iterator type for the map in the MultiMap.
* @tparam Tlist_iter Iterator type for the lists in the MultiMap.
* @tparam Tkey Key type of the MultiMap.
* @tparam Tvalue Value type of the MultMap.
* @tparam Tcompare Comparator type for keys of the MultiMap.
*/
template<class Tmap_iter, class Tlist_iter, class Tkey, class Tvalue, class Tcompare>
class MultiMapIterator {
protected:
friend class MultiMap<Tkey, Tvalue, Tcompare>;
typedef MultiMapIterator<Tmap_iter, Tlist_iter, Tkey, Tvalue, Tcompare> Self;
Tlist_iter list_iter; ///< Iterator pointing to current position in the current list of items with equal keys.
Tmap_iter map_iter; ///< Iterator pointing to the position of the current list of items with equal keys in the map.
/**
* Flag to show that the iterator has just "walked" a step in the map.
* We cannot check the current list for that as we might have reached end() of the map. In that case we'd need to
* set list_iter to some sort of "invalid" state, but that's impossible as operator== yields undefined behaviour
* if the iterators don't belong to the same list and there is no list at end(). So if we created a static empty
* list and an "invalid" iterator in that we could not determine if the iterator is invalid while it's valid. We
* can also not determine if the map iterator is valid while we don't have the map; so in the end it's easiest to
* just introduce an extra flag.
*/
bool list_valid;
public:
/**
* Simple, dangerous constructor to allow later assignment with operator=.
*/
MultiMapIterator() : list_valid(false) {}
/**
* Constructor to allow possibly const iterators to be assigned from possibly
* non-const map iterators. You can assign end() like this.
* @tparam Tnon_const Iterator type assignable to Tmap_iter (which might be const).
* @param mi One such iterator.
*/
template<class Tnon_const>
MultiMapIterator(Tnon_const mi) : map_iter(mi), list_valid(false) {}
/**
* Constructor to allow specifying an exact position in map and list. You cannot
* construct end() like this as the constructor will actually check li and mi->second
* for list_valid.
* @param mi Iterator in the map.
* @param li Iterator in the list.
*/
MultiMapIterator(Tmap_iter mi, Tlist_iter li) : list_iter(li), map_iter(mi)
{
this->list_valid = (this->list_iter != this->map_iter->second.begin());
}
/**
* Assignment iterator like constructor with the same signature.
* @tparam Tnon_const Iterator type assignable to Tmap_iter (which might be const).
* @param mi One such iterator.
* @return This iterator.
*/
template<class Tnon_const>
Self &operator=(Tnon_const mi)
{
this->map_iter = mi;
this->list_valid = false;
return *this;
}
/**
* Dereference operator. Works just like usual STL operator*() on various containers.
* Doesn't do a lot of checks for sanity, just like STL.
* @return The value associated with the item this iterator points to.
*/
Tvalue &operator*() const
{
assert(!this->map_iter->second.empty());
return this->list_valid ?
this->list_iter.operator*() :
this->map_iter->second.begin().operator*();
}
/**
* Same as operator*(), but returns a pointer.
* @return Pointer to the value this iterator points to.
*/
Tvalue *operator->() const
{
assert(!this->map_iter->second.empty());
return this->list_valid ?
this->list_iter.operator->() :
this->map_iter->second.begin().operator->();
}
inline const Tmap_iter &GetMapIter() const { return this->map_iter; }
inline const Tlist_iter &GetListIter() const { return this->list_iter; }
inline bool ListValid() const { return this->list_valid; }
const Tkey &GetKey() const { return this->map_iter->first; }
/**
* Prefix increment operator. Increment the iterator and set it to the
* next item in the MultiMap. This either increments the list iterator
* or the map iterator and sets list_valid accordingly.
* @return This iterator after incrementing.
*/
Self &operator++()
{
assert(!this->map_iter->second.empty());
if (this->list_valid) {
if (++this->list_iter == this->map_iter->second.end()) {
++this->map_iter;
this->list_valid = false;
}
} else {
this->list_iter = ++(this->map_iter->second.begin());
if (this->list_iter == this->map_iter->second.end()) {
++this->map_iter;
} else {
this->list_valid = true;
}
}
return *this;
}
/**
* Postfix increment operator. Same as prefix increment, but return the
* previous state.
* @param dummy param to mark postfix.
* @return This iterator before incrementing.
*/
Self operator++(int)
{
Self tmp = *this;
this->operator++();
return tmp;
}
/**
* Prefix decrement operator. Decrement the iterator and set it to the
* previous item in the MultiMap.
* @return This iterator after decrementing.
*/
Self &operator--()
{
assert(!this->map_iter->second.empty());
if (!this->list_valid) {
--this->map_iter;
this->list_iter = this->map_iter->second.end();
assert(!this->map_iter->second.empty());
}
this->list_valid = (--this->list_iter != this->map_iter->second.begin());
return *this;
}
/**
* Postfix decrement operator. Same as prefix decrement, but return the
* previous state.
* @param dummy param to mark postfix.
* @return This iterator before decrementing.
*/
Self operator--(int)
{
Self tmp = *this;
this->operator--();
return tmp;
}
};
/* Generic comparison functions for const/non-const MultiMap iterators and map iterators */
/**
* Compare two MultiMap iterators. Iterators are equal if
* 1. Their map iterators are equal.
* 2. They agree about list_valid.
* 3. If list_valid they agree about list_iter.
* Lots of template parameters to make all possible const and non-const types of MultiMap iterators
* (on maps with const and non-const values) comparable to each other.
* @param iter1 First iterator to compare.
* @param iter2 Second iterator to compare.
* @return If iter1 and iter2 are equal.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tlist_iter2, class Tkey, class Tvalue1, class Tvalue2, class Tcompare>
bool operator==(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue1, Tcompare> &iter1, const MultiMapIterator<Tmap_iter2, Tlist_iter2, Tkey, Tvalue2, Tcompare> &iter2)
{
if (iter1.GetMapIter() != iter2.GetMapIter()) return false;
if (!iter1.ListValid()) return !iter2.ListValid();
return iter2.ListValid() ?
iter1.GetListIter() == iter2.GetListIter() : false;
}
/**
* Inverse of operator==().
* Lots of template parameters to make all possible const and non-const types of MultiMap iterators
* (on maps with const and non-const values) comparable to each other.
* @param iter1 First iterator to compare.
* @param iter2 Second iterator to compare.
* @return If iter1 and iter2 are not equal.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tlist_iter2, class Tkey, class Tvalue1, class Tvalue2, class Tcompare>
bool operator!=(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue1, Tcompare> &iter1, const MultiMapIterator<Tmap_iter2, Tlist_iter2, Tkey, Tvalue2, Tcompare> &iter2)
{
return !(iter1 == iter2);
}
/**
* Check if a MultiMap iterator is at the begin of a list pointed to by the given map iterator.
* Lots of template parameters to make all possible const and non-const types of MultiMap iterators
* (on maps with const and non-const values) comparable to all possible types of map iterators.
* @param iter1 MultiMap iterator.
* @param iter2 Map iterator.
* @return If iter1 points to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator==(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1, const Tmap_iter2 &iter2)
{
return !iter1.ListValid() && iter1.GetMapIter() == iter2;
}
/**
* Inverse of operator==() with same signature.
* @param iter1 MultiMap iterator.
* @param iter2 Map iterator.
* @return If iter1 doesn't point to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator!=(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1, const Tmap_iter2 &iter2)
{
return iter1.ListValid() || iter1.GetMapIter() != iter2;
}
/**
* Same as operator==() with reversed order of arguments.
* @param iter2 Map iterator.
* @param iter1 MultiMap iterator.
* @return If iter1 points to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator==(const Tmap_iter2 &iter2, const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1)
{
return !iter1.ListValid() && iter1.GetMapIter() == iter2;
}
/**
* Same as operator!=() with reversed order of arguments.
* @param iter2 Map iterator.
* @param iter1 MultiMap iterator.
* @return If iter1 doesn't point to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator!=(const Tmap_iter2 &iter2, const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1)
{
return iter1.ListValid() || iter1.GetMapIter() != iter2;
}
/**
* Hand-rolled multimap as map of lists. Behaves mostly like a list, but is sorted
* by Tkey so that you can easily look up ranges of equal keys. Those ranges are
* internally ordered in a deterministic way (contrary to STL multimap). All
* STL-compatible members are named in STL style, all others are named in OpenTTD
* style.
*/
template<typename Tkey, typename Tvalue, typename Tcompare = std::less<Tkey> >
class MultiMap : public std::map<Tkey, std::list<Tvalue>, Tcompare > {
public:
typedef typename std::list<Tvalue> List;
typedef typename List::iterator ListIterator;
typedef typename List::const_iterator ConstListIterator;
typedef typename std::map<Tkey, List, Tcompare > Map;
typedef typename Map::iterator MapIterator;
typedef typename Map::const_iterator ConstMapIterator;
typedef MultiMapIterator<MapIterator, ListIterator, Tkey, Tvalue, Tcompare> iterator;
typedef MultiMapIterator<ConstMapIterator, ConstListIterator, Tkey, const Tvalue, Tcompare> const_iterator;
/**
* Erase the value pointed to by an iterator. The iterator may be invalid afterwards.
* @param it Iterator pointing at some value.
* @return Iterator to the element after the deleted one (or invalid).
*/
iterator erase(iterator it)
{
List &list = it.map_iter->second;
assert(!list.empty());
if (it.list_valid) {
it.list_iter = list.erase(it.list_iter);
/* This can't be the first list element as otherwise list_valid would have
* to be false. So the list cannot be empty here. */
if (it.list_iter == list.end()) {
++it.map_iter;
it.list_valid = false;
}
} else {
list.erase(list.begin());
if (list.empty()) this->Map::erase(it.map_iter++);
}
return it;
}
/**
* Insert a value at the end of the range with the specified key.
* @param key Key to be inserted at.
* @param val Value to be inserted.
*/
void Insert(const Tkey &key, const Tvalue &val)
{
List &list = (*this)[key];
list.push_back(val);
assert(!list.empty());
}
/**
* Count all items in this MultiMap. This involves iterating over the map.
* @return Number of items in the MultiMap.
*/
size_t size() const
{
size_t ret = 0;
for (ConstMapIterator it = this->Map::begin(); it != this->Map::end(); ++it) {
ret += it->second.size();
}
return ret;
}
/**
* Count the number of ranges with equal keys in this MultiMap.
* @return Number of ranges with equal keys.
*/
size_t MapSize() const
{
return this->Map::size();
}
/**
* Get a pair of iterators specifying a range of items with equal keys.
* @param key Key to look for.
* @return Range of items with given key.
*/
std::pair<iterator, iterator> equal_range(const Tkey &key)
{
MapIterator begin(this->lower_bound(key));
if (begin != this->Map::end() && begin->first == key) {
MapIterator end = begin;
return std::make_pair(begin, ++end);
}
return std::make_pair(begin, begin);
}
/**
* Get a pair of constant iterators specifying a range of items with equal keys.
* @param key Key to look for.
* @return Constant range of items with given key.
*/
std::pair<const_iterator, const_iterator> equal_range(const Tkey &key) const
{
ConstMapIterator begin(this->lower_bound(key));
if (begin != this->Map::end() && begin->first == key) {
ConstMapIterator end = begin;
return std::make_pair(begin, ++end);
}
return std::make_pair(begin, begin);
}
};
#endif /* MULTIMAP_HPP */

View File

@@ -35,9 +35,6 @@ DEFINE_POOL_METHOD(inline)::Pool(const char *name) :
first_free(0),
first_unused(0),
items(0),
#ifdef OTTD_ASSERT
checked(0),
#endif /* OTTD_ASSERT */
cleaning(false),
data(NULL),
alloc_cache(NULL)

View File

@@ -59,13 +59,6 @@ struct PoolBase {
* Virtual method that deletes all items in the pool.
*/
virtual void CleanPool() = 0;
private:
/**
* Dummy private copy constructor to prevent compilers from
* copying the structure, which fails due to GetPools().
*/
PoolBase(const PoolBase &other);
};
/**
@@ -100,7 +93,7 @@ struct Pool : PoolBase {
virtual void CleanPool();
/**
* Returns Titem with given index
* Returs Titem with given index
* @param index of item to get
* @return pointer to Titem
* @pre index < this->first_unused
@@ -161,7 +154,6 @@ struct Pool : PoolBase {
*/
inline void operator delete(void *p)
{
if (p == NULL) return;
Titem *pn = (Titem *)p;
assert(pn == Tpool->Get(pn->index));
Tpool->FreeItem(pn->index);
@@ -235,7 +227,7 @@ struct Pool : PoolBase {
}
/**
* Returns Titem with given index
* Returs Titem with given index
* @param index of item to get
* @return pointer to Titem
* @pre index < this->first_unused
@@ -246,7 +238,7 @@ struct Pool : PoolBase {
}
/**
* Returns Titem with given index
* Returs Titem with given index
* @param index of item to get
* @return pointer to Titem
* @note returns NULL for invalid index

View File

@@ -29,14 +29,13 @@ uint32 Randomizer::Next()
}
/**
* Generate the next pseudo random number scaled to \a limit, excluding \a limit
* itself.
* @param limit Limit of the range to be generated from.
* @return Random number in [0,\a limit)
* Generate the next pseudo random number scaled to max
* @param max the maximum value of the returned random number
* @return the random number
*/
uint32 Randomizer::Next(uint32 limit)
uint32 Randomizer::Next(uint32 max)
{
return ((uint64)this->Next() * (uint64)limit) >> 32;
return ((uint64)this->Next() * (uint64)max) >> 32;
}
/**
@@ -76,8 +75,8 @@ uint32 DoRandom(int line, const char *file)
return _random.Next();
}
uint32 DoRandomRange(uint32 limit, int line, const char *file)
uint32 DoRandomRange(uint32 max, int line, const char *file)
{
return ((uint64)DoRandom(line, file) * (uint64)limit) >> 32;
return ((uint64)DoRandom(line, file) * (uint64)max) >> 32;
}
#endif /* RANDOM_DEBUG */

View File

@@ -25,7 +25,7 @@ struct Randomizer {
uint32 state[2];
uint32 Next();
uint32 Next(uint32 limit);
uint32 Next(uint32 max);
void SetSeed(uint32 seed);
};
extern Randomizer _random; ///< Random used in the game state calculations
@@ -65,24 +65,17 @@ void SetRandomSeed(uint32 seed);
#define Random() DoRandom(__LINE__, __FILE__)
#endif
uint32 DoRandom(int line, const char *file);
#define RandomRange(limit) DoRandomRange(limit, __LINE__, __FILE__)
uint32 DoRandomRange(uint32 limit, int line, const char *file);
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
uint32 DoRandomRange(uint32 max, int line, const char *file);
#else
static inline uint32 Random()
{
return _random.Next();
}
/**
* Pick a random number between 0 and \a limit - 1, inclusive. That means 0
* can be returned and \a limit - 1 can be returned, but \a limit can not be
* returned.
* @param limit Limit for the range to be picked from.
* @return A random number in [0,\a limit).
*/
static inline uint32 RandomRange(uint32 limit)
static inline uint32 RandomRange(uint32 max)
{
return _random.Next(limit);
return _random.Next(max);
}
#endif
@@ -91,9 +84,9 @@ static inline uint32 InteractiveRandom()
return _interactive_random.Next();
}
static inline uint32 InteractiveRandomRange(uint32 limit)
static inline uint32 InteractiveRandomRange(uint32 max)
{
return _interactive_random.Next(limit);
return _interactive_random.Next(max);
}
/**

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