]> git.scottworley.com Git - planeteer/commitdiff
Don't eden warp to planets that sell eden warp units.
authorScott Worley <sworley@chkno.net>
Thu, 3 Nov 2011 23:12:34 +0000 (16:12 -0700)
committerScott Worley <sworley@chkno.net>
Thu, 3 Nov 2011 23:12:34 +0000 (16:12 -0700)
The Codex forbids this.

Also, only use one eden warp unit at a time.

planeteer.go

index 9ff2de79976d0f4ef565ff3009c3d59ac50450f1..85b07a122d9edfe795bb77d422f66d88c6a88937 100644 (file)
@@ -300,13 +300,17 @@ func FillCellByArriving(data planet_data, dims []int, table []State, addr []int)
        }
 
        /* Travel here via Eden Warp Unit */
-       for other[Edens] = addr[Edens] + 1; other[Edens] < dims[Edens]; other[Edens]++ {
-               for other[Location] = 0; other[Location] < dims[Location]; other[Location]++ {
-                       UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
+       if addr[Edens]+1 < dims[Edens] {
+               _, available := data.Planets[data.i2p[addr[Location]]].RelativePrices["Eden Warp Units"]
+               if !available {
+                       other[Edens] = addr[Edens] + 1
+                       for other[Location] = 0; other[Location] < dims[Location]; other[Location]++ {
+                               UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
+                       }
+                       other[Location] = addr[Location]
+                       other[Edens] = addr[Edens]
                }
        }
-       other[Location] = addr[Location]
-       other[Edens] = addr[Edens]
 }
 
 func FillCellBySelling(data planet_data, dims []int, table []State, addr []int) {