"ALLES funktioniert nicht bei GIB"
- disabling OPTION MATERIALPOOL
This commit is contained in:
Enno Rehling 2008-02-12 18:26:30 +00:00
parent 321723f69f
commit 40898eea55
8 changed files with 38 additions and 51 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -245,12 +245,12 @@ enum {
O_REPORT, /* 1 */
O_COMPUTER, /* 2 */
O_ZUGVORLAGE, /* 4 */
O_SILBERPOOL, /* 8 */
O_UNUSED_3,
O_STATISTICS, /* 16 */
O_DEBUG, /* 32 */
O_COMPRESS, /* 64 */
O_NEWS, /* 128 */
O_MATERIALPOOL, /* 256 */
O_UNUSED_8,
O_ADRESSEN, /* 512 */
O_BZIP2, /* 1024 - compress as bzip2 */
O_SCORE, /* 2048 - punkte anzeigen? */

View File

@ -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