chiark / gitweb /
Fix output formatting a little.
[rocl] / elite-pairs
index d4ce23a5ea065e117f57304c082fee4e51d9a980..5a435cf1d6c7bcef3e7d4e930904ce907446b52d 100755 (executable)
@@ -1,8 +1,8 @@
 #! /usr/bin/tclsh
 #
 #! /usr/bin/tclsh
 #
-# $Id: elite-pairs,v 1.3 2003/02/26 00:02:51 mdw Exp $
+# $Id: elite-pairs,v 1.4 2003/03/07 00:41:46 mdw Exp $
 
 
-package require "elite" "1.0.0"
+package require "elite" "1.0.1"
 
 proc ok {s vv expr} {
   global argv0
 
 proc ok {s vv expr} {
   global argv0
@@ -47,7 +47,7 @@ for {set i 0} {$i < [llength $argv]} {incr i} {
     }
     "-d" {
       incr i
     }
     "-d" {
       incr i
-      set d [expr {[lindex $argv $i] * 10}]
+      set d [expr {int([lindex $argv $i] * 10)}]
     }
     "-v" {
       incr v
     }
     "-v" {
       incr v
@@ -73,20 +73,17 @@ if {$i != [llength $argv] - 2} {
   exit 1
 }
 destructure {aexpr bexpr} [lrange $argv $i end]
   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) {
 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]} {
     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]
       if {$v} {
        puts [format "%s (%.1f LY)" [world-summary $s] $d]
        puts [world-summary $ss]