From: Scott Worley Date: Wed, 26 Oct 2011 04:12:26 +0000 (-0700) Subject: Some safety against future modifications in DimensionSizes(). X-Git-Url: http://git.scottworley.com/planeteer/commitdiff_plain/2f4ed5caeb960f8e2ffd331ad2b7057e534f374d?ds=sidebyside Some safety against future modifications in DimensionSizes(). --- diff --git a/planeteer.go b/planeteer.go index 5acf98f..314a3b6 100644 --- a/planeteer.go +++ b/planeteer.go @@ -142,6 +142,13 @@ func DimensionSizes(data planet_data) []int { dims[NeedFighters] = bint(*drones > 0) + 1 dims[NeedShields] = bint(*batteries > 0) + 1 dims[Visit] = 1 << uint(len(visit())) + + // Remind myself to add a line above when adding new dimensions + for i, dim := range dims { + if dim < 1 { + panic(i) + } + } return dims }