From bbcb2113d79380916aaff8a9ddd89e5db4165eb0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 30 Apr 2019 18:40:24 +0200 Subject: [PATCH] WIP feature: STIRB [PARTEI ] --- res/core/messages.xml | 14 ------------- res/translations/messages.de.po | 8 +------ res/translations/messages.en.po | 8 +------ src/laws.c | 37 ++++++++++++++++++++++++++++++--- src/randenc.c | 3 +-- src/spells.c | 4 ++-- 6 files changed, 39 insertions(+), 35 deletions(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 7028ab6b9..4de8b0299 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -2937,13 +2937,6 @@ - - - - - - - @@ -3244,13 +3237,6 @@ - - - - - - - diff --git a/res/translations/messages.de.po b/res/translations/messages.de.po index 57b4426ef..c24966d6a 100644 --- a/res/translations/messages.de.po +++ b/res/translations/messages.de.po @@ -587,9 +587,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Unbekannte Opti msgid "error131" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Um in Gletschern Straßen bauen zu können, muß zuerst ein Tunnel errichtet werden.\"" -msgid "error241" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Partei muß mindestens 81 Wochen alt sein, um einen Neustart mit einer anderen Rasse zu versuchen.\"" - msgid "feedback_unit_not_found" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit wurde nicht gefunden.\"" @@ -1119,7 +1116,7 @@ msgid "dissolve_units_4" msgstr "\"$unit($unit) in $region($region): $int($number) $race($race,$number) $if($eq($number,1),\"zerfiel\", \"zerfielen\") zu Staub.\"" msgid "error281" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Gegen welche Rasse soll der Jihad ausgerufen werden?\"" +msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Zielpartei muss die selbe Rasse haben.\"" msgid "error171" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Diesen Kampfzauber gibt es nicht.\"" @@ -1784,9 +1781,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Es konnte kein msgid "error50" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit ist nicht erfahren genug dafür.\"" -msgid "error282" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Gegen diese Rasse kann kein Jihad ausgerufen werden.\"" - msgid "nmr_warning_final" msgstr "\"Bitte sende die Befehle nächste Runde ein, wenn du weiterspielen möchtest.\"" diff --git a/res/translations/messages.en.po b/res/translations/messages.en.po index 060fe09c2..1f1db551c 100644 --- a/res/translations/messages.en.po +++ b/res/translations/messages.en.po @@ -587,9 +587,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Unknown option. msgid "error131" msgstr "\"$unit($unit) in $region($region): '$order($command)' - You must build a tunnel before building roads through glaciers.\"" -msgid "error241" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - The faction must be at least 81 weeks old to restart with a new race.\"" - msgid "feedback_unit_not_found" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit could not be found.\"" @@ -1119,7 +1116,7 @@ msgid "dissolve_units_4" msgstr "\"$unit($unit) in $region($region): $int($number) $race($race,$number) turned to dust.\"" msgid "error281" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - What race did you want the jihad to be against?\"" +msgstr "\"$unit($unit) in $region($region): '$order($command)' - The target faction must have the same race as yours.\"" msgid "error171" msgstr "\"$unit($unit) in $region($region): '$order($command)' - This combat spell does not exist.\"" @@ -1784,9 +1781,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - No peasant coul msgid "error50" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is not experienced enough to do this.\"" -msgid "error282" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - You cannot start a jihad against this race.\"" - msgid "nmr_warning_final" msgstr "\"Please send in orders for the next turn if you want to continue playing.\"" diff --git a/src/laws.c b/src/laws.c index fda3f434f..d6c754f08 100644 --- a/src/laws.c +++ b/src/laws.c @@ -395,8 +395,7 @@ static void peasants(region * r, int rule) dead += (int)(0.5 + n * PEASANT_STARVATION_CHANCE); if (dead > 0) { - message *msg = add_message(&r->msgs, msg_message("phunger", "dead", dead)); - msg_release(msg); + ADDMSG(&r->msgs, msg_message("phunger", "dead", dead)); peasants -= dead; } @@ -941,6 +940,10 @@ int leave_cmd(unit * u, struct order *ord) return 0; } +int transfer_faction(faction *fsrc, faction *fdst) { + return 0; +} + int quit_cmd(unit * u, struct order *ord) { char token[128]; @@ -952,6 +955,34 @@ int quit_cmd(unit * u, struct order *ord) assert(kwd == K_QUIT); passwd = gettoken(token, sizeof(token)); if (checkpasswd(f, (const char *)passwd)) { + param_t p; + p = getparam(f->locale); + if (p == P_FACTION) { + faction *f2 = getfaction(); + if (f2 == NULL) { + cmistake(u, ord, 66, MSG_EVENT); + } + else if (f->race != f2->race) { + cmistake(u, ord, 281, MSG_EVENT); + } + else { + unit *u2; + for (u2 = u->region->units; u2; u2 = u2->next) { + if (u2->faction == f2 && ucontact(u2, u)) { + int err = transfer_faction(u->faction, u2->faction); + if (err != 0) { + /* something went wrong */ + cmistake(u, ord, err, MSG_EVENT); + } + break; + } + } + if (u2 == NULL) { + /* no target unit found */ + cmistake(u, ord, 0, MSG_EVENT); + } + } + } fset(f, FFL_QUIT); } else { @@ -2077,7 +2108,7 @@ int banner_cmd(unit * u, struct order *ord) init_order_depr(ord); s = getstrtoken(); faction_setbanner(u->faction, s); - add_message(&u->faction->msgs, msg_message("changebanner", "value", s)); + ADDMSG(&u->faction->msgs, msg_message("changebanner", "value", s)); return 0; } diff --git a/src/randenc.c b/src/randenc.c index b0e5dd13a..9c3fd4739 100644 --- a/src/randenc.c +++ b/src/randenc.c @@ -603,8 +603,7 @@ void plagues(region * r) } if (dead > 0) { - message *msg = add_message(&r->msgs, msg_message("pest", "dead", dead)); - msg_release(msg); + ADDMSG(&r->msgs, msg_message("pest", "dead", dead)); deathcounts(r, dead); rsetpeasants(r, peasants - dead); } diff --git a/src/spells.c b/src/spells.c index 5e2474861..83b7f2050 100644 --- a/src/spells.c +++ b/src/spells.c @@ -3110,8 +3110,8 @@ static int sp_chaossuction(castorder * co) create_special_direction(rt, r, 2, "vortex_desc", "vortex", false); new_border(&bt_chaosgate, r, rt); - add_message(&r->msgs, msg_message("chaosgate_effect_1", "mage", caster)); - add_message(&rt->msgs, msg_message("chaosgate_effect_2", "")); + ADDMSG(&r->msgs, msg_message("chaosgate_effect_1", "mage", caster)); + ADDMSG(&rt->msgs, msg_message("chaosgate_effect_2", "")); return cast_level; }