Skip to content

Commit

Permalink
Autoreload marked longturn games
Browse files Browse the repository at this point in the history
Automatically load the last savegame of a longturn game that is marked
for autoreload when it is (re)started.
  • Loading branch information
lonemadmax committed Feb 26, 2019
1 parent 06c906f commit 90dd03e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions publite2/init-freeciv-web.sh
Expand Up @@ -36,6 +36,14 @@ savesdir=${1}
if [ "$5" = "longturn" ]; then
savesdir="${savesdir}/lt/${6}"
mkdir -p "${savesdir}"

grep -q '^#\s*autoreload\s*$' "pubscript_${6}.serv"
if [ $? -eq 0 ]; then
lastsave=$(ls -t "${savesdir}" | head -n 1)
if [ -n "${lastsave}" ]; then
addArgs --file "${lastsave%.*}"
fi
fi
else
addArgs --quitidle 20
fi
Expand Down

0 comments on commit 90dd03e

Please sign in to comment.