From 6b8df360bed7a9d2bc182f25fcd86235aa47735b Mon Sep 17 00:00:00 2001 Message-Id: <6b8df360bed7a9d2bc182f25fcd86235aa47735b.1714679059.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 6 Feb 2006 19:14:49 +0000 Subject: [PATCH] Highly compressed world-summary strings. Organization: Straylight/Edgeware From: mdw * Add world-brief in elite.tcl to create a summary string. * Use the brief summaries in elite-tantalus and elite-pairs. * Document the new function. Also fix out-of-date docs for elite-summary. --- DEVGUIDE | 11 +++++++++-- elite-pairs | 5 +++-- elite-tantalus | 5 ++--- elite.tcl | 16 +++++++++++++++- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/DEVGUIDE b/DEVGUIDE index 6561dc7..5cb167b 100644 --- a/DEVGUIDE +++ b/DEVGUIDE @@ -187,9 +187,16 @@ Package `elite' seeds in PP are in G. It's not a problem if the seeds in PP aren't valid. - world-summary P + world-summary P [IND [SPC]] Produce a standard one-line summary of information about the - world P (a seed). + world P (a seed). IND is the number of spaces to insert before + the world name, and SPC is the number of additional spaces to + insert afterwards; both default to 0 if not supplied. + + world-brief P + Produce a very short summary about the world P, showing its + name, tech-level, and cryptic abbreviations for economic and + government status. jameson ARR Populate ARR with the standard Commander Jameson. diff --git a/elite-pairs b/elite-pairs index 5a435cf..700006b 100755 --- a/elite-pairs +++ b/elite-pairs @@ -1,6 +1,6 @@ #! /usr/bin/tclsh # -# $Id: elite-pairs,v 1.4 2003/03/07 00:41:46 mdw Exp $ +# $Id$ package require "elite" "1.0.1" @@ -89,7 +89,8 @@ foreach {s x y} $ww { 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] } } } diff --git a/elite-tantalus b/elite-tantalus index 478d5ba..bdb6285 100755 --- a/elite-tantalus +++ b/elite-tantalus @@ -69,8 +69,8 @@ foreach g $gg { set dd [$lv get $i $j] set r [expr {$dd/"$d.0"}] if {$r >= $minratio} { - puts [format "%14s %-8s -> %-8s %5.1f %5.1f (%5.1f)" \ - $g [worldname $w] [worldname $ww] \ + puts [format "%14s %s -> %s %4.1f %5.1f (%4.1f)" \ + $g [world-brief $w] [world-brief $ww] \ [expr {$d/10.0}] [expr {$dd/10.0}] $r] } } @@ -79,4 +79,3 @@ foreach g $gg { $lv destroy $pv destroy } - diff --git a/elite.tcl b/elite.tcl index 127d72c..d72250f 100644 --- a/elite.tcl +++ b/elite.tcl @@ -1,6 +1,6 @@ #! /usr/bin/tclsh # -# $Id: elite.tcl,v 1.6 2003/03/07 00:44:57 mdw Exp $ +# $Id$ package require "elite-bits" "1.0.1" @@ -38,6 +38,9 @@ tab eco \ rich-ind avg-ind poor-ind mainly-ind \ mainly-agri rich-agri avg-agri poor-agri +tab gv Ay Fl MG Dp Ct Cy Dy CS +tab ec RI AI PI MI MA RA AA PA + set products { food "Food" textiles "Textiles" @@ -398,6 +401,17 @@ proc world-summary {s {ind 0} {spc 0}} { $eco($p(economy)) $gov($p(government)) $p(techlevel) $p(seed)] } +# --- world-brief PLANET --- +# +# Return a very brief summary string for PLANET. + +proc world-brief {s} { + global gv ec + elite-worldinfo p $s + return [format "%-8s (%s, %s, %2d)" \ + $p(name) $ec($p(economy)) $gv($p(government)) $p(techlevel)] +} + # --- jameson ARR --- # # Fill ARR with the information about commander JAMESON. -- [mdw]