From f1a89a3ca758c8af549e62ad4258504cb2bc2c7c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 28 Jul 2019 01:07:11 +0200 Subject: Fix dice copy constructor and set default value --- die.cpp | 4 +++- die.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/die.cpp b/die.cpp index 2d2ff91..531853c 100644 --- a/die.cpp +++ b/die.cpp @@ -35,7 +35,7 @@ Die::Die() , m_op(Die::PLUS) //,m_mt(m_randomDevice) { auto seed= std::chrono::high_resolution_clock::now().time_since_epoch().count(); - m_rng= std::mt19937(quintptr(this) + seed); + m_rng= std::mt19937(quintptr(this) + static_cast(seed)); } Die::Die(const Die& die) { @@ -49,6 +49,8 @@ Die::Die(const Die& die) m_base= die.m_base; m_color= die.getColor(); m_op= die.getOp(); + auto seed= std::chrono::high_resolution_clock::now().time_since_epoch().count(); + m_rng= std::mt19937(quintptr(this) + static_cast(seed)); } void Die::setValue(qint64 r) diff --git a/die.h b/die.h index f544808..eb43521 100644 --- a/die.h +++ b/die.h @@ -151,8 +151,8 @@ private: bool m_hasValue= false; bool m_displayStatus= false; bool m_highlighted= true; - qint64 m_maxValue; - qint64 m_base; + qint64 m_maxValue= 0; + qint64 m_base= 0; QString m_color; Die::ArithmeticOperator m_op; -- cgit v1.2.3-70-g09d2