From 31f589e76f58d82052d0b231ee2dd1f7842716ee Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 8 Jan 2021 19:44:20 +0100 Subject: [PATCH] https://bugs.eressea.de/view.php?id=2716 improved messages when following a ship. --- res/core/messages.xml | 12 ++++++++++++ res/translations/messages.de.po | 6 ++++++ res/translations/messages.en.po | 6 ++++++ src/move.c | 25 ++++++++++++++++++++++++- 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 754af8100..de3fad07b 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -2216,6 +2216,18 @@ + + + + + + + + + + + + diff --git a/res/translations/messages.de.po b/res/translations/messages.de.po index 537454fef..85522b480 100644 --- a/res/translations/messages.de.po +++ b/res/translations/messages.de.po @@ -2603,6 +2603,12 @@ msgstr "\"$unit($follower) konnte $unit($unit) nicht folgen.\"" msgid "followdetect" msgstr "\"$unit($follower) ist $unit($unit) gefolgt.\"" +msgid "followfail_ship" +msgstr "\"Die $ship($follower) konnte die $ship($ship) nicht einholen.\"" + +msgid "followdetect_ship" +msgstr "\"Die $ship($ship) wurde von $ship($follower) verfolgt.\"" + msgid "unitnotfound_id" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Einheit $id wurde nicht gefunden.\"" diff --git a/res/translations/messages.en.po b/res/translations/messages.en.po index 8da97fba2..f64f8a278 100644 --- a/res/translations/messages.en.po +++ b/res/translations/messages.en.po @@ -2597,6 +2597,12 @@ msgstr "\"$unit($mage) makes $unit($target) appear as $race($race,$unit.size($ta msgid "error248" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The faction has to be 10 turns old.\"" +msgid "followfail_ship" +msgstr "\"$ship($follower) could not catch up to $ship($ship).\"" + +msgid "followdetect_ship" +msgstr "\"$ship($follower) followed $ship($ship).\"" + msgid "followfail" msgstr "\"$unit($follower) could not follow $unit($unit).\"" diff --git a/src/move.c b/src/move.c index bc2871366..5f4c42c3e 100644 --- a/src/move.c +++ b/src/move.c @@ -897,6 +897,29 @@ static bool present(region * r, unit * u) return (u && u->region == r); } +static void caught_target_ship(region* r, unit* u) +{ + attrib* a = a_find(u->attribs, &at_follow); + + /* Verfolgungen melden */ + /* Misserfolgsmeldung, oder bei erfolgreichem Verfolgen unter + * Umstaenden eine Warnung. */ + + if (a) { + unit* target = (unit*)a->data.v; + + if (target == u || !present(r, target)) { + ADDMSG(&u->faction->msgs, msg_message("followfail_ship", + "ship follower", target->ship, u->ship)); + } + else if (!alliedunit(target, u->faction, HELP_ALL) + && cansee(target->faction, r, u, 0)) { + ADDMSG(&target->faction->msgs, msg_message("followdetect_ship", + "ship follower", target->ship, u->ship)); + } + } +} + static void caught_target(region * r, unit * u) { attrib *a = a_find(u->attribs, &at_follow); @@ -1971,7 +1994,7 @@ static void sail(unit * u, order * ord, bool drifting) /* Verfolgungen melden */ if (fval(u, UFL_FOLLOWING)) { - caught_target(current_point, u); + caught_target_ship(current_point, u); } move_ship(sh, starting_point, current_point, route);