]> git.scottworley.com Git - planeteer/commitdiff
Allow specifying a starting cargo
authorScott Worley <sworley@chkno.net>
Thu, 1 Dec 2011 15:34:51 +0000 (07:34 -0800)
committerScott Worley <sworley@chkno.net>
Thu, 1 Dec 2011 15:34:51 +0000 (07:34 -0800)
planeteer.go

index 72f9935f453ea205f3534e2a81a5c1daa8fc4867..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 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?")
 
 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[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
        start_index := EncodeIndex(dims, addr)
        table[start_index].value = int32(*funds)
        table[start_index].from = FROM_ROOT