diff --git a/process/CMakeLists.txt b/process/CMakeLists.txt index 106c4c864..7039bf127 100644 --- a/process/CMakeLists.txt +++ b/process/CMakeLists.txt @@ -1,5 +1,5 @@ install(PROGRAMS create-orders backup-box backup-onedrive - run-turn send-zip-report + run-turn send-zip-report updatelist.sh send-bz2-report compress.py compress.sh epasswd.py accept-orders.py getemail.py checkpasswd.py sendreport.sh sendreports.sh orders-accept DESTINATION bin) diff --git a/process/cron/run-eressea.cron b/process/cron/run-eressea.cron index f72d37482..11993132d 100755 --- a/process/cron/run-eressea.cron +++ b/process/cron/run-eressea.cron @@ -86,6 +86,7 @@ backup BACKUP "$GAME" "$TURN" upload "$BACKUP" rm -f execute.lock "$BIN/run-turn" "$GAME" "$TURN" +"$BIN/updatelist.sh" "$TURN" touch execute.lock (( NEXTTURN=TURN+1 )) || true diff --git a/process/updatelist.sh b/process/updatelist.sh new file mode 100755 index 000000000..cf63df8e1 --- /dev/null +++ b/process/updatelist.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +TURN=$1 +LIST=eressea-announce@kn-bremen.de +awk '{ if ($2 =="'$TURN'") print $5 }' deadlog.txt |\ + mailman delmembers -f- -l$LIST +tail reports/reports.txt | cut -d: -f2 | sed -e 's/email=//' | \ + mailman addmembers - $LIST + diff --git a/src/bind_region.c b/src/bind_region.c index 782900075..c80eb7efd 100644 --- a/src/bind_region.c +++ b/src/bind_region.c @@ -273,15 +273,17 @@ static int tolua_region_has_border(lua_State *L) if (btype) { direction_t dir = (direction_t)tolua_tonumber(L, 3, 0); region *r2 = rconnect(r, dir); - connection *b; - for (b = get_borders(r, r2); b; b = b->next) { - if (b->type == btype) { - lua_pushboolean(L, true); - return 1; + if (r2) { + connection *b; + for (b = get_borders(r, r2); b; b = b->next) { + if (b->type == btype) { + lua_pushboolean(L, true); + return 1; + } } + lua_pushboolean(L, false); + return 1; } - lua_pushboolean(L, false); - return 1; } return 0; } diff --git a/src/kernel/connection.c b/src/kernel/connection.c index f5dfd43d1..8a6740c78 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -100,8 +100,11 @@ static connection **get_borders_i(const region * r1, const region * r2) connection *get_borders(const region * r1, const region * r2) { - connection **bp = get_borders_i(r1, r2); - return *bp; + if (r1 && r2) { + connection **bp = get_borders_i(r1, r2); + return *bp; + } + return NULL; } connection *border_create(region *from) diff --git a/src/kernel/ship.c b/src/kernel/ship.c index 5f732aafb..623fa4b83 100644 --- a/src/kernel/ship.c +++ b/src/kernel/ship.c @@ -581,7 +581,7 @@ unit *ship_owner(const ship * sh) { if (sh->number > 0) { unit *owner = sh->_owner; - if (!owner || owner->ship != sh) { + if (!owner || owner->ship != sh || owner->number <= 0) { unit * heir = ship_owner_ex(sh, owner ? owner->faction : NULL); return (heir && heir->number > 0) ? heir : NULL; } diff --git a/src/kernel/ship.test.c b/src/kernel/ship.test.c index 4436e43bb..7b1681da9 100644 --- a/src/kernel/ship.test.c +++ b/src/kernel/ship.test.c @@ -187,7 +187,7 @@ static void test_shipowner_goes_to_other_when_empty(CuTest * tc) u_set_ship(u, sh); u_set_ship(u2, sh); CuAssertPtrEquals(tc, u, ship_owner(sh)); - leave_ship(u); + u->number = 0; CuAssertPtrEquals(tc, u2, ship_owner(sh)); test_teardown(); } diff --git a/src/kernel/version.c b/src/kernel/version.c index 56acac4fb..b017fdb12 100644 --- a/src/kernel/version.c +++ b/src/kernel/version.c @@ -8,7 +8,7 @@ #ifndef ERESSEA_VERSION /* the version number, if it was not passed to make with -D */ -#define ERESSEA_VERSION "30.4.0" +#define ERESSEA_VERSION "31.1.0" #endif const char *eressea_version(void) { diff --git a/src/main.c b/src/main.c index 9d8973225..a3de84ae9 100644 --- a/src/main.c +++ b/src/main.c @@ -239,7 +239,7 @@ static int parse_args(int argc, char **argv) case 'l': i = get_arg(argc, argv, 2, i, &arg, NULL); if (arg) { - log_flags = arg ? atoi(arg) : 0xff; + log_flags = atoi(arg); } else { return usage(argv[0], NULL); } @@ -263,7 +263,7 @@ static int parse_args(int argc, char **argv) case 'w': i = get_arg(argc, argv, 2, i, &arg, NULL); if (arg) { - bcrypt_workfactor = arg ? atoi(arg) : 0xff; + bcrypt_workfactor = atoi(arg); } else { return usage(argv[0], NULL); } @@ -274,7 +274,7 @@ static int parse_args(int argc, char **argv) case 'v': i = get_arg(argc, argv, 2, i, &arg, NULL); if (arg) { - verbosity = arg ? atoi(arg) : 0xff; + verbosity = atoi(arg); } break; case 'h': diff --git a/src/summary.c b/src/summary.c index b39d0df79..a98f74a5e 100644 --- a/src/summary.c +++ b/src/summary.c @@ -248,7 +248,6 @@ static int cmp_nmr_faction(const void *a, const void *b) static void report_nmrs(FILE *F, int timeout) { nmr_faction *nmrs = NULL; - size_t len, i; faction *f; for (f = factions; f; f = f->next) { if (turn - 1 - f->lastorders > 0) { @@ -257,13 +256,16 @@ static void report_nmrs(FILE *F, int timeout) nmr->nmr = turn - 1 - f->lastorders; } } - len = arrlen(nmrs); - qsort(nmrs, len, sizeof(struct nmr_faction), cmp_nmr_faction); - fprintf(F, "\n\nFactions with NMRs:\n"); - for (i = 0; i != len; ++i) { - out_faction(F, nmrs[i].f); + if (nmrs) { + size_t len, i; + len = arrlen(nmrs); + qsort(nmrs, len, sizeof(struct nmr_faction), cmp_nmr_faction); + fprintf(F, "\n\nFactions with NMRs:\n"); + for (i = 0; i != len; ++i) { + out_faction(F, nmrs[i].f); + } + arrfree(nmrs); } - arrfree(nmrs); } void report_summary(const summary * s, bool full)