3 # Abort the script on error.
6 # Give helpful message to players that want to start without compiling first.
7 if [ ! -e ./roguelike-server ]
9 echo 'No ./roguelike-server file found to execute. Try "make" first?'
12 if [ ! -e ./roguelike-client ]
14 echo 'No ./roguelike-client file found to execute. Try "make" first?'
18 # Use shell script's arguments for server and pipe server output to log file.
19 # This script's wrapper script will read it out on exit.
20 ./roguelike-server "$@" > log 2>&1 &
24 # Give server some time to start up and exit on error.
27 # The client should not start if the server is not running. (If the server was
28 # running in the foreground, any error exit of it so far would be caught by "set
29 # -e" above. But "set -e" is blind to error codes generated in the background.)
30 kill -0 $! 2> /dev/null
32 # Give server some time (max. 10 seconds) to generate its worldstate file.
34 while [ ! -e server/worldstate ] && [ $i -le 1000 ]
39 if [ ! -e server/worldstate ]
41 echo "Server failed generating worldstate file within given time limit."
45 # Only start the interface when everything else went well.
46 kill -0 $! 2> /dev/null