Play sounds associated with the time of day.

This commit is contained in:
Karol Nowak 2007-04-01 20:10:00 +00:00
parent aabb90cd54
commit 2164de4999
3 changed files with 10 additions and 6 deletions

View File

@ -127,7 +127,8 @@ time_of_day::time_of_day(const config& cfg)
image_mask(cfg["mask"]),
red(atoi(cfg["red"].c_str())),
green(atoi(cfg["green"].c_str())),
blue(atoi(cfg["blue"].c_str()))
blue(atoi(cfg["blue"].c_str())),
sounds(cfg["sound"])
{
}
@ -162,11 +163,9 @@ void parse_times(const config& cfg, std::vector<time_of_day>& normal_times)
normal_times.push_back(time_of_day(**t));
}
if ( normal_times.empty() )
if(normal_times.empty())
{
// Makeing sure we have at least default time
config dummy_cfg;
normal_times.push_back(time_of_day(dummy_cfg));
}
@ -244,7 +243,6 @@ void gamestatus::write(config& cfg) const
/// returns time of day object in the turn
/// Correct time is calculated from current time.
time_of_day gamestatus::get_time_of_day_turn(int nturn) const
{
wassert(!times_.empty());

View File

@ -46,6 +46,10 @@ struct time_of_day
//the colour modifications that should
//be made to the game board to reflect the time of day.
int red, green, blue;
// list of "ambient" sounds associated with this time_of_day,
// played at the beginning of turn
std::string sounds;
};
struct wml_menu_item

View File

@ -370,7 +370,9 @@ void play_controller::init_side(const unsigned int team_index, bool is_replay){
reset_resting(units_, player_number_);
}
current_team.set_time_of_day(int(status_.turn()),status_.get_time_of_day());
const time_of_day &tod = status_.get_time_of_day();
current_team.set_time_of_day(int(status_.turn()), tod);
sound::play_sound(tod.sounds, sound::SOUND_FX);
if (!recorder.is_skipping()){
::clear_shroud(*gui_,status_,map_,gameinfo_,units_,teams_,team_index);