1
0

Fixed MSVC warnings in SoundEffect functions.

This commit is contained in:
madmaxoft 2014-07-13 13:31:09 +02:00
parent 9b0b57bcbc
commit 31415aec63
3 changed files with 7 additions and 15 deletions

View File

@ -652,7 +652,7 @@ void cChunkMap::BroadcastSoundEffect(const AString & a_SoundName, double a_X, do
cCSLock Lock(m_CSLayers); cCSLock Lock(m_CSLayers);
int ChunkX, ChunkZ; int ChunkX, ChunkZ;
cChunkDef::BlockToChunk(std::floor(a_X), std::floor(a_Z), ChunkX, ChunkZ); cChunkDef::BlockToChunk((int)std::floor(a_X), (int)std::floor(a_Z), ChunkX, ChunkZ);
cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ);
if (Chunk == NULL) if (Chunk == NULL)
{ {

View File

@ -280,16 +280,12 @@ void cProtocol132::SendPlayerSpawn(const cPlayer & a_Player)
void cProtocol132::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) void cProtocol132::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
{ {
int SrcX = std::floor(a_X * 8.0);
int SrcY = std::floor(a_Y * 8.0);
int SrcZ = std::floor(a_Z * 8.0);
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);
WriteByte (PACKET_SOUND_EFFECT); WriteByte (PACKET_SOUND_EFFECT);
WriteString (a_SoundName); WriteString (a_SoundName);
WriteInt (SrcX); WriteInt ((int)(a_X * 8.0));
WriteInt (SrcY); WriteInt ((int)(a_Y * 8.0));
WriteInt (SrcZ); WriteInt ((int)(a_Z * 8.0));
WriteFloat (a_Volume); WriteFloat (a_Volume);
WriteChar ((char)(a_Pitch * 63.0f)); WriteChar ((char)(a_Pitch * 63.0f));
Flush(); Flush();

View File

@ -1088,15 +1088,11 @@ void cProtocol172::SendSoundEffect(const AString & a_SoundName, double a_X, doub
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?
int SrcX = std::floor(a_X * 8.0);
int SrcY = std::floor(a_Y * 8.0);
int SrcZ = std::floor(a_Z * 8.0);
cPacketizer Pkt(*this, 0x29); // Sound Effect packet cPacketizer Pkt(*this, 0x29); // Sound Effect packet
Pkt.WriteString(a_SoundName); Pkt.WriteString(a_SoundName);
Pkt.WriteInt(SrcX); Pkt.WriteInt((int)(a_X * 8.0));
Pkt.WriteInt(SrcY); Pkt.WriteInt((int)(a_Y * 8.0));
Pkt.WriteInt(SrcZ); Pkt.WriteInt((int)(a_Z * 8.0));
Pkt.WriteFloat(a_Volume); Pkt.WriteFloat(a_Volume);
Pkt.WriteByte((Byte)(a_Pitch * 63)); Pkt.WriteByte((Byte)(a_Pitch * 63));
} }