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); assert(itype!=NULL);
n = new_get_pooled(src, item2resource(itype), GET_DEFAULT); n = new_get_pooled(src, item2resource(itype), GET_DEFAULT);
n = min(want, n); n = min(want, n);
#define GIVERESTRICTION 3
if (n == 0) { 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; error = 36;
} else if (itype->flags & ITF_CURSED) { } else if (itype->flags & ITF_CURSED) {
error = 25; error = 25;
@ -527,13 +531,17 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, const char
} }
void void
givemen(int n, unit * u, unit * u2, strlist * S) givemen(int n, unit * u, unit * u2, const char * cmd)
{ {
ship *sh; ship *sh;
int k = 0; int k = 0;
int error = 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; error = 10;
} else if ((u && unit_has_cursed_item(u)) || (u2 && unit_has_cursed_item(u2))) { } else if ((u && unit_has_cursed_item(u)) || (u2 && unit_has_cursed_item(u2))) {
error = 78; 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 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); cmistake(u, S->s, 153, MSG_COMMERCE);
} else { } else {
cmistake(u, S->s, 64, MSG_COMMERCE); cmistake(u, S->s, 64, MSG_COMMERCE);
@ -952,7 +960,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
return; return;
} }
n = u->number; n = u->number;
givemen(n, u, u2, S); givemen(n, u, u2, S->s);
return; 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)); msg_error(u, S->s, "race_noregroup", "race", u->race));
return; return;
} }
givemen(n, u, u2, S); givemen(n, u, u2, S->s);
return; return;
} }

View File

@ -216,12 +216,28 @@ destroyfaction(faction * f)
} }
} }
void static void
restart(unit *u, const race * rc) restart(unit *u, const race * rc)
{ {
faction *f = addplayer(u->region, u->faction->email, rc, u->faction->locale)->faction; 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->magiegebiet = u->faction->magiegebiet;
f->options = u->faction->options; 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); destroyfaction(u->faction);
} }
@ -1057,11 +1073,10 @@ quit(void)
continue; continue;
} }
if (u->faction->age < 100) { if (u->faction->age < 100) {
cmistake(u, S->s, 241, MSG_EVENT); frace = u->faction->race;
continue; } else {
}
frace = findrace(getstrtoken(), u->faction->locale); frace = findrace(getstrtoken(), u->faction->locale);
}
if (frace == NULL || !playerrace(frace)) { if (frace == NULL || !playerrace(frace)) {
cmistake(u, S->s, 243, MSG_EVENT); cmistake(u, S->s, 243, MSG_EVENT);

View File

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

View File

@ -1,26 +1,29 @@
<messages> <messages>
<message name="newbieimmunity"> <message name="newbieimmunity" section="events">
<type> <type>
<arg name="turns" type="int"></arg> <arg name="turns" type="int"></arg>
</type> </type>
<locale name="de"> <text locae="de">"Deine Partei ist noch $int($turns) Wochen immun gegen Angriffe."</text>
<nr section="events">
<text>"Deine Partei ist noch $int($turns) Wochen immun gegen Angriffe."</text>
</nr>
</locale>
</message> </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> <type>
<arg name="unit" type="unit"></arg> <arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg> <arg name="region" type="region"></arg>
<arg name="command" type="string"></arg> <arg name="command" type="string"></arg>
</type> </type>
<locale name="de"> <text locale="de">"$unit($unit) in $region($region): '$command' - Syntax: MAGIEGEBIET [1-5]."</text>
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - Syntax: MAGIEGEBIET [1-5]."</text>
</nr>
</locale>
</message> </message>
<message name="error131"> <message name="error131">