]> git.scottworley.com Git - planeteer/blobdiff - planeteer.go
Allow specifying a starting cargo
[planeteer] / planeteer.go
index e3c04cfb3bd9690bbd5e465605240b788b34c6fc..a707d589d11778890efc81cb73b5f2a31346278a 100644 (file)
@@ -43,6 +43,8 @@ var fuel = flag.Int("fuel", 16, "Hyper Jump power left")
 
 var hold = flag.Int("hold", 300, "Size of your cargo hold")
 
+var start_hold = flag.String("start_hold", "", "Start with a hold full of cargo")
+
 var start_edens = flag.Int("start_edens", 0,
        "How many Eden Warp Units are you starting with?")
 
@@ -283,7 +285,9 @@ func CreateStateTable(data planet_data, dims []int) []State {
        addr[Fuel] = *fuel
        addr[Edens] = *start_edens
        addr[Location] = data.p2i[*start]
-       addr[Traded] = 1
+       if *start_hold != "" {
+               addr[Hold] = data.c2i[*start_hold]
+       }
        start_index := EncodeIndex(dims, addr)
        table[start_index].value = int32(*funds)
        table[start_index].from = FROM_ROOT
@@ -520,7 +524,7 @@ func CellValue(data planet_data, dims []int, table []State, addr []int) int32 {
 
        // UI: Progress bar
        cell_filled_count++
-       if cell_filled_count&0xff == 0 {
+       if cell_filled_count&0xfff == 0 {
                print(fmt.Sprintf("\r%3.1f%%", 100*float64(cell_filled_count)/float64(StateTableSize(dims))))
        }