mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
misc formatting fixes, and a removal of the
bool LightningData::preload(bool server, String &errorStr)
{...
dQsort(thunderSounds, MaxThunders, sizeof(SFXTrack*), cmpSounds);
...}
call causing network stream corruption
This commit is contained in:
parent
0b21072b10
commit
8b4f3fea31
1 changed files with 25 additions and 14 deletions
|
|
@ -240,9 +240,15 @@ LightningData::LightningData()
|
||||||
{
|
{
|
||||||
strikeSound = NULL;
|
strikeSound = NULL;
|
||||||
|
|
||||||
dMemset( strikeTextureNames, 0, sizeof( strikeTextureNames ) );
|
for (S32 i = 0; i < MaxThunders; i++)
|
||||||
dMemset( strikeTextures, 0, sizeof( strikeTextures ) );
|
thunderSounds[i] = NULL;
|
||||||
dMemset( thunderSounds, 0, sizeof( thunderSounds ) );
|
|
||||||
|
for (S32 i = 0; i < MaxTextures; i++)
|
||||||
|
{
|
||||||
|
strikeTextureNames[i] = NULL;
|
||||||
|
strikeTextures[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
mNumStrikeTextures = 0;
|
mNumStrikeTextures = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,9 +288,10 @@ bool LightningData::preload(bool server, String &errorStr)
|
||||||
if (Parent::preload(server, errorStr) == false)
|
if (Parent::preload(server, errorStr) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dQsort(thunderSounds, MaxThunders, sizeof(SFXTrack*), cmpSounds);
|
//dQsort(thunderSounds, MaxThunders, sizeof(SFXTrack*), cmpSounds);
|
||||||
for (numThunders = 0; numThunders < MaxThunders && thunderSounds[numThunders] != NULL; numThunders++) {
|
|
||||||
//
|
for (S32 i = 0; i < MaxThunders; i++) {
|
||||||
|
if (thunderSounds[i]!= NULL) numThunders++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server == false)
|
if (server == false)
|
||||||
|
|
@ -321,14 +328,15 @@ void LightningData::packData(BitStream* stream)
|
||||||
|
|
||||||
U32 i;
|
U32 i;
|
||||||
for (i = 0; i < MaxThunders; i++)
|
for (i = 0; i < MaxThunders; i++)
|
||||||
sfxWrite( stream, thunderSounds[ i ] );
|
{
|
||||||
|
if (stream->writeFlag(thunderSounds[i]))
|
||||||
|
sfxWrite(stream, thunderSounds[i]);
|
||||||
|
}
|
||||||
|
|
||||||
stream->writeInt(mNumStrikeTextures, 4);
|
stream->writeInt(mNumStrikeTextures, 4);
|
||||||
|
|
||||||
for (i = 0; i < MaxTextures; i++)
|
for (i = 0; i < MaxTextures; i++)
|
||||||
{
|
|
||||||
stream->writeString(strikeTextureNames[i]);
|
stream->writeString(strikeTextureNames[i]);
|
||||||
}
|
|
||||||
|
|
||||||
sfxWrite( stream, strikeSound );
|
sfxWrite( stream, strikeSound );
|
||||||
}
|
}
|
||||||
|
|
@ -339,14 +347,17 @@ void LightningData::unpackData(BitStream* stream)
|
||||||
|
|
||||||
U32 i;
|
U32 i;
|
||||||
for (i = 0; i < MaxThunders; i++)
|
for (i = 0; i < MaxThunders; i++)
|
||||||
sfxRead( stream, &thunderSounds[ i ] );
|
{
|
||||||
|
if (stream->readFlag())
|
||||||
|
sfxRead(stream, &thunderSounds[i]);
|
||||||
|
else
|
||||||
|
thunderSounds[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
mNumStrikeTextures = stream->readInt(4);
|
mNumStrikeTextures = stream->readInt(4);
|
||||||
|
|
||||||
for (i = 0; i < MaxTextures; i++)
|
for (i = 0; i < MaxTextures; i++)
|
||||||
{
|
|
||||||
strikeTextureNames[i] = stream->readSTString();
|
strikeTextureNames[i] = stream->readSTString();
|
||||||
}
|
|
||||||
|
|
||||||
sfxRead( stream, &strikeSound );
|
sfxRead( stream, &strikeSound );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue