Fixed a problem when running the multithreaded testsuite with sound.

This commit is contained in:
Xawotihs
2012-01-11 20:13:24 +00:00
parent f388414f3f
commit cb7f3b070f
+10 -1
View File
@@ -1018,7 +1018,7 @@ int MTGCardInstance::cantBeBlockedBy(MTGCardInstance * card)
/* Choose a sound sample to associate to that card */
JSample * MTGCardInstance::getSample()
{
JSample * js;
JSample * js = 0;
if (sample.size())
return WResourceManager::Instance()->RetrieveSample(sample);
@@ -1028,6 +1028,8 @@ JSample * MTGCardInstance::getSample()
string type = Subtypes::subtypesList->find(types[i]);
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
type = type + ".wav";
if(getObserver() && getObserver()->getResourceManager())
{
js = WResourceManager::Instance()->RetrieveSample(type);
if (js)
{
@@ -1035,6 +1037,7 @@ JSample * MTGCardInstance::getSample()
return js;
}
}
}
if (basicAbilities.any())
{
@@ -1044,6 +1047,8 @@ JSample * MTGCardInstance::getSample()
continue;
string type = Constants::MTGBasicAbilities[x];
type = type + ".wav";
if(getObserver() && getObserver()->getResourceManager())
{
js = WResourceManager::Instance()->RetrieveSample(type);
if (js)
{
@@ -1052,6 +1057,7 @@ JSample * MTGCardInstance::getSample()
}
}
}
}
string type = "";
if(!types.size())
@@ -1059,12 +1065,15 @@ JSample * MTGCardInstance::getSample()
type = Subtypes::subtypesList->find(types[0]);
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
type.append(".wav");
if(getObserver() && getObserver()->getResourceManager())
{
js = WResourceManager::Instance()->RetrieveSample(type);
if (js)
{
sample = string(type);
return js;
}
}
return NULL;
}