Commit Graph

168 Commits (86cb184eb4401b2cd77fa2404cac8dcec6b9a7cf)

Author SHA1 Message Date
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 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
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 6f35f3274f
Fix ab1a4c6c: Crash if the "No Music" set is loaded because there is no current set_index. (#11511)
Add a helper function to get the current set_index which which checks it is in range.
6 months ago
Peter Nelson 519fe33175
Fix ab1a4c6c: Changing baseset/playlist while shuffle is on does not change song. (#11510)
The change-playlist function relied on toggling shuffle to restart playing which is no longer the case, so always handle it when changing playlist instead.
6 months ago
Peter Nelson ab1a4c6c80 Change: Don't restart playback when toggling playlist shuffle.
Instead update the selected playlist entry for the current song.
6 months ago
Peter Nelson 6c91c4b99d Fix: Invalidate playlist window when (un)shuffling playlist. 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
frosch 0b7ecf6102 Codechange: use the shortname as unique id to identify the base graphics in openttd.cfg. 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
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
glx22 46b504a700 Fix: ini_key issues reported by the script 11 months ago
merni-ns 161cc04b8a Fix #11087: Disable base graphics/sound dropdown outside main menu 11 months ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Peter Nelson e6740046ee Codechange: Use range-for iteration. 1 year ago
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Peter Nelson e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
1 year ago
Peter Nelson e999aa2923 Fix: Don't (briefly) switch from title-only playlist on menu screen.
Switching playlist while on the menu screen now only changes the playlist
that will be used when out of the menu screen.
1 year ago
Peter Nelson 3b90b85439 Change: Allow jukebox lists to fill window width. 1 year ago
Peter Nelson 0c4e2ce114 Change: Resize jukebox when changing music set. 1 year ago
Peter Nelson 1ec34acb51 Fix: Truncated music-set song names cause warning log.
The music-set does not need to be selected for this to occur.

Resolved by using std::string instead of fixed buffer for song names,
which avoids manual string copying and removes the length limit.
1 year ago
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2 years ago
Peter Nelson 123983743f Change: Add optional text labels to slider widget. 2 years ago
Peter Nelson 1180c95372 Codechange: Add parameters to change range of slider widget. 2 years ago
Peter Nelson d35f1d3d06 Codechange: Rename slider widget functions to be less specific. 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
Jonathan G Rennison 0fae0599b7 Fix: Data race on effect volume setting with mixer thread 2 years ago
PeterN 0bac74ec2b
Fix #10038: Missing upper bounds check when loading custom playlists (#10039) 2 years ago
Peter Nelson 8321ef0061 Codechange: Set specific widgets dirty instead of window. 3 years ago
rubidium42 6bca9e090d Codechange: add SetDParamStr that accepts std::string& 3 years ago
Niels Martin Hansen 785e42a6f9 Feature: Volume sliders in Game Options window 3 years ago
Niels Martin Hansen 88c92f7b7c Codechange: Move volume control slider logic to separate functions 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Michael Lutz a49fdb7ebb Codechange: Store base set related texts in std::strings. 4 years ago
Milek7 a411ce18c9 Fix: avoid using string pointer after scope end 4 years ago
Niels Martin Hansen f02b643a44 Change: Show volume sliders with wedges instead of boxy slider 4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Michael Lutz c7b9987d08 Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
5 years ago
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 5 years ago
Peter Nelson 6dfe36b5cd Change: Make volume slider widget capture mouse when clicked.
This makes the slider continue to respond even when mouse cursor
is no longer over the widget.
5 years ago
Niels Martin Hansen c618a7c093 Fix 6298b96: Changing music set did not save new setting 6 years ago
Charles Pigott 52ed3bcbaa Remove: A few bits of dead code 6 years ago
Niels Martin Hansen 336d6cab68 Fix 6298b96: Playlist window not drawing playlist
Copy-paste error in change to remove C++11 usage...
6 years ago
Niels Martin Hansen 6298b96571 Change: Modernise music control logic implementation (#6839)
Rewrite of almost the entire music control logic to a more modern style, hopefully also easier to understand. The old playlist handling made it look like arcane magic, which it doesn't have to be.

- Playlists are now stored in std::vector of objects instead of arrays of bytes with magic sentinel values, that need to be rotated around all the time. Position in playlist is stored as a simple index.
- The theme song is now reserved for the title screen, it doesn't play on any of the standard playlists, but is still available for use on custom playlists.
- When the player enters/leaves the game from the main menu, the music always restarts.
- Playback state (playing or not) is kept even if music becomes unavailable due to an empty playlist (or an empty music set), so it can restart immediately if music becomes available again.
- The shuffle algorithm was changed to a standard Fisher-Yates.
- Possibly better behavior when editing a custom playlist while it's playing.
- Custom playlists should be compatible.
- Framework for supporting custom playlists with songs from multiple music sets.
6 years ago
Niels Martin Hansen a1b7812c7e Change: Improved looping of title song 6 years ago
Niels Martin Hansen f946b3da56 Codechange: Pass a MusicSongInfo struct instead of bare filename to music drivers.
Preparation for later extending the info passed to music drivers.
6 years ago
Niels Martin Hansen 19f5a6cbb0 Feature #6090: Change music set during gameplay 6 years ago