Fixing Bugs 2246 & 2251

parse error message for bad orders:
https://bugs.eressea.de/view.php?id=2251
report when TEMP-Units cannot recuit:
https://bugs.eressea.de/view.php?id=2246
This commit is contained in:
Enno Rehling 2016-11-05 18:20:56 +01:00
parent bad4fb47c5
commit fec9945458
4 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<messages>
<message name="parse_error" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="command" type="string"/>
</type>
<text locale="de">"$unit($unit): '$command' - Dieser Befehl ist unbekannt."</text>
<text locale="en">"$unit($unit): '$command' - Parse error, unknown command."</text>
</message>
<message name="reduced_production">
<text locale="de">Die Region ist verwüstet, der Boden karg.</text>
<text locale="en">The region is ravaged, the ground infertile.</text>

View File

@ -341,8 +341,8 @@ static int do_recruiting(recruitment * recruits, int available)
/* unit is empty, dead, and cannot recruit */
number = 0;
}
if (number > 0) {
add_recruits(u, number, req->qty);
if (number > 0) {
dec = (int)(number * multi);
if ((rc->ec_flags & ECF_REC_ETHEREAL) == 0) {
recruited += dec;

View File

@ -285,7 +285,7 @@ static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
order *ord = NULL;
int lindex;
if ((int)kwd > 0 && keyword_disabled(kwd)) {
if (kwd == NOKEYWORD || keyword_disabled(kwd)) {
log_error("trying to create an order for disabled keyword %s.", keyword(kwd));
return NULL;
}
@ -407,9 +407,9 @@ order *parse_order(const char *s, const struct locale * lang)
if (kwd != NOKEYWORD) {
while (isxspace(*(unsigned char *)sptr)) ++sptr;
s = sptr;
}
return create_order_i(kwd, s, persistent, lang);
}
}
return NULL;
}

View File

@ -206,12 +206,14 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
if (*ordp) {
ordp = &(*ordp)->next;
}
else {
ADDMSG(&f->msgs, msg_message("parse_error", "unit command", u, s));
}
}
}
}
else {
/* cmistake(?, buf, 160, MSG_EVENT); */
return NULL;
}
return u;