Fehlermeldung, wenn ein Nicht-Elf versucht, Elfenbögen zu bauen

This commit is contained in:
Enno Rehling 2004-06-12 11:19:17 +00:00
parent 901a08f52d
commit 162e67899f
1 changed files with 54 additions and 52 deletions

View File

@ -1321,62 +1321,64 @@ economics(void)
static void static void
manufacture(unit * u, const item_type * itype, int want) manufacture(unit * u, const item_type * itype, int want)
{ {
int n; int n;
int skill; int skill;
int minskill = itype->construction->minskill; int minskill = itype->construction->minskill;
skill_t sk = itype->construction->skill; skill_t sk = itype->construction->skill;
skill = effskill(u, sk); skill = effskill(u, sk);
skill = skillmod(itype->rtype->attribs, u, u->region, sk, skill, SMF_PRODUCTION); skill = skillmod(itype->rtype->attribs, u, u->region, sk, skill, SMF_PRODUCTION);
if (skill < 0) { if (skill < 0) {
/* an error occured */ /* an error occured */
int err = -skill; int err = -skill;
cmistake(u, findorder(u, u->thisorder), err, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), err, MSG_PRODUCE);
return; return;
} }
if(want==0) if(want==0)
want=maxbuild(u, itype->construction); want=maxbuild(u, itype->construction);
n = build(u, itype->construction, 0, want); n = build(u, itype->construction, 0, want);
switch (n) { switch (n) {
case ENEEDSKILL: case ENEEDSKILL:
add_message(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "skill_needed", "skill", sk)); msg_error(u, findorder(u, u->thisorder), "skill_needed", "skill", sk));
return; return;
case ELOWSKILL: case ELOWSKILL:
add_message(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "manufacture_skills", "skill minskill product", msg_error(u, findorder(u, u->thisorder), "manufacture_skills", "skill minskill product",
sk, minskill, itype->rtype, 1)); sk, minskill, itype->rtype, 1));
return; return;
case ENOMATERIALS: case ENOMATERIALS:
/* something missing from the list of materials */ /* something missing from the list of materials */
strcpy(buf, "Dafür braucht man mindestens:"); strcpy(buf, "Dafür braucht man mindestens:");
{ {
int c, n; int c, n;
const construction * cons = itype->construction; const construction * cons = itype->construction;
char * ch = buf+strlen(buf); char * ch = buf+strlen(buf);
assert(cons); assert(cons);
for (c=0;cons->materials[c].number; c++) { for (c=0;cons->materials[c].number; c++) {
if (c!=0) if (c!=0)
strcat(ch++, ","); strcat(ch++, ",");
n=cons->materials[c].number / cons->reqsize; n=cons->materials[c].number / cons->reqsize;
sprintf(ch, " %d %s", n?n:1, sprintf(ch, " %d %s", n?n:1,
locale_string(u->faction->locale, locale_string(u->faction->locale,
resname(cons->materials[c].type, cons->materials[c].number!=1))); resname(cons->materials[c].type, cons->materials[c].number!=1)));
ch = ch+strlen(ch); ch = ch+strlen(ch);
} }
mistake(u, findorder(u, u->thisorder), buf, MSG_PRODUCE); mistake(u, findorder(u, u->thisorder), buf, MSG_PRODUCE);
return; return;
} }
} }
if (n>0) { if (n>0) {
i_change(&u->items, itype, n); i_change(&u->items, itype, n);
if (want==INT_MAX) want = n; if (want==INT_MAX) want = n;
ADDMSG(&u->faction->msgs, msg_message("manufacture", ADDMSG(&u->faction->msgs, msg_message("manufacture",
"unit region amount wanted resource", u, u->region, n, want, itype->rtype)); "unit region amount wanted resource", u, u->region, n, want, itype->rtype));
} } else {
cmistake(u, findorder(u, u->thisorder), 125, MSG_PRODUCE);
}
} }
typedef struct allocation { typedef struct allocation {