Commit Graph

286 Commits (c0ab436077d2e2f425d8b3969de392a640256b88)

Author SHA1 Message Date
Peter Nelson c0ab436077
Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
4 months ago
Rubidium aa5ba5bd7f Codechange: allow certain enumeration to be added
Otherwise C++20 doesn't like it.
5 months ago
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.
5 months ago
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.
5 months ago
Peter Nelson bfb4254226 Fix: Changing default livery did not propagate to group liveries.
#11614 attempted to address this but did not handle 2CC properly, and changes to the default livery were not handled.
5 months ago
Peter Nelson 3436b5f090 Change: Show a message in livery window if vehicle type has no groups. 5 months ago
Peter Nelson 513c7e7b53 Change: Add distinct tooltips for vehicle group colour schemes. 5 months ago
Peter Nelson eda0dd24fe Change: Remove hardcoded minimum sizes and allow resize.
This stops the window being needlessly large.
5 months ago
Peter Nelson 0949eddd55 Change: Move colour selection dropdowns to bottom of window.
This stops them looking similar to how filter controls are used elsewhere,
and matches action dropdowns on other windows.
5 months ago
Darragh acfe367507
Fix #11442: "default" colour in group colour window is not updated when changing master colour (#11614)
Updated SelectCompanyLiveryWindow.DrawWidget method to check if a group's livery.in_use 0 bit is set, rendering the company's default colour if it has not been.
5 months ago
Peter Nelson 66b064cbad Codechange: Use return value of SetDisplayedPlane to simplify CompanyWindow. 6 months ago
Peter Nelson 17c3ce8632
Codechange: Use maxdim instead of setting width/height separately. (#11535) 6 months ago
Peter Nelson 49532914dd Change: Use CRTP-mixins to compose dropdown list items.
This allows list items to built from component parts as required, and additional
functionality is added:

* Icons and text can be positioned at the start or end of the space (templated.)
* Font size of text can be changed (templated.)
* Palette of sprites can be set (runtime.)
6 months ago
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(...)`.
6 months ago
Peter Nelson 306e75223a Change: Adjust layouts and standardize spacing for company-related windows. 7 months ago
Peter Nelson 58c037fba0 Change: Increase finance window lines (and underlines) with interface scale. 7 months ago
Peter Nelson ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
7 months ago
Peter Nelson db6b32e421
Codechange: Avoid pointers and lengthof in ExpensesList. (#11427)
Use std::initializer_list which allows iteration.
7 months ago
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
7 months ago
Peter Nelson 19c314ea1f Change: Use modalpopup spacing for buy company window. 7 months ago
Bernhard Reutner-Fischer ac42dea7b2 Codechange: Remove unused parameter for Height()
DropDownListItem::Height does not need to take an argument so remove it

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
7 months ago
Rubidium f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 7 months ago
Peter Nelson fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. (#11384)
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
7 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Rubidium 8ab0936491 Codechange: use parameter pack/folding instead of va_arg macros for widget states 9 months ago
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 9 months ago
PeterN afc1ea8135
Codechange: Using alias and std::array for company expense storage. (#11273)
This simplifies passing yearly expenses to functions and use of std algorithms.
9 months ago
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.
9 months ago
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 10 months ago
Patric Stout b7acf9e50e
Codechange: use TimerGameCalendar::Year and friends when working with years (#11188) 10 months ago
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
11 months ago
glx22 46b504a700 Fix: ini_key issues reported by the script 11 months ago
PeterN d42a78f3e8
Codechange: Make DropDownListStringItem preformat and remove other implementations. (#11063)
Having to choose between DropDownListStringItem, DropDownListCharStringItem, and DropDownListParamStringItem depending on whether to draw a StringID, a raw string, or a StringID with extra parameters was needlessly complex.

Instead, allow passing a StringID or raw string to DropDownListStringItem. This will preformat the StringID into a raw string, and can therefore accept parameters via the normal SetDParam mechanism.

This also means that strings no longer need to be formatted on every draw.
11 months ago
Rubidium 7c37dcb8e3 Fix: do not use {STRING} when {STRING1} or {STRING2} is needed 12 months ago
Patric Stout 3b1407d240
Feature: allow to do a hostile takeover of an AI company (in singleplayer) (#10914)
With the removal of the share-system, you could no longer make an
AI disappear in a single player game. At least, not without going
into the console.
1 year ago
Patric Stout 772729cc7d
Fix: when syncing width of GUI items, take padding into account (#10915) 1 year ago
Rubidium f29606fd14 Codechange: use std::string to cache engine/group/vehicle names 1 year ago
PeterN 64930c343a
Codechange: Pass reference instead of pointer to GUI*Lists. (#10822)
Pointer-avoidance.
1 year ago
Tyler Trahan 98d809c33b
Codechange: Don't use macros for DAYS_TILL and friends (#10746) 1 year ago
Rubidium e33b2afd87 Codechange: pass (uint) money as Money for CmdGiveMoney 1 year ago
Peter Nelson 0880616851 Codechange: Remove various STRING strings. 1 year ago
Peter Nelson e18f688db5 Codechange: Remove various COMMA strings. 1 year ago
Peter Nelson 35ba49bfb4 Change: Rename text colour NWidgetPart to SetTextStyle and add font size.
This allows to set both text colour and size for any widget with default
drawing.
1 year ago
Rubidium c829930440 Codechange: replace strnatcmp with C++ string capable version 1 year ago
Patric Stout 36a0818bc5
Remove: buying/selling/owning company shares (#10709) 1 year ago
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 1 year ago
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 1 year ago
PeterN 018f0f63a6
Change: Centre company face in scaled widget. (#10688) 1 year ago
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
1 year ago
Peter Nelson 701092003d Fix: DropDownListColourItem didn't provide width nor scale vertical padding. 1 year ago