mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 08:39:19 +02:00
refactor(sonar): rely on class template argument deduction (cpp:S6012)
This commit is contained in:
@@ -393,7 +393,7 @@ sound_source::play_basic() {
|
||||
// dispatch appropriate sound
|
||||
if( true == m_playbeginning
|
||||
&& sound(sound_id::begin).buffer != null_handle) {
|
||||
std::vector<sound_id> sounds { sound_id::begin, sound_id::main };
|
||||
std::vector sounds { sound_id::begin, sound_id::main };
|
||||
insert( std::begin( sounds ), std::end( sounds ) );
|
||||
m_playbeginning = false;
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ sound_source::update_soundproofing() {
|
||||
void
|
||||
sound_source::insert( sound_handle const Sound ) {
|
||||
|
||||
std::vector<sound_handle> sounds { Sound };
|
||||
std::vector sounds { Sound };
|
||||
return insert( std::begin( sounds ), std::end( sounds ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ opengl33_precipitation::create( int const Tesselation ) {
|
||||
std::uint16_t index = 0;
|
||||
|
||||
// auto const radius { 25.f }; // cylinder radius
|
||||
std::vector<float> radii { 25.f, 10.f, 5.f, 1.f };
|
||||
std::vector radii { 25.f, 10.f, 5.f, 1.f };
|
||||
for( auto radius : radii ) {
|
||||
|
||||
for( int i = 0; i <= latitudes; ++i ) {
|
||||
|
||||
@@ -39,7 +39,7 @@ opengl_precipitation::create( int const Tesselation ) {
|
||||
std::uint16_t index = 0;
|
||||
|
||||
// auto const radius { 25.f }; // cylinder radius
|
||||
std::vector<float> radii { 25.f, 10.f, 5.f, 1.f };
|
||||
std::vector radii { 25.f, 10.f, 5.f, 1.f };
|
||||
for( auto radius : radii ) {
|
||||
|
||||
for( int i = 0; i <= latitudes; ++i ) {
|
||||
|
||||
@@ -127,14 +127,14 @@ bool ClearFlag(int &Flag, int const Value)
|
||||
double Random(double min, double max)
|
||||
{
|
||||
if (max < min) { std::swap(min, max); } // std::uniform_real_distribution requires min <= max (inverted bounds are UB)
|
||||
std::uniform_real_distribution<double> dist(min, max);
|
||||
std::uniform_real_distribution dist(min, max);
|
||||
return dist(Global.random_engine);
|
||||
}
|
||||
|
||||
int Random(int min, int max)
|
||||
{
|
||||
if (max < min) { std::swap(min, max); } // std::uniform_int_distribution requires min <= max (inverted bounds are UB)
|
||||
std::uniform_int_distribution<int> dist(min, max);
|
||||
std::uniform_int_distribution dist(min, max);
|
||||
return dist(Global.random_engine);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ std::uint32_t seed_of(std::string const &Text)
|
||||
|
||||
std::string generate_uuid_v4()
|
||||
{
|
||||
std::uniform_int_distribution<int> dist(0, 255);
|
||||
std::uniform_int_distribution dist(0, 255);
|
||||
|
||||
std::array<uint8_t, 16> bytes;
|
||||
for (auto &b : bytes)
|
||||
@@ -203,7 +203,7 @@ std::string generate_uuid_v4()
|
||||
double LocalRandom(double a, double b)
|
||||
{
|
||||
if (b < a) { std::swap(a, b); } // std::uniform_real_distribution requires a <= b (inverted bounds are UB)
|
||||
std::uniform_real_distribution<double> dist(a, b);
|
||||
std::uniform_real_distribution dist(a, b);
|
||||
return dist(Global.local_random_engine);
|
||||
}
|
||||
|
||||
|
||||
@@ -426,12 +426,12 @@ class condition_variable
|
||||
// methods
|
||||
void wait()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock lock(m_mutex);
|
||||
m_condition.wait(lock, [this]() { return m_spurious == false; });
|
||||
}
|
||||
template <class Rep_, class Period_> void wait_for(const std::chrono::duration<Rep_, Period_> &Time)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock lock(m_mutex);
|
||||
m_condition.wait_for(lock, Time, [this]() { return m_spurious == false; });
|
||||
}
|
||||
void notify_one()
|
||||
|
||||
@@ -76,7 +76,7 @@ void TGauge::Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Ty
|
||||
auto const nulloffset { glm::vec3{} };
|
||||
auto const offset { model_offset() };
|
||||
{
|
||||
std::vector<sound_source *> soundfxs = {
|
||||
std::vector soundfxs = {
|
||||
&m_soundfxincrease,
|
||||
&m_soundfxdecrease,
|
||||
&m_soundfxon,
|
||||
|
||||
@@ -180,7 +180,7 @@ void ui::cameraview_panel::record_func()
|
||||
while (record_state == RUNNING) {
|
||||
if (bufpos == frame_size)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
std::unique_lock lock(mutex);
|
||||
auto r = notify_var.wait_for(lock, std::chrono::milliseconds(50), [this, last_cnt]{return last_cnt != frame_cnt;});
|
||||
last_cnt = frame_cnt;
|
||||
if (!image_ptr || !r)
|
||||
|
||||
Reference in New Issue
Block a user