]> git.scottworley.com Git - planeteer/commitdiff
Implement --visit
authorScott Worley <sworley@chkno.net>
Fri, 11 Nov 2011 06:09:34 +0000 (22:09 -0800)
committerScott Worley <sworley@chkno.net>
Fri, 11 Nov 2011 06:09:34 +0000 (22:09 -0800)
planeteer.go

index 060456dae90b2fe30acd9383b4944bea3fc6272e..a2406ab30cf9a2ec6a0a79ab2afdcbc03e1232f0 100644 (file)
@@ -429,6 +429,14 @@ func FillCellByMisc(data planet_data, dims []int, table []State, addr []int) {
        }
 
        /* Visit this planet */
        }
 
        /* Visit this planet */
+       var i uint
+       for i = 0; i < uint(len(visit())); i++ {
+               if addr[Visit] & (1 << i) != 0 && visit()[i] == data.i2p[addr[Location]] {
+                       other[Visit] = addr[Visit] & ^(1 << i)
+                       UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
+               }
+       }
+       other[Visit] = addr[Visit]
 
 }
 
 
 }
 
@@ -618,6 +626,10 @@ func DescribePath(data planet_data, dims []int, table []State, start int) (descr
                if addr[BuyFighters] == 1 && prev[BuyFighters] == 0 {
                        line += fmt.Sprint("Buy ", *drones, " Fighter Drones")
                }
                if addr[BuyFighters] == 1 && prev[BuyFighters] == 0 {
                        line += fmt.Sprint("Buy ", *drones, " Fighter Drones")
                }
+               if addr[Visit] != prev[Visit] {
+                       // TODO: verify that the bit chat changed is addr[Location]
+                       line += fmt.Sprint("Visit ", data.i2p[addr[Location]])
+               }
                if line == "" {
                        line = fmt.Sprint(prev, " -> ", addr)
                }
                if line == "" {
                        line = fmt.Sprint(prev, " -> ", addr)
                }