summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SetFlags.cmake1
-rw-r--r--src/Generating/CompoGen.cpp2
-rw-r--r--src/Mobs/AggressiveMonster.cpp18
-rw-r--r--src/Mobs/AggressiveMonster.h5
-rw-r--r--src/OSSupport/Event.cpp18
-rw-r--r--src/OSSupport/Event.h3
-rw-r--r--src/RankManager.cpp2
7 files changed, 15 insertions, 34 deletions
diff --git a/SetFlags.cmake b/SetFlags.cmake
index 9931e4b64..c99a6355b 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -277,7 +277,6 @@ macro(set_exe_flags)
# Ignore another problem in sqlite
add_flags_cxx("-Wno-documentation-unknown-command")
endif()
- add_flags_cxx("-Wno-format-pedantic")
endif()
endif()
endif()
diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp
index f55228b80..00a19b72b 100644
--- a/src/Generating/CompoGen.cpp
+++ b/src/Generating/CompoGen.cpp
@@ -377,7 +377,7 @@ void cCompoGenCache::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::
if (((m_NumHits + m_NumMisses) % 1024) == 10)
{
LOGD("CompoGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
- LOGD("CompoGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits);
+ LOGD("CompoGenCache: Avg cache chain length: %.2f", static_cast<float>(m_TotalChain) / m_NumHits);
}
#endif // _DEBUG
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 7fde1e56b..65bda2dff 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -104,21 +104,3 @@ void cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
m_AttackInterval = 0.0;
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
}
-
-
-
-
-bool cAggressiveMonster::IsMovingToTargetPosition()
-{
- // Difference between destination x and target x is negligible (to 10^-12 precision)
- if (fabsf(static_cast<float>(m_FinalDestination.x) - static_cast<float>(m_Target->GetPosX())) < std::numeric_limits<float>::epsilon())
- {
- return false;
- }
- // Difference between destination z and target z is negligible (to 10^-12 precision)
- else if (fabsf(static_cast<float>(m_FinalDestination.z) - static_cast<float>(m_Target->GetPosZ())) > std::numeric_limits<float>::epsilon())
- {
- return false;
- }
- return true;
-}
diff --git a/src/Mobs/AggressiveMonster.h b/src/Mobs/AggressiveMonster.h
index f64c1103f..f46a5c1ef 100644
--- a/src/Mobs/AggressiveMonster.h
+++ b/src/Mobs/AggressiveMonster.h
@@ -21,11 +21,6 @@ public:
virtual void EventSeePlayer(cEntity *) override;
virtual void Attack(std::chrono::milliseconds a_Dt);
-
-protected:
- /** Whether this mob's destination is the same as its target's position. */
- bool IsMovingToTargetPosition();
-
} ;
diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp
index 4c2adea3c..be2803451 100644
--- a/src/OSSupport/Event.cpp
+++ b/src/OSSupport/Event.cpp
@@ -25,9 +25,9 @@ void cEvent::Wait(void)
{
{
std::unique_lock<std::mutex> Lock(m_Mutex);
- m_CondVar.wait(Lock, [this](){ return m_ShouldContinue.load(); });
+ m_CondVar.wait(Lock, [this](){ return m_ShouldContinue; });
+ m_ShouldContinue = false;
}
- m_ShouldContinue = false;
}
@@ -40,9 +40,9 @@ bool cEvent::Wait(unsigned a_TimeoutMSec)
bool Result;
{
std::unique_lock<std::mutex> Lock(m_Mutex); // We assume that this lock is acquired without much delay - we are the only user of the mutex
- Result = m_CondVar.wait_until(Lock, dst, [this](){ return m_ShouldContinue.load(); });
+ Result = m_CondVar.wait_until(Lock, dst, [this](){ return m_ShouldContinue; });
+ m_ShouldContinue = false;
}
- m_ShouldContinue = false;
return Result;
}
@@ -52,7 +52,10 @@ bool cEvent::Wait(unsigned a_TimeoutMSec)
void cEvent::Set(void)
{
- m_ShouldContinue = true;
+ {
+ std::unique_lock<std::mutex> Lock(m_Mutex);
+ m_ShouldContinue = true;
+ }
m_CondVar.notify_one();
}
@@ -61,7 +64,10 @@ void cEvent::Set(void)
void cEvent::SetAll(void)
{
- m_ShouldContinue = true;
+ {
+ std::unique_lock<std::mutex> Lock(m_Mutex);
+ m_ShouldContinue = true;
+ }
m_CondVar.notify_all();
}
diff --git a/src/OSSupport/Event.h b/src/OSSupport/Event.h
index 2c58ba485..067a2207c 100644
--- a/src/OSSupport/Event.h
+++ b/src/OSSupport/Event.h
@@ -12,7 +12,6 @@
#include <mutex>
#include <condition_variable>
-#include <atomic>
@@ -42,7 +41,7 @@ public:
private:
/** Used for checking for spurious wakeups. */
- std::atomic<bool> m_ShouldContinue;
+ bool m_ShouldContinue;
/** Mutex protecting m_ShouldContinue from multithreaded access. */
std::mutex m_Mutex;
diff --git a/src/RankManager.cpp b/src/RankManager.cpp
index ee39026ea..e6cd2d665 100644
--- a/src/RankManager.cpp
+++ b/src/RankManager.cpp
@@ -1846,7 +1846,7 @@ void cRankManager::SetRankVisuals(
stmt.bind(2, a_MsgSuffix);
stmt.bind(3, a_MsgNameColorCode);
stmt.bind(4, a_RankName);
- if (!stmt.executeStep())
+ if (stmt.exec() < 1)
{
LOGINFO("%s: Rank %s not found, visuals not set.", __FUNCTION__, a_RankName.c_str());
}