Peter Nelson and Michael Lutz
ede1201b6a
Codechange: Rename override manager variables.
2023-01-26 21:39:16 +01:00
Peter Nelson and Michael Lutz
bcc53c5ad5
Codechange: Add missing this-> in override manager.
...
Variable scope is also tweaked in a couple of cases reducing line count.
2023-01-26 21:39:16 +01:00
Peter Nelson and Michael Lutz
eedb786872
Codechange: Use vector for NewGRF spec overrides.
...
This replaces C-style memory management.
2023-01-26 21:39:16 +01:00
PeterN and GitHub
4dfd6a096f
Fix #10220 : Don't select unselectable engine as default. ( #10404 )
2023-01-24 00:05:42 +00:00
PeterN and GitHub
5801442780
Fix: Switch to OWNER_TOWN prevented OWNER_DEITY test during industry prospecting. ( #10360 )
2023-01-17 17:33:03 -05:00
PeterN and GitHub
2355882ec1
Codechange: Remove object enabled flag and shuffle members. ( #10358 )
...
`enabled` flag is replaced with IsEnabled() which checks if views is
non-zero.
ObjectSpec is shuffled to reduce its memory footprint.
2023-01-15 10:58:03 +00:00
PeterN and GitHub
b4f0450974
Change: Display font status as aa/noaa instead of true/false. ( #10352 )
2023-01-14 22:39:15 +00:00
Peter Nelson and PeterN
8149ba338f
Change: Check glyph size before trying to render it.
...
This change of order ensures that the "Font glyph is foot large" occurs
even if the glyph is too large for an alloca() allocation.
2023-01-14 20:50:59 +00:00
Peter Nelson and PeterN
fa0c67b10a
Change: Remove guess-work from calls to GetGlyphOutline().
...
This API method is intended to be called twice, so don't attempt to guess
the required size.
2023-01-14 20:50:59 +00:00
Peter Nelson and PeterN
5370e910d3
Change: Use std::vector for fallback font list.
2023-01-14 20:50:59 +00:00
PeterN and GitHub
6a0d1c7c19
Fix: Link variants to parents when finalising engines. ( #10346 )
...
This ensures that definition-order of engines within the NewGRF does not matter.
2023-01-13 19:22:31 +00:00
PeterN and GitHub
09a32f2ce1
Fix #10335 : Set initial scrollbar count for object GUI. ( #10336 )
...
This previously happened when the window was resized by itself which was fixed by #10196 . Explicitly set the count instead.
2023-01-11 18:26:38 +00:00
PeterN and GitHub
c18a171028
Fix #10331 : Starting new company during load must happen after AI start. ( #10332 )
...
This situation occurs when loading a savegame in single-player which only
has AI companies.
2023-01-08 18:09:38 +00:00
PeterN and GitHub
1b1aa682a6
Fix: Don't assume engclass 2 should be elrail. ( #10315 )
...
When disabling/enabling elrail, there is an assumption that `engclass` of 2
means the engine will run on elrail. While this holds for default engines,
NewGRFs can do other things.
To resolve this we store the intended railtype so that toggling elrail will
restore to the correct type.
2023-01-06 00:44:57 +00:00
PeterN and GitHub
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
PeterN and GitHub
f7e2b6ef12
Change: Make vehicle list dropdown buttons resize to fit strings. ( #10286 )
2022-12-27 18:39:37 +00:00
PeterN and GitHub
9e56e16147
Fix: Local authority window rating list height ignored icon sizes. ( #10285 )
...
Only font height was taken into account, so the list was broken if icon
sizes were taller than font height.
2022-12-26 18:26:01 +00:00
PeterN and GitHub
961e66df30
Fix #10224 : Don't fiddle with fast-forward when saving. ( #10230 )
...
The original comment about saving with fast-forward on was written 18 years
ago, and predates lots of changes to how saveload work.
2022-12-26 00:05:14 +01:00
PeterN and GitHub
4f26f6b8aa
Cleanup: Simplify GRFLabel linked-list with std::vector. ( #10284 )
2022-12-25 22:32:22 +00:00
Peter Nelson and PeterN
efa20dd969
Change: Support engine property 0xC6 in purchase list.
2022-12-25 16:41:58 +00:00
Peter Nelson and PeterN
cbf48c4dd9
Change: Add extra random seed to StartupEngines().
...
This means that calling reset_engines will rerandomise introduction dates
and reliability.
Probably not necessary.
2022-12-25 16:41:58 +00:00
Peter Nelson and PeterN
74180efe7f
Change: Attempt to improve randomisation of reliability
2022-12-25 16:41:58 +00:00
Peter Nelson and PeterN
3485709f53
Add: Additional vehicle flags to control variants.
2022-12-25 16:41:58 +00:00
Peter Nelson and PeterN
898dadadb2
Change: Mark build/autoreplace windows dirty less often in monthy loop.
...
These window classes were marked dirty for every engine that had
reliability calculated every month.
2022-12-25 16:41:58 +00:00
Peter Nelson and PeterN
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 and PeterN
94167dfd34
Change: Add variant hierarchy to build vehicle window list.
2022-12-25 16:41:58 +00:00
Peter Nelson and PeterN
c11db7d593
Change: Clear last variant when engine becomes unavailable.
2022-12-25 16:41:58 +00:00
peter1138 and PeterN
d7f561a400
Change: Add variant property to engines.
2022-12-25 16:41:58 +00:00
PeterN and GitHub
c8cc61d889
Fix #10150 : Force FS_SMALL for small viewport signs. ( #10283 )
...
* Fix #10150 : Force FS_SMALL for small viewport signs.
This is a workaround for string widths being different with mixed
font-sizes.
* Fix: Flag small sign shadow as small text.
(This method of drawing shadows is hilarious and needs replacing, but
this is a quick fix.)
2022-12-25 13:29:38 +00:00
PeterN and GitHub
23eec0b7b3
Fix #8971 : Resize QueryStrings with interface scale change. ( #10281 )
...
* Fix: Use width of caret symbol '_' for text entry.
This replaces an arbitrary pixel width with the space actually required.
* Fix #8971 : Update QueryString sizes with interface scale change.
2022-12-25 00:40:55 +00:00
PeterN and GitHub
7b5edba76c
Change: Support flipping shorter engines without NewGRF support. ( #10262 )
...
* Change: Support flipping shorter engines without NewGRF support.
* Cleanup: Remove write-only prop27_set temporary flag.
2022-12-23 21:02:14 +00:00
Peter Nelson and PeterN
a971eee2e0
Cleanup: Replace foundation drawing magic numbers.
...
Use TILE_SIZE or TILE_HEIGHT as appropriate instead.
2022-12-23 15:43:11 +00:00
Peter Nelson and PeterN
138198e971
Change: Separate ground sprite from foundation sprite offsets.
2022-12-23 15:43:11 +00:00
Peter Nelson and PeterN
002fe67bef
Add: Optionally disable child sprites drawing relative to parent sprites offsets.
2022-12-23 15:43:11 +00:00
PeterN and GitHub
f6e7e44169
Fix #10151 : Use smaller padding for viewport signs. ( #10272 )
...
Before variable-scaling, the padding was always 1x1 pixel. This was
changed to be scaled, except using the wrong dimension of 2x1 pixels
instead of 1x1 pixel.
2022-12-21 22:21:50 +00:00
PeterN and GitHub
c962c77306
Fix: Incorrect available height for dropdowns due to unsigned promotion. ( #10264 )
...
Dropdowns which are taller than the main window should automatically have
a scrollbar added. This did not work for toolbar dropdown as the location
near the top of the window resulted in an unsigned underflow.
2022-12-20 09:39:23 -05:00
PeterN and GitHub
03c1b5169c
Fix #10260 : Incorrect rect height drawing image in vehicle details. ( #10261 )
2022-12-19 21:01:17 +00:00
PeterN and GitHub
dde15a403c
Fix #10257 : Incorrect wire position on sloped bridge heads. ( #10258 )
2022-12-19 20:16:26 +00:00
Peter Nelson and Tyler Trahan
daaa058493
Change: Vertically centre sprite font relative to TrueType font.
2022-12-18 11:46:01 -05:00
Peter Nelson and Tyler Trahan
8599041ce4
Fix: GetDefaultFontHeight() is static, don't use ->
2022-12-18 11:46:01 -05:00
PeterN and GitHub
1eecbd39ed
Change: Use lowered not disabled widget for current tab. ( #10252 )
...
While tab-buttons are not often used, all other similar occurences use
lowered rather than disabled widgets, so use them for train detail
window too.
2022-12-17 18:04:39 +00:00
Peter Nelson and PeterN
5eb7e1d3ab
Fix: Improve sprite aligner list size and alignment.
2022-12-17 15:38:28 +00:00
Peter Nelson and PeterN
8adc47858d
Change: Set minimal size on aligner buttons.
2022-12-17 15:38:28 +00:00
Peter Nelson and PeterN
33eb9688cf
Add: Sprite centre and crosshair toggles on sprite aligner.
2022-12-17 15:38:28 +00:00
PeterN and GitHub
131b7f5127
Fix: Vertically centre chat prompt. ( #10250 )
2022-12-17 12:22:02 +00:00
PeterN and GitHub
c448eb04d8
Fix #10242 : Allow a space for text shadow when clipping WWT_EMPTY/WWT_TEXT. ( #10243 )
2022-12-15 23:21:10 +00:00
PeterN and GitHub
daacde4496
Fix #10147 : Sound effect volume slider no longer set volume. ( #10228 )
2022-12-10 15:51:45 +00:00
PeterN and GitHub
53b827c460
Fix: Maximum space for engine preview image was never scaled. ( #10219 )
2022-12-05 17:57:27 +00:00
PeterN and GitHub
1131608eb4
Fix #10114 : Incorrect drag-highlight position with non-power-of-2 scaling. ( #10211 )
2022-12-03 09:31:52 +00:00
PeterN and GitHub
485368f607
Fix: Missing extra padding when drawing tooltip text. ( #10201 )
...
* Fix: Missing extra padding when drawing tooltip text.
This padding is included when calculating the size of the tooltips, the
difference caused a mismatch in height for some tooltips.
* Codechange: Don't draw grey panel underneath tooltip.
This removes the default framerect padding so it is now added explicitly.
SetMinimalSize is also removed as this is overridden in UpdateWidgetSize
anyway.
2022-11-29 18:55:02 +00:00
PeterN and GitHub
387c57b023
Fix eb4ba1991: Signal icons incorrectly positioned in UI. ( #10199 )
2022-11-28 20:03:27 +00:00
PeterN and GitHub
eaf1e33bd7
Fix #10021 : Object GUI resized when switching between different objects. ( #10196 )
...
* Fix: Scale object gui margin by interface scale.
* Fix: Improve padding on object info text.
* Fix #10021 : Resizing for 1/2/4 object views didn't account for interface scale.
As halving and doubling padding is problematic due to rounding, it is now
added on lower view counts instead of removing on higher view counts.
2022-11-28 00:27:57 +00:00
PeterN and GitHub
a7ffd47c64
Fix #10191 : Incorrect refit highlight position. ( #10195 )
...
Refit highlight was not correct for non-power-of-2 interface scale.
2022-11-27 15:13:09 +00:00
PeterN and GitHub
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.
2022-11-23 21:01:09 +00:00
PeterN and GitHub
a7adadcf9b
Fix: Indent production in industry window and resolve button issues. ( #10184 )
...
Industry production used to be indented, although a different amount than
the industry accepts list. This is now added back, with the standard indent
width.
Additionally the cheat-mode production modifier buttons now support RTL and
the list height now takes account of the button height.
2022-11-19 21:18:53 +00:00
PeterN and GitHub
a044e8e007
Fix: Scale minimum visible caption by interface scale. ( #10180 )
2022-11-17 22:45:15 +00:00
Peter Nelson and PeterN
60404c3aea
Fix #8770 : Centre vehicle status bar icon.
...
The icon is now centred within its scaled bounding box, which intentionally
leaves a little space around the icon when not at 1/2/4x scale.
2022-11-17 09:12:07 +00:00
Peter Nelson and PeterN
9bf24ec56f
Codechange: Reorder and properly declare DrawSpriteIgnorePadding().
...
Parameters have been rearranged to be closer to those of the standard
DrawSprite() function, and PaletteID can now be set.
2022-11-17 09:12:07 +00:00
PeterN and GitHub
c81c242c5a
Fix: Crash if error message window is too wide for screen. ( #10172 )
...
This doesn't seem new, just easier to trigger with new scaling.
2022-11-17 09:10:47 +00:00
PeterN and GitHub
6ea3e7e487
Fix #10164 : Incorrect slider handle position in RTL. ( #10175 )
2022-11-16 19:02:51 +00:00
PeterN and GitHub
cea62ef73d
Fix #10161 : Ignore ascender in FallbackLayouter for non-built-in fonts. ( #10169 )
2022-11-13 17:10:34 +00:00
Peter Nelson and PeterN
dff03124e5
Change: Use modalpopup padding for error/query windows.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
ecb5393c55
Change: Standardize progress bar layout.
...
Progress bars are drawn differently depending on when it was added, with
different layouts and sizes.
This change adds a standard padding size to use, and makes all progress
bars visually similar, with scaled padding.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
920e588334
Change: Use standard dimensions instead of custom widths.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
9666e46739
Feature: Variable GUI scale.
...
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
13d271217f
Change: Sprite-scale inter-character spacing of fonts.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
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 and PeterN
062ea68422
Change: Scale position of font shadow.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
dd90d79e7b
Add: Setting to toggle thin vs chunky (scaled) bevels.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
e554fd7808
Change: Hide WidgetDrawDistances from general use.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
890b2666d3
Change: Use scaled WidgetDimensions.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
61da064b82
Fix: Settings GUI sprite size.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
123983743f
Change: Add optional text labels to slider widget.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
f0ae111c4a
Change: Put ends of slider under centre of control knob.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
64a1fc174f
Change: Scale thickness of slider bevel.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
1180c95372
Codechange: Add parameters to change range of slider widget.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
d35f1d3d06
Codechange: Rename slider widget functions to be less specific.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
23a8222200
Change: Split vscroll and hscroll padding.
...
Vertical and horizontal scrollbars are different sizes, this allows
different padding for each type.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
90ce704366
Change: Use scaled WidgetDimensions for core widgets.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
0bb9a45785
Change: Simplify drawing widget image buttons.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
d0add1e07f
Change: Ignore offsets when drawing GUI sprite.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
b5693becdc
Add: Define scaled WidgetDimensions.
...
Includes RectPadding container.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
b6ed595176
Codechange: Prefer suggested widget padding.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
0108e9f387
Change: Set up suggested widget padding for panel, frame and inset.
...
Window handlers are free to ignore the suggested padding, however some
handlers have logic that assumes this information was already provided.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
68423c40c5
Fix: Off-by-one in GetAlignedPosition().
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
47f4fc6a70
Add: NWidgetPart SetPadding via RectPadding
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
dd9f6bc803
Change: Use RectPadding Horizontal()/Vertical() helpers.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
04cbe57d2a
Change: Use RectPadding for widget padding/uz_padding.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
75b222b0d9
Add: RectPadding type.
...
This is similar to Rect but specifies padding to apply to a Rect.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
5786d49143
Change: Use Rect when drawing build engine list.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
46a1ab0937
Change: Use Rect when drawing infrastructure window.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
c9a81fd67b
Change: Use Rect for drawing vehicle details.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
3ff05321dc
Change: Use standard padding for AI Debug window.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
1f1378c129
Change: Align picker previews to button centre.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
cb059fc081
Change: Use Rect for QueryString editor.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
fea7247072
Change: Use standard 'frametext' padding for settings window.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
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
Peter Nelson and PeterN
cb10ed1509
Change: Move error window padding to widget level.
...
This simplifies calculation during drawing.
2022-11-12 18:28:39 +00:00
Peter Nelson and PeterN
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 and PeterN
f5f035a22b
Codechange: Make use of Rect Width/Height helpers.
2022-11-12 18:28:39 +00:00