diff --git a/src/kernel/config.c b/src/kernel/config.c index 7120a0439..0e0e53e28 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -794,15 +794,6 @@ parse(keyword_t kword, int(*dofun) (unit *, struct order *), bool thisorder) } } -const char *igetstrtoken(const char *initstr) -{ - if (initstr != NULL) { - init_tokens_str(initstr, NULL); - } - - return getstrtoken(); -} - unsigned int getuint(void) { const char *s = getstrtoken(); diff --git a/src/kernel/config.h b/src/kernel/config.h index 75b72c6c2..037c2b968 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -112,8 +112,6 @@ extern "C" { unsigned int getuint(void); int getint(void); - const char *igetstrtoken(const char *s); - param_t findparam(const char *s, const struct locale *lang); param_t findparam_ex(const char *s, const struct locale * lang); bool isparam(const char *s, const struct locale * lang, param_t param); diff --git a/src/kernel/save.c b/src/kernel/save.c index c4ea62b63..3671b07fe 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -246,13 +246,6 @@ static faction *factionorders(void) return f; } -/* ------------------------------------------------------------- */ - -static param_t igetparam(const char *s, const struct locale *lang) -{ - return findparam(igetstrtoken(s), lang); -} - int readorders(const char *filename) { FILE *F = NULL; @@ -275,8 +268,12 @@ int readorders(const char *filename) while (b) { const struct locale *lang = f ? f->locale : default_locale; - int p; - switch (igetparam(b, lang)) { + param_t p; + const char *s; + init_tokens_str(b, NULL); + s = getstrtoken(); + p = s ? findparam(s, lang) : NOPARAM; + switch (p) { #undef LOCALE_CHANGE #ifdef LOCALE_CHANGE case P_LOCALE: @@ -286,8 +283,8 @@ int readorders(const char *filename) f->locale = get_locale(s); } } - b = getbuf(F, enc_gamedata); - break; + b = getbuf(F, enc_gamedata); + break; #endif case P_GAMENAME: case P_FACTION: @@ -307,10 +304,13 @@ int readorders(const char *filename) case P_UNIT: if (!f || !unitorders(F, enc_gamedata, f)) do { - b = getbuf(F, enc_gamedata); - if (!b) - break; - p = (b[0] == '@') ? NOPARAM : igetparam(b, lang); + b = getbuf(F, enc_gamedata); + if (!b) { + break; + } + init_tokens_str(b, NULL); + b = getstrtoken(); + p = (!b || b[0] == '@') ? NOPARAM : findparam(b, lang); } while ((p != P_UNIT || !f) && p != P_FACTION && p != P_NEXT && p != P_GAMENAME); break; @@ -1030,8 +1030,8 @@ void writeregion(struct gamedata *data, const region * r) WRITE_INT(data->store, rmoney(r)); if (r->land) for (demand = r->land->demands; demand; demand = demand->next) { - WRITE_TOK(data->store, resourcename(demand->type->itype->rtype, 0)); - WRITE_INT(data->store, demand->value); + WRITE_TOK(data->store, resourcename(demand->type->itype->rtype, 0)); + WRITE_INT(data->store, demand->value); } WRITE_TOK(data->store, "end"); write_items(data->store, r->land->items); @@ -1856,7 +1856,7 @@ int writegame(const char *filename) log_printf(stdout, "\nOk.\n"); return 0; -} + } int a_readint(attrib * a, void *owner, struct storage *store) { diff --git a/src/move.c b/src/move.c index 0e9111de4..69486d2e9 100644 --- a/src/move.c +++ b/src/move.c @@ -2615,7 +2615,8 @@ static int hunt(unit * u, order * ord) /* In command steht jetzt das NACH-Kommando. */ /* NACH ignorieren und Parsing initialisieren. */ - igetstrtoken(command); + init_tokens_str(command, NULL); + getstrtoken(); /* NACH ausführen */ move(u, false); return 1; /* true -> Einheitenliste von vorne durchgehen */