#!/bin/csh -f
#
# Program to refresh 've' data files after an empire update.  World
# information ('news', 'market', etc) is stored in files ('newsout', 
# 'marketout', etc) that will be overwritten at the next update.
# Telegrams are temporarily stored in a file 'readout', and logged to
# a file 'telegrams.save'.
#
# Honors COUNTRY and PASSWORD if set, prompts if not.  Usage is
# 'update' from within your empire data directory.  Assumes realm #0
# includes your entire country.
#
if (! $?COUNTRY) then
    echo -n "Country: "
    setenv COUNTRY $<
endif
#
if (! $?PASSWORD) then
    echo -n "Password: "
    stty -echo
    setenv PASSWORD $<
    stty echo
endif
#
# set up directory for update
echo "map" >! mapout
echo "cen" >! cenout
echo "com" >! comout
echo "radar" >! radarout
echo "coastwatch" >! coastout
echo "ship" >! shipout
echo "plane" >! planeout
#
empire $COUNTRY << EOI
$PASSWORD
map #0 >> mapout
cen #0 >> cenout
com #0 >> comout
ship >> shipout
plane >> planeout
radar #0 ?des=) >> radarout
read >! readout
y
news >! newsout
power >! powerout
nation >! nationout
market >! marketout
report >! reportout
quit
EOI
cat readout >>! telegrams.save
