summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/music_gui.cpp8
2 files changed, 7 insertions, 2 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index fcdd58b19..1b025997f 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -650,6 +650,7 @@ STR_MUSIC_RULER_MARKER :{TINY_FONT}{BLA
STR_MUSIC_TRACK_NONE :{TINY_FONT}{DKGREEN}--
STR_MUSIC_TRACK_DIGIT :{TINY_FONT}{DKGREEN}{ZEROFILL_NUM}
STR_MUSIC_TITLE_NONE :{TINY_FONT}{DKGREEN}------
+STR_MUSIC_TITLE_NOMUSIC :{TINY_FONT}{DKGREEN}No music available
STR_MUSIC_TITLE_NAME :{TINY_FONT}{DKGREEN}"{RAW_STRING}"
STR_MUSIC_TRACK :{TINY_FONT}{BLACK}Track
STR_MUSIC_XTITLE :{TINY_FONT}{BLACK}Title
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);
}