mirror of
https://github.com/glest/glest-source.git
synced 2025-09-02 20:42:34 +02:00
core_data.cpp: add function to play sounds
This function can be used to pass different arguments to it, so the other play sfx functions (below it) can be removed. (#63)
This commit is contained in:
@@ -722,6 +722,32 @@ namespace Glest
|
||||
|
||||
return &clickSoundC;
|
||||
}
|
||||
|
||||
StaticSound *CoreData::getSound (const std::string& iniPlaySoundVal)
|
||||
{
|
||||
int loadAttemptLookupKey = tsyst_COUNT + 6;
|
||||
if (itemLoadAttempted.find (loadAttemptLookupKey) ==
|
||||
itemLoadAttempted.end ())
|
||||
{
|
||||
|
||||
itemLoadAttempted[loadAttemptLookupKey] = true;
|
||||
|
||||
try
|
||||
{
|
||||
static Config & config = Config::getInstance ();
|
||||
iniPlaySound.load (config.getString (iniPlaySoundVal, ""));
|
||||
}
|
||||
catch (const megaglest_runtime_error & ex)
|
||||
{
|
||||
message (ex.what (),
|
||||
GlobalStaticFlags::getIsNonGraphicalModeEnabled (),
|
||||
tempDataLocation);
|
||||
}
|
||||
}
|
||||
|
||||
return &iniPlaySound;
|
||||
}
|
||||
|
||||
StaticSound *CoreData::getAttentionSound ()
|
||||
{
|
||||
int loadAttemptLookupKey = tsyst_COUNT + 6;
|
||||
|
@@ -66,6 +66,7 @@ namespace Glest
|
||||
StaticSound clickSoundA;
|
||||
StaticSound clickSoundB;
|
||||
StaticSound clickSoundC;
|
||||
StaticSound iniPlaySound;
|
||||
StaticSound attentionSound;
|
||||
StaticSound newServerSound;
|
||||
StaticSound highlightSound;
|
||||
@@ -212,6 +213,7 @@ namespace Glest
|
||||
StaticSound *getClickSoundA ();
|
||||
StaticSound *getClickSoundB ();
|
||||
StaticSound *getClickSoundC ();
|
||||
StaticSound *getSound (const std::string& iniPlaySoundVal);
|
||||
StaticSound *getAttentionSound ();
|
||||
StaticSound *getNewServerSound ();
|
||||
StaticSound *getHighlightSound ();
|
||||
|
Reference in New Issue
Block a user