magic uses new argument type to report missing components.

This commit is contained in:
Enno Rehling 2006-01-13 21:27:16 +00:00
parent 7eee06c285
commit e19a918291
2 changed files with 16 additions and 22 deletions

View file

@ -923,7 +923,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
{ {
int k; int k;
int itemanz; int itemanz;
boolean b = true; resource * reslist = NULL;
if (knowsspell(u->region, u, sp) == false) { if (knowsspell(u->region, u, sp) == false) {
/* Diesen Zauber kennt die Einheit nicht */ /* Diesen Zauber kennt die Einheit nicht */
@ -962,22 +962,16 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
} }
if (get_pooled(u, rtype, GET_DEFAULT) < itemanz) { if (get_pooled(u, rtype, GET_DEFAULT) < itemanz) {
if (b == false) { resource * res = malloc(sizeof(resource));
/* es fehlte schon eine andere Komponente, wir basteln die res->number = itemanz;
* Meldung weiter zusammen */ res->type = rtype;
scat(", "); res->next = reslist;
} else { reslist = res->next;
b = false;
buf[0] = 0;
}
icat(itemanz);
scat(" ");
scat(LOC(u->faction->locale, resourcename(rtype, (itemanz!=1)?NMF_PLURAL:0)));
} }
} }
} }
if (!b) { if (reslist!=NULL) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "missing_components_list", "list", buf)); ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "missing_components_list", "list", reslist));
} }
return b; return b;

View file

@ -381,11 +381,11 @@
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
<arg name="region" type="region"/> <arg name="region" type="region"/>
<arg name="command" type="order"/> <arg name="command" type="order"/>
<arg name="required" type="items"/> <arg name="required" type="resources"/>
</type> </type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Dafür braucht die Einheit $items($required)."</text> <text locale="de">"$unit($unit) in $region($region): '$order($command)' - Dafür braucht die Einheit $resources($required)."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - for this, the unit needs $items($required)."</text> <text locale="fr">"$unit($unit) in $region($region): '$order($command)' - for this, the unit needs $resources($required)."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - for this, the unit needs $items($required)."</text> <text locale="en">"$unit($unit) in $region($region): '$order($command)' - for this, the unit needs $resources($required)."</text>
</message> </message>
<message name="travelthru_trail" section="events"> <message name="travelthru_trail" section="events">
<type> <type>
@ -1434,10 +1434,10 @@
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
<arg name="region" type="region"/> <arg name="region" type="region"/>
<arg name="command" type="order"/> <arg name="command" type="order"/>
<arg name="list" type="string"/> <arg name="list" type="resources"/>
</type> </type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Für diesen Zauber fehlen noch ${list}."</text> <text locale="de">"$unit($unit) in $region($region): '$order($command)' - Für diesen Zauber fehlen noch $resources($list)."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Casting this spell requires an additional ${list}."</text> <text locale="en">"$unit($unit) in $region($region): '$order($command)' - Casting this spell requires an additional $resources($list)."</text>
</message> </message>
<message name="missing_components" section="magic"> <message name="missing_components" section="magic">
<type> <type>
@ -1445,7 +1445,7 @@
<arg name="level" type="int"/> <arg name="level" type="int"/>
<arg name="spell" type="spell"/> <arg name="spell" type="spell"/>
</type> </type>
<text locale="de">"$unit($unit) hat nur genügend Komponenten um $spell($spell) auf Stufe $int($level) zu zaubern."</text> <text locale="de">"$unit($unit) hat nicht genügend Komponenten um $spell($spell) auf Stufe $int($level) zu zaubern."</text>
<text locale="en">"$unit($unit) has insufficient components to cast $spell($spell) on level $int($level)."</text> <text locale="en">"$unit($unit) has insufficient components to cast $spell($spell) on level $int($level)."</text>
</message> </message>
<message name="patzer" section="magic"> <message name="patzer" section="magic">