]> git.scottworley.com Git - planeteer/commitdiff
Using an eden warp doesn't give you cargo.
authorScott Worley <sworley@chkno.net>
Fri, 4 Nov 2011 00:54:53 +0000 (17:54 -0700)
committerScott Worley <sworley@chkno.net>
Fri, 4 Nov 2011 00:54:53 +0000 (17:54 -0700)
planeteer.go

index 40d19dd700c6b9dc4187ed32869c35555f220216..12bf87934b985eabd5e3fd10beb7818c0b7a99d9 100644 (file)
@@ -221,7 +221,7 @@ func EncodeIndex(dims, addr []int) int {
                panic(0)
        }
        for i := 1; i < NumDimensions; i++ {
                panic(0)
        }
        for i := 1; i < NumDimensions; i++ {
-               if addr[i] > dims[i] {
+               if addr[i] < 0 || addr[i] > dims[i] {
                        panic(i)
                }
                index = index*dims[i] + addr[i]
                        panic(i)
                }
                index = index*dims[i] + addr[i]
@@ -300,14 +300,16 @@ func FillCellByArriving(data planet_data, dims []int, table []State, addr []int)
        }
 
        /* Travel here via Eden Warp Unit */
        }
 
        /* Travel here via Eden Warp Unit */
-       if addr[Edens]+1 < dims[Edens] {
+       if addr[Edens]+1 < dims[Edens] && addr[UnusedCargo] > 1 {
                _, available := data.Planets[data.i2p[addr[Location]]].RelativePrices["Eden Warp Units"]
                if !available {
                        other[Edens] = addr[Edens] + 1
                _, available := data.Planets[data.i2p[addr[Location]]].RelativePrices["Eden Warp Units"]
                if !available {
                        other[Edens] = addr[Edens] + 1
+                       other[UnusedCargo] = addr[UnusedCargo] - 1
                        for other[Location] = 0; other[Location] < dims[Location]; other[Location]++ {
                                UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
                        }
                        other[Location] = addr[Location]
                        for other[Location] = 0; other[Location] < dims[Location]; other[Location]++ {
                                UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
                        }
                        other[Location] = addr[Location]
+                       other[UnusedCargo] = addr[UnusedCargo]
                        other[Edens] = addr[Edens]
                }
        }
                        other[Edens] = addr[Edens]
                }
        }