From 55df24ffb8e9970eefddb386b532712a8aae55d4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 16 Sep 2016 16:54:41 +0200 Subject: [PATCH] all code review nitpicks fixed. --- s/runtests | 2 +- s/travis-build | 1 - src/CMakeLists.txt | 2 +- src/kernel/save.c | 6 ------ src/kernel/save.h | 1 - src/kernel/save.test.c | 1 + src/kernel/version.c | 7 +++++++ src/kernel/version.h | 14 +++++++++----- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/s/runtests b/s/runtests index d0b3432e8..2f22402dc 100755 --- a/s/runtests +++ b/s/runtests @@ -20,6 +20,6 @@ $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests.lua $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e2.lua $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e4.lua -rm -rf data reports orders.txt score score.alliances +rm -rf data reports orders.txt score score.alliances datum turn cd $OLDWPD diff --git a/s/travis-build b/s/travis-build index f2ec7e487..414a70f80 100755 --- a/s/travis-build +++ b/s/travis-build @@ -12,7 +12,6 @@ fi set -e [ -z $BUILD ] && BUILD=Debug ; export BUILD -cmake --version s/cmake-init s/build cd $ROOT diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e4d90c069..11bd860ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project (server C) include_directories (${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/kernel/save.c b/src/kernel/save.c index bffc339f9..b9b522794 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1858,12 +1858,6 @@ static void clear_npc_orders(faction *f) } } -int version_no(const char *str) { - int maj = 0, min = 0, bld = 0; - sscanf(str, "%d.%d.%d", &maj, &min, &bld); - return (maj << 16) | (min << 8) | bld; -} - int writegame(const char *filename) { int n; diff --git a/src/kernel/save.h b/src/kernel/save.h index 27dd56661..3cd443926 100644 --- a/src/kernel/save.h +++ b/src/kernel/save.h @@ -79,7 +79,6 @@ extern "C" { int write_game(struct gamedata *data); int read_game(struct gamedata *data); - int version_no(const char *str); /* test-only functions that give access to internal implementation details (BAD) */ void _test_write_password(struct gamedata *data, const struct faction *f); diff --git a/src/kernel/save.test.c b/src/kernel/save.test.c index 95acbd4c0..00b5ff96c 100644 --- a/src/kernel/save.test.c +++ b/src/kernel/save.test.c @@ -5,6 +5,7 @@ #include #include "save.h" +#include "version.h" #include "unit.h" #include "group.h" #include "ally.h" diff --git a/src/kernel/version.c b/src/kernel/version.c index 95d61f014..220e113f7 100644 --- a/src/kernel/version.c +++ b/src/kernel/version.c @@ -1,5 +1,6 @@ #include "version.h" +#include #ifndef ERESSEA_VERSION // the version number, if it was not passed to make with -D #define ERESSEA_VERSION "3.10.0-devel" @@ -8,3 +9,9 @@ const char *eressea_version(void) { return ERESSEA_VERSION; } + +int version_no(const char *str) { + int maj = 0, min = 0, bld = 0; + sscanf(str, "%d.%d.%d", &maj, &min, &bld); + return (maj << 16) | (min << 8) | bld; +} diff --git a/src/kernel/version.h b/src/kernel/version.h index f71177f9f..c268e7bac 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -1,13 +1,17 @@ +#pragma once /* +-------------------+ | | Enno Rehling | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2007 | Christian Schlittchen - | | + | (c) 1998 - 2016 | Christian Schlittchen + | | https://github.com/eressea/server +-------------------+ - - This program may not be used, modified or distributed - without prior permission by the authors of Eressea. */ +#ifndef H_KERNEL_VERSION +#define H_KERNEL_VERSION + const char *eressea_version(void); +int version_no(const char *str); + +#endif