openttd updated to 1.5.0-beta2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-03-01 00:30:53 +03:00
parent 0abb47ce90
commit d201932121
682 changed files with 26103 additions and 16553 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: music_gui.cpp 25776 2013-09-15 15:56:46Z planetmaker $ */
/* $Id: music_gui.cpp 27003 2014-10-12 18:41:53Z rubidium $ */
/*
* This file is part of OpenTTD.
@@ -29,6 +29,8 @@
#include "table/strings.h"
#include "table/sprites.h"
#include "safeguards.h"
/**
* Get the name of the song.
* @param index of the song.
@@ -174,22 +176,22 @@ static void SkipToNextSong()
static void MusicVolumeChanged(byte new_vol)
{
_music_driver->SetVolume(new_vol);
MusicDriver::GetInstance()->SetVolume(new_vol);
}
static void DoPlaySong()
{
char filename[MAX_PATH];
if (FioFindFullPath(filename, lengthof(filename), BASESET_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename) == NULL) {
FioFindFullPath(filename, lengthof(filename), OLD_GM_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
if (FioFindFullPath(filename, lastof(filename), BASESET_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename) == NULL) {
FioFindFullPath(filename, lastof(filename), OLD_GM_DIR, BaseMusic::GetUsedSet()->files[_music_wnd_cursong - 1].filename);
}
_music_driver->PlaySong(filename);
MusicDriver::GetInstance()->PlaySong(filename);
SetWindowDirty(WC_MUSIC_WINDOW, 0);
}
static void DoStopMusic()
{
_music_driver->StopSong();
MusicDriver::GetInstance()->StopSong();
SetWindowDirty(WC_MUSIC_WINDOW, 0);
}
@@ -200,12 +202,17 @@ static void SelectSongToPlay()
memset(_cur_playlist, 0, sizeof(_cur_playlist));
do {
const char *filename = BaseMusic::GetUsedSet()->files[_playlists[_settings_client.music.playlist][i] - 1].filename;
/* We are now checking for the existence of that file prior
* to add it to the list of available songs */
if (!StrEmpty(filename) && FioCheckFileExists(filename, BASESET_DIR)) {
_cur_playlist[j] = _playlists[_settings_client.music.playlist][i];
j++;
/* File is the index into the file table of the music set. The play list uses 0 as 'no entry',
* so we need to subtract 1. In case of 'no entry' (file = -1), just skip adding it outright. */
int file = _playlists[_settings_client.music.playlist][i] - 1;
if (file >= 0) {
const char *filename = BaseMusic::GetUsedSet()->files[file].filename;
/* We are now checking for the existence of that file prior
* to add it to the list of available songs */
if (!StrEmpty(filename) && FioCheckFileExists(filename, BASESET_DIR)) {
_cur_playlist[j] = _playlists[_settings_client.music.playlist][i];
j++;
}
}
} while (_playlists[_settings_client.music.playlist][++i] != 0 && j < lengthof(_cur_playlist) - 1);
@@ -271,7 +278,7 @@ void MusicLoop()
if (!_song_is_active) return;
if (!_music_driver->IsSongPlaying()) {
if (!MusicDriver::GetInstance()->IsSongPlaying()) {
if (_game_mode != GM_MENU) {
StopMusic();
SkipToNextSong();