Commit Graph

418 Commits

Author SHA1 Message Date
Rubidium c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Peter Nelson 1a24016964 Fix: Set TC_NO_SHADE only for shaded engine in purchase list.
Additionally use TC_FORCE to prevent additional colours in the shaded text.
2023-04-28 23:12:07 +01:00
PeterN 1697dff744
Change: Hide all variants from UI when (display) parent is hidden. (#10708) 2023-04-25 20:34:10 +01:00
Patric Stout 1c76e0904d
Codechange: revive STR_TINY_BLACK_COMMA from its coma (#10714) 2023-04-24 18:33:39 +00:00
Jonathan G Rennison a967cc4de2 Fix: Violation of strict weak ordering in engine value/running cost sorter 2023-04-23 12:52:12 +01:00
Andy 15c3bc456f
Change: extend callback 161 (engine name) with bit 0x22 for context 'Autoreplace - Vehicles in use' (#10666) 2023-04-17 00:02:32 +02:00
PeterN f1144de509
Feature: Separate rail/road and sea/air velocity units, and add knots. (#10594)
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2023-04-08 12:26:13 -04:00
Michael Lutz 05ed9f56fd Feature: [NewGRF] Engine name callback. 2023-01-30 22:00:56 +01:00
PeterN 4dfd6a096f
Fix #10220: Don't select unselectable engine as default. (#10404) 2023-01-24 00:05:42 +00:00
Rubidium 8aeef665c7 Fix #10377, Fix 94167df: bad sorting of rail vehicles when primary variant is missing 2023-01-22 21:13:17 +01:00
Rubidium 90f1768006 Codechange: add non-nullptr asserts in cases where it should never be nullptr
Though where similar calls are checked for nullptr as in those instances of
the use of that function it can actually return nullptr. In other words, write
down the assumption that the function never returns nullptr in an assert.
2023-01-14 21:15:23 +01:00
Jonathan G Rennison 10e76b2788 Fix #10032: Capacities of articulated vehicles in build window
See also: #9954
2023-01-14 18:52:01 +01:00
PeterN 5e22788664
Fix #10220: Adding unavailable variants failed for non-rail engines. (#10297)
Unavailable parent variant engine for non-rail engines was added to the
wrong (temporary) list so the hierarchy was not added correctly.
2022-12-31 10:10:25 +00:00
Peter Nelson 85814b29d4 Feature: Vehicle add-ons can now group engines in purchase list.
Grouped engines are collapsed by default but can be expanded. This allows
similar engines to be grouped together to avoid cluttering the list.

Suggested uses for this are e.g.:
* Liveries; same stats but different paint job.
* Re-gearing; engine design is mostly the same but different stats.

... but avoiding complex hidden cargo subtype refit systems.

Grouped engines are otherwise separate, so can be independently
autoreplaced, even between variants.
2022-12-25 16:41:58 +00:00
peter1138 94167dfd34 Change: Add variant hierarchy to build vehicle window list. 2022-12-25 16:41:58 +00:00
Peter Nelson ed60c88b0a Change: Use power-of-2 scaling for some dimensions in GUI.
These are related to drawing sprites that are normally drawn on the
landscape, and should therefore still follow power-of-2 scaling to fit
correctly.
2022-11-12 18:28:39 +00:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson 5786d49143 Change: Use Rect when drawing build engine list. 2022-11-12 18:28:39 +00:00
Peter Nelson 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Henry Wilson 89cf0d5da8 Codechange: Factor cargotype weight conversion magic numbers 2022-11-08 21:02:08 +01:00
Michael Lutz 41fa16f325 Codechange: Don't use globals for return values from vehicle command procs. 2021-12-16 22:28:32 +01:00
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz e740c24eb7 Codechange: Template DoCommand to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz b0990fcff7 Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
2021-12-16 22:28:32 +01:00
Michael Lutz 123c7f99c3 Codechange: Move command callback declarations to the cmd header files. 2021-12-16 22:28:32 +01:00
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2021-12-16 22:28:32 +01:00
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
Loïc Guilloux 9b0bb21f3b
Fix 57734fd: Don't enable rename button for network clients in build vehicle window (#9452) 2021-07-19 22:38:36 +02:00
glx22 5844027eb8 Codechange: Remove FOR_ALL_SORTED_STANDARD_CARGOSPECS 2021-07-09 21:36:09 +02:00
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
PeterN 224625942c
Fix: Count engine details text in lines rather than pixels. (#9107)
This allows the details panel to scale correctly for different zoom levels.
2021-04-25 19:34:16 +01:00
stormcone 9c5a7d3a57 Fix #8733: Can't buy train engine when the "Engines only" filter is active 2021-03-11 21:35:10 +00:00
Didac Perez Parera 6e2a96c133
Add: filter for "engines only" in build train window (#8733) 2021-03-08 12:03:11 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Jonathan G Rennison d830a34394 Fix: Violation of strict weak ordering in engine name sorter
This could be caused by an engine being renamed, and the old
name being cached from a previous sort.

See: #7838
2020-06-18 12:38:43 +02:00
stormcone b524f1ae21 Feature: Show the name of the NewGRF in the build vehicle window. 2020-01-04 18:42:35 +01:00
glx 1f6b3a37f9 Codechange: Replace FOR_ALL_ENGINES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
dorobouNeko cbefc1d994 Fix #7561: Fix power/running-cost vehicle sorter 2019-10-21 22:31:25 +01:00
Jonathan G Rennison b9eb9a4af9 Fix #7594: Max speed rendered incorrectly in road vehicle purchase window when using original acceleration model (#7597)
An incorrect DParam index was used.
2019-05-18 19:31:00 +02:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
Charles Pigott 931d32f414 Codechange: Remove RailTypeByte type 2019-04-29 17:40:22 +01:00
glx b52561fd38 Codechange: use std::sort() in EngList_Sort[Partial]() 2019-04-13 12:49:18 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 2019-03-28 00:09:33 +01:00
Charles Pigott 7c81f8e076 Codechange: Simplify refit cargo filter condition and stop mixing enum types 2019-03-26 20:54:40 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson 5795f66d2e Codechange: Replaced SmallVector::Contains() with std::find() pattern 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
Henry Wilson 9cba6f7193 Codechange: Replaced SmallVector::Compact() with std::vector::shrink_to_fit() 2019-03-26 20:15:57 +00:00
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
peter1138 e6bb90543e Change: Show additional cost and refitted capacity in build vehicle window. 2019-03-24 15:28:48 +00:00
peter1138 d54b6ac09b Feature: When filtering purchase list by cargo type, make buy button perform a refit if required. 2019-03-24 15:28:48 +00:00
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01:00
Peter Nelson 57734fd85d Fix #6599: Disable build and rename button in build vehicle window when no vehicle is selected. 2019-02-14 19:35:48 +01:00
glx a18b0eba5b Add: more options for translators 2019-01-26 21:17:42 +01:00
PeterN 4cebebcf68
Change: Add CargoTypes type for cargo masks. (#6790) 2018-05-21 22:08:39 +01:00
alberth 319de74d99 (svn r27799) -Add: Display aircraft type in buy window (patch by Samu) 2017-03-18 20:46:15 +00:00
peter1138 0877f892c5 (svn r26960) -Codechange: Draw sort button symbols as sprites, and pad sort buttons with non-static width. 2014-10-05 11:20:02 +00:00
peter1138 ce9fab58bc (svn r26951) -Codechange: Do the GUI-scale dance for vehicle, depot, and purchase lists. 2014-10-04 16:40:23 +00:00
alberth bc84c52b30 (svn r26849) -Fix[FS#6113]: Better display of refit information in articulated vehicles. 2014-09-18 19:53:22 +00:00
alberth 22b967676e (svn r26811) -Fix[FS#6108]: Fixed spelling error in widget name. 2014-09-11 17:10:38 +00:00
alberth a49744b50c (svn r26804) -Feature: Allow hiding of non-interesting engines in the build vehicle GUI. 2014-09-07 16:14:06 +00:00
alberth dcc67681ad (svn r26803) -Doc: Document some fields in the build vehicle gui, and the rail definition struct. 2014-09-07 16:13:29 +00:00
alberth 0e3647d4e3 (svn r26799) -Codechange: Export vehicle sorting data and functions. 2014-09-07 16:10:27 +00:00
alberth 83f0b02ff5 (svn r26798) -Codechange: Code style fixes. 2014-09-07 16:09:48 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
frosch ba1779b978 (svn r26241) -Codechange: Remember the GRFFile which filled the TextRefStack in the TextRefStack. 2014-01-12 18:00:39 +00:00
frosch 549784efcd (svn r25733) -Fix: Engine name was misaligned in purchase list for RTL. (sbr) 2013-08-18 22:19:38 +00:00
frosch 43ec0bf0c1 (svn r25537) -Codechange: Optionally make WWT_MATRIX compute the number of rows and columns from the resize step size. 2013-06-30 14:36:31 +00:00
frosch 98fdd20f84 (svn r25531) -Codechange: Use separate function to set data of WWT_MATRIX widgets. 2013-06-30 14:32:31 +00:00
rubidium 7c0f34130c (svn r25454) -Remove/Fix/Cleanup: SETX(Y) does not work at all with other than default fonts, so get rid of it 2013-06-24 18:39:19 +00:00
frosch c73219f9e5 (svn r25394) -Fix: Restrict renaming engines to the server, just like renaming towns. 2013-06-11 18:24:01 +00:00
frosch ce110eed32 (svn r25313) -Fix: Do not assume '8' to be the broadest digit, but test all of them. 2013-06-01 14:33:48 +00:00
frosch 4e4e635916 (svn r25294) -Feature: Add another button to window title bars to resize the window to its default size. 2013-05-26 19:30:07 +00:00
frosch 8157a8afd8 (svn r25290) -Add: Assign string names to notable windows. 2013-05-26 19:25:01 +00:00
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 2013-05-26 19:23:42 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
frosch 59951051a0 (svn r24848) -Fix [FS#5386]: Consider regearing-like cargos as no-cargo in cargo filters. 2012-12-23 22:12:52 +00:00
michi_cc 245e32a10e (svn r24839) -Feature [FS#5271]: [NewGRF] Support oversized purchase list sprites. (Based on patch by Eddi) 2012-12-23 01:00:25 +00:00
frosch b533523258 (svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations. 2012-12-08 17:18:51 +00:00
frosch 03736af2ae (svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default. 2012-11-11 16:10:43 +00:00
frosch 8ec00c4cc9 (svn r24321) -Change/Fix [FS#4254]: [NewGRF] Group vehicles in the purchase list properly by source GRF, but also consider engine GRFID overrides. 2012-06-03 15:07:27 +00:00
frosch 16e913505e (svn r24203) -Fix: Make the engine name not overdraw the engine count in the autoreplace GUI. 2012-05-05 19:27:47 +00:00
michi_cc e44a923a71 (svn r24137) -Feature(ette): Draw indicator icon in the replace vehicle window for vehicles which have a replacement set. 2012-04-17 19:44:08 +00:00
yexo 21c2f9377d (svn r23792) -Feature [FS#4958]: move 'refitable to' text above custom newgrf text in build vehicle gui 2012-01-12 19:23:00 +00:00
truebrain e9f584ac21 (svn r23531) -Codechange: document and rename widgets to be consistent and understandable 2011-12-16 16:27:45 +00:00
truebrain 2aa774e831 (svn r23528) -Codechange: move widget enums to widgets/NNN_type.h 2011-12-15 22:22:55 +00:00
rubidium 3d88c74389 (svn r23526) -Codechange: unify cargos vs cargoes 2011-12-15 21:56:00 +00:00
michi_cc 7f8162c324 (svn r23508) -Add: Engine sorter for aircraft range. 2011-12-13 01:18:40 +00:00
michi_cc def8e7215b (svn r23504) -Feature: Aircraft range. 2011-12-13 00:43:35 +00:00
frosch 2ba05f1601 (svn r23335) -Change: Make determination of vehicle weight when loaded consistent between road and rail vehicle purchase info. 2011-11-26 14:52:33 +00:00
frosch 3e780a794b (svn r23334) -Fix [FS#4820]: Road vehicle purchase info failed to display vehicles carrying no cargo. (Can only happen when NewGRFs are screwed up.) 2011-11-26 14:51:06 +00:00
frosch d8f8909f85 (svn r23142) -Change: [NewGRF v8] Unify the return values of callbacks returning D0xx texts. 2011-11-08 17:24:43 +00:00
frosch bbc3409942 (svn r23080) -Feature: [NewGRF] Use variable 10 to enable vehicle GRFs to draw different sprites on the map and in various GUIs. 2011-11-01 16:51:47 +00:00
frosch acc3c75951 (svn r23075) -Codechange: Add GetGRF() and GetGRFID() methods to Engine and Vehicle to simplify code. 2011-11-01 00:23:41 +00:00