]> git.scottworley.com Git - planeteer/commitdiff
Fix flight plan logic (destination, not origin)
authorScott Worley <sworley@chkno.net>
Thu, 3 Nov 2011 21:58:27 +0000 (14:58 -0700)
committerScott Worley <sworley@chkno.net>
Thu, 3 Nov 2011 21:58:27 +0000 (14:58 -0700)
planeteer.go

index 3dd20374cf54d869152145277c2510443d15f0c8..d5c359aaacf5f65bcc3791508da9342ba31cbc69 100644 (file)
@@ -276,10 +276,11 @@ func FillCellByArriving(data planet_data, dims []int, table []State, addr []int)
        /* Travel here via a hidey hole */
        if addr[Fuel]+1 < dims[Fuel] {
                hole_index := (dims[Fuel] - 1) - (addr[Fuel] + 1)
        /* Travel here via a hidey hole */
        if addr[Fuel]+1 < dims[Fuel] {
                hole_index := (dims[Fuel] - 1) - (addr[Fuel] + 1)
-               if hole_index < len(flight_plan()) {
+               if hole_index < len(flight_plan()) && addr[Location] == data.p2i[flight_plan()[hole_index]] {
                        other[Fuel] = addr[Fuel] + 1
                        other[Fuel] = addr[Fuel] + 1
-                       other[Location] = data.p2i[flight_plan()[hole_index]]
-                       UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
+                       for other[Location] = 0; other[Location] < dims[Location]; other[Location]++ {
+                               UpdateCell(table, my_index, EncodeIndex(dims, other), 0)
+                       }
                        other[Location] = addr[Location]
                        other[Fuel] = addr[Fuel]
                }
                        other[Location] = addr[Location]
                        other[Fuel] = addr[Fuel]
                }