Commit Graph

120 Commits (86cb184eb4401b2cd77fa2404cac8dcec6b9a7cf)

Author SHA1 Message Date
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 3 months ago
Peter Nelson a602845d0a
Fix #12202: Race condition when using sprite picker. (#12204)
When using the sprite picker the screen is redrawn so that the sprites under the mouse cursor can be captured. This redraw also caused the sprite aligner window to be redrawn before the OnInvalidateData event that updates its scrollbars with the list count.
3 months ago
Peter Nelson d4f0f0e2c5
Codechange: Use `GetVisibleRangeIterators()` in more places. (#12190)
This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
3 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
Rubidium e3f49ee7a0 Codechange: coding style fixes 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 5cb7a16edc
Fix #11618: Don't try to display unavailable zoom levels in sprite aligner. (#11619) 5 months ago
Peter Nelson 313ee13e5f Codechange: Add Rect version of FillDrawPixelInfo().
This simplifies most callers as they longer have to split out a rect.
6 months ago
Peter Nelson 6e8c27b8e5
Change: Hide bevel for resizeable sparse layout windows. (#11572)
When clicked, the button is still highlighted to show that it is active.

The bevel is controlled with widget_data by RWV_SHOW_BEVEL or RWV_HIDE_BEVEL values.
6 months ago
Peter Nelson 4d9f335f36 Change: Add outline of sprite to sprite aligner. 6 months ago
Peter Nelson f7380a4d2d Change: Make NewGRF Sprite Aligner window resizeable. 6 months ago
Peter Nelson 0434c1b474 Feature: (-tte) Add zoom level buttons to sprite aligner.
This allows for offsets to be adjusted a different zoom level than currently in use, and offset adjustment and display is also more convenient.
6 months ago
Peter Nelson 4e5700939d Change: Use sparse padding for sprite aligner. 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 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
7 months ago
Jonathan G Rennison a1c6923c63
Fix: Assertion in sprite aligner window (#11371)
When clicking sprite number after re-opening window having previously used sprite picker tool
8 months ago
Joan Josep 6b7537646d
Fix: Allow NewGRF inspection of road tiles. (#11323) 9 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Michael Lutz a6f2f3c042 Add: [NewGRF] Inspection window for airports.
As as the station window combines all station types, accessing the
debug view is via the parent of the airport tile only.
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
Rubidium d9f8a4c380 Codechange: use std::string GetString variant 1 year ago
Peter Nelson 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
1 year ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Peter Nelson 83f2ad500e Codechange: stdarg.h include not needed as cstdarg is included. 1 year ago
Patric Stout 199e41c762
Codechange: use default dtor instead of empty (#10826) 1 year ago
Peter Nelson 531d1ae8bc Codechange: Use GetScrolled(Row/Item)FromWidget in more places.
In many instances the clicked row position is 'manually' calculated
instead of using the GetScrolledRowFromWidget helper function, with
variations on checks. Replace with the two helpers where possible.
1 year ago
Peter Nelson d2034d9c38 Codechange: Scrollbar methods now accept size_t.
This clears up a lot of casts from size_t to int.
1 year ago
Peter Nelson e18f688db5 Codechange: Remove various COMMA strings. 1 year ago
Rubidium 630d3bc053 Codechange: use fmt::format instead of printf for the NewGRF profiler 1 year ago
Rubidium 3105d0b09e Codechange: replace text-buf printf with fmt::format 1 year ago
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 1 year ago
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
1 year ago
Tyler Trahan 0bf6f82305 Cleanup: Don't mix switches and early returns in widget selection 1 year ago
Jonathan G Rennison 4c1406a4b5 Add: NewGRF road stops 1 year ago
Rubidium f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 1 year ago
Peter Nelson 5eb7e1d3ab Fix: Improve sprite aligner list size and alignment. 1 year ago
Peter Nelson 8adc47858d Change: Set minimal size on aligner buttons. 1 year ago
Peter Nelson 33eb9688cf Add: Sprite centre and crosshair toggles on sprite aligner. 1 year ago
PeterN 53682b4b6b
Fix #10114: Wonky depot layout. (#10191)
Depot lists internal layout was not handled well. This is improved by
throwing more Rects at it:
- Vehicle images are now be vertically centred in the rect.
- Image clipping is relaxed to cover the rect, improving larger sprites.
- Outline highlight is now aware of bevel thickness.
2 years ago
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2 years ago
Peter Nelson b6ed595176 Codechange: Prefer suggested widget padding. 2 years ago
Peter Nelson fea7247072 Change: Use standard 'frametext' padding for settings window. 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 f5f035a22b Codechange: Make use of Rect Width/Height helpers. 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
rubidium42 e588923bff Codechange: add std::string accepting SetDParamStr to ErrorMessageData 3 years ago
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 3 years ago
Rubidium fdc11a9f94 Codechange: introduce SpriteFile to be used by the sprite loader instead of the global FIO slot functionality 3 years ago
Peter Nelson af70195e44 Fix: Tidy up sizing of sprite aligner window sprite list. 3 years ago