]> git.scottworley.com Git - planeteer/blobdiff - planeteer.go
Don't eden warp to planets that sell eden warp units.
[planeteer] / 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) {