From c92f7505e5134255520a2cdac7e2f7206574dfe2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 7 Apr 2019 13:11:02 +0200 Subject: [PATCH 1/6] Bug 2576: additional logging. increase log verbosity, decrease some log levels. --- scripts/eressea/tunnels.lua | 16 +++++++++++++--- src/creport.c | 9 ++++----- src/magic.c | 2 +- src/main.c | 4 ++-- src/reports.c | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/scripts/eressea/tunnels.lua b/scripts/eressea/tunnels.lua index 4a787a373..6b7a8e8d1 100644 --- a/scripts/eressea/tunnels.lua +++ b/scripts/eressea/tunnels.lua @@ -27,11 +27,21 @@ end local function tunnel_action(b, param) local units = tunnel_travelers(b) local rto = get_target(param) + eressea.log.info("Tunnel from " .. tostring(b) .. " [" .. param .. "]") if rto and units then - eressea.log.debug("Tunnel from " .. tostring(b) .. " [" .. param .. "]") - for key, u in pairs(units) do + for _, u in pairs(units) do u.region = rto - eressea.log.debug("teleported " .. tostring(u) .. " to " .. tostring(rto)) + eressea.log.info("teleported " .. tostring(u) .. " to " .. tostring(rto)) + end + elseif not units then + eressea.log.info("No units in tunnel " .. tostring(b) .. " [" .. param .. "]") + elseif not rto then + eressea.log.error("No target for tunnel " .. tostring(b) .. " [" .. param .. "]") + end + -- debug code to find bugs: + for u in b.region.units do + if u.building == b then + eressea.log.error("Did not teleport " .. tostring(u) .. " from tunnel " .. tostring(b)) end end end diff --git a/src/creport.c b/src/creport.c index 45400f241..0458f7271 100644 --- a/src/creport.c +++ b/src/creport.c @@ -848,13 +848,12 @@ void cr_output_unit(stream *out, const faction * f, pzTmp = get_racename(u->attribs); if (pzTmp) { - const char *pzRace = LOC(lang, mkname("race", pzTmp)); - pzTmp = pzRace ? pzRace : pzTmp; - stream_printf(out, "\"%s\";Typ\n", translate(pzTmp, LOC(lang, pzTmp))); + const char *pzRace = locale_string(lang, mkname("race", pzTmp), false); + pzTmp = pzRace ? translate(pzRace, LOC(lang, pzRace)) : pzTmp; + stream_printf(out, "\"%s\";Typ\n", pzTmp); if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) { pzRace = rc_name_s(u_race(u), NAME_PLURAL); - stream_printf(out, "\"%s\";wahrerTyp\n", - translate(pzRace, LOC(lang, pzRace))); + stream_printf(out, "\"%s\";wahrerTyp\n", pzTmp); } } else { diff --git a/src/magic.c b/src/magic.c index d7b57f24d..fdd74d55e 100644 --- a/src/magic.c +++ b/src/magic.c @@ -2237,7 +2237,7 @@ static void equip_familiar(unit *fam) { snprintf(eqname, sizeof(eqname), "fam_%s", rc->_name); if (!equip_unit(fam, eqname)) { - log_info("could not perform initialization for familiar %s.\n", rc->_name); + log_debug("could not perform initialization for familiar %s.\n", rc->_name); } } diff --git a/src/main.c b/src/main.c index 6b80c0cb0..4216d3046 100644 --- a/src/main.c +++ b/src/main.c @@ -53,7 +53,7 @@ static const char *logfile = "eressea.log"; static const char *luafile = 0; static const char *inifile = "eressea.ini"; static int memdebug = 0; -static int verbosity = 1; +static int verbosity = 2; static void load_inifile(void) { @@ -183,7 +183,7 @@ static int verbosity_to_flags(int verbosity) { static int parse_args(int argc, char **argv) { int i; - int log_stderr, log_flags = 2; + int log_stderr, log_flags = 3; for (i = 1; i != argc; ++i) { char *argi = argv[i]; diff --git a/src/reports.c b/src/reports.c index 056ee8dd0..42deefb12 100644 --- a/src/reports.c +++ b/src/reports.c @@ -715,7 +715,7 @@ void bufunit(const faction * f, const unit * u, const faction *fv, pzTmp = get_racename(u->attribs); if (pzTmp) { - const char *name = LOC(lang, mkname("race", pzTmp)); + const char *name = locale_string(lang, mkname("race", pzTmp), false); sbs_strcat(sbp, name ? name : pzTmp); if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) { sbs_strcat(sbp, " ("); From de5181f3fef66d034fc09151ae78e74120b73033 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 6 Apr 2019 11:29:19 +0200 Subject: [PATCH 2/6] I am moving my library dependency folder to c:\libraries build.bat needed to know that. --- CMakeLists.txt | 7 ++----- cmake/Modules/FindToLua.cmake | 4 +++- vs2017-build.bat | 11 +++++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b91565da..aa4e746c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,9 +31,6 @@ 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}) @@ -42,7 +39,8 @@ else (MSVC) find_package (Curses) endif (MSVC) -find_package (Readline) +# find_package (Readline) +find_package (EXPAT REQUIRED) if (ERESSEA_DB STREQUAL "db") find_package (BerkeleyDB REQUIRED QUIET) @@ -50,7 +48,6 @@ else() find_package (SQLite3 REQUIRED QUIET) endif() -find_package(EXPAT REQUIRED) find_package (ToLua REQUIRED) if (TOLUA_FOUND) if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2") 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/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 From 2c03c67075fccd61be73f04960a072dc544dd7a0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 6 Apr 2019 11:41:56 +0200 Subject: [PATCH 3/6] fix cmake syntax. --- CMakeLists.txt | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa4e746c0..2d2635f05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,41 +6,38 @@ 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) - -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) -find_package (EXPAT REQUIRED) +find_package (Readline) if (ERESSEA_DB STREQUAL "db") find_package (BerkeleyDB REQUIRED QUIET) @@ -48,6 +45,7 @@ else() find_package (SQLite3 REQUIRED QUIET) endif() +find_package(EXPAT REQUIRED) find_package (ToLua REQUIRED) if (TOLUA_FOUND) if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2") From adb626df3d83c74e3bd33e5a52b15211fa31ff1f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 19 Apr 2019 20:14:43 +0200 Subject: [PATCH 4/6] stop using the turn column from gamedb --- process/epasswd.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/process/epasswd.py b/process/epasswd.py index bdb3c4a6d..3e0033236 100755 --- a/process/epasswd.py +++ b/process/epasswd.py @@ -45,9 +45,7 @@ class EPasswd: def load_database(self, file): conn = sqlite3.connect(file) c = conn.cursor() - c.execute('SELECT MAX(turn) FROM factions') - args = c.fetchone() - for row in c.execute('SELECT no, email, password FROM factions WHERE turn=?', args): + for row in c.execute('SELECT no, email, password FROM factions ORDER BY turn'): (no, email, passwd) = row self.set_data(baseconvert(no, 36), email, passwd) conn.close() From 6fcfca27ca20279a1ca0bea46d27e27d4734b5c9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 20 Apr 2019 08:15:27 +0200 Subject: [PATCH 5/6] Revert "stop using the turn column from gamedb" This reverts commit adb626df3d83c74e3bd33e5a52b15211fa31ff1f. --- process/epasswd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/process/epasswd.py b/process/epasswd.py index 3e0033236..bdb3c4a6d 100755 --- a/process/epasswd.py +++ b/process/epasswd.py @@ -45,7 +45,9 @@ class EPasswd: def load_database(self, file): conn = sqlite3.connect(file) c = conn.cursor() - for row in c.execute('SELECT no, email, password FROM factions ORDER BY turn'): + c.execute('SELECT MAX(turn) FROM factions') + args = c.fetchone() + for row in c.execute('SELECT no, email, password FROM factions WHERE turn=?', args): (no, email, passwd) = row self.set_data(baseconvert(no, 36), email, passwd) conn.close() From 97afaa29c34bd507e0ad0f895595db3092c2c4b5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 26 Apr 2019 06:10:17 +0200 Subject: [PATCH 6/6] increase maximum number of submissions per week from 20 to 30. --- process/accept-orders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/accept-orders.py b/process/accept-orders.py index 69a6ce28f..237184861 100755 --- a/process/accept-orders.py +++ b/process/accept-orders.py @@ -54,7 +54,7 @@ hostname = gethostname() orderbase = "orders.dir" sendmail = True # maximum number of reports per sender: -maxfiles = 20 +maxfiles = 30 # write headers to file? writeheaders = True # reject all html email?