From: Scott Worley Date: Wed, 2 Nov 2011 22:32:10 +0000 (-0700) Subject: Relative prices from the data file are percentages X-Git-Url: http://git.scottworley.com/planeteer/commitdiff_plain/cbf01f59c3e293e272cb83a35b125c22a9ce499b Relative prices from the data file are percentages Divide them by 100 before using them. --- diff --git a/planeteer.go b/planeteer.go index 4dbb27b..53f69f1 100644 --- a/planeteer.go +++ b/planeteer.go @@ -319,8 +319,8 @@ func FillCellBySelling(data planet_data, dims []int, table []State, addr []int) continue } base_price := data.Commodities[commodity].BasePrice - absolute_price := relative_price * base_price - sell_price := int(float64(absolute_price) * 0.9) + absolute_price := float64(base_price) * float64(relative_price) / 100.0 + sell_price := int(absolute_price * 0.9) for other[UnusedCargo] = 0; other[UnusedCargo] < dims[UnusedCargo]; other[UnusedCargo]++ { @@ -350,7 +350,7 @@ func FillCellByBuying(data planet_data, dims []int, table []State, addr []int) { return } base_price := data.Commodities[commodity].BasePrice - absolute_price := relative_price * base_price + absolute_price := int(float64(base_price) * float64(relative_price) / 100.0) quantity := *hold - addr[UnusedCargo] total_price := quantity * absolute_price other[Hold] = 0