Commit Graph

170 Commits

Author SHA1 Message Date
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Jonathan G Rennison e42aec5a89 Fix #12305: Crash with large positive sprite x offset in engine preview window 2024-03-21 21:05:27 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter Nelson 2fd9096070
Change: Decouple and remove landscape-dependent cargo types. (#11719)
Cargo types of default engines, industries and houses are now specified in terms of label.
2024-02-04 10:16:08 +00:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
frosch abfeeea849 Codechange: Compose engine preview text from multiple strings. 2024-01-28 14:44:24 +01:00
Peter Nelson 7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Peter Nelson 952d111b94 Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
2024-01-09 18:56:05 +00:00
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
Peter Nelson c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. (#11481)
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
Peter Nelson 616fb48e25 Change: Use modalpopup spacing for engine preview window. 2023-10-26 12:43:20 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter Nelson e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
glx22 46b504a700 Fix: ini_key issues reported by the script 2023-07-14 14:32:46 +02:00
PeterN 64930c343a
Codechange: Pass reference instead of pointer to GUI*Lists. (#10822)
Pointer-avoidance.
2023-05-14 09:17:44 +01: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
Rubidium 8aeef665c7 Fix #10377, Fix 94167df: bad sorting of rail vehicles when primary variant is missing 2023-01-22 21:13:17 +01:00
PeterN 53b827c460
Fix: Maximum space for engine preview image was never scaled. (#10219) 2022-12-05 17:57:27 +00:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson cd0d5a771d Fix: Engine preview text overly padded.
WIP_EP_QUESTION is already padded at the widget level, so no need to apply
extra padding to left/right.
2022-11-12 18:28:39 +00:00
Peter Nelson f5f035a22b Codechange: Make use of Rect Width/Height helpers. 2022-11-12 18:28:39 +00:00
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 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 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
glx22 994bf19aef Fix f6d5c01: Delay deletion when closing windows 2021-05-29 21:08:25 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
glx b52561fd38 Codechange: use std::sort() in EngList_Sort[Partial]() 2019-04-13 12:49:18 +01:00
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 2019-03-28 00:09:33 +01:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson aa7ca7fe64 Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n 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
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01:00
Nikolas Nyby 6a56a4ce84 Fix #6584: text layout problem in engine preview dialog
With language set to German, there was a problem in this dialog box due
to the long strings in this language. It looks like the call to
`GetStringHeight()` here is using `r.top` to help calculate the
max width, rather than `r.left`.
2019-01-29 07:18:48 +00:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch a682962719 (svn r27889) -Change: Do not cancel headquarter construction and engine-preview-query when shift-clicking (adf88) 2017-07-11 19:37:10 +00:00
alberth da608f6214 (svn r27802) -Add: Display aircraft type in engine preview window (patch by Samu) 2017-03-18 20:48:54 +00:00
alberth dda71fab19 (svn r27800) -Change: Rename long aircraft string names of the preview window 2017-03-18 20:47:48 +00:00
peter1138 1748d7ad6b (svn r26934) -Fix (r26933): Don't statically initialise non-static variables. 2014-09-28 09:21:51 +00:00
peter1138 2b9782fd95 (svn r26933) -Codechange: Resize engine preview window to fit vehicle sprite. 2014-09-28 09:02:11 +00:00
alberth 4ff3ab1357 (svn r26848) -Codechange: Unduplicate summing of cargo capacities in GetTotalCapacityOfArticulatedParts. 2014-09-18 19:50:41 +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 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
frosch 5c358c4173 (svn r24811) -Add: Close engine preview window when another client accepts it. 2012-12-09 16:55:21 +00:00
frosch 2bb54f09d8 (svn r24809) -Feature(ette) [FS#2632]: Consider engine preview windows always sticky, so non-shift mass-closure does not affect them. 2012-12-09 16:54:23 +00:00