Skip to content

Commit

Permalink
Merge pull request #766 from eressea/develop
Browse files Browse the repository at this point in the history
preparing release 3.15
  • Loading branch information
ennorehling authored Feb 7, 2018
2 parents 04f46cd + 961c6e0 commit 89d158b
Show file tree
Hide file tree
Showing 350 changed files with 8,433 additions and 6,784 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ script: s/travis-build
addons:
apt:
packages:
- libbsd-dev
- liblua5.1-dev
- libtolua-dev
- libncurses5-dev
- libsqlite3-dev
- libxml2-dev
- valgrind
- cppcheck
- shellcheck
os:
- linux
notifications:
Expand Down
46 changes: 39 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,56 @@
cmake_minimum_required(VERSION 2.8)
project (eressea-server C)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})

if (WIN32)
FILE(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH )
FILE(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH )
endif(WIN32)

project (eressea-server C)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})

if (MSVC)
include(MSVC)
set (HAVE_STRDUP 0)
set (HAVE_STRLCAT 0)
set (HAVE_LIBBSD 0)
else (MSVC)

INCLUDE (CheckIncludeFile)
CHECK_INCLUDE_FILE(bsd/string.h HAVE_LIBBSD)

INCLUDE (CheckFunctionExists)
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
IF (HAVE_LIBBSD)
INCLUDE (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(bsd strlcat "bsd/string.h" HAVE_STRLCAT)
ELSE (HAVE_LIBBSD)
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
ENDIF(HAVE_LIBBSD)

endif (MSVC)

find_package (SQLite3)
if (MSVC)
find_package (PDCurses)
SET(CURSES_FOUND ${PDCURSES_FOUND})
SET(CURSES_LIBRARIES ${PDCURSES_LIBRARY})
SET(CURSES_INCLUDE_DIR ${PDCURSES_INCLUDE_DIR})
else (MSVC)
find_package (Curses)
find_package (LibXml2)
endif (MSVC)

if (ERESSEA_DB STREQUAL "db")
find_package (BerkeleyDB REQUIRED QUIET)
else()
find_package (SQLite3 REQUIRED QUIET)
endif()

find_package (LibXml2 REQUIRED)
find_package (ToLua REQUIRED)
if (TOLUA_FOUND)
if (${TOLUA_VERSION_STRING} VERSION_GREATER "5.2")
if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2")
find_package (Lua 5.2 REQUIRED)
elseif (${TOLUA_VERSION_STRING} VERSION_GREATER "5.1")
find_package (Lua 5.1 REQUIRED)
else ()
find_package (Lua51 REQUIRED)
endif()
endif(TOLUA_FOUND)

Expand All @@ -39,3 +70,4 @@ install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PAT
install(DIRECTORY lunit DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY share DESTINATION ${CMAKE_INSTALL_PREFIX})


50 changes: 50 additions & 0 deletions cmake/Modules/FindBerkeleyDB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- cmake -*-

# - Find BerkeleyDB
# Find the BerkeleyDB includes and library
# This module defines
# DB_INCLUDE_DIR, where to find db.h, etc.
# DB_LIBRARIES, the libraries needed to use BerkeleyDB.
# DB_FOUND, If false, do not try to use BerkeleyDB.
# also defined, but not for general use are
# DB_LIBRARY, where to find the BerkeleyDB library.

FIND_PATH(DB_INCLUDE_DIR db.h
/usr/local/include/db4
/usr/local/include
/usr/include/db4
/usr/include
)

SET(DB_NAMES ${DB_NAMES} db)
FIND_LIBRARY(DB_LIBRARY
NAMES ${DB_NAMES}
PATHS /usr/lib /usr/local/lib
)

IF (DB_LIBRARY AND DB_INCLUDE_DIR)
SET(DB_LIBRARIES ${DB_LIBRARY})
SET(DB_FOUND "YES")
ELSE (DB_LIBRARY AND DB_INCLUDE_DIR)
SET(DB_FOUND "NO")
ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR)


IF (DB_FOUND)
IF (NOT DB_FIND_QUIETLY)
MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}")
ENDIF (NOT DB_FIND_QUIETLY)
ELSE (DB_FOUND)
IF (DB_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library")
ENDIF (DB_FIND_REQUIRED)
ENDIF (DB_FOUND)

# Deprecated declarations.
SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH)

MARK_AS_ADVANCED(
DB_LIBRARY
DB_INCLUDE_DIR
)
38 changes: 38 additions & 0 deletions cmake/Modules/FindPDCurses.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Locate PDCurses library
# This module defines
# PDCURSES_LIBRARIES, the name of the library to link against
# PDCURSES_FOUND, if false, do not try to link to PDCurses
# PDCURSES_INCLUDE_DIR, where to find curses.h

FIND_PATH(PDCURSES_INCLUDE_DIR curses.h
HINTS
$ENV{PDCURSESDIR}
PATH_SUFFIXES include/pdcurses include)

FIND_LIBRARY(PDCURSES_LIBRARY
NAMES pdcurses
HINTS
$ENV{PDCURSESDIR}
PATH_SUFFIXES lib64 lib)

FIND_LIBRARY(PDCURSES_PANEL_LIBRARY
NAMES panel
HINTS
$ENV{PDCURSESDIR}
PATH_SUFFIXES lib64 lib)

IF(PDCURSES_LIBRARY)
SET(PDCURSES_LIBRARIES ${PDCURSES_LIBRARY})
IF(PDCURSES_PANEL_LIBRARY)
SET(PDCURSES_LIBRARIES ${PDCURSES_LIBRARIES} ${PDCURSES_PANEL_LIBRARY})
ENDIF(PDCURSES_PANEL_LIBRARY)
ENDIF(PDCURSES_LIBRARY)

SET(PDCURSES_FOUND "NO")
IF(PDCURSES_INCLUDE_DIR AND PDCURSES_LIBRARY)
# message(STATUS "Found PDCurses library: ${PDCURSES_LIBRARIES}")
# Set the final string here so the GUI reflects the final state.
SET(PDCURSES_LIBRARIES PDCURSES_LIBRARY} CACHE STRING "Where the PDCurses Library can be found")

SET(PDCURSES_FOUND "YES")
ENDIF(PDCURSES_INCLUDE_DIR AND PDCURSES_LIBRARY)
7 changes: 6 additions & 1 deletion conf/e2/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"game.id" : 2,
"orders.default": "work",
"NewbieImmunity": 8,
"modules.wormholes": true,
"modules.market": false,
"modules.astralspace": true,
"modules.wormhole": true,
"modules.iceberg": true,
"modules.volcano": true,
"monsters.spawn.chance": 50,
"entertain.base": 0,
"entertain.perlevel": 20,
"taxing.perlevel": 20,
Expand Down
11 changes: 7 additions & 4 deletions conf/e3/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"database.gameid": 7,
"NewbieImmunity": 4,
"modules.astralspace": false,
"modules.wormholes": false,
"modules.markets": true,
"modules.wormhole": false,
"modules.market": true,
"modules.iceberg": false,
"modules.volcano": true,
"magic.regeneration": 0.75,
"magic.power": 0.5,
"resource.factor": 0.25,
Expand All @@ -46,8 +48,8 @@
"healing.forest": 2.0,
"hunger.long": false,
"hunger.damage": "1d9+9",
"hunger.demons.skill": true,
"hunger.demons.peasant_tolerance": true,
"hunger.demon.skills": true,
"hunger.demon.peasant_tolerance": true,
"init_spells": 0,
"recruit.allow_merge": true,
"study.expensivemigrants": true,
Expand All @@ -63,6 +65,7 @@
"rules.stealth.anon_battle": false,
"rules.check_overload": false,
"rules.combat.goblinbonus": 3,
"rules.ship.damage_drift": 0.0,
"rules.alliances": true,
"rules.combat.herospeed": 3,
"rules.combat.demon_vampire": 5,
Expand Down
3 changes: 1 addition & 2 deletions conf/eressea.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[game]
email = eressea-server@kn-bremen.de
email = eressea-server@example.com
sender = Eressea Server
name = Eressea
report = reports
verbose = 0
lomem = 0
memcheck = 0
locales = de,en

Expand Down
6 changes: 6 additions & 0 deletions process/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SCRIPTS=compress.sh send-bz2-report send-zip-report create-orders \
run-turn sendreports.sh
IGNORE=sendreport.sh

shellcheck: $(SCRIPTS)
shellcheck $(SCRIPTS)
19 changes: 10 additions & 9 deletions process/compress.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/bin/bash

if [ -z $ERESSEA ]; then
if [ -z "$ERESSEA" ]; then
echo "You need to define the \$ERESSEA environment variable to run $0"
exit -2
fi

GAME=$ERESSEA/game-$1
GAME_NAME=$(grep -w name $GAME/eressea.ini | sed 's/.*=\s*//')
GAME="$ERESSEA/game-$1"
GAME_NAME=$(grep -w name "$GAME/eressea.ini" | sed 's/.*=\s*//')

TURN=$2
if [ -z $TURN ]
if [ -z "$TURN" ]
then
TURN=`cat $GAME/turn`
TURN=$(cat "$GAME/turn")
fi

if [ ! -d $GAME/reports ]; then
if [ ! -d "$GAME/reports" ]; then
echo "cannot find reports directory in $GAME"
exit -1
fi

cd $GAME/reports
$ERESSEA/server/bin/compress.py $TURN "$GAME_NAME"
cd -
cd "$GAME/reports" || exit
"$ERESSEA/server/bin/compress.py" "$TURN" "$GAME_NAME"
cd - || exit

8 changes: 4 additions & 4 deletions process/create-orders
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
GAME=$1
TURN=$2

if [ ! -d $ERESSEA/game-$GAME ] ; then
if [ ! -d "$ERESSEA/game-$GAME" ] ; then
echo "No such game: $GAME"
exit 1
fi

cd $ERESSEA/game-$GAME
cd "$ERESSEA/game-$GAME" || exit

if [ -d orders.dir.$TURN ]; then
if [ -d "orders.dir.$TURN" ]; then
echo "orders.dir.$TURN already exists"
else
mv orders.dir orders.dir.$TURN
mv orders.dir "orders.dir.$TURN"
mkdir -p orders.dir
fi
find "orders.dir.$TURN" -maxdepth 1 -type f -printf "%T+\t%p\n" | sort | cut -f2 | while read -r
Expand Down
12 changes: 6 additions & 6 deletions process/run-turn
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/sh

GAME=$1
TURN=$2
GAME="$1"
TURN="$2"

if [ ! -d $ERESSEA/game-$GAME ] ; then
if [ ! -d "$ERESSEA/game-$GAME" ] ; then
echo "No such game: $GAME"
exit 1
fi

cd $ERESSEA/game-$GAME
cd "$ERESSEA/game-$GAME" || exit

echo "running turn $TURN, game $GAME"
$ERESSEA/server/bin/eressea -t $TURN run-turn.lua
"$ERESSEA/server/bin/eressea" -t "$TURN" run-turn.lua
mkdir -p log
ln -f eressea.log log/eressea.log.$TURN
ln -f eressea.log "log/eressea.log.$TURN"

11 changes: 6 additions & 5 deletions process/send-bz2-report
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/bin/bash
if [ -z $ERESSEA ]; then
ERESSEA=`echo $PWD |sed -e 's/\/game.*//'`
if [ -z "$ERESSEA" ]; then
ERESSEA=$(echo "$PWD" |sed -e 's/\/game.*//')
echo "Assuming that ERESSEA=$ERESSEA"
fi
if [ ! -f reports.txt ]; then
echo "need to run $0 from the report direcory"
exit -2
fi
source $HOME/bin/functions.sh

TEMPLATE=report-mail.txt
if [ "$1" == "-Lde" ]
Expand All @@ -16,7 +15,7 @@ then
shift
fi

if [ "$1" == "-Lde" ]
if [ "$1" == "-Len" ]
then
TEMPLATE=report-mail.en.txt
shift
Expand All @@ -26,4 +25,6 @@ addr=$1
subj=$2
shift 2

cat $ERESSEA/server/etc/$TEMPLATE | mutt -F $ERESSEA/etc/muttrc -s "$subj" -a $* -- $addr
mutt -F "$ERESSEA/etc/muttrc" -s "$subj" -a "$@" -- "$addr" \
< "$ERESSEA/server/etc/$TEMPLATE"

Loading

0 comments on commit 89d158b

Please sign in to comment.