chiark / gitweb /
Highly compressed world-summary strings.
[rocl] / elite-pairs
index d4ce23a5ea065e117f57304c082fee4e51d9a980..700006bd3df4f77ea66e700a052dcd16638c3a99 100755 (executable)
@@ -1,8 +1,8 @@
 #! /usr/bin/tclsh
 #
-# $Id: elite-pairs,v 1.3 2003/02/26 00:02:51 mdw Exp $
+# $Id$
 
-package require "elite" "1.0.0"
+package require "elite" "1.0.1"
 
 proc ok {s vv expr} {
   global argv0
@@ -47,7 +47,7 @@ for {set i 0} {$i < [llength $argv]} {incr i} {
     }
     "-d" {
       incr i
-      set d [expr {[lindex $argv $i] * 10}]
+      set d [expr {int([lindex $argv $i] * 10)}]
     }
     "-v" {
       incr v
@@ -73,26 +73,24 @@ if {$i != [llength $argv] - 2} {
   exit 1
 }
 destructure {aexpr bexpr} [lrange $argv $i end]
-puts -nonewline stderr "\[computing adjacency table..."
-flush stderr
-set ww [worldinfo $g]
-adjacency $ww adj $d
-puts stderr " done\]"
+set ww [elite-galaxylist $g]
+elite-adjacency adj $ww $d
 unset a
 foreach {s x y} $ww {
   if {![ok $s {} $aexpr]} { continue }
   elite-worldinfo a $s
   set l {}
   foreach {ss xx yy} $adj($s) {
-    set d [world-distance $x $y $xx $yy]
+    set d [elite-distance $x $y $xx $yy]
     if {[ok $ss {a d} $bexpr]} {
-      set d [expr {[world-distance $x $y $xx $yy]/10.0}]
+      set d [expr {[elite-distance $x $y $xx $yy]/10.0}]
       if {$v} {
        puts [format "%s (%.1f LY)" [world-summary $s] $d]
        puts [world-summary $ss]
        puts ""
       } else {
-       puts [format "%-11s %-11s (%.1f LY)" $a(name) [worldname $ss] $d]
+       puts [format "%s  %s  (%.1f LY)" \
+                 [world-brief $s] [world-brief $ss] $d]
       }
     }
   }