forked from github/server
remove igetstrtoken, a confusing helper function that was hardly used at all.
This commit is contained in:
parent
da1d3c49c3
commit
2966e1ea3d
4 changed files with 20 additions and 30 deletions
|
@ -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)
|
unsigned int getuint(void)
|
||||||
{
|
{
|
||||||
const char *s = getstrtoken();
|
const char *s = getstrtoken();
|
||||||
|
|
|
@ -112,8 +112,6 @@ extern "C" {
|
||||||
unsigned int getuint(void);
|
unsigned int getuint(void);
|
||||||
int getint(void);
|
int getint(void);
|
||||||
|
|
||||||
const char *igetstrtoken(const char *s);
|
|
||||||
|
|
||||||
param_t findparam(const char *s, const struct locale *lang);
|
param_t findparam(const char *s, const struct locale *lang);
|
||||||
param_t findparam_ex(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);
|
bool isparam(const char *s, const struct locale * lang, param_t param);
|
||||||
|
|
|
@ -246,13 +246,6 @@ static faction *factionorders(void)
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
|
||||||
|
|
||||||
static param_t igetparam(const char *s, const struct locale *lang)
|
|
||||||
{
|
|
||||||
return findparam(igetstrtoken(s), lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
int readorders(const char *filename)
|
int readorders(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *F = NULL;
|
FILE *F = NULL;
|
||||||
|
@ -275,8 +268,12 @@ int readorders(const char *filename)
|
||||||
|
|
||||||
while (b) {
|
while (b) {
|
||||||
const struct locale *lang = f ? f->locale : default_locale;
|
const struct locale *lang = f ? f->locale : default_locale;
|
||||||
int p;
|
param_t p;
|
||||||
switch (igetparam(b, lang)) {
|
const char *s;
|
||||||
|
init_tokens_str(b, NULL);
|
||||||
|
s = getstrtoken();
|
||||||
|
p = s ? findparam(s, lang) : NOPARAM;
|
||||||
|
switch (p) {
|
||||||
#undef LOCALE_CHANGE
|
#undef LOCALE_CHANGE
|
||||||
#ifdef LOCALE_CHANGE
|
#ifdef LOCALE_CHANGE
|
||||||
case P_LOCALE:
|
case P_LOCALE:
|
||||||
|
@ -286,8 +283,8 @@ int readorders(const char *filename)
|
||||||
f->locale = get_locale(s);
|
f->locale = get_locale(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b = getbuf(F, enc_gamedata);
|
b = getbuf(F, enc_gamedata);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case P_GAMENAME:
|
case P_GAMENAME:
|
||||||
case P_FACTION:
|
case P_FACTION:
|
||||||
|
@ -307,10 +304,13 @@ int readorders(const char *filename)
|
||||||
case P_UNIT:
|
case P_UNIT:
|
||||||
if (!f || !unitorders(F, enc_gamedata, f))
|
if (!f || !unitorders(F, enc_gamedata, f))
|
||||||
do {
|
do {
|
||||||
b = getbuf(F, enc_gamedata);
|
b = getbuf(F, enc_gamedata);
|
||||||
if (!b)
|
if (!b) {
|
||||||
break;
|
break;
|
||||||
p = (b[0] == '@') ? NOPARAM : igetparam(b, lang);
|
}
|
||||||
|
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
|
} while ((p != P_UNIT || !f) && p != P_FACTION && p != P_NEXT
|
||||||
&& p != P_GAMENAME);
|
&& p != P_GAMENAME);
|
||||||
break;
|
break;
|
||||||
|
@ -1030,8 +1030,8 @@ void writeregion(struct gamedata *data, const region * r)
|
||||||
WRITE_INT(data->store, rmoney(r));
|
WRITE_INT(data->store, rmoney(r));
|
||||||
if (r->land)
|
if (r->land)
|
||||||
for (demand = r->land->demands; demand; demand = demand->next) {
|
for (demand = r->land->demands; demand; demand = demand->next) {
|
||||||
WRITE_TOK(data->store, resourcename(demand->type->itype->rtype, 0));
|
WRITE_TOK(data->store, resourcename(demand->type->itype->rtype, 0));
|
||||||
WRITE_INT(data->store, demand->value);
|
WRITE_INT(data->store, demand->value);
|
||||||
}
|
}
|
||||||
WRITE_TOK(data->store, "end");
|
WRITE_TOK(data->store, "end");
|
||||||
write_items(data->store, r->land->items);
|
write_items(data->store, r->land->items);
|
||||||
|
@ -1856,7 +1856,7 @@ int writegame(const char *filename)
|
||||||
|
|
||||||
log_printf(stdout, "\nOk.\n");
|
log_printf(stdout, "\nOk.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int a_readint(attrib * a, void *owner, struct storage *store)
|
int a_readint(attrib * a, void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2615,7 +2615,8 @@ static int hunt(unit * u, order * ord)
|
||||||
/* In command steht jetzt das NACH-Kommando. */
|
/* In command steht jetzt das NACH-Kommando. */
|
||||||
|
|
||||||
/* NACH ignorieren und Parsing initialisieren. */
|
/* NACH ignorieren und Parsing initialisieren. */
|
||||||
igetstrtoken(command);
|
init_tokens_str(command, NULL);
|
||||||
|
getstrtoken();
|
||||||
/* NACH ausführen */
|
/* NACH ausführen */
|
||||||
move(u, false);
|
move(u, false);
|
||||||
return 1; /* true -> Einheitenliste von vorne durchgehen */
|
return 1; /* true -> Einheitenliste von vorne durchgehen */
|
||||||
|
|
Loading…
Reference in a new issue