From: Scott Worley Date: Thu, 24 Nov 2011 07:10:04 +0000 (-0800) Subject: Private flag X-Git-Url: http://git.scottworley.com/planeteer/commitdiff_plain/370d198431389207cae2521ff186437eba3ef729?ds=sidebyside Private flag --- diff --git a/planeteer.go b/planeteer.go index 5e406fa..e9f10c7 100644 --- a/planeteer.go +++ b/planeteer.go @@ -110,6 +110,7 @@ type Commodity struct { } type Planet struct { BeaconOn bool + Private bool /* Use relative prices rather than absolute prices because you can get relative prices without traveling to each planet. */ RelativePrices map[string]int @@ -336,6 +337,10 @@ func FillCellByArriving(data planet_data, dims []int, table []State, addr []int) } func FillCellBySelling(data planet_data, dims []int, table []State, addr []int) { + if data.Planets[data.i2p[addr[Location]]].Private { + // Can't do commerce on private planets + return + } if addr[Hold] > 0 { // Can't sell and still have cargo return @@ -373,6 +378,10 @@ func FillCellBySelling(data planet_data, dims []int, table []State, addr []int) } func FillCellByBuying(data planet_data, dims []int, table []State, addr []int) { + if data.Planets[data.i2p[addr[Location]]].Private { + // Can't do commerce on private planets + return + } if addr[Hold] == 0 { // Can't buy and then have nothing return