3 package require "elite" "1.0.0"
8 for {set i 0} {$i < [llength $argv]} {incr i} {
9 set a [lindex $argv $i]
13 set a [lindex $argv $i]
14 set g [parse-galaxy-spec $a]
15 if {[string equal $g ""]} {
16 puts stderr "$argv0: bad galaxy string `$a'"
23 set a [lindex $argv $i]
24 set weight "weight-$a"
25 if {[lsearch -exact [info commands "weight-*"] $weight] == -1} {
26 puts stderr "$argv0: unknown weight function `$a'"
27 puts stderr "$argv0: I know [info commands weight-*]"
36 puts stderr "unknown switch `$a'"
50 foreach a [lrange $argv $i end] {
51 set s [parse-planet-spec $g $a]
52 if {[string equal $s ""]} {
53 puts stderr "$argv0: unknown planet `$a'"
56 if {![info exists px($s)]} {
57 puts stderr "$argv0: planet `$a' doesn't exist in galaxy $ng"
62 if {[llength $r] < 2} {
63 puts stderr "usage: $argv0 \[-g GALAXY\] \[-w WEIGHT\] PLANET PLANET ..."
66 puts -nonewline stderr "\[computing adjacency table..."
69 set home [lindex $r 0]
71 foreach w [lrange $r 1 end] {
72 destructure {p .} [shortest-path adj $home $w $weight]
74 puts -stderr "$argv0: no route from [worldinfo $home] to [worldinfo $w]"
82 if {![string equal $s $last]} {
83 puts [world-summary $s]