aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--die.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/die.cpp b/die.cpp
index 4782705..28be07c 100644
--- a/die.cpp
+++ b/die.cpp
@@ -95,15 +95,17 @@ void Die::replaceLastValue(qint64 value)
void Die::roll(bool adding)
{
- quint64 value=(qrand()%m_faces)+1;
-
- if((adding)||(m_rollResult.isEmpty()))
- {
- insertRollValue(value);
- }
- else
+ if(m_faces!=0)
{
- replaceLastValue(value);
+ quint64 value=(qrand()%m_faces)+1;
+ if((adding)||(m_rollResult.isEmpty()))
+ {
+ insertRollValue(value);
+ }
+ else
+ {
+ replaceLastValue(value);
+ }
}
}