Fix savegame not loading and improve build
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Fábio André Damas 2025-06-04 20:37:26 +00:00
parent 5dcbafdeaa
commit b5ed770d81
3 changed files with 11 additions and 7 deletions

View file

@ -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

View file

@ -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"

View file

@ -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