Bugfix für's lernen in vinyambar I. Erweiterter NEUSTART Befehl.

This commit is contained in:
Enno Rehling 2002-01-13 10:42:56 +00:00
parent c992ce237d
commit 666fb81e14
4 changed files with 53 additions and 29 deletions

View File

@ -491,8 +491,12 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, const char
assert(itype!=NULL);
n = new_get_pooled(src, item2resource(itype), GET_DEFAULT);
n = min(want, n);
if (n == 0) {
#define GIVERESTRICTION 3
if (src->faction != dest->faction && src->faction->age < GIVERESTRICTION) {
ADDMSG(&src->faction->msgs, msg_error(src, cmd, "giverestriction",
"turns", GIVERESTRICTION));
return;
} else if (n == 0) {
error = 36;
} else if (itype->flags & ITF_CURSED) {
error = 25;
@ -527,13 +531,17 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, const char
}
void
givemen(int n, unit * u, unit * u2, strlist * S)
givemen(int n, unit * u, unit * u2, const char * cmd)
{
ship *sh;
int k = 0;
int error = 0;
if (u == u2) {
if (u->faction != u2->faction && u->faction->age < GIVERESTRICTION) {
ADDMSG(&u->faction->msgs, msg_error(u, cmd, "giverestriction",
"turns", GIVERESTRICTION));
return;
} else if (u == u2) {
error = 10;
} else if ((u && unit_has_cursed_item(u)) || (u2 && unit_has_cursed_item(u2))) {
error = 78;
@ -625,7 +633,7 @@ givemen(int n, unit * u, unit * u2, strlist * S)
}
}
}
addgive(u, u2, n, R_PERSON, S->s, error);
addgive(u, u2, n, R_PERSON, cmd, error);
}
void
@ -663,7 +671,7 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
}
}
}
givemen(u->number, u, NULL, S);
givemen(u->number, u, NULL, S->s);
cmistake(u, S->s, 153, MSG_COMMERCE);
} else {
cmistake(u, S->s, 64, MSG_COMMERCE);
@ -952,7 +960,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
return;
}
n = u->number;
givemen(n, u, u2, S);
givemen(n, u, u2, S->s);
return;
}
@ -995,7 +1003,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
msg_error(u, S->s, "race_noregroup", "race", u->race));
return;
}
givemen(n, u, u2, S);
givemen(n, u, u2, S->s);
return;
}

View File

@ -216,12 +216,28 @@ destroyfaction(faction * f)
}
}
void
static void
restart(unit *u, const race * rc)
{
faction *f = addplayer(u->region, u->faction->email, rc, u->faction->locale)->faction;
unit * nu = f->units;
strlist ** o=&u->orders;
f->magiegebiet = u->faction->magiegebiet;
f->options = u->faction->options;
freestrlist(nu->orders);
nu->orders = u->orders;
u->orders = NULL;
while (*o) {
strlist * S = *o;
if (igetkeyword(S->s, u->faction->locale) == K_RESTART) {
*o = S->next;
S->next = NULL;
freestrlist(S);
} else {
o = &S->next;
}
}
destroyfaction(u->faction);
}
@ -1057,11 +1073,10 @@ quit(void)
continue;
}
if (u->faction->age < 100) {
cmistake(u, S->s, 241, MSG_EVENT);
continue;
}
frace = u->faction->race;
} else {
frace = findrace(getstrtoken(), u->faction->locale);
}
if (frace == NULL || !playerrace(frace)) {
cmistake(u, S->s, 243, MSG_EVENT);

View File

@ -674,9 +674,7 @@ learn(void)
#else
days = (int)((u->number * 30 + a->data.i) * multi);
#endif
#if HUNGER_DISABLES_LONGORDERS
days = days / 2;
#endif
if (fval(u, FL_HUNGER)) days = days / 2;
change_skill(u, (skill_t)i, days);
if (a) {
a_remove(&u->attribs, a);

View File

@ -1,26 +1,29 @@
<messages>
<message name="newbieimmunity">
<message name="newbieimmunity" section="events">
<type>
<arg name="turns" type="int"></arg>
</type>
<locale name="de">
<nr section="events">
<text>"Deine Partei ist noch $int($turns) Wochen immun gegen Angriffe."</text>
</nr>
</locale>
<text locae="de">"Deine Partei ist noch $int($turns) Wochen immun gegen Angriffe."</text>
</message>
<message name="error130">
<message name="giverestriction" section="errors">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
<arg name="turns" type="int"></arg>
</type>
<text locale="de">"$unit($unit) in $region($region): '$command' - Deine Partei muss mindestens $int($turns) alt sein, um etwas an andere Parteien übergeben zu können."</text>
<text locale="en">"$unit($unit) in $region($region): '$command' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text>
</message>
<message name="error130" section="errors">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<locale name="de">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - Syntax: MAGIEGEBIET [1-5]."</text>
</nr>
</locale>
<text locale="de">"$unit($unit) in $region($region): '$command' - Syntax: MAGIEGEBIET [1-5]."</text>
</message>
<message name="error131">