aboutsummaryrefslogtreecommitdiff
path: root/logic
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2017-01-30 13:22:03 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2017-01-30 13:22:03 +0100
commita3307cfac80b2932b7665a1a6aa812f6e34a6b9a (patch)
tree11716d503676b1970e4acb39121c74779ee75566 /logic
parentcfe34944094ffff5b61878d55aa14798d7701297 (diff)
downloadgoffel-a3307cfac80b2932b7665a1a6aa812f6e34a6b9a.tar.gz
goffel-a3307cfac80b2932b7665a1a6aa812f6e34a6b9a.zip
dices: use fancy dice runes only if explicit specified
Diffstat (limited to 'logic')
-rw-r--r--logic/dices.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/logic/dices.go b/logic/dices.go
index 43dca22..bab1248 100644
--- a/logic/dices.go
+++ b/logic/dices.go
@@ -8,6 +8,12 @@ import (
)
var diceRunes = [7]string{"", "\u2680", "\u2681", "\u2682", "\u2683", "\u2684", "\u2685"}
+var fancy = false
+
+func SetFancyPrint(f bool) {
+ fancy = f
+}
+
type Dices [5]int
@@ -28,7 +34,11 @@ func (d *Dices) Roll(i []int) error {
func (d Dices) String() string {
s := ""
for _, v := range d {
- s += diceRunes[v] + " "
+ if fancy {
+ s += diceRunes[v] + " "
+ } else {
+ s += fmt.Sprintf("%d ", v)
+ }
}
return fmt.Sprintf("%s", s)
}