From d1ad6058bb610fc8880108ba7181f32642f69763 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 3 Nov 2011 17:54:53 -0700 Subject: [PATCH] Using an eden warp doesn't give you cargo. --- planeteer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/planeteer.go b/planeteer.go index 40d19dd..12bf879 100644 --- a/planeteer.go +++ b/planeteer.go @@ -221,7 +221,7 @@ func EncodeIndex(dims, addr []int) int { 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] @@ -300,14 +300,16 @@ func FillCellByArriving(data planet_data, dims []int, table []State, addr []int) } /* 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 + 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] + other[UnusedCargo] = addr[UnusedCargo] other[Edens] = addr[Edens] } } -- 2.44.1