From b51349df6bc1afe7667dd33062abc15263b59464 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 20 Jan 2017 22:39:38 +0100 Subject: [PATCH] change error message categories. also removing some unused messages and code that supports them. https://bugs.eressea.de/view.php?id=2270 --- res/core/messages.xml | 117 +++++++--------------------------------- src/kernel/messages.c | 18 ------- src/kernel/types.h | 2 - src/util/unicode.test.c | 17 ++++++ 4 files changed, 36 insertions(+), 118 deletions(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 260f76c70..41569d9f3 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -1804,7 +1804,7 @@ "$unit($unit) in $region($region): '$order($command)' - Der Magier erschafft ein Traumgebäude." "$unit($unit) in $region($region): '$order($command)' - The magician creates an illusionary building." - + @@ -2402,7 +2402,7 @@ "Eine Botschaft von $unit.dative($unit) in $region($region): 'Ups! Quack, Quack!'" "A message from $unit($unit) in $region($region): 'Oops! Croak, Croak!'" - + @@ -2412,7 +2412,7 @@ "$unit($unit) in $region($region): '$order($command)' - $unit($mage) kann Zauber, die durch $unit($unit) gewirkt werden, nicht zusätzlich in die Ferne richten." "$unit($unit) in $region($region): '$order($command)' - $unit($mage) cannot direct spells that are channeled through $unit($unit) into distant regions." - + @@ -2552,13 +2552,6 @@ "$unit($unit) in $region($region) regeneriert $int($amount) Aura." "$unit($unit) regenerates $int($amount) aura in $region($region)." - - - - - "$string" - "$string" - @@ -2596,13 +2589,6 @@ "$unit($teacher) lehrt $unit($student) $skill($skill)." "$unit($teacher) teaches $unit($student) $skill($skill)." - - - - - "$string" - "$string" - @@ -2834,13 +2820,6 @@ "$unit($unit) baut für $int($size) an $ship($ship) weiter." "$unit($unit) builds $int($size) more on $ship($ship)." - - - - - "$string" - "$string" - @@ -2878,15 +2857,7 @@ "$unit($unit) $if($eq($mode,1),"reitet", "wandert") von $region($start) nach $region($end).$if($isnull($regions),""," Dabei wurde $trail($regions) durchquert.")" "$unit($unit) $if($eq($mode,1),"rides", "walks") from $region($start) to $region($end)$if($isnull($regions),""," by way of $trail($regions)")." - - - - - - "$unit($unit) entdeckt dass im $direction($direction) $terrain($region) ist." - "$unit($unit) discovered that $terrain($region) lies in the $direction($direction)." - - + @@ -2895,7 +2866,7 @@ "$unit($unit) entdeckt, dass $region($region) $localize($terrain) ist." "$unit($unit) discovered that $region($region) is $localize($terrain)." - + @@ -2903,7 +2874,7 @@ "$unit($unit) ist in dieser Runde gelandet und kann nicht weiter ins Landesinnere nach $region($region) vorstossen." "$unit($unit) has just landed and cannot continue moving to $region($region)." - + @@ -2911,7 +2882,7 @@ "Die Mannschaft der $ship($ship) kann in letzter Sekunde verhindern, dass das Schiff in $region($region) auf Land aufläuft." "At the very last moment, the crew of the $ship($ship) saved the ship from running aground in $region($region)." - + @@ -2919,7 +2890,7 @@ "Die $ship($ship) konnte in $region($region) nicht einreisen, die Küste ist zu gefährlich für das Schiff." "The $ship($ship) could not berth in $region($region). The coast is too dangerous for the vessel." - + @@ -2927,7 +2898,7 @@ "Die Mannschaft der $ship($ship) weigert sich, nach $direction($direction) zu reisen." "The crew of the $ship($ship) refuses to travel to the $direction($direction)." - + @@ -2935,7 +2906,7 @@ "Die Mannschaft der $ship($ship) weigert sich, nach $region($region) zu reisen." "The crew of the $ship($ship) refuses to travel to $region($region)." - + @@ -2943,7 +2914,7 @@ "$unit($unit) weigert sich, nach $direction($direction) zu reisen." "$unit($unit) refuses to travel to the $direction($direction)." - + @@ -2951,7 +2922,7 @@ "$unit($unit) weigert sich, nach $region($region) zu reisen." "$unit($unit) refuses to travel to $region($region)." - + @@ -2959,7 +2930,7 @@ "Die $ship($ship) konnte $region($region) nicht verlassen." "The $ship($ship) could not leave $region($region)." - + @@ -2968,35 +2939,7 @@ "$unit($unit) wurde in $region($region) von $unit.dative($guard) aufgehalten." "$unit($unit) was kept in $region($region) by $unit($guard)." - - - - - "Wir haben den Krieg mit $faction($faction) beendet." - "We declared peace with $faction($faction)." - - - - - - "$faction($faction) hat den Krieg mit uns beendet." - "$faction($faction) has declared peace with us." - - - - - - "Wir haben $faction($faction) den Krieg erklärt." - "We declared war on $faction($faction)." - - - - - - "$faction($faction) hat uns den Krieg erklärt." - "$faction($faction) has declared war on us." - - + @@ -3005,7 +2948,7 @@ "$unit($unit) konnte nicht von $region($region) nach $region($target) reisen, da der Besitzer der Region es verhinderte." "$unit($unit) could not travel from $region($region) to $region($target) because the owner denied entrance." - + @@ -3029,7 +2972,7 @@ "$unit($follower) konnte $unit($unit) nicht folgen." "$unit($follower) could not follow $unit($unit)." - + @@ -3037,7 +2980,7 @@ "$unit($unit) entdeckt, dass es keinen Weg nach $direction($direction) gibt." "$unit($unit) discovers that there is no route going $direction($direction)." - + @@ -3046,13 +2989,6 @@ "$unit($unit) konnte von $region($region) nicht nach $direction($direction) ausreisen, der Nebel war zu dicht." "$unit($unit) could not travel $direction($direction) from $region($region), the fog was too dense." - - - - - "$string" - "$string" - @@ -6945,13 +6881,6 @@ "$unit($unit) in $region($region): '$order($command)' - Man benötigt mindestens $int($minskill) $skill($skill), um $resource($product,0) zu produzieren." "$unit($unit) in $region($region): '$order($command)' - You need at least $int($minskill) $skill($skill), to produce $resource($product,0)." - - - - - "$string" - "$string" - @@ -6959,13 +6888,6 @@ "$string" "$string" - - - - - "$string" - "$string" - @@ -6997,7 +6919,6 @@ "$unit($target) erhält $int($amount) $resource($resource,$amount) von $unit($unit)." "$unit($target) receives $int($amount) $resource($resource,$amount) from $unit($unit)." - @@ -7200,7 +7121,7 @@ "$unit($unit) in $region($region): '$order($command)' - No pyramids may be build in this region. The closest region to build a pyramid in is between $int($mindist) and $int($maxdist) regions away." - + @@ -7621,7 +7542,7 @@ "Heer $int($index)($abbrev): $int($dead) Tote, $int($fled) Geflohene, $int($survived) Überlebende." "Army $int($index)($abbrev): $int($dead) dead, $int($fled) fled, $int($survived) survivors." - + diff --git a/src/kernel/messages.c b/src/kernel/messages.c index 89278624f..cb859df96 100644 --- a/src/kernel/messages.c +++ b/src/kernel/messages.c @@ -214,29 +214,11 @@ caddmessage(region * r, faction * f, const char *s, msg_t mtype, int level) UNUSED_ARG(level); switch (mtype) { - case MSG_INCOME: - assert(f); - m = add_message(&f->msgs, msg_message("msg_economy", "string", s)); - break; case MSG_BATTLE: assert(0 || !"battle messages must not use addmessage"); break; - case MSG_MOVE: - assert(f); - m = add_message(&f->msgs, msg_message("msg_movement", "string", s)); - break; - case MSG_COMMERCE: - assert(f); - m = add_message(&f->msgs, msg_message("msg_economy", "string", s)); - break; - case MSG_PRODUCE: - assert(f); - m = add_message(&f->msgs, msg_message("msg_production", "string", s)); - break; case MSG_MAGIC: - case MSG_COMMENT: case MSG_MESSAGE: - case MSG_ORCVERMEHRUNG: case MSG_EVENT: /* Botschaften an REGION oder einzelne PARTEI */ m = msg_message("msg_event", "string", s); diff --git a/src/kernel/types.h b/src/kernel/types.h index 2b63f7e07..b9faefce7 100644 --- a/src/kernel/types.h +++ b/src/kernel/types.h @@ -146,9 +146,7 @@ typedef enum { /* Fehler und Meldungen im Report */ MSG_INCOME, MSG_COMMERCE, MSG_PRODUCE, - MSG_ORCVERMEHRUNG, MSG_MESSAGE, - MSG_COMMENT, MSG_MAGIC, MAX_MSG } msg_t; diff --git a/src/util/unicode.test.c b/src/util/unicode.test.c index ef07c944c..a6268186e 100644 --- a/src/util/unicode.test.c +++ b/src/util/unicode.test.c @@ -100,9 +100,26 @@ static void test_unicode_utf8_to_ucs(CuTest *tc) { CuAssertIntEquals(tc, 1, sz); } +static void test_unicode_bug2262(CuTest *tc) { + char name[7]; + ucs4_t ucs; + size_t sz; + + strcpy(name, "utende"); + CuAssertIntEquals(tc, 0, unicode_utf8_to_ucs4(&ucs, name, &sz)); + CuAssertIntEquals(tc, 1, sz); + CuAssertIntEquals(tc, 'u', ucs); + CuAssertIntEquals(tc, 0, unicode_utf8_trim(name)); + + name[0] = -4; // latin1: ü should fail to decode + CuAssertIntEquals(tc, EILSEQ, unicode_utf8_to_ucs4(&ucs, name, &sz)); + CuAssertIntEquals(tc, EILSEQ, unicode_utf8_trim(name)); +} + CuSuite *get_unicode_suite(void) { CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_unicode_bug2262); SUITE_ADD_TEST(suite, test_unicode_tolower); SUITE_ADD_TEST(suite, test_unicode_trim); SUITE_ADD_TEST(suite, test_unicode_utf8_to_other);