<img src="style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" /> Mates
Today I've another crash <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid="
" border="0" alt="modding.gif" />
The last logs talks about sound so I decide to investigate and I found a potential bug (not sure about this but for what I know it better to fix):
In;
C:\giochi\Pirates of the Caribbean\PROGRAM\sound.c
In this session;
// added by MAXIMUS -->
// added by MAXIMUS -->
case "ship":
if (Whr_IsStorm())
{
SetSoundScheme("sea_weather_storm");
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> int rainSoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("rain_storm");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, rainSoundID, 0.5);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, rainSoundID, 0);
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro-->int windSoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("water_sea_storm");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, windSoundID, 0.45);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, windSoundID, 0);
SetMusicAlarm("music_storm");
}
else
{
SetMusicAlarm("music_spokplavanie");
if (Whr_IsRain())
{
SetSoundScheme("sea_weather_rain");
PlayStereoSoundLooped("rain");
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> int waterSoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("water_sea");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, waterSoundID, 0.6);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, waterSoundID, 0);
}
else
{
SetSoundScheme("sea_weather");
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> int water2SoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("water_sea");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, water2SoundID, 0.35);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, water2SoundID, 0);
}
}
break;
case "crew":
SetSoundScheme("tavern");
if (Whr_IsStorm())
{
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> rainSoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("rain_storm");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, rainSoundID, 0.5);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, rainSoundID, 0);
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> windSoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("water_sea_storm");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, windSoundID, 0.45);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, windSoundID, 0);
}
else
{
if (Whr_IsRain())
{
PlayStereoSoundLooped("rain");
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> waterSoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("water_sea");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, waterSoundID, 0.6);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, waterSoundID, 0);
}
else
{
<!--coloro:#CC0000--><span style="color:#CC0000"><!--/coloro--> water2SoundID <!--colorc--></span><!--/colorc--> = PlayStereoSoundLooped_JustCache("water_sea");
SendMessage(Sound,"llf",MSG_SOUND_SET_VOLUME, water2SoundID, 0.35);
SendMessage(Sound,"lll",MSG_SOUND_RESUME, water2SoundID, 0);
}
}
break;
// added by MAXIMUS <--
There are some variable (red marked) that are declared inside a Case session and this could be a problem if Case where are not declared occurs.
I declared all these variables outside the case session;
void SetSchemeForLocation (ref loc)
{
//GO <---
int rainSoundID=0;
int windSoundID=0;
int waterSoundID=0;
int water2SoundID=0;
//GO --->
if(CheckAttribute(loc,"type"))
{
ResetSoundScheme();
switch (loc.type)
{
case "port":
SetSoundScheme("port");
SetTimeScheme("land");
SetWeatherScheme("seashore_weather");
Repeat, I can't say that this have cause last my crash but should be better don't declare variables inside a check condition and use the same variable inside another contition, what do you think about?
<img src="style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid="
" border="0" alt="keith.gif" /> Bye,bye,
giuliootto