瀏覽代碼

Updated: cleaned and compiling again.

Still need to finish porting c++ to go.
Steve Thielemann 3 年之前
父節點
當前提交
c042a36d15
共有 2 個文件被更改,包括 11 次插入11 次删除
  1. 1 1
      deck.go
  2. 10 10
      playcards.go

+ 1 - 1
deck.go

@@ -13,7 +13,7 @@ type Deck struct {
 
 func (d *Deck) SetBackColor(color string) {
 	for x := 0; x < 5; x++ {
-		for idx, _ := range d.Backs[x].Lines {
+		for idx := range d.Backs[x].Lines {
 			d.Backs[x].Lines[idx].DefaultColor = color
 		}
 	}

+ 10 - 10
playcards.go

@@ -199,9 +199,9 @@ func (pc *PlayCards) Init() {
 			})
 
 		timeUpdate := func() string {
-			left := pc.Door.TimeLeft()
-			used := pc.Door.TimeUsed()
-			txt := fmt.Sprintf("Time used: %3d / %3d", used.Minutes(), left.Minutes())
+			var left int = int(pc.Door.TimeLeft().Minutes())
+			var used int = int(pc.Door.TimeUsed().Minutes())
+			txt := fmt.Sprintf("Time used: %3d / %3d", used, left)
 			txt += strings.Repeat(" ", W-len(txt))
 			return txt
 		}
@@ -399,7 +399,7 @@ func (pc *PlayCards) Init() {
 					if v == 0 {
 						text += "   "
 					} else {
-						text += fmt.Sprintf("%-2d")
+						text += fmt.Sprintf("%-2d", v)
 						status := pc.Day_status[v-1]
 						switch status {
 						case 0:
@@ -492,6 +492,7 @@ func (pc *PlayCards) PlayCards() int {
 
 	off_x := (MX - game_width) / 2
 	off_y := (MY - game_height) / 2
+	_ = off_x
 
 	// We can now position things properly centered
 	pc.SpaceAceTriPeaks.X = (MX - pc.SpaceAceTriPeaks.Width) / 2
@@ -512,19 +513,18 @@ func (pc *PlayCards) PlayCards() int {
 	{
 		// Secret Squirrel method of seeding the RNG
 		sha1 := sha1.New()
-		seeds := make([]byte, 0)
+		seed_seq := make([]byte, 0)
 
 		for _, seed := range pc.Seeds {
 			ba := int32toByteArray(seed)
-			seeds = append(seeds, ba[:]...)
+			seed_seq = append(seed_seq, ba[:]...)
 			// sha1.Sum(ba[:])
 		}
 		pd := int64toByteArray(pc.Play_day_t)
-		seeds = append(seeds, pd[:]...)
+		seed_seq = append(seed_seq, pd[:]...)
 
-		result := sha1.Sum(seeds)
-		var seed int64
-		seed = int64(binary.BigEndian.Uint64(result[0:8]))
+		result := sha1.Sum(seed_seq)
+		var seed int64 = int64(binary.BigEndian.Uint64(result[0:8]))
 		pc.RNG.Seed(seed)
 	}
 	return 0