mirror of
https://github.com/glest/glest-source.git
synced 2025-09-09 07:20:47 +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;
|
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 ()
|
StaticSound *CoreData::getAttentionSound ()
|
||||||
{
|
{
|
||||||
int loadAttemptLookupKey = tsyst_COUNT + 6;
|
int loadAttemptLookupKey = tsyst_COUNT + 6;
|
||||||
|
@@ -66,6 +66,7 @@ namespace Glest
|
|||||||
StaticSound clickSoundA;
|
StaticSound clickSoundA;
|
||||||
StaticSound clickSoundB;
|
StaticSound clickSoundB;
|
||||||
StaticSound clickSoundC;
|
StaticSound clickSoundC;
|
||||||
|
StaticSound iniPlaySound;
|
||||||
StaticSound attentionSound;
|
StaticSound attentionSound;
|
||||||
StaticSound newServerSound;
|
StaticSound newServerSound;
|
||||||
StaticSound highlightSound;
|
StaticSound highlightSound;
|
||||||
@@ -212,6 +213,7 @@ namespace Glest
|
|||||||
StaticSound *getClickSoundA ();
|
StaticSound *getClickSoundA ();
|
||||||
StaticSound *getClickSoundB ();
|
StaticSound *getClickSoundB ();
|
||||||
StaticSound *getClickSoundC ();
|
StaticSound *getClickSoundC ();
|
||||||
|
StaticSound *getSound (const std::string& iniPlaySoundVal);
|
||||||
StaticSound *getAttentionSound ();
|
StaticSound *getAttentionSound ();
|
||||||
StaticSound *getNewServerSound ();
|
StaticSound *getNewServerSound ();
|
||||||
StaticSound *getHighlightSound ();
|
StaticSound *getHighlightSound ();
|
||||||
|
Reference in New Issue
Block a user