瀏覽代碼

Improve game start scripts

joostsijm 2 年之前
父節點
當前提交
36dade3bc5
共有 4 個文件被更改,包括 38 次插入5 次删除
  1. 0 5
      start.sh
  2. 12 0
      start_client.sh
  3. 17 0
      start_server.sh
  4. 9 0
      utils.sh

+ 0 - 5
start.sh

@@ -1,5 +0,0 @@
-#!/bin/sh
-
-screen -S $1 -Am \
-	/usr/local/games/openttd -D -c $1.cfg -g ./save/$1.sav
-	# /usr/local/games/openttd -D -c $1.cfg

+ 12 - 0
start_client.sh

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+source ./utils.sh
+
+#openttd_exe=/usr/local/games/openttd 
+openttd_exe=~/dev/packages/OpenTTD-patches/build/openttd
+config_file=~/.openttd/config/$1.cfg
+
+echo "info | conf file ${config_file}"
+check_file_exists "${save_file}"
+
+${openttd_exe} -c ${config_file}

+ 17 - 0
start_server.sh

@@ -0,0 +1,17 @@
+#!/bin/sh
+
+source ./utils.sh
+
+#openttd_exe=/usr/local/games/openttd 
+openttd_exe=~/dev/packages/OpenTTD-patches/build/openttd
+config_file=~/.openttd/config/cb_${1}.cfg
+save_file=~/.openttd/save/cb_${2}.sav
+
+echo "info | conf file ${config_file}"
+check_file_exists "${save_file}"
+echo "info | save file ${save_file}"
+check_file_exists "${config_file}"
+
+# tmux new -s openttd_{$1} \
+	${openttd_exe} -D -c ${config_file} -g ${save_file}
+	# /usr/local/games/openttd -D -c $1.cfg

+ 9 - 0
utils.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+check_file_exists() {
+    echo "info | config file ${1}"
+    if [ ! -f "${1}" ]; then
+        echo "warn | file ${1} does not exist."
+        exit
+    fi
+}