forked from github/server
macros should have uppercase names.
This commit is contained in:
parent
f1be8caa46
commit
ba14fab3a3
6 changed files with 16 additions and 15 deletions
|
@ -1568,7 +1568,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
|
|||
}
|
||||
fprintf(F, "%d;age\n", f->age);
|
||||
fprintf(F, "%d;Optionen\n", f->options);
|
||||
if (f->options & want(O_SCORE) && f->age > DISPLAYSCORE) {
|
||||
if (f->options & WANT_OPTION(O_SCORE) && f->age > DISPLAYSCORE) {
|
||||
char score[32];
|
||||
write_score(score, sizeof(score), f->score);
|
||||
fprintf(F, "%s;Punkte\n", score);
|
||||
|
@ -1615,7 +1615,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
|
|||
print_items(F, f->items, f->locale);
|
||||
fputs("OPTIONEN\n", F);
|
||||
for (i = 0; i != MAXOPTIONS; ++i) {
|
||||
int flag = want(i);
|
||||
int flag = WANT_OPTION(i);
|
||||
if (options[i]) {
|
||||
fprintf(F, "%d;%s\n", (f->options & flag) ? 1 : 0, options[i]);
|
||||
}
|
||||
|
|
|
@ -253,8 +253,9 @@ faction *addfaction(const char *email, const char *password,
|
|||
ADDMSG(&f->msgs, msg_message("changepasswd", "value", password));
|
||||
|
||||
f->options =
|
||||
want(O_REPORT) | want(O_ZUGVORLAGE) | want(O_COMPUTER) | want(O_COMPRESS) |
|
||||
want(O_ADRESSEN) | want(O_STATISTICS);
|
||||
WANT_OPTION(O_REPORT) | WANT_OPTION(O_ZUGVORLAGE) |
|
||||
WANT_OPTION(O_COMPUTER) | WANT_OPTION(O_COMPRESS) |
|
||||
WANT_OPTION(O_ADRESSEN) | WANT_OPTION(O_STATISTICS);
|
||||
|
||||
f->no = unused_faction_id();
|
||||
if (rule_region_owners()) {
|
||||
|
|
|
@ -99,7 +99,7 @@ extern "C" {
|
|||
|
||||
extern struct faction *factions;
|
||||
|
||||
#define want(option) (1<<option)
|
||||
#define WANT_OPTION(option) (1<<option)
|
||||
|
||||
void fhash(struct faction *f);
|
||||
void funhash(struct faction *f);
|
||||
|
|
|
@ -1071,14 +1071,14 @@ faction *read_faction(gamedata * data)
|
|||
READ_INT(data->store, &n);
|
||||
f->options = n;
|
||||
|
||||
n = want(O_REPORT) | want(O_COMPUTER);
|
||||
n = WANT_OPTION(O_REPORT) | WANT_OPTION(O_COMPUTER);
|
||||
if ((f->options & n) == 0) {
|
||||
/* Kein Report eingestellt, Fehler */
|
||||
f->options |= n;
|
||||
}
|
||||
if (data->version < JSON_REPORT_VERSION) {
|
||||
/* mistakes were made in the past*/
|
||||
f->options &= ~want(O_JSON);
|
||||
f->options &= ~WANT_OPTION(O_JSON);
|
||||
}
|
||||
read_allies(data, f);
|
||||
read_groups(data, f);
|
||||
|
@ -1139,7 +1139,7 @@ void write_faction(gamedata *data, const faction * f)
|
|||
WRITE_INT(data->store, ur->y);
|
||||
}
|
||||
WRITE_SECTION(data->store);
|
||||
WRITE_INT(data->store, f->options & ~want(O_DEBUG));
|
||||
WRITE_INT(data->store, f->options & ~WANT_OPTION(O_DEBUG));
|
||||
WRITE_SECTION(data->store);
|
||||
|
||||
for (sf = f->allies; sf; sf = sf->next) {
|
||||
|
|
10
src/report.c
10
src/report.c
|
@ -2048,7 +2048,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
attrib *a;
|
||||
message *m;
|
||||
unsigned char op;
|
||||
int maxh, bytes, ix = want(O_STATISTICS);
|
||||
int maxh, bytes, ix = WANT_OPTION(O_STATISTICS);
|
||||
int wants_stats = (f->options & ix);
|
||||
FILE *F = fopen(filename, "w");
|
||||
stream strm = { 0 }, *out = &strm;
|
||||
|
@ -2098,18 +2098,18 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
centre(out, buf, true);
|
||||
}
|
||||
}
|
||||
if ((f->options & want(O_COMPUTER)) == 0) {
|
||||
if ((f->options & WANT_OPTION(O_COMPUTER)) == 0) {
|
||||
const char *s;
|
||||
s = locale_getstring(f->locale, "newbie_info_cr");
|
||||
if (s) {
|
||||
newline(out);
|
||||
centre(out, s, true);
|
||||
}
|
||||
f->options |= want(O_COMPUTER);
|
||||
f->options |= WANT_OPTION(O_COMPUTER);
|
||||
}
|
||||
}
|
||||
newline(out);
|
||||
if (f->options & want(O_SCORE) && f->age > DISPLAYSCORE) {
|
||||
if (f->options & WANT_OPTION(O_SCORE) && f->age > DISPLAYSCORE) {
|
||||
char score[32], avg[32];
|
||||
write_score(score, sizeof(score), f->score);
|
||||
write_score(avg, sizeof(avg), average_score_of_age(f->age, f->age / 24 + 1));
|
||||
|
@ -2164,7 +2164,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
for (op = 0; op != MAXOPTIONS; op++) {
|
||||
if (f->options & want(op) && options[op]) {
|
||||
if (f->options & WANT_OPTION(op) && options[op]) {
|
||||
bytes = (int)str_strlcpy(bufp, " ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
|
|
@ -928,7 +928,7 @@ spskill(char *buffer, size_t size, const struct locale * lang,
|
|||
if (!u->number)
|
||||
return 0;
|
||||
if (sv->level <= 0) {
|
||||
if (sv->old <= 0 || (u->faction->options & want(O_SHOWSKCHANGE)) == 0) {
|
||||
if (sv->old <= 0 || (u->faction->options & WANT_OPTION(O_SHOWSKCHANGE)) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -964,7 +964,7 @@ spskill(char *buffer, size_t size, const struct locale * lang,
|
|||
if (wrptr(&bufp, &size, snprintf(bufp, size, "%d", effsk)) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
||||
if (u->faction->options & want(O_SHOWSKCHANGE)) {
|
||||
if (u->faction->options & WANT_OPTION(O_SHOWSKCHANGE)) {
|
||||
int oldeff = 0;
|
||||
int diff;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue