smaller fixes

This commit is contained in:
Enno Rehling 2004-06-27 18:56:03 +00:00
parent 65786fc059
commit bee21c7597
3 changed files with 18 additions and 16 deletions

View file

@ -1109,7 +1109,7 @@ restart(unit * u, struct order * ord)
} }
static boolean static boolean
EnhancedQuit() EnhancedQuit(void)
{ {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {

View file

@ -146,15 +146,16 @@ AllianceAuto(void)
{ {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {
char * str = strdup(get_param(global.parameters, "alliance.auto")); const char * str = get_param(global.parameters, "alliance.auto");
value = 0; value = 0;
if (str!=NULL) { if (str!=NULL) {
char * tok = strtok(str, " "); char * sstr = strdup(str);
char * tok = strtok(sstr, " ");
while (tok) { while (tok) {
value |= ally_flag(tok); value |= ally_flag(tok);
tok = strtok(NULL, " "); tok = strtok(NULL, " ");
} }
free(str); free(sstr);
} }
} }
return value; return value;
@ -165,15 +166,16 @@ AllianceRestricted(void)
{ {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {
char * str = strdup(get_param(global.parameters, "alliance.restricted")); const char * str = get_param(global.parameters, "alliance.restricted");
value = 0; value = 0;
if (str!=NULL) { if (str!=NULL) {
char * tok = strtok(str, " "); char * sstr = strdup(str);
char * tok = strtok(sstr, " ");
while (tok) { while (tok) {
value |= ally_flag(tok); value |= ally_flag(tok);
tok = strtok(NULL, " "); tok = strtok(NULL, " ");
} }
free(str); free(sstr);
} }
} }
return value; return value;

View file

@ -235,9 +235,9 @@ read_newfactions(const char * filename)
char race[20], email[64], lang[8], password[16]; char race[20], email[64], lang[8], password[16];
newfaction *nf; newfaction *nf;
int bonus, subscription; int bonus, subscription;
int alliance;
if (alliances!=NULL) { if (alliances!=NULL) {
int alliance;
/* email;race;locale;startbonus;subscription;alliance */ /* email;race;locale;startbonus;subscription;alliance */
if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break; if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break;
} else { } else {