diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 65c757a7d..30010de54 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1230,7 +1230,12 @@ report_computer(const char * filename, report_context * ctx, const char * charse print_items(F, f->items, f->locale); fputs("OPTIONEN\n", F); for (i=0;i!=MAXOPTIONS;++i) { - fprintf(F, "%d;%s\n", (f->options&want(i))?1:0, options[i]); + int flag = want(i); + if (options[i]) { + fprintf(F, "%d;%s\n", (f->options&flag)?1:0, options[i]); + } else if (f->options&flag) { + f->options &= (~flag); + } } #ifdef ENEMIES show_enemies(F, f->enemies); diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 1726d1dda..991db2fe1 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3767,8 +3767,12 @@ static void maintain_buildings_2(region * r) { maintain_buildings(r,true); } static void reset_moved(unit * u) { freset(u, UFL_MOVED); } static void reset_rng(void) { - if (turn == 0) rng_init((int)time(0)); - else rng_init(turn); + rng_init(turn?turn:(int)time(0)); +} + +static void reset_rng_region(const region * r) +{ + rng_init(r->index); } /** warn about passwords that are not US ASCII. @@ -3895,6 +3899,7 @@ processorders (void) add_proc_order(p, K_TEACH, &teach_cmd, PROC_THISORDER|PROC_LONGORDER, "Lehren"); } p+=10; + add_proc_region(p, &reset_rng_region, NULL); add_proc_order(p, K_STUDY, &learn_cmd, PROC_THISORDER|PROC_LONGORDER, "Lernen"); p+=10; diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index eefd8be1e..15997be7a 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1373,8 +1373,7 @@ report_template(const char * filename, report_context * ctx, const char * charse rps_nowrap(F, ""); rnl(F); - sprintf(buf, "; ECHECK %s-w4 -r%d -v%s", (f->options & want(O_SILBERPOOL)) ? "-l " : "", - f->race->recruitcost, ECHECK_VERSION); + sprintf(buf, "; ECHECK -l -w4 -r%d -v%s", f->race->recruitcost, ECHECK_VERSION); /* -v3.4: ECheck Version 3.4.x */ rps_nowrap(F, buf); rnl(F); @@ -2056,7 +2055,7 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars bytes = snprintf(buf, size,"%s:", LOC(f->locale, "nr_options")); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); for (op = 0; op != MAXOPTIONS; op++) { - if (f->options & want(op)) { + if (f->options & want(op) && options[op]) { bytes = (int)strlcpy(bufp, " ", size); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); bytes = (int)strlcpy(bufp, LOC(f->locale, options[op]), size); diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index b08071b67..e7dc23024 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -433,12 +433,12 @@ const char *options[MAXOPTIONS] = "AUSWERTUNG", "COMPUTER", "ZUGVORLAGE", - "SILBERPOOL", + NULL, "STATISTIK", "DEBUG", "ZIPPED", "ZEITUNG", /* Option hat Sonderbehandlung! */ - "MATERIALPOOL", + NULL, "ADRESSEN", "BZIP2", "PUNKTE", @@ -2023,13 +2023,13 @@ init_locale(const struct locale * lang) tokens = get_translations(lang, UT_KEYWORDS); for (i=0;i!=MAXKEYWORDS;++i) { var.i = i; - addtoken(tokens, LOC(lang, keywords[i]), var); + if (keywords[i]) addtoken(tokens, LOC(lang, keywords[i]), var); } tokens = get_translations(lang, UT_OPTIONS); for (i=0;i!=MAXOPTIONS;++i) { var.i = i; - addtoken(tokens, LOC(lang, options[i]), var); + if (options[i]) addtoken(tokens, LOC(lang, options[i]), var); } tokens = get_translations(lang, UT_TERRAINS); @@ -2859,10 +2859,7 @@ kernel_init(void) translation_init(); if (!turn) turn = lastturn(); - if (turn == 0) - rng_init((int)time(0)); - else - rng_init(turn); + rng_init(turn?turn:(int)time(0)); if (sqlpatch) { sprintf(zBuffer, "%s/patch-%d.sql", datapath(), turn); sql_init(zBuffer); diff --git a/src/common/kernel/faction.c b/src/common/kernel/faction.c index a4c3440ce..760f6dff4 100644 --- a/src/common/kernel/faction.c +++ b/src/common/kernel/faction.c @@ -131,7 +131,7 @@ addfaction(const char *email, const char * password, f->locale = loc; f->subscription = subscription; - f->options = want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_SILBERPOOL) | want(O_COMPUTER) | want(O_COMPRESS) | want(O_ADRESSEN) | want(O_STATISTICS); + f->options = want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_COMPUTER) | want(O_COMPRESS) | want(O_ADRESSEN) | want(O_STATISTICS); f->no = unused_faction_id(); addlist(&factions, f); diff --git a/src/common/kernel/pool.c b/src/common/kernel/pool.c index 10b9a3c83..bb3e458d1 100644 --- a/src/common/kernel/pool.c +++ b/src/common/kernel/pool.c @@ -40,9 +40,6 @@ #define TODO_POOL #undef TODO_RESOURCES -static int want_mp = 1 << O_MATERIALPOOL; -static int want_sp = 1 << O_SILBERPOOL; - static const race * rc_stonegolem; static const race * rc_irongolem; @@ -102,19 +99,14 @@ change_resource(unit * u, const resource_type * rtype, int change) i = change_maxspellpoints(u, change); else assert(!"undefined resource detected. rtype->uchange not initialized."); - assert(i >= 0 && (i < 100000000)); /* Softer Test, daß kein Unfug - * * passiert */ + assert(i >= 0 && (i < 100000000)); /* soft test to catch mischief */ return i; } int get_reservation(const unit * u, const resource_type * rtype) { - faction * f = u->faction; struct reservation * res = u->reservations; - if ((rtype==r_silver && !(f->options & want_sp)) || (rtype!=r_silver && !(f->options & want_mp))) { - return get_resource(u, rtype); - } if (!rc_stonegolem) init_static(); @@ -201,10 +193,6 @@ get_pooled(const unit * u, const resource_type * rtype, unsigned int mode, int c if ((urace(v)->ec_flags & GIVEITEM) == 0) continue; if (v->faction == f) { - if ((mode & GET_POOLED_FORCE)==0) { - if (rtype==r_silver && !(f->options & want_sp)) continue; - if (rtype!=r_silver && !(f->options & want_mp)) continue; - } mask = (mode >> 3) & (GET_SLACK|GET_RESERVE); } else if (alliedunit(v, f, HELP_MONEY)) mask = (mode >> 6) & (GET_SLACK|GET_RESERVE); @@ -254,10 +242,6 @@ use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count) if ((urace(v)->ec_flags & GIVEITEM) == 0) continue; if (v->faction == f) { - if ((mode & GET_POOLED_FORCE)==0) { - if (rtype==r_silver && !(f->options & want_sp)) continue; - if (rtype!=r_silver && !(f->options & want_mp)) continue; - } mask = (mode >> 3) & (GET_SLACK|GET_RESERVE); } else if (alliedunit(v, f, HELP_MONEY)) mask = (mode >> 6) & (GET_SLACK|GET_RESERVE); diff --git a/src/common/kernel/types.h b/src/common/kernel/types.h index 27f0e62d7..30aba9575 100644 --- a/src/common/kernel/types.h +++ b/src/common/kernel/types.h @@ -242,21 +242,21 @@ extern const char *parameters[MAXPARAMS]; /* --------------- Reports Typen ------------------------------- */ enum { - O_REPORT, /* 1 */ - O_COMPUTER, /* 2 */ - O_ZUGVORLAGE, /* 4 */ - O_SILBERPOOL, /* 8 */ - O_STATISTICS, /* 16 */ - O_DEBUG, /* 32 */ - O_COMPRESS, /* 64 */ - O_NEWS, /* 128 */ - O_MATERIALPOOL, /* 256 */ - O_ADRESSEN, /* 512 */ - O_BZIP2, /* 1024 - compress as bzip2 */ - O_SCORE, /* 2048 - punkte anzeigen? */ - O_SHOWSKCHANGE, /* 4096 - Skillveränderungen anzeigen? */ + O_REPORT, /* 1 */ + O_COMPUTER, /* 2 */ + O_ZUGVORLAGE, /* 4 */ + O_UNUSED_3, + O_STATISTICS, /* 16 */ + O_DEBUG, /* 32 */ + O_COMPRESS, /* 64 */ + O_NEWS, /* 128 */ + O_UNUSED_8, + O_ADRESSEN, /* 512 */ + O_BZIP2, /* 1024 - compress as bzip2 */ + O_SCORE, /* 2048 - punkte anzeigen? */ + O_SHOWSKCHANGE, /* 4096 - Skillveränderungen anzeigen? */ O_XML, /* 8192 - XML report versenden */ - MAXOPTIONS + MAXOPTIONS }; /* ------------------ Talente ---------------------------------- */ diff --git a/src/eressea/lua/gamecode.cpp b/src/eressea/lua/gamecode.cpp index 484c58680..f94f3f0c2 100644 --- a/src/eressea/lua/gamecode.cpp +++ b/src/eressea/lua/gamecode.cpp @@ -63,8 +63,7 @@ lua_planmonsters(void) faction * f = findfaction(MONSTER_FACTION); if (f==NULL) return; - if (turn == 0) rng_init((int)time(0)); - else rng_init(turn); + rng_init(turn?turn:(int)time(0)); plan_monsters(); for (u=f->units;u;u=u->nextF) { call_script(u); @@ -199,9 +198,7 @@ readshortpwds() static int process_orders(void) { - if (turn == 0) rng_init((int)time(0)); - else rng_init(turn); - + rng_init(turn?turn:(int)time(0)); #ifdef SHORTPWDS readshortpwds("passwords"); #endif