diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b91565da..2d2635f05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,40 +6,35 @@ 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}) +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") if (MSVC) -include(MSVC) +find_package (PDCurses) +set (CURSES_FOUND ${PDCURSES_FOUND}) +set (CURSES_LIBRARIES ${PDCURSES_LIBRARY}) +set (CURSES_INCLUDE_DIR ${PDCURSES_INCLUDE_DIR}) set (HAVE_STRDUP 0) set (HAVE_STRLCAT 0) set (HAVE_LIBBSD 0) set (HAVE_SIGNAL_H 0) set (HAVE_EXECINFO_H 0) +include (MSVC) else (MSVC) -INCLUDE (CheckIncludeFile) +find_package (Curses) +include (CheckIncludeFile) CHECK_INCLUDE_FILE(signal.h HAVE_SIGNAL_H) CHECK_INCLUDE_FILE(execinfo.h HAVE_EXECINFO_H) CHECK_INCLUDE_FILE(bsd/string.h HAVE_LIBBSD) -INCLUDE (CheckFunctionExists) +include (CheckFunctionExists) CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP) -IF (HAVE_LIBBSD) -INCLUDE (CheckLibraryExists) +if (HAVE_LIBBSD) +include (CheckLibraryExists) CHECK_LIBRARY_EXISTS(bsd strlcat "bsd/string.h" HAVE_STRLCAT) -ELSE (HAVE_LIBBSD) +else (HAVE_LIBBSD) CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT) -ENDIF(HAVE_LIBBSD) - -endif (MSVC) - -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) +endif (HAVE_LIBBSD) endif (MSVC) find_package (Readline) diff --git a/cmake/Modules/FindToLua.cmake b/cmake/Modules/FindToLua.cmake index 52c721112..92732981b 100644 --- a/cmake/Modules/FindToLua.cmake +++ b/cmake/Modules/FindToLua.cmake @@ -58,7 +58,9 @@ elseif(TOLUA_INCLUDE_DIR AND EXISTS "${TOLUA_INCLUDE_DIR}/tolua.h") string(REGEX REPLACE "^#define[\t ]+TOLUA_VERSION[\t ]+\"tolua ([^\"]*)\".*" "\\1" TOLUA_VERSION_STRING "${tolua_version_str}") unset(tolua_version_str) -endif() +else(PC_TOLUA_VERSION) +message(ERROR "TOLUA_VERSION_STRING cannot be determined") +endif(PC_TOLUA_VERSION) # handle the QUIETLY and REQUIRED arguments and set TOLUA_FOUND to TRUE if # all listed variables are TRUE diff --git a/conf/e2/config.json b/conf/e2/config.json index 4da247263..cc480b2e2 100644 --- a/conf/e2/config.json +++ b/conf/e2/config.json @@ -41,7 +41,8 @@ "nmr.timeout": 5, "nmr.removenewbie": false, "GiveRestriction": 3, - "hunger.long": true, + "hunger.long": false, + "hunger.damage": "1d9+9", "init_spells": 0, "game.era": 2, "game.start": 184, diff --git a/src/bind_gmtool.c b/src/bind_gmtool.c index d0a023a5b..5901ccf1d 100644 --- a/src/bind_gmtool.c +++ b/src/bind_gmtool.c @@ -160,7 +160,7 @@ static int tolua_make_island(lua_State * L) int y = (int)tolua_tonumber(L, 2, 0); int s = (int)tolua_tonumber(L, 3, 0); - s = build_island_e3(x, y, s, NULL, 0); + s = build_island(x, y, s, NULL, 0); lua_pushinteger(L, s); return 1; } diff --git a/src/gmtool.c b/src/gmtool.c index 0ab31854e..3ec464a3f 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -1143,7 +1143,7 @@ static void handlekey(state * st, int c) else { n = minpop; } - build_island_e3(nx, ny, n, NULL, 0); + build_island(nx, ny, n, NULL, 0); st->modified = 1; st->wnd_info->update |= 1; st->wnd_status->update |= 1; diff --git a/src/kernel/gamedata.h b/src/kernel/gamedata.h index 986b13d1d..587ee0a40 100644 --- a/src/kernel/gamedata.h +++ b/src/kernel/gamedata.h @@ -64,6 +64,4 @@ void gamedata_close(gamedata *data); gamedata *gamedata_open(const char *filename, const char *mode, int version); int gamedata_openfile(gamedata *data, const char *filename, const char *mode, int version); -#define STREAM_VERSION 2 /* internal encoding of binary files */ - #endif diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index 65d4b1dfc..a59567dd4 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -49,7 +49,7 @@ #include #include -const terrain_type *random_terrain(const terrain_type * terrains[], +static const terrain_type *random_terrain_select(const terrain_type * terrains[], int distribution[], int size) { int ndistribution = size; @@ -583,7 +583,7 @@ int autoseed(newfaction ** players, int nsize, int max_agediff) break; } else { - terraform_region(r, random_terrain(terrainarr, distribution, nterrains)); + terraform_region(r, random_terrain_select(terrainarr, distribution, nterrains)); --isize; } } @@ -619,7 +619,7 @@ int autoseed(newfaction ** players, int nsize, int max_agediff) pnormalize(&x, &y, pl); rn = new_region(x, y, pl, 0); if (rng_int() % SPECIALCHANCE < special) { - terrain = random_terrain(terrainarr, distribution, nterrains); + terrain = random_terrain_select(terrainarr, distribution, nterrains); special = SPECIALCHANCE / 3; /* 33% chance auf noch eines */ } else { @@ -698,23 +698,21 @@ region *regionqueue_pop(region_list ** rlist) return 0; } -#define GEOMAX 8 +#define GEOMAX 7 static struct geo { int distribution; terrain_t type; } geography_e3[GEOMAX] = { - { - 8, T_OCEAN }, { - 3, T_SWAMP }, { - 1, T_VOLCANO }, { - 3, T_DESERT }, { - 4, T_HIGHLAND }, { - 3, T_MOUNTAIN }, { - 2, T_GLACIER }, { - 1, T_PLAIN } + { 8, T_OCEAN }, + { 3, T_SWAMP }, + { 3, T_DESERT }, + { 4, T_HIGHLAND }, + { 3, T_MOUNTAIN }, + { 2, T_GLACIER }, + { 1, T_PLAIN } }; -const terrain_type *random_terrain_e3(direction_t dir) +const terrain_type *random_terrain(direction_t dir) { static const terrain_type **terrainarr = 0; static int *distribution = 0; @@ -731,7 +729,7 @@ const terrain_type *random_terrain_e3(direction_t dir) distribution[n] = geography_e3[n].distribution; } } - return random_terrain(terrainarr, distribution, GEOMAX); + return random_terrain_select(terrainarr, distribution, GEOMAX); } static int @@ -864,8 +862,8 @@ static void starting_region(newfaction ** players, region * r, region * rn[]) } } -/* E3A island generation */ -int build_island_e3(int x, int y, int minsize, newfaction ** players, int numfactions) +/* island generator */ +int build_island(int x, int y, int minsize, newfaction ** players, int numfactions) { #define MIN_QUALITY 1000 int nfactions = 0; @@ -881,14 +879,14 @@ int build_island_e3(int x, int y, int minsize, newfaction ** players, int numfac r = new_region(x, y, pl, 0); } do { - terraform_region(r, random_terrain_e3(NODIRECTION)); + terraform_region(r, random_terrain(NODIRECTION)); } while (!r->land); while (r) { fset(r, RF_MARK); if (r->land) { if (nsize < minsize) { - nsize += random_neighbours(r, &rlist, &random_terrain_e3, minsize - nsize); + nsize += random_neighbours(r, &rlist, &random_terrain, minsize - nsize); } else { nsize += random_neighbours(r, &rlist, &get_ocean, minsize - nsize); diff --git a/src/modules/autoseed.h b/src/modules/autoseed.h index b78a2df55..cec42ba4a 100644 --- a/src/modules/autoseed.h +++ b/src/modules/autoseed.h @@ -33,10 +33,8 @@ extern "C" { extern int autoseed(newfaction ** players, int nsize, int max_agediff); extern newfaction *read_newfactions(const char *filename); - extern const struct terrain_type *random_terrain(const struct terrain_type - *terrains[], int distribution[], int size); - extern int build_island_e3(int x, int y, int minsize, newfaction **players, int numfactions); + extern int build_island(int x, int y, int minsize, newfaction **players, int numfactions); #ifdef __cplusplus } diff --git a/src/report.c b/src/report.c index ae9607736..961f5227e 100644 --- a/src/report.c +++ b/src/report.c @@ -1216,14 +1216,14 @@ static void statistics(struct stream *out, const region * r, const faction * f) if (!markets_module()) { if (buildingtype_exists(r, bt_find("caravan"), true)) { - m = msg_message("nr_stat_luxuries", "max", (p * 2) / TRADE_FRACTION); + p *= 2; } - else { + if (p >= TRADE_FRACTION) { m = msg_message("nr_stat_luxuries", "max", p / TRADE_FRACTION); + nr_render(m, f->locale, buf, sizeof(buf), f); + paragraph(out, buf, 2, 2, 0); + msg_release(m); } - nr_render(m, f->locale, buf, sizeof(buf), f); - paragraph(out, buf, 2, 2, 0); - msg_release(m); } /* count */ diff --git a/vs2017-build.bat b/vs2017-build.bat index 7503153fe..22e153874 100644 --- a/vs2017-build.bat +++ b/vs2017-build.bat @@ -1,13 +1,16 @@ @ECHO OFF +IF "%WIN32_DEV%" == "" SET WIN32_DEV="C:\Libraries" +SET CMAKE_ROOT=%ProgramFiles%\CMake +IF "%LUA_DEV%" == "" SET LUA_DEV="%ProgramFiles(x86)%/Lua/5.1" SET VSVERSION=15 SET SRCDIR=%CD% -CD .. -SET ERESSEA=%CD% +REM CD .. +REM SET ERESSEA=%CD% +REM CD %SRCDIR% -CD %SRCDIR% IF exist build-vs%VSVERSION% goto HAVEDIR mkdir build-vs%VSVERSION% :HAVEDIR cd build-vs%VSVERSION% -"%ProgramFiles%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE .. +"%CMAKE_ROOT%\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%LUA_DEV%;%WIN32_DEV%" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE .. PAUSE