Merge pull request #736 from ennorehling/develop

BUG 2374 ATTACKIERE auf Seeschlangen
This commit is contained in:
Enno Rehling 2017-10-16 20:53:57 +02:00 committed by GitHub
commit 10eb4f9ac9
20 changed files with 222 additions and 175 deletions

View File

@ -27,7 +27,7 @@ fi
if [ -e $GAME/$TEMPLATE ]; then if [ -e $GAME/$TEMPLATE ]; then
TEMPLATE=$GAME/$TEMPLATE TEMPLATE=$GAME/$TEMPLATE
else else
TEMPLATE=$ERESSEA/etc/$TEMPLATE TEMPLATE=$ERESSEA/server/etc/$TEMPLATE
fi fi
if [ ! -e $TEMPLATE ]; then if [ ! -e $TEMPLATE ]; then

View File

@ -7154,7 +7154,7 @@
<text locale="de">"Das Wurmloch in $region($region) schließt sich."</text> <text locale="de">"Das Wurmloch in $region($region) schließt sich."</text>
<text locale="en">"The wormhole in $region($region) disappears."</text> <text locale="en">"The wormhole in $region($region) disappears."</text>
</message> </message>
<message name="battle::useflamingsword" section="battle"> <message name="useflamingsword" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
<arg name="amount" type="int"/> <arg name="amount" type="int"/>
@ -7162,7 +7162,7 @@
<text locale="de">"$int($amount) Krieger von $unit($unit) benutzen ihre Flammenschwerter."</text> <text locale="de">"$int($amount) Krieger von $unit($unit) benutzen ihre Flammenschwerter."</text>
<text locale="en">"$int($amount) fighters of $unit($unit) are using their flaming sword."</text> <text locale="en">"$int($amount) fighters of $unit($unit) are using their flaming sword."</text>
</message> </message>
<message name="battle::usecatapult" section="battle"> <message name="usecatapult" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
<arg name="amount" type="int"/> <arg name="amount" type="int"/>
@ -7170,35 +7170,35 @@
<text locale="de">"$int($amount) Krieger von $unit($unit) feuern ihre Katapulte ab."</text> <text locale="de">"$int($amount) Krieger von $unit($unit) feuern ihre Katapulte ab."</text>
<text locale="en">"$int($amount) fighters of $unit($unit) launch their catapults."</text> <text locale="en">"$int($amount) fighters of $unit($unit) launch their catapults."</text>
</message> </message>
<message name="battle::starters" section="battle"> <message name="start_battle" section="battle">
<type> <type>
<arg name="factions" type="string"/> <arg name="factions" type="string"/>
</type> </type>
<text locale="de">"Der Kampf wurde ausgelöst von ${factions}."</text> <text locale="de">"Der Kampf wurde ausgelöst von ${factions}."</text>
<text locale="en">"The battle was initiated by ${factions}."</text> <text locale="en">"The battle was initiated by ${factions}."</text>
</message> </message>
<message name="battle::potionsave" section="battle"> <message name="potionsave" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
</type> </type>
<text locale="de">"Eine Person von $unit($unit) konnte durch einen Heiltrank überleben."</text> <text locale="de">"Eine Person von $unit($unit) konnte durch einen Heiltrank überleben."</text>
<text locale="en">"A fighter of $unit($unit) was saved by a healing potion."</text> <text locale="en">"A fighter of $unit($unit) was saved by a healing potion."</text>
</message> </message>
<message name="battle::tactics_lost" section="battle"> <message name="tactics_lost" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
</type> </type>
<text locale="de">"$unit($unit) konnte dem Gegner eine Falle stellen."</text> <text locale="de">"$unit($unit) konnte dem Gegner eine Falle stellen."</text>
<text locale="en">"$unit($unit) lured the enemy into an ambush."</text> <text locale="en">"$unit($unit) lured the enemy into an ambush."</text>
</message> </message>
<message name="battle::tactics_won" section="battle"> <message name="tactics_won" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
</type> </type>
<text locale="de">"$unit($unit) überrascht den Gegner."</text> <text locale="de">"$unit($unit) überrascht den Gegner."</text>
<text locale="en">"$unit($unit) surprises the enemies."</text> <text locale="en">"$unit($unit) surprises the enemies."</text>
</message> </message>
<message name="battle::spell_failed" section="battle"> <message name="spell_failed" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
<arg name="spell" type="spell"/> <arg name="spell" type="spell"/>
@ -7206,20 +7206,20 @@
<text locale="de">"$unit($unit) versucht $spell($spell) zu zaubern, doch der Zauber schlägt fehl!"</text> <text locale="de">"$unit($unit) versucht $spell($spell) zu zaubern, doch der Zauber schlägt fehl!"</text>
<text locale="en">"$unit($unit) tries to cast $spell($spell), but the spell fails!"</text> <text locale="en">"$unit($unit) tries to cast $spell($spell), but the spell fails!"</text>
</message> </message>
<message name="battle::aborted" section="battle"> <message name="aborted_battle" section="battle">
<type> <type>
</type> </type>
<text locale="de">"Der Kampf wurde abgebrochen, da alle Verteidiger flohen."</text> <text locale="de">"Der Kampf wurde abgebrochen, da alle Verteidiger flohen."</text>
<text locale="en">"The battle was aborted because all enemies escaped."</text> <text locale="en">"The battle was aborted because all enemies escaped."</text>
</message> </message>
<message name="battle::row_header" section="battle"> <message name="battle_row" section="battle">
<type> <type>
<arg name="row" type="int"/> <arg name="row" type="int"/>
</type> </type>
<text locale="de">"... in der $int($row). Kampflinie:"</text> <text locale="de">"... in der $int($row). Kampflinie:"</text>
<text locale="en">"... in combat rank $int($row):"</text> <text locale="en">"... in combat rank $int($row):"</text>
</message> </message>
<message name="battle::out_of_range" section="battle"> <message name="spell_out_of_range" section="battle">
<type> <type>
<arg name="mage" type="unit"/> <arg name="mage" type="unit"/>
<arg name="spell" type="spell"/> <arg name="spell" type="spell"/>
@ -7228,14 +7228,14 @@
<text locale="en">"$unit($mage) casts $spell($spell), but nobody was in range."</text> <text locale="en">"$unit($mage) casts $spell($spell), but nobody was in range."</text>
</message> </message>
<message name="battle::after" section="battle"> <message name="after_battle" section="battle">
<type> <type>
</type> </type>
<text locale="de">"Einheiten nach dem Kampf:"</text> <text locale="de">"Einheiten nach dem Kampf:"</text>
<text locale="en">"Units after the battle:"</text> <text locale="en">"Units after the battle:"</text>
</message> </message>
<message name="battle::section" section="battle"> <message name="section_battle" section="battle">
<type> <type>
</type> </type>
<text locale="de">""</text> <text locale="de">""</text>
@ -7301,21 +7301,21 @@
<text locale="en">"$unit($mage) causes the walls of $building($building) to glow in an eerie magic light."</text> <text locale="en">"$unit($mage) causes the walls of $building($building) to glow in an eerie magic light."</text>
</message> </message>
<message name="battle::lineup" section="battle"> <message name="lineup_battle" section="battle">
<type> <type>
<arg name="turn" type="int"/> <arg name="turn" type="int"/>
</type> </type>
<text locale="de">"Einheiten vor der $int($turn). Runde:"</text> <text locale="de">"Einheiten vor der $int($turn). Runde:"</text>
<text locale="en">"Units before turn $int($turn):"</text> <text locale="en">"Units before turn $int($turn):"</text>
</message> </message>
<message name="battle::header" section="battle"> <message name="header_battle" section="battle">
<type> <type>
<arg name="region" type="region"/> <arg name="region" type="region"/>
</type> </type>
<text locale="de">"In $region($region) findet ein Kampf statt."</text> <text locale="de">"In $region($region) findet ein Kampf statt."</text>
<text locale="en">"There is a battle in $region($region)."</text> <text locale="en">"There is a battle in $region($region)."</text>
</message> </message>
<message name="battle::combatspell" section="battle"> <message name="cast_combatspell" section="battle">
<type> <type>
<arg name="mage" type="unit"/> <arg name="mage" type="unit"/>
<arg name="spell" type="spell"/> <arg name="spell" type="spell"/>
@ -7516,7 +7516,7 @@
<text locale="en">"$unit($mage) casts $spell($spell). $int($amount) fighters are temporarily losing some of their memories."</text> <text locale="en">"$unit($mage) casts $spell($spell). $int($amount) fighters are temporarily losing some of their memories."</text>
</message> </message>
<message name="battle::killed" section="battle"> <message name="killed_battle" section="battle">
<type> <type>
<arg name="unit" type="unit"/> <arg name="unit" type="unit"/>
<arg name="dead" type="int"/> <arg name="dead" type="int"/>
@ -7524,7 +7524,7 @@
<text locale="de">"$unit($unit) tötete $int($dead) Krieger."</text> <text locale="de">"$unit($unit) tötete $int($dead) Krieger."</text>
<text locale="en">"$unit($unit) killed $int($dead) opponents."</text> <text locale="en">"$unit($unit) killed $int($dead) opponents."</text>
</message> </message>
<message name="battle::army_report" section="battle"> <message name="army_report" section="battle">
<type> <type>
<arg name="index" type="int"/> <arg name="index" type="int"/>
<arg name="abbrev" type="string"/> <arg name="abbrev" type="string"/>

View File

@ -1295,7 +1295,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
if (oldpotiontype[P_HEAL] && !fval(&df->person[dt.index], FL_HEALING_USED)) { if (oldpotiontype[P_HEAL] && !fval(&df->person[dt.index], FL_HEALING_USED)) {
if (i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0) { if (i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0) {
message *m = msg_message("battle::potionsave", "unit", du); message *m = msg_message("potionsave", "unit", du);
message_faction(b, du->faction, m); message_faction(b, du->faction, m);
msg_release(m); msg_release(m);
i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1); i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
@ -1630,7 +1630,7 @@ selist *fighters(battle * b, const side * vs, int minrow, int maxrow, int mask)
static void report_failed_spell(struct battle * b, struct unit * mage, const struct spell *sp) static void report_failed_spell(struct battle * b, struct unit * mage, const struct spell *sp)
{ {
message *m = msg_message("battle::spell_failed", "unit spell", mage, sp); message *m = msg_message("spell_failed", "unit spell", mage, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
} }
@ -2277,7 +2277,7 @@ void do_attack(fighter * af)
* Ladezeit neu und generiert die Meldung. */ * Ladezeit neu und generiert die Meldung. */
if (af->catmsg >= 0) { if (af->catmsg >= 0) {
struct message *m = struct message *m =
msg_message("battle::killed", "unit dead", au, af->catmsg); msg_message("killed_battle", "unit dead", au, af->catmsg);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
af->catmsg = -1; af->catmsg = -1;
@ -2752,10 +2752,10 @@ static void aftermath(battle * b)
battle_effects(b, dead_players); battle_effects(b, dead_players);
for (s = b->sides; s != b->sides + b->nsides; ++s) { for (s = b->sides; s != b->sides + b->nsides; ++s) {
message *seen = msg_message("battle::army_report", message *seen = msg_message("army_report",
"index abbrev dead fled survived", "index abbrev dead fled survived",
army_index(s), sideabkz(s, false), s->dead, s->flee, s->alive); army_index(s), sideabkz(s, false), s->dead, s->flee, s->alive);
message *unseen = msg_message("battle::army_report", message *unseen = msg_message("army_report",
"index abbrev dead fled survived", "index abbrev dead fled survived",
army_index(s), "-?-", s->dead, s->flee, s->alive); army_index(s), "-?-", s->dead, s->flee, s->alive);
@ -2864,7 +2864,7 @@ static void print_fighters(battle * b, const side * s)
if (row == thisrow) { if (row == thisrow) {
if (m == NULL) { if (m == NULL) {
m = msg_message("battle::row_header", "row", row); m = msg_message("battle_row", "row", row);
message_all(b, m); message_all(b, m);
} }
battle_punit(du, b); battle_punit(du, b);
@ -2927,7 +2927,7 @@ static void print_header(battle * b)
bufp = STRLCPY(bufp, lastf, size); bufp = STRLCPY(bufp, lastf, size);
} }
m = msg_message("battle::starters", "factions", zText); m = msg_message("start_battle", "factions", zText);
message_faction(b, f, m); message_faction(b, f, m);
msg_release(m); msg_release(m);
} }
@ -3049,10 +3049,10 @@ static void print_stats(battle * b)
unit *u = tf->unit; unit *u = tf->unit;
message *m = NULL; message *m = NULL;
if (!is_attacker(tf)) { if (!is_attacker(tf)) {
m = msg_message("battle::tactics_lost", "unit", u); m = msg_message("tactics_lost", "unit", u);
} }
else { else {
m = msg_message("battle::tactics_won", "unit", u); m = msg_message("tactics_won", "unit", u);
} }
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
@ -3579,9 +3579,9 @@ static int battle_report(battle * b)
message_faction(b, fac, msg_separator); message_faction(b, fac, msg_separator);
if (cont) if (cont)
m = msg_message("battle::lineup", "turn", b->turn); m = msg_message("lineup_battle", "turn", b->turn);
else else
m = msg_message("battle::after", ""); m = msg_message("after_battle", "");
message_faction(b, fac, m); message_faction(b, fac, m);
msg_release(m); msg_release(m);
@ -3847,7 +3847,7 @@ static bool start_battle(region * r, battle ** bp)
/* Beginn Fehlerbehandlung */ /* Beginn Fehlerbehandlung */
/* Fehler: "Die Einheit wurde nicht gefunden" */ /* Fehler: "Die Einheit wurde nicht gefunden" */
if (!u2 || u2->number == 0 || !cansee(u->faction, u->region, u2, 0, seen_battle)) { if (!u2 || u2->number == 0 || !cansee(u->faction, u->region, u2, 0)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
"feedback_unit_not_found", "")); "feedback_unit_not_found", ""));
continue; continue;
@ -4073,7 +4073,7 @@ void do_battle(region * r)
bool fighting = false; bool fighting = false;
ship *sh; ship *sh;
if (msg_separator == NULL) { if (msg_separator == NULL) {
msg_separator = msg_message("battle::section", ""); msg_separator = msg_message("section_battle", "");
} }
fighting = start_battle(r, &b); fighting = start_battle(r, &b);
@ -4087,7 +4087,7 @@ void do_battle(region * r)
print_header(b); print_header(b);
if (!fighting) { if (!fighting) {
/* Niemand mehr da, Kampf kann nicht stattfinden. */ /* Niemand mehr da, Kampf kann nicht stattfinden. */
message *m = msg_message("battle::aborted", ""); message *m = msg_message("aborted_battle", "");
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
free_battle(b); free_battle(b);

View File

@ -1497,7 +1497,7 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
if (u->building || u->ship || (stealthmod > INT_MIN if (u->building || u->ship || (stealthmod > INT_MIN
&& cansee(f, r, u, stealthmod, r->seen.mode))) { && cansee_ex(f, r, u, stealthmod, r->seen.mode))) {
cr_output_unit_compat(F, r, f, u, r->seen.mode); cr_output_unit_compat(F, r, f, u, r->seen.mode);
} }
} }

View File

@ -2454,7 +2454,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
} }
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction == f && cansee_depr(u->faction, r, u2, 0)) if (u2->faction == f && cansee(u->faction, r, u2, 0))
break; break;
} }

View File

@ -614,7 +614,7 @@ bool can_give_to(unit *u, unit *u2) {
return false; return false;
} }
if (u2 && !alliedunit(u2, u->faction, HELP_GIVE) if (u2 && !alliedunit(u2, u->faction, HELP_GIVE)
&& !cansee_depr(u->faction, u->region, u2, 0) && !ucontact(u2, u) && !cansee(u->faction, u->region, u2, 0) && !ucontact(u2, u)
&& !fval(u2, UFL_TAKEALL)) { && !fval(u2, UFL_TAKEALL)) {
return false; return false;
} }

View File

@ -93,7 +93,7 @@ static bool is_guardian_u(const unit * guard, unit * u)
return false; return false;
if (ucontact(guard, u)) if (ucontact(guard, u))
return false; return false;
if (!cansee_depr(guard->faction, u->region, u, 0)) if (!cansee(guard->faction, u->region, u, 0))
return false; return false;
if (!(u_race(guard)->flags & RCF_FLY) && u_race(u)->flags & RCF_FLY) if (!(u_race(guard)->flags & RCF_FLY) && u_race(u)->flags & RCF_FLY)
return false; return false;

View File

@ -63,7 +63,7 @@ int *casualties)
if (wp != NULL && wp->type == wtype) if (wp != NULL && wp->type == wtype)
++k; ++k;
} }
msg = msg_message("battle::useflamingsword", "amount unit", k, fi->unit); msg = msg_message("useflamingsword", "amount unit", k, fi->unit);
message_all(fi->side->battle, msg); message_all(fi->side->battle, msg);
msg_release(msg); msg_release(msg);
fi->catmsg = 0; fi->catmsg = 0;
@ -119,7 +119,7 @@ int *casualties)
if (af->person[i].reload == 0 && af->person[i].missile == wp) if (af->person[i].reload == 0 && af->person[i].missile == wp)
++k; ++k;
} }
msg = msg_message("battle::usecatapult", "amount unit", k, au); msg = msg_message("usecatapult", "amount unit", k, au);
message_all(b, msg); message_all(b, msg);
msg_release(msg); msg_release(msg);
af->catmsg = 0; af->catmsg = 0;

View File

@ -113,7 +113,7 @@ static void destroy_road(unit * u, int nmax, struct order *ord)
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction != u->faction && is_guard(u2) if (u2->faction != u->faction && is_guard(u2)
&& cansee_depr(u2->faction, u->region, u, 0) && cansee(u2->faction, u->region, u, 0)
&& !alliedunit(u, u2->faction, HELP_GUARD)) { && !alliedunit(u, u2->faction, HELP_GUARD)) {
cmistake(u, ord, 70, MSG_EVENT); cmistake(u, ord, 70, MSG_EVENT);
return; return;

View File

@ -1651,7 +1651,7 @@ static bool try_rename(unit *u, building *b, order *ord) {
} }
if (owner) { if (owner) {
if (cansee(owner->faction, u->region, u, 0, seen_unit)) { if (cansee(owner->faction, u->region, u, 0)) {
ADDMSG(&owner->faction->msgs, ADDMSG(&owner->faction->msgs,
msg_message("renamed_building_seen", msg_message("renamed_building_seen",
"building renamer region", b, u, u->region)); "building renamer region", b, u, u->region));
@ -1747,7 +1747,7 @@ int name_cmd(struct unit *u, struct order *ord)
break; break;
} }
} }
if (cansee(f, r, u, 0, seen_unit)) { if (cansee(f, r, u, 0)) {
ADDMSG(&f->msgs, ADDMSG(&f->msgs,
msg_message("renamed_faction_seen", "unit region", u, r)); msg_message("renamed_faction_seen", "unit region", u, r));
} }
@ -1794,7 +1794,7 @@ int name_cmd(struct unit *u, struct order *ord)
} }
uo = ship_owner(sh); uo = ship_owner(sh);
if (uo) { if (uo) {
if (cansee(uo->faction, r, u, 0, seen_unit)) { if (cansee(uo->faction, r, u, 0)) {
ADDMSG(&uo->faction->msgs, ADDMSG(&uo->faction->msgs,
msg_message("renamed_ship_seen", "ship renamer region", sh, u, r)); msg_message("renamed_ship_seen", "ship renamer region", sh, u, r));
} }
@ -1823,7 +1823,7 @@ int name_cmd(struct unit *u, struct order *ord)
unit *u2 = 0; unit *u2 = 0;
getunit(r, u->faction, &u2); getunit(r, u->faction, &u2);
if (!u2 || !cansee(u->faction, r, u2, 0, seen_unit)) { if (!u2 || !cansee(u->faction, r, u2, 0)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
"feedback_unit_not_found", "")); "feedback_unit_not_found", ""));
break; break;
@ -1836,7 +1836,7 @@ int name_cmd(struct unit *u, struct order *ord)
break; break;
} }
} }
if (cansee(u2->faction, r, u, 0, seen_unit)) { if (cansee(u2->faction, r, u, 0)) {
ADDMSG(&u2->faction->msgs, msg_message("renamed_seen", ADDMSG(&u2->faction->msgs, msg_message("renamed_seen",
"renamer renamed region", u, u2, r)); "renamer renamed region", u, u2, r));
} }
@ -1898,7 +1898,7 @@ int name_cmd(struct unit *u, struct order *ord)
void void
deliverMail(faction * f, region * r, unit * u, const char *s, unit * receiver) deliverMail(faction * f, region * r, unit * u, const char *s, unit * receiver)
{ {
if (!cansee(f, r, u, 0, seen_unit)) { if (!cansee(f, r, u, 0)) {
u = NULL; u = NULL;
} }
if (!receiver) { /* BOTSCHAFT an PARTEI */ if (!receiver) { /* BOTSCHAFT an PARTEI */
@ -1917,7 +1917,7 @@ mailunit(region * r, unit * u, int n, struct order *ord, const char *s)
{ {
unit *u2 = findunitr(r, n); unit *u2 = findunitr(r, n);
if (u2 && cansee(u->faction, r, u2, 0, seen_unit)) { if (u2 && cansee(u->faction, r, u2, 0)) {
deliverMail(u2->faction, r, u, s, u2); deliverMail(u2->faction, r, u, s, u2);
/* now done in prepare_mail_cmd */ /* now done in prepare_mail_cmd */
} }
@ -1995,7 +1995,7 @@ int mail_cmd(unit * u, struct order *ord)
n = getid(); n = getid();
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->no == n && cansee(u->faction, r, u2, 0, seen_unit)) { if (u2->no == n && cansee(u->faction, r, u2, 0)) {
break; break;
} }
} }
@ -2049,7 +2049,7 @@ int mail_cmd(unit * u, struct order *ord)
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->building == b && !fval(u2->faction, FFL_SELECT) if (u2->building == b && !fval(u2->faction, FFL_SELECT)
&& cansee(u->faction, r, u2, 0, seen_unit)) { && cansee(u->faction, r, u2, 0)) {
mailunit(r, u, u2->no, ord, s); mailunit(r, u, u2->no, ord, s);
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
} }
@ -2078,7 +2078,7 @@ int mail_cmd(unit * u, struct order *ord)
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->ship == sh && !fval(u2->faction, FFL_SELECT) if (u2->ship == sh && !fval(u2->faction, FFL_SELECT)
&& cansee(u->faction, r, u2, 0, seen_unit)) { && cansee(u->faction, r, u2, 0)) {
mailunit(r, u, u2->no, ord, s); mailunit(r, u, u2->no, ord, s);
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
} }
@ -4281,7 +4281,7 @@ void update_subscriptions(void)
* Es muss auch niemand aus f in der region sein, wenn sie vom Turm * Es muss auch niemand aus f in der region sein, wenn sie vom Turm
* erblickt wird */ * erblickt wird */
bool bool
cansee(const faction * f, const region * r, const unit * u, int modifier, seen_mode mode) cansee(const faction * f, const region * r, const unit * u, int modifier)
{ {
int stealth, rings; int stealth, rings;
@ -4310,35 +4310,31 @@ cansee(const faction * f, const region * r, const unit * u, int modifier, seen_m
rings = invisible(u, NULL); rings = invisible(u, NULL);
stealth = eff_stealth(u, r) - modifier; stealth = eff_stealth(u, r) - modifier;
if (mode > seen_unit) { unit *u2;
return (rings <= 0 && stealth <= 0); for (u2 = r->units; u2; u2 = u2->next) {
} if (u2->faction == f) {
else { if (rings < u->number || invisible(u, u2) < u->number) {
unit *u2; if (skill_enabled(SK_PERCEPTION)) {
for (u2 = r->units; u2; u2 = u2->next) { int observation = effskill(u2, SK_PERCEPTION, 0);
if (u2->faction == f) {
if (rings < u->number || invisible(u, u2) < u->number) {
if (skill_enabled(SK_PERCEPTION)) {
int observation = effskill(u2, SK_PERCEPTION, 0);
if (observation >= stealth) { if (observation >= stealth) {
return true;
}
}
else {
return true; return true;
} }
} }
else {
return true;
}
} }
} }
} }
return false;
return (rings <= 0 && stealth <= 0);
} }
bool bool cansee_ex(const faction * f, const region * r, const unit * u, int modifier, seen_mode mode)
cansee_depr(const faction * f, const region * r, const unit * u, int modifier)
{ {
return cansee(f, r, u, modifier, seen_unit); UNUSED_ARG(mode);
return cansee(f, r, u, modifier);
} }
bool cansee_unit(const unit * u, const unit * target, int modifier) bool cansee_unit(const unit * u, const unit * target, int modifier)
@ -4427,7 +4423,7 @@ bool
seefaction(const faction * f, const region * r, const unit * u, int modifier) seefaction(const faction * f, const region * r, const unit * u, int modifier)
{ {
if (((f == u->faction) || !fval(u, UFL_ANON_FACTION)) if (((f == u->faction) || !fval(u, UFL_ANON_FACTION))
&& cansee(f, r, u, modifier, seen_unit)) && cansee(f, r, u, modifier))
return true; return true;
return false; return false;
} }

View File

@ -98,9 +98,9 @@ extern "C" {
void nmr_warnings(void); void nmr_warnings(void);
bool cansee_ex(const struct faction * f, const struct region * r,
const struct unit * u, int modifier, seen_mode mode);
bool cansee(const struct faction * f, const struct region * r, bool cansee(const struct faction * f, const struct region * r,
const struct unit *u, int modifier, seen_mode mode);
bool cansee_depr(const struct faction *f, const struct region *r,
const struct unit *u, int modifier); const struct unit *u, int modifier);
bool cansee_durchgezogen(const struct faction *f, const struct region *r, bool cansee_durchgezogen(const struct faction *f, const struct region *r,
const struct unit *u, int modifier); const struct unit *u, int modifier);

View File

@ -1579,60 +1579,6 @@ static void test_demon_hunger(CuTest * tc)
test_cleanup(); test_cleanup();
} }
static void test_cansee(CuTest *tc) {
unit *u, *u2;
test_setup();
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
u2 = test_create_unit(test_create_faction(0), u->region);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0, seen_unit));
set_level(u2, SK_STEALTH, 1);
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_unit));
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_spell));
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 1, seen_spell));
set_level(u, SK_PERCEPTION, 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0, seen_unit));
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_spell));
test_cleanup();
}
static void test_cansee_items(CuTest *tc) {
unit *u, *u2;
item_type *itype[3];
test_setup();
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
u2 = test_create_unit(test_create_faction(0), u->region);
scale_number(u2, 2);
itype[0] = test_create_itemtype("roi");
itype[1] = test_create_itemtype("sphereofinv");
itype[2] = test_create_itemtype("aots");
CuAssertPtrNotNull(tc, get_resourcetype(R_RING_OF_INVISIBILITY));
CuAssertPtrNotNull(tc, get_resourcetype(R_SPHERE_OF_INVISIBILITY));
CuAssertPtrNotNull(tc, get_resourcetype(R_AMULET_OF_TRUE_SEEING));
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0, seen_unit));
i_change(&u2->items, itype[0], 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0, seen_unit));
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_spell));
i_change(&u2->items, itype[0], 1);
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_unit));
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_spell));
i_change(&u->items, itype[2], 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0, seen_unit));
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0, seen_spell));
test_cleanup();
}
static void test_armedmen(CuTest *tc) { static void test_armedmen(CuTest *tc) {
/* TODO: test RCF_NOWEAPONS and SK_WEAPONLESS */ /* TODO: test RCF_NOWEAPONS and SK_WEAPONLESS */
unit *u; unit *u;
@ -1669,6 +1615,109 @@ static void test_armedmen(CuTest *tc) {
test_cleanup(); test_cleanup();
} }
static void test_cansee(CuTest *tc) {
unit *u, *u2;
test_setup();
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
u2 = test_create_unit(test_create_faction(0), u->region);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
set_level(u2, SK_STEALTH, 1);
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0));
set_level(u, SK_PERCEPTION, 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
test_cleanup();
}
static void test_cansee_spell(CuTest *tc) {
unit *u2;
faction *f;
test_setup();
f = test_create_faction(0);
u2 = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
CuAssertTrue(tc, cansee_ex(f, u2->region, u2, 0, seen_spell));
CuAssertTrue(tc, cansee_ex(f, u2->region, u2, 0, seen_battle));
set_level(u2, SK_STEALTH, 1);
CuAssertTrue(tc, !cansee_ex(f, u2->region, u2, 0, seen_spell));
CuAssertTrue(tc, cansee_ex(f, u2->region, u2, 1, seen_spell));
CuAssertTrue(tc, cansee_ex(f, u2->region, u2, 1, seen_battle));
test_cleanup();
}
static void test_cansee_ring(CuTest *tc) {
unit *u, *u2;
item_type *itype[2];
test_setup();
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
u2 = test_create_unit(test_create_faction(0), u->region);
scale_number(u2, 2);
itype[0] = test_create_itemtype("roi");
itype[1] = test_create_itemtype("aots");
CuAssertPtrNotNull(tc, get_resourcetype(R_RING_OF_INVISIBILITY));
CuAssertPtrEquals(tc, itype[0]->rtype, (void *)get_resourcetype(R_RING_OF_INVISIBILITY));
CuAssertPtrNotNull(tc, get_resourcetype(R_AMULET_OF_TRUE_SEEING));
CuAssertPtrEquals(tc, itype[1]->rtype, (void *)get_resourcetype(R_AMULET_OF_TRUE_SEEING));
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
/* a single ring is not enough to hide two people */
i_change(&u2->items, itype[0], 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
/* two rings can hide two people */
i_change(&u2->items, itype[0], 1);
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0));
/* one amulet negates one of the two rings */
i_change(&u->items, itype[1], 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
test_cleanup();
}
static void test_cansee_sphere(CuTest *tc) {
unit *u, *u2;
item_type *itype[2];
test_setup();
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
u2 = test_create_unit(test_create_faction(0), u->region);
itype[0] = test_create_itemtype("sphereofinv");
itype[1] = test_create_itemtype("aots");
CuAssertPtrNotNull(tc, get_resourcetype(R_SPHERE_OF_INVISIBILITY));
CuAssertPtrEquals(tc, itype[0]->rtype, (void *)get_resourcetype(R_SPHERE_OF_INVISIBILITY));
CuAssertPtrNotNull(tc, get_resourcetype(R_AMULET_OF_TRUE_SEEING));
CuAssertPtrEquals(tc, itype[1]->rtype, (void *)get_resourcetype(R_AMULET_OF_TRUE_SEEING));
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
/* a single sphere can hide 100 people */
scale_number(u2, 100);
i_change(&u2->items, itype[0], 1);
CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0));
/* one single amulet negates it? */
i_change(&u->items, itype[1], 1);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
/* number of people inside the sphere does not matter? */
scale_number(u2, 99);
CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0));
test_cleanup();
}
CuSuite *get_laws_suite(void) CuSuite *get_laws_suite(void)
{ {
CuSuite *suite = CuSuiteNew(); CuSuite *suite = CuSuiteNew();
@ -1738,7 +1787,9 @@ CuSuite *get_laws_suite(void)
SUITE_ADD_TEST(suite, test_demon_hunger); SUITE_ADD_TEST(suite, test_demon_hunger);
SUITE_ADD_TEST(suite, test_armedmen); SUITE_ADD_TEST(suite, test_armedmen);
SUITE_ADD_TEST(suite, test_cansee); SUITE_ADD_TEST(suite, test_cansee);
SUITE_ADD_TEST(suite, test_cansee_items); SUITE_ADD_TEST(suite, test_cansee_ring);
SUITE_ADD_TEST(suite, test_cansee_sphere);
SUITE_ADD_TEST(suite, test_cansee_spell);
return suite; return suite;
} }

View File

@ -1621,7 +1621,7 @@ order * ord)
if (u->region != r) if (u->region != r)
u = NULL; u = NULL;
else if (sp->sptyp & TESTCANSEE) { else if (sp->sptyp & TESTCANSEE) {
if (!cansee_depr(mage->faction, r, u, 0) && !ucontact(u, mage)) { if (!cansee(mage->faction, r, u, 0) && !ucontact(u, mage)) {
u = NULL; u = NULL;
} }
} }

View File

@ -159,7 +159,7 @@ static order *monster_attack(unit * u, const unit * target)
{ {
assert(u->region == target->region); assert(u->region == target->region);
assert(u->faction != target->faction); assert(u->faction != target->faction);
if (!cansee_depr(u->faction, u->region, target, 0)) if (!cansee(u->faction, u->region, target, 0))
return NULL; return NULL;
if (monster_is_waiting(u)) if (monster_is_waiting(u))
return NULL; return NULL;
@ -199,7 +199,7 @@ int monster_attacks(unit * monster, bool rich_only)
int money = 0; int money = 0;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction != monster->faction && cansee_depr(monster->faction, r, u2, 0) && !in_safe_building(u2, monster)) { if (u2->faction != monster->faction && cansee(monster->faction, r, u2, 0) && !in_safe_building(u2, monster)) {
int m = get_money(u2); int m = get_money(u2);
if (u_race(monster) == rc_serpent) { if (u_race(monster) == rc_serpent) {
/* attack bigger ships only */ /* attack bigger ships only */

View File

@ -912,7 +912,7 @@ static void caught_target(region * r, unit * u)
target, u)); target, u));
} }
else if (!alliedunit(target, u->faction, HELP_ALL) else if (!alliedunit(target, u->faction, HELP_ALL)
&& cansee_depr(target->faction, r, u, 0)) { && cansee(target->faction, r, u, 0)) {
ADDMSG(&target->faction->msgs, msg_message("followdetect", ADDMSG(&target->faction->msgs, msg_message("followdetect",
"unit follower", target, u)); "unit follower", target, u));
} }
@ -1185,7 +1185,7 @@ static void init_transportation(void)
continue; continue;
} }
if (!transport(ut, u)) { if (!transport(ut, u)) {
if (cansee_depr(u->faction, r, ut, 0)) { if (cansee(u->faction, r, ut, 0)) {
cmistake(u, u->thisorder, 286, MSG_MOVE); cmistake(u, u->thisorder, 286, MSG_MOVE);
} }
else { else {
@ -2093,7 +2093,7 @@ static const region_list *travel_i(unit * u, const region_list * route_begin,
} }
} }
if (!found) { if (!found) {
if (cansee_depr(u->faction, u->region, ut, 0)) { if (cansee(u->faction, u->region, ut, 0)) {
cmistake(u, ord, 90, MSG_MOVE); cmistake(u, ord, 90, MSG_MOVE);
} }
else { else {
@ -2604,7 +2604,7 @@ void follow_unit(unit * u)
u2 = a->data.v; u2 = a->data.v;
} }
if (!u2 || (!followship && (u2->region != r || !cansee_depr(u->faction, r, u2, 0)))) { if (!u2 || (!followship && (u2->region != r || !cansee(u->faction, r, u2, 0)))) {
return; return;
} }

View File

@ -768,7 +768,7 @@ static void rp_battles(struct stream *out, faction * f)
while (bm) { while (bm) {
char buf[256]; char buf[256];
RENDER(f, buf, sizeof(buf), ("battle::header", "region", bm->r)); RENDER(f, buf, sizeof(buf), ("header_battle", "region", bm->r));
newline(out); newline(out);
centre(out, buf, true); centre(out, buf, true);
newline(out); newline(out);
@ -2349,7 +2349,7 @@ report_plaintext(const char *filename, report_context * ctx,
} }
while (u && !u->ship) { while (u && !u->ship) {
if (stealthmod > INT_MIN && r->seen.mode >= seen_unit) { if (stealthmod > INT_MIN && r->seen.mode >= seen_unit) {
if (u->faction == f || cansee(f, r, u, stealthmod, r->seen.mode)) { if (u->faction == f || cansee_ex(f, r, u, stealthmod, r->seen.mode)) {
nr_unit(out, f, u, 4, r->seen.mode); nr_unit(out, f, u, 4, r->seen.mode);
} }
} }

View File

@ -960,7 +960,7 @@ struct message *msg_curse(const struct curse *c, const void *obj, objtype_t typ,
const struct unit *ucansee(const struct faction *f, const struct unit *u, const struct unit *ucansee(const struct faction *f, const struct unit *u,
const struct unit *x) const struct unit *x)
{ {
if (cansee_depr(f, u->region, u, 0)) if (cansee(f, u->region, u, 0))
return u; return u;
return x; return x;
} }
@ -1069,7 +1069,7 @@ void get_addresses(report_context * ctx)
faction *sf = visible_faction(ctx->f, u); faction *sf = visible_faction(ctx->f, u);
if (lastf != sf) { if (lastf != sf) {
if (u->building || u->ship || (stealthmod > INT_MIN if (u->building || u->ship || (stealthmod > INT_MIN
&& cansee_depr(ctx->f, r, u, stealthmod))) { && cansee(ctx->f, r, u, stealthmod))) {
add_seen_faction_i(&flist, sf); add_seen_faction_i(&flist, sf);
lastf = sf; lastf = sf;
} }
@ -1087,7 +1087,7 @@ void get_addresses(report_context * ctx)
if (u->faction != ctx->f) { if (u->faction != ctx->f) {
faction *sf = visible_faction(ctx->f, u); faction *sf = visible_faction(ctx->f, u);
bool ballied = sf && sf != ctx->f && sf != lastf bool ballied = sf && sf != ctx->f && sf != lastf
&& !fval(u, UFL_ANON_FACTION) && cansee_depr(ctx->f, r, u, stealthmod); && !fval(u, UFL_ANON_FACTION) && cansee(ctx->f, r, u, stealthmod);
if (ballied || is_allied(ctx->f, sf)) { if (ballied || is_allied(ctx->f, sf)) {
add_seen_faction_i(&flist, sf); add_seen_faction_i(&flist, sf);
lastf = sf; lastf = sf;

View File

@ -362,11 +362,11 @@ int report_action(region * r, unit * actor, message * msg, int flags)
if (view == ACTION_CANSEE) { if (view == ACTION_CANSEE) {
/* Bei Fernzaubern sieht nur die eigene Partei den Magier */ /* Bei Fernzaubern sieht nur die eigene Partei den Magier */
show = show || (r == actor->region show = show || (r == actor->region
&& cansee_depr(u->faction, r, actor, 0)); && cansee(u->faction, r, actor, 0));
} }
else if (view == ACTION_CANNOTSEE) { else if (view == ACTION_CANNOTSEE) {
show = !show && !(r == actor->region show = !show && !(r == actor->region
&& cansee_depr(u->faction, r, actor, 0)); && cansee(u->faction, r, actor, 0));
} }
else { else {
/* the unliely (or lazy) case */ /* the unliely (or lazy) case */
@ -1328,7 +1328,7 @@ static int sp_rosthauch(castorder * co)
"mage target amount", mage, u, ironweapon)); "mage target amount", mage, u, ironweapon));
ADDMSG(&u->faction->msgs, msg_message("rust_effect", ADDMSG(&u->faction->msgs, msg_message("rust_effect",
"mage target amount", "mage target amount",
cansee_depr(u->faction, r, mage, 0) ? mage : NULL, u, ironweapon)); cansee(u->faction, r, mage, 0) ? mage : NULL, u, ironweapon));
success += ironweapon; success += ironweapon;
} }
else { else {
@ -1405,7 +1405,7 @@ static int sp_kaelteschutz(castorder * co)
u)); u));
if (u->faction != mage->faction) if (u->faction != mage->faction)
ADDMSG(&u->faction->msgs, msg_message("heat_effect", "mage target", ADDMSG(&u->faction->msgs, msg_message("heat_effect", "mage target",
cansee_depr(u->faction, r, mage, 0) ? mage : NULL, u)); cansee(u->faction, r, mage, 0) ? mage : NULL, u));
i = cast_level; i = cast_level;
} }
/* Erstattung? */ /* Erstattung? */
@ -1825,7 +1825,7 @@ static int sp_treewalkenter(castorder * co)
m = NULL; m = NULL;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, r, u, 0)) { if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_disappear", "unit", u); m = msg_message("astral_disappear", "unit", u);
@ -1842,7 +1842,7 @@ static int sp_treewalkenter(castorder * co)
m = NULL; m = NULL;
for (u2 = rt->units; u2; u2 = u2->next) { for (u2 = rt->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, rt, u, 0)) { if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_appear", "unit", u); m = msg_message("astral_appear", "unit", u);
@ -1971,7 +1971,7 @@ static int sp_treewalkexit(castorder * co)
m = NULL; m = NULL;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, r, u, 0)) { if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_disappear", "unit", u); m = msg_message("astral_disappear", "unit", u);
@ -1989,7 +1989,7 @@ static int sp_treewalkexit(castorder * co)
m = NULL; m = NULL;
for (u2 = rt->units; u2; u2 = u2->next) { for (u2 = rt->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, rt, u, 0)) { if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_appear", "unit", u); m = msg_message("astral_appear", "unit", u);
@ -2954,7 +2954,7 @@ static int sp_deathcloud(castorder * co)
if (!fval(u->faction, FFL_SELECT)) { if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT); fset(u->faction, FFL_SELECT);
ADDMSG(&u->faction->msgs, msg_message("deathcloud_effect", ADDMSG(&u->faction->msgs, msg_message("deathcloud_effect",
"mage region", cansee_depr(u->faction, r, mage, 0) ? mage : NULL, r)); "mage region", cansee(u->faction, r, mage, 0) ? mage : NULL, r));
} }
} }
@ -3848,7 +3848,7 @@ static int sp_song_of_peace(castorder * co)
if (!fval(u->faction, FFL_SELECT)) { if (!fval(u->faction, FFL_SELECT)) {
message *m = NULL; message *m = NULL;
fset(u->faction, FFL_SELECT); fset(u->faction, FFL_SELECT);
if (cansee_depr(u->faction, r, mage, 0)) { if (cansee(u->faction, r, mage, 0)) {
if (msg[0] == NULL) if (msg[0] == NULL)
msg[0] = msg_message("song_of_peace_effect_0", "mage", mage); msg[0] = msg_message("song_of_peace_effect_0", "mage", mage);
m = msg[0]; m = msg[0];
@ -3905,7 +3905,7 @@ static int sp_generous(castorder * co)
if (!fval(u->faction, FFL_SELECT)) { if (!fval(u->faction, FFL_SELECT)) {
message *m = NULL; message *m = NULL;
fset(u->faction, FFL_SELECT); fset(u->faction, FFL_SELECT);
if (cansee_depr(u->faction, r, mage, 0)) { if (cansee(u->faction, r, mage, 0)) {
if (msg[0] == NULL) if (msg[0] == NULL)
msg[0] = msg_message("generous_effect_0", "mage", mage); msg[0] = msg_message("generous_effect_0", "mage", mage);
m = msg[0]; m = msg[0];
@ -5040,7 +5040,7 @@ int sp_enterastral(castorder * co)
m = NULL; m = NULL;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, r, u, 0)) { if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_disappear", "unit", u); m = msg_message("astral_disappear", "unit", u);
@ -5058,7 +5058,7 @@ int sp_enterastral(castorder * co)
m = NULL; m = NULL;
for (u2 = rt->units; u2; u2 = u2->next) { for (u2 = rt->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, rt, u, 0)) { if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_appear", "unit", u); m = msg_message("astral_appear", "unit", u);
@ -5184,7 +5184,7 @@ int sp_pullastral(castorder * co)
m = NULL; m = NULL;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, r, u, 0)) { if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_disappear", "unit", u); m = msg_message("astral_disappear", "unit", u);
@ -5202,7 +5202,7 @@ int sp_pullastral(castorder * co)
m = NULL; m = NULL;
for (u2 = rt->units; u2; u2 = u2->next) { for (u2 = rt->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, rt, u, 0)) { if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_appear", "unit", u); m = msg_message("astral_appear", "unit", u);
@ -5315,7 +5315,7 @@ int sp_leaveastral(castorder * co)
m = NULL; m = NULL;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, r, u, 0)) { if (cansee(u2->faction, r, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_disappear", "unit", u); m = msg_message("astral_disappear", "unit", u);
@ -5333,7 +5333,7 @@ int sp_leaveastral(castorder * co)
m = NULL; m = NULL;
for (u2 = rt->units; u2; u2 = u2->next) { for (u2 = rt->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, rt, u, 0)) { if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_appear", "unit", u); m = msg_message("astral_appear", "unit", u);
@ -5443,7 +5443,7 @@ int sp_fetchastral(castorder * co)
m = NULL; m = NULL;
for (u2 = ro->units; u2; u2 = u2->next) { for (u2 = ro->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, ro, u, 0)) { if (cansee(u2->faction, ro, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_disappear", "unit", u); m = msg_message("astral_disappear", "unit", u);
@ -5460,7 +5460,7 @@ int sp_fetchastral(castorder * co)
m = NULL; m = NULL;
for (u2 = rt->units; u2; u2 = u2->next) { for (u2 = rt->units; u2; u2 = u2->next) {
if (!fval(u2->faction, FFL_SELECT)) { if (!fval(u2->faction, FFL_SELECT)) {
if (cansee_depr(u2->faction, rt, u, 0)) { if (cansee(u2->faction, rt, u, 0)) {
fset(u2->faction, FFL_SELECT); fset(u2->faction, FFL_SELECT);
if (!m) if (!m)
m = msg_message("astral_appear", "unit", u); m = msg_message("astral_appear", "unit", u);

View File

@ -131,7 +131,7 @@ int damage_spell(struct castorder * co, int dmg, int strength)
enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
if (enemies == 0) { if (enemies == 0) {
message *m = message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -144,7 +144,7 @@ int damage_spell(struct castorder * co, int dmg, int strength)
killed += terminate(dt, at, AT_COMBATSPELL, damage, false); killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
} }
m = msg_message("battle::combatspell", "mage spell dead", m = msg_message("cast_combatspell", "mage spell dead",
fi->unit, sp, killed); fi->unit, sp, killed);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
@ -171,7 +171,7 @@ int sp_petrify(struct castorder * co)
enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
message *m = message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -218,7 +218,7 @@ int sp_stun(struct castorder * co)
enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
message *m = message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -366,7 +366,7 @@ int sp_sleep(struct castorder * co)
enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -485,7 +485,7 @@ int sp_mindblast_temp(struct castorder * co)
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -551,7 +551,7 @@ int sp_mindblast(struct castorder * co)
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -634,7 +634,7 @@ int sp_dragonodem(struct castorder * co)
if (!enemies) { if (!enemies) {
struct message *m = struct message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -653,7 +653,7 @@ int sp_dragonodem(struct castorder * co)
} }
m = m =
msg_message("battle::combatspell", "mage spell dead", fi->unit, sp, msg_message("cast_combatspell", "mage spell dead", fi->unit, sp,
killed); killed);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
@ -682,7 +682,7 @@ int sp_immolation(struct castorder * co)
if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) { if (!count_enemies(b, fi, FIGHT_ROW, AVOID_ROW, SELECT_ADVANCE | SELECT_FIND)) {
message *m = message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -710,7 +710,7 @@ int sp_immolation(struct castorder * co)
selist_free(fgs); selist_free(fgs);
m = m =
msg_message("battle::combatspell", "mage spell killed", fi->unit, sp, msg_message("cast_combatspell", "mage spell killed", fi->unit, sp,
killed); killed);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
@ -736,7 +736,7 @@ int sp_drainodem(fighter * fi, int level, double power, spell * sp)
enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -917,7 +917,7 @@ int sp_chaosrow(struct castorder * co)
bool chaosrow = strcmp(sp->sname, "chaosrow") == 0; bool chaosrow = strcmp(sp->sname, "chaosrow") == 0;
if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) { if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) {
m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -1167,7 +1167,7 @@ int sp_frighten(struct castorder * co)
enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
message *m = message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -1217,7 +1217,7 @@ int sp_tiredsoldiers(struct castorder * co)
if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW,
SELECT_ADVANCE | SELECT_FIND)) { SELECT_ADVANCE | SELECT_FIND)) {
message *m = message *m =
msg_message("battle::out_of_range", "mage spell", fi->unit, sp); msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;
@ -1263,7 +1263,7 @@ int sp_windshield(struct castorder * co)
enemies = count_enemies(b, fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE); enemies = count_enemies(b, fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
if (!enemies) { if (!enemies) {
m = msg_message("battle::out_of_range", "mage spell", fi->unit, sp); m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
message_all(b, m); message_all(b, m);
msg_release(m); msg_release(m);
return 0; return 0;

View File

@ -193,7 +193,7 @@ static bool can_set_factionstealth(const unit * u, const faction * f)
if (ru->number) { if (ru->number) {
faction *fv = visible_faction(f, ru); faction *fv = visible_faction(f, ru);
if (fv == f) { if (fv == f) {
if (cansee_depr(f, lastr, ru, 0)) if (cansee(f, lastr, ru, 0))
return true; return true;
} }
} }