From 0c27c3442a12e844cb7459037f20a32705440bab Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 3 Nov 2011 16:12:34 -0700 Subject: [PATCH] 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. --- planeteer.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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) { -- 2.44.1