diff --git a/res/core/messages.xml b/res/core/messages.xml
index 409e2ee09..52b132220 100644
--- a/res/core/messages.xml
+++ b/res/core/messages.xml
@@ -787,10 +787,11 @@
+
- "Deine Partei hat $int($population) Personen in $int($units) Einheiten."
- "Your faction has $int($population) people in $int($units) units."
+ "Deine Partei hat $int($population) Personen in $int($units) von maximal $int($limit) Einheiten."
+ "Your faction has $int($population) people in $int($units) of $int($limit) possible units."
diff --git a/src/creport.c b/src/creport.c
index 2bb96f65f..0bfe10033 100644
--- a/src/creport.c
+++ b/src/creport.c
@@ -1523,6 +1523,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
fprintf(F, "\"%s\";Spiel\n", game_name());
fprintf(F, "\"%s\";Konfiguration\n", "Standard");
fprintf(F, "\"%s\";Koordinaten\n", "Hex");
+ fprintf(F, "%d;max_units\n", rule_faction_limit());
fprintf(F, "%d;Basis\n", 36);
fprintf(F, "%d;Runde\n", turn);
fprintf(F, "%d;Zeitalter\n", era);
diff --git a/src/kernel/config.c b/src/kernel/config.c
index 7cae41c1e..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();
@@ -1218,16 +1209,6 @@ typedef struct param {
char *data;
} param;
-int getid(void)
-{
- const char *str = getstrtoken();
- int i = str ? atoi36(str) : 0;
- if (i < 0) {
- return -1;
- }
- return i;
-}
-
const char *get_param(const struct param *p, const char *key)
{
while (p != NULL) {
diff --git a/src/kernel/config.h b/src/kernel/config.h
index 908f9b993..037c2b968 100644
--- a/src/kernel/config.h
+++ b/src/kernel/config.h
@@ -112,19 +112,13 @@ 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);
param_t getparam(const struct locale *lang);
- int getid(void);
#define unitid(x) itoa36((x)->no)
-#define getshipid() getid()
-#define getfactionid() getid()
-
#define buildingid(x) itoa36((x)->no)
#define shipid(x) itoa36((x)->no)
#define factionid(x) itoa36((x)->no)
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 */
diff --git a/src/report.c b/src/report.c
index 7bc09d60c..3500e938f 100644
--- a/src/report.c
+++ b/src/report.c
@@ -2195,7 +2195,7 @@ const char *charset)
no_people = f->num_people;
}
#endif
- m = msg_message("nr_population", "population units", no_people, no_units);
+ m = msg_message("nr_population", "population units limit", no_people, no_units, rule_faction_limit());
nr_render(m, f->locale, buf, sizeof(buf), f);
msg_release(m);
centre(F, buf, true);
diff --git a/src/util/parser.c b/src/util/parser.c
index 5cd8f08ed..2520fd170 100644
--- a/src/util/parser.c
+++ b/src/util/parser.c
@@ -1,6 +1,7 @@
#include
#include "parser.h"
#include "unicode.h"
+#include "base36.h"
#include "log.h"
#include
@@ -200,3 +201,13 @@ const char *getstrtoken(void)
{
return parse_token((const char **)&states->current_token);
}
+
+int getid(void)
+{
+ const char *str = getstrtoken();
+ int i = str ? atoi36(str) : 0;
+ if (i < 0) {
+ return -1;
+ }
+ return i;
+}
diff --git a/src/util/parser.h b/src/util/parser.h
index 521987174..c268ad22a 100644
--- a/src/util/parser.h
+++ b/src/util/parser.h
@@ -14,13 +14,16 @@
extern "C" {
#endif
- extern void init_tokens_str(const char *initstr, char *cmd); /* initialize token parsing, take ownership of cmd */
- extern void skip_token(void);
- extern const char *parse_token(const char **str);
- extern void parser_pushstate(void);
- extern void parser_popstate(void);
- extern bool parser_end(void);
- extern const char *getstrtoken(void);
+ void init_tokens_str(const char *initstr, char *cmd); /* initialize token parsing, take ownership of cmd */
+ void skip_token(void);
+ const char *parse_token(const char **str);
+ void parser_pushstate(void);
+ void parser_popstate(void);
+ bool parser_end(void);
+ const char *getstrtoken(void);
+ int getid(void);
+#define getshipid() getid()
+#define getfactionid() getid()
#ifdef __cplusplus
}