11package state
22
33import (
4- "strconv"
5-
64 "github.com/applejag/epic-wizard-firefly-gladiators/pkg/util"
75 "github.com/applejag/firefly-go-math/ffrand"
86
@@ -80,11 +78,11 @@ func (g *GameState) Save() {
8078 }
8179 firefly .DumpFile ("save" , save )
8280
83- var buf [len ( "saved game, size: " ) + 10 + len ( " B" ) ]byte
84- index := copy (buf [0 :], "saved game, size: " )
85- index += util .FormatIntInto (buf [index :], len (save ))
86- index += copy (buf [index :], " B" )
87- util .LogDebugBytes (buf [:index ])
81+ var buf [32 ]byte
82+ n := copy (buf [0 :], "saved game, size: " )
83+ n += util .FormatIntInto (buf [n :], len (save ))
84+ n += copy (buf [n :], " B" )
85+ util .LogDebugBytes (buf [:n ])
8886}
8987
9088func (g * GameState ) HasSave () bool {
@@ -102,7 +100,11 @@ func (g *GameState) LoadSave() bool {
102100 return false
103101 }
104102
105- firefly .LogDebug ("loaded saved game, size: " + strconv .Itoa (len (file )) + " B" )
103+ var buf [42 ]byte
104+ n := copy (buf [0 :], "loaded saved game, size: " )
105+ n += util .FormatIntInto (buf [n :], len (file ))
106+ n += copy (buf [n :], " B" )
107+ firefly .LogDebugBytes (buf [:n ])
106108 return true
107109}
108110
0 commit comments