From: Scott Worley Date: Thu, 3 Nov 2011 23:12:34 +0000 (-0700) Subject: Don't eden warp to planets that sell eden warp units. X-Git-Url: http://git.scottworley.com/planeteer/commitdiff_plain/0c27c3442a12e844cb7459037f20a32705440bab Don't eden warp to planets that sell eden warp units. The Codex forbids this. Also, only use one eden warp unit at a time. --- diff --git a/planeteer.go b/planeteer.go index 9ff2de7..85b07a1 100644 --- a/planeteer.go +++ b/planeteer.go @@ -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) {