diff options
| author | 2018-03-18 17:43:27 +0100 | |
|---|---|---|
| committer | 2018-03-18 17:43:27 +0100 | |
| commit | 8edc89703e5e0be26471432bc0e953d694bc92a5 (patch) | |
| tree | 1b5598828986b747dbed9a1b77a9a0494f014779 /result/diceresult.cpp | |
| parent | 86bd8dbc2bba4023ef4d7e3ba9c21a4396c9ccd1 (diff) | |
| download | OneRoll-8edc89703e5e0be26471432bc0e953d694bc92a5.tar.gz OneRoll-8edc89703e5e0be26471432bc0e953d694bc92a5.zip | |
-Get copy for result
Diffstat (limited to 'result/diceresult.cpp')
| -rw-r--r-- | result/diceresult.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/result/diceresult.cpp b/result/diceresult.cpp index b3d5e54..b8ed8d5 100644 --- a/result/diceresult.cpp +++ b/result/diceresult.cpp @@ -150,7 +150,7 @@ void DiceResult::setOperator(const Die::ArithmeticOperator& dieOperator) QString DiceResult::toString(bool wl) { QStringList scalarSum; - for(Die* die:m_diceValues) + for(auto die : m_diceValues) { scalarSum << QString::number(die->getValue()); } @@ -163,3 +163,18 @@ QString DiceResult::toString(bool wl) return m_id; } } +Result* DiceResult::getCopy() const +{ + auto copy = new DiceResult(); + copy->setHomogeneous(m_homogeneous); + copy->setOperator(m_operator); + QList<Die*> list; + for(auto die : m_diceValues) + { + auto newdie = new Die(*die); + die->displayed(); + list.append(newdie); + } + copy->setResultList(list); + return copy; +} |