Commit Graph

75 Commits (86cb184eb4401b2cd77fa2404cac8dcec6b9a7cf)

Author SHA1 Message Date
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 3 months ago
Peter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 3 months ago
Peter Nelson ae3390fe48 Codechange: Add ColourShade enum. 3 months ago
Peter Nelson 0463d4c198 Codechange: Remove direct access to _colour_gradient.
Access is now through GetColourGradient, which ensures parameters are in range.
3 months ago
Richard Wheeler c25d9f5c81
Fix: Make link graph node borders scale with GUI (#12167) 3 months ago
frosch 68c64d2511 Codechange: Remove TKM string codes by duplicating strings. 4 months ago
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
frosch f457be5a27
Fix #11819, aa5ba5b: Out-of-bounds access in linkgraph GUI. (#11821) 5 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 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 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 b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
5 months ago
Peter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 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 d4008850e3 Codechange: Ensure function opening `{` is on new line. 7 months ago
Peter Nelson bbd64bbe2b
Fix #9545: Crash when all cargo types are disabled. (#11432)
This is not a very useful state, but it's nice to not crash.

Some parts of the game don't (yet) check for cargo types being redefined, that is out-of-scope here.
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 53845bc024 Codechange: Move includes to correct place.
Some other source file inadvertently included things via smallmap_gui.h
7 months ago
Peter Nelson f91462f54b Codechange: Don't access SmallMapWindow method directly from LinkGraphOverlay. 7 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 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
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
Jonathan G Rennison 864d2352c2 Fix: Integer overflow in LinkGraphOverlay::ShowTooltip for long links
In particular when fully zoomed in
This could result in tooltips not being shown at all, or being shown
when not appropriate
11 months ago
Rubidium 836541b41c Codechange: use SetDParam and CopyOutDParam for tooltips 12 months ago
Rubidium 820fe8c621 Codechange: use std::string and concatenation when combining multiple formatted strings 1 year ago
PeterN 702194cfef
Change: Cargo flow legend only shows defined cargo. (#10872)
This removes the large mostly-empty grid of cargo buttons when not using a complex industry set.
1 year ago
Peter Nelson e6740046ee Codechange: Use range-for iteration. 1 year ago
Peter Nelson 0880616851 Codechange: Remove various STRING strings. 1 year ago
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 1 year ago
Peter Nelson 6be6703498 Fix: Linkgraph legend assumes strings are small.
Ensure all linkgraph legend strings are drawn with FS_SMALL forced, so
that it does not rely on NewGRF authors.
1 year ago
Peter Nelson 5199881a8d Codechange: Use correct type for linkgraph company mask. 1 year ago
PeterN c1077212d7
Codechange: Use a shared_ptr for viewport overlay. (#10586) 1 year ago
Jonathan G Rennison 87f4d37de3
Fix #10522: Link graph line tooltip test for vertical lines (#10524) 1 year ago
Michael Lutz aab580e0ac Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph. 1 year ago
Michael Lutz 7352f812e6 Codechange: [Linkgraph] Only store present link graph edges and not all possible edges. 1 year ago
Rubidium bcfe0fb076 Codechange: introduce GetMainWindow() to properly account for nullptr checks
Some nullptr checks have been removed as they were not triggered with nullptr
with the null video driver and in dedicated server mode.
1 year ago
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2 years ago
Peter Nelson b6ed595176 Codechange: Prefer suggested widget padding. 2 years ago
Peter Nelson 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2 years ago
Peter Nelson eb4ba1991b Change: Use CenterBounds function in more places.
CenterBounds may have a 1 pixel difference so the result is not exactly
the same.
2 years ago
Jonathan G Rennison e931f3061f
Fix: Dereference of past-the-end iterator in linkgraph overlay tooltip (#10145) 2 years ago
Nicolas Chappe 864771ca09 Feature: [Linkgraph] Show a tooltip with statistics when hovering a link 2 years ago
Bouke Haarsma c7f55a058b
Fix: link overlay line width on HiDPI displays (#10064) 2 years ago
Tyler Trahan e79724ea22
Feature: Alternative linkgraph colour schemes (#9866) 2 years ago
glx22 a543a4b7bb Codechange: Remove FOR_EACH_SET_CARGO_ID 3 years ago
Peter Nelson 56a6f66903 Codechange: Use text lines instead of pixel height of font for link graph widgets. 3 years ago
Tyler Trahan de891238d6
Change: Recolour graph windows to brown (#8700) 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago