#! /bin/csh -f

mv ./.global ./Global.$$
cp ./.players ./Players.$$
mv ./.planets ./Planets.$$
mv ./.conquer ./Conquer.$$
mv ./logfile ./Logfile.$$
mv ./inl_log ./INL_log.$$
mv ./inl_stats ./INL_stats.$$
mv ./.inl_timestats ./Timestats.$$


if ($1 != "player") then
# save player file
	reset_tourney
else
# nuke player file
	reset_tourney player
endif

pwstats -o ./Players.$$ ./PWstats.$$
pwstats -aon ./Players.$$ ./PWstats.$$
pwstats -ap ./Players.$$ ./PWstats.$$
snidstats ./Timestats.$$ ./Popstats.$$

# quick log of player's logins from INL_log.
# players can send fake "joining as" messages if they like BTW
grep Ensign INL_log.$$ | cut -c34- | grep "joining as" > ./Logins.$$


echo Tourney completed.  Files in File.$$

if ($2 != "") then
	echo Running register_tourney
	register_tourney $$
endif
