summaryrefslogtreecommitdiff
path: root/src/music_gui.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-03-19 20:26:13 +0100
committerfrosch <github@elsenhans.name>2018-04-29 19:26:05 +0200
commitbb809e35ce02e6ec59a89a9d88ce5ca6040e03a3 (patch)
tree749a1fe6922cfa45829f39b3924f5a3d6545c722 /src/music_gui.cpp
parente1727949479950cbaa41c8a05cc563ce0763c4a8 (diff)
downloadopenttd-bb809e35ce02e6ec59a89a9d88ce5ca6040e03a3.tar.xz
Change: Less intrusive "no music" message from Music window
Diffstat (limited to 'src/music_gui.cpp')
-rw-r--r--src/music_gui.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 9b7f2f95d..7d927d561 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -591,6 +591,9 @@ struct MusicWindow : public Window {
switch (widget) {
case WID_M_TRACK_NR: {
GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, PC_BLACK);
+ if (BaseMusic::GetUsedSet()->num_available == 0) {
+ break;
+ }
StringID str = STR_MUSIC_TRACK_NONE;
if (_song_is_active != 0 && _music_wnd_cursong != 0) {
SetDParam(0, GetTrackNumber(_music_wnd_cursong - 1));
@@ -604,7 +607,9 @@ struct MusicWindow : public Window {
case WID_M_TRACK_NAME: {
GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, PC_BLACK);
StringID str = STR_MUSIC_TITLE_NONE;
- if (_song_is_active != 0 && _music_wnd_cursong != 0) {
+ if (BaseMusic::GetUsedSet()->num_available == 0) {
+ str = STR_MUSIC_TITLE_NOMUSIC;
+ } else if (_song_is_active != 0 && _music_wnd_cursong != 0) {
str = STR_MUSIC_TITLE_NAME;
SetDParamStr(0, GetSongName(_music_wnd_cursong - 1));
}
@@ -799,6 +804,5 @@ static WindowDesc _music_window_desc(
void ShowMusicWindow()
{
- if (BaseMusic::GetUsedSet()->num_available == 0) ShowErrorMessage(STR_ERROR_NO_SONGS, INVALID_STRING_ID, WL_WARNING);
AllocateWindowDescFront<MusicWindow>(&_music_window_desc, 0);
}