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" ?> <?xml version="1.0" encoding="utf-8" ?>
<messages> <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"> <message name="reduced_production">
<text locale="de">Die Region ist verwüstet, der Boden karg.</text> <text locale="de">Die Region ist verwüstet, der Boden karg.</text>
<text locale="en">The region is ravaged, the ground infertile.</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 */ /* unit is empty, dead, and cannot recruit */
number = 0; number = 0;
} }
if (number > 0) {
add_recruits(u, number, req->qty); add_recruits(u, number, req->qty);
if (number > 0) {
dec = (int)(number * multi); dec = (int)(number * multi);
if ((rc->ec_flags & ECF_REC_ETHEREAL) == 0) { if ((rc->ec_flags & ECF_REC_ETHEREAL) == 0) {
recruited += dec; recruited += dec;

View File

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

View File

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