From b5ed770d81723f366e3be0dc9586c0fe28aeff71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Andr=C3=A9=20Damas?= Date: Wed, 4 Jun 2025 20:37:26 +0000 Subject: [PATCH] Fix savegame not loading and improve build --- Dockerfile | 2 +- docker-compose.yml | 5 +++-- start.sh | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6bcf0a8..237378c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ RUN git clone --depth 1 --branch jgrpp-$OPENTTD_JGR_VERSION https://github.com/J WORKDIR /openttd/source RUN mkdir build && cd build && \ - cmake .. -DCMAKE_BUILD_TYPE=Release && \ + cmake .. -DCMAKE_BUILD_TYPE=Release -DOPTION_DEDICATED=ON && \ make -j$(nproc) FROM alpine:latest diff --git a/docker-compose.yml b/docker-compose.yml index cc920d3..3fecf7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,9 @@ services: container_name: openttd-jgr volumes: - ./save:/root/.openttd/save - # - ./content:/root/.openttd/content - # - ./config:/root/.openttd + - ./content:/root/.openttd/content_download + - ./openttd.cfg:/root/.openttd/openttd.cfg + - ./private.cfg:/root/.openttd/private.cfg ports: - "3979:3979/udp" - "3979:3979/tcp" diff --git a/start.sh b/start.sh index 1401b56..fb506f4 100644 --- a/start.sh +++ b/start.sh @@ -1,9 +1,12 @@ #!/bin/sh -SAVE_FILE="/root/.openttd/save/autosave/latest.sav" +SAVE_DIR="/root/.openttd/save" +LATEST_SAVE=$(ls -rt ${SAVE_DIR}/autosave/ | tail -n1) +ABSOLUTE_SAVE="$SAVE_DIR/autosave/$LATEST_SAVE" -if [ -f "$SAVE_FILE" ]; then - echo "Loading savegame: $SAVE_FILE" - exec /openttd/openttd -D -g autosave/latest.sav + +if [ -f "$ABSOLUTE_SAVE" ]; then + echo "Loading savegame: $LATEST_SAVE" + exec /openttd/openttd -D -g $ABSOLUTE_SAVE else echo "No savegame found. Starting new game." exec /openttd/openttd -D