From dae9e5792a4f030ae9e748548a16a89790fbd311 Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 24 May 2015 12:56:56 +0100 Subject: Made -Weverything an error. --- src/BlockEntities/BeaconEntity.cpp | 6 +++--- src/BlockEntities/MobSpawnerEntity.cpp | 13 +++++++++---- src/BlockEntities/NoteEntity.cpp | 9 +++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/BlockEntities') diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp index fb3940ce9..a945c6ea9 100644 --- a/src/BlockEntities/BeaconEntity.cpp +++ b/src/BlockEntities/BeaconEntity.cpp @@ -77,7 +77,7 @@ bool cBeaconEntity::IsValidEffect(cEntityEffect::eType a_Effect, char a_BeaconLe default: { - LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, (int)a_Effect); + LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, static_cast(a_Effect)); return false; } } @@ -228,9 +228,9 @@ void cBeaconEntity::GiveEffects(void) virtual bool Item(cPlayer * a_Player) { Vector3d PlayerPosition = Vector3d(a_Player->GetPosition()); - if (PlayerPosition.y > (double)m_PosY) + if (PlayerPosition.y > static_cast(m_PosY)) { - PlayerPosition.y = (double)m_PosY; + PlayerPosition.y = static_cast(m_PosY); } // TODO: Vanilla minecraft uses an AABB check instead of a radius one diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp index f8222822c..4746bdd1b 100644 --- a/src/BlockEntities/MobSpawnerEntity.cpp +++ b/src/BlockEntities/MobSpawnerEntity.cpp @@ -145,9 +145,9 @@ void cMobSpawnerEntity::SpawnEntity(void) break; } - int RelX = (int) (m_RelX + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0); + int RelX = static_cast(m_RelX + static_cast(Random.NextFloat() - Random.NextFloat()) * 4.0); int RelY = m_RelY + Random.NextInt(3) - 1; - int RelZ = (int) (m_RelZ + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0); + int RelZ = static_cast(m_RelZ + static_cast(Random.NextFloat() - Random.NextFloat()) * 4.0); cChunk * Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(RelX, RelZ); if ((Chunk == nullptr) || !Chunk->IsValid()) @@ -172,7 +172,12 @@ void cMobSpawnerEntity::SpawnEntity(void) if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cEntity::INVALID_ID) { EntitiesSpawned = true; - Chunk->BroadcastSoundParticleEffect(2004, (int)(PosX * 8.0), (int)(RelY * 8.0), (int)(PosZ * 8.0), 0); + Chunk->BroadcastSoundParticleEffect( + 2004, + static_cast(PosX * 8.0), + static_cast(RelY * 8.0), + static_cast(PosZ * 8.0), + 0); m_NearbyEntitiesNum++; } } @@ -260,7 +265,7 @@ int cMobSpawnerEntity::GetNearbyMonsterNum(eMonsterType a_EntityType) return; } - cMonster * Mob = (cMonster *)a_Entity; + cMonster * Mob = static_cast(a_Entity); if (Mob->GetMobType() != m_EntityType) { return; diff --git a/src/BlockEntities/NoteEntity.cpp b/src/BlockEntities/NoteEntity.cpp index a9af13c55..48ca15d1f 100644 --- a/src/BlockEntities/NoteEntity.cpp +++ b/src/BlockEntities/NoteEntity.cpp @@ -90,8 +90,13 @@ void cNoteEntity::MakeSound(void) m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK); // TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all - float calcPitch = pow(2.0f, ((float)m_Pitch - 12.0f) / 12.0f); - m_World->BroadcastSoundEffect(sampleName, (double)m_PosX, (double)m_PosY, (double)m_PosZ, 3.0f, calcPitch); + float calcPitch = pow(2.0f, static_cast(m_Pitch - 12.0f) / 12.0f); + m_World->BroadcastSoundEffect( + sampleName, + static_cast(m_PosX), + static_cast(m_PosY), + static_cast(m_PosZ), + 3.0f, calcPitch); } -- cgit v1.2.3