diff --git a/conf/e3/config.json b/conf/e3/config.json index b4b6d0e48..dcc3e9f53 100644 --- a/conf/e3/config.json +++ b/conf/e3/config.json @@ -28,7 +28,6 @@ "stealth", "taxation", "trade", - "besiege", "steal", "buy", "teach", diff --git a/conf/keywords.json b/conf/keywords.json index 4f8f27f5b..11376ea95 100644 --- a/conf/keywords.json +++ b/conf/keywords.json @@ -12,7 +12,6 @@ "work": [ "ARBEITE", "ARBEITEN" ], "attack": ["ATTACKIERE", "ATTACKIEREN"], "steal": [ "BEKLAUE", "BEKLAUEN" ], - "besiege": ["BELAGERE", "BELAGERN" ], "name": [ "BENENNE", "BENENNEN" ], "use": [ "BENUTZE", "BENUTZEN" ], "describe": [ "BESCHREIBE", "BESCHREIBEN" ], diff --git a/res/core/messages.xml b/res/core/messages.xml index 1e4e977e0..d2c40f9b3 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -710,12 +710,6 @@ - - - - - - @@ -2684,19 +2678,6 @@ - - - - - - - - - - - - - @@ -3351,14 +3332,6 @@ - - - - - - - - @@ -3890,13 +3863,6 @@ - - - - - - - @@ -4002,13 +3968,6 @@ - - - - - - - @@ -4993,20 +4952,6 @@ - - - - - - - - - - - - - - diff --git a/res/translations/messages.de.po b/res/translations/messages.de.po index 507f0e39d..76ff0afc9 100644 --- a/res/translations/messages.de.po +++ b/res/translations/messages.de.po @@ -257,9 +257,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Hier kann man k msgid "error165" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Trank bekommt der Einheit nicht.\"" -msgid "siege_catapults" -msgstr "\"$unit($unit) belagert $building($building). Dabei richten die Katapulte Zerstörungen von $int($destruction) Größenpunkten an.\"" - msgid "curseinfo::magicstreet" msgstr "\"Die Straßen sind erstaunlich trocken und gut begehbar. ($int36($id))\"" @@ -638,9 +635,6 @@ msgstr "\"$unit($unit) erscheint plötzlich.\"" msgid "magicresistance_effect" msgstr "\"$unit($unit) wird kurz von einem magischen Licht umhüllt.\"" -msgid "siege" -msgstr "\"$unit($unit) belagert $building($building).\"" - msgid "missing_force" msgstr "\"$unit($unit) schafft es nicht, genug Kraft aufzubringen, um $spell($spell) auf Stufe $int($level) zu zaubern.\"" @@ -977,9 +971,6 @@ msgstr "\"$unit($mage) kümmert sich um die Verletzten und benutzt ein $resource msgid "error276" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Hier kann man keine Schiffe bauen.\"" -msgid "error166" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Diese Rasse kann eine Burg nicht belagern.\"" - msgid "chaosgate_effect_2" msgstr "\"Ein Wirbel aus blendendem Licht erscheint.\"" @@ -998,9 +989,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit ist msgid "error82" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Es gibt keine Abstimmung mit dieser Nummer.\"" -msgid "error60" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit wird belagert.\"" - msgid "error162" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Heiltrank wird automatisch bei Bedarf benutzt.\"" @@ -1457,9 +1445,6 @@ msgstr "\"$unit($unit) öffnet eines der Schlösser in $region($region) mit $if( msgid "error255" msgstr "\"$unit($unit) in $region($region): '$order($command)' - So etwas kann man nicht opfern.\"" -msgid "entrance_besieged" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - $building($building) wird belagert.\"" - msgid "error260" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Besitzer eines Schiffes oder Gebäudes kann nicht neu sortiert werden.\"" @@ -1550,9 +1535,6 @@ msgstr "\"In $region($region) findet ein Kampf statt.\"" msgid "wormhole_dissolve" msgstr "\"Das Wurmloch in $region($region) schließt sich.\"" -msgid "error23" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Belagerungszustand macht die Kontaktaufnahme unmöglich.\"" - msgid "error12" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Das Schiff gehört uns nicht.\"" @@ -2135,9 +2117,6 @@ msgstr "\"Seit $int($age) Wochen Mitglied der Allianz '$name ($int36($id))', ang msgid "deathcloud_effect" msgstr "\"$unit($mage) beschwört einen Giftelementar in $region($region).\"" -msgid "nr_building_besieged" -msgstr "\", belagert von $int($soldiers) Personen$if($lt($diff,0),\"\",\" (abgeschnitten)\")\"" - msgid "nr_population" msgstr "\"Deine Partei hat $int($population) Personen in $int($units) von maximal $int($limit) Einheiten.\"" @@ -2414,9 +2393,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Das Schiff hat msgid "aborted_battle" msgstr "\"Der Kampf wurde abgebrochen, da alle Verteidiger flohen.\"" -msgid "error24" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Belagerungszustand macht Spionage unmöglich.\"" - msgid "usecatapult" msgstr "\"$int($amount) Krieger von $unit($unit) feuern ihre Katapulte ab.\"" diff --git a/res/translations/messages.en.po b/res/translations/messages.en.po index bf9d8e3c9..50108fc03 100644 --- a/res/translations/messages.en.po +++ b/res/translations/messages.en.po @@ -257,9 +257,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Buildings canno msgid "error165" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The potion does not agree with the unit.\"" -msgid "siege_catapults" -msgstr "\"$building($building) is under siege by $unit($unit). During siege, catapults caused $int($destruction) points destruction.\"" - msgid "curseinfo::magicstreet" msgstr "\"The roads are extremely dry and well-kept. ($int36($id))\"" @@ -638,9 +635,6 @@ msgstr "\"$unit($unit) appears.\"" msgid "magicresistance_effect" msgstr "\"$unit($unit) is briefly surrounded by a magical light.\"" -msgid "siege" -msgstr "\"$building($building) is under siege by $unit($unit).\"" - msgid "missing_force" msgstr "\"$unit($unit) cannot muster enough energy to cast $spell($spell) on level $int($level).\"" @@ -977,9 +971,6 @@ msgstr "\"$unit($mage) sees after the wounded and heals $int($amount). A $resour msgid "error276" msgstr "\"$unit($unit) in $region($region): '$order($command)' - Ships cannot be built here.\"" -msgid "error166" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - This race cannot besiege a castle.\"" - msgid "chaosgate_effect_2" msgstr "\"A vortex of blinding light appears.\"" @@ -998,9 +989,6 @@ msgstr "\"'$order($command)' - $unit($unit) marched into $region($region) during msgid "error82" msgstr "\"$unit($unit) in $region($region): '$order($command)' - There is no agreement with this number.\"" -msgid "error60" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is under siege.\"" - msgid "error162" msgstr "\"$unit($unit) in $region($region): '$order($command)' - This healing potion will be automatically used when needed.\"" @@ -1457,9 +1445,6 @@ msgstr "\"$unit($unit) unlocks one of the locks in $region($region) with $if($eq msgid "error255" msgstr "\"$unit($unit) in $region($region): '$order($command)' - You cannot sacrifice this.\"" -msgid "entrance_besieged" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - $building($building) is under siege.\"" - msgid "error260" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The owner of a ship or a building cannot be sorted.\"" @@ -1550,9 +1535,6 @@ msgstr "\"There is a battle in $region($region).\"" msgid "wormhole_dissolve" msgstr "\"The wormhole in $region($region) disappears.\"" -msgid "error23" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Contact was not possible due to siege.\"" - msgid "error12" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The ship is not ours.\"" @@ -2135,9 +2117,6 @@ msgstr "\"Member of '$name ($int36($id))' for $int($age) weeks, led by $faction( msgid "deathcloud_effect" msgstr "\"$unit($mage) summons a poison elemental in $region($region).\"" -msgid "nr_building_besieged" -msgstr "\", besieged by $int($soldiers) soldiers$if($lt($diff,0),\"\",\" (cut off)\")\"" - msgid "nr_population" msgstr "\"Your faction has $int($population) people in $int($units) of $int($limit) possible units.\"" @@ -2414,9 +2393,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - The ship has mo msgid "aborted_battle" msgstr "\"The battle was aborted because all enemies escaped.\"" -msgid "error24" -msgstr "\"$unit($unit) in $region($region): '$order($command)' - Espionage was not possible due to siege.\"" - msgid "usecatapult" msgstr "\"$int($amount) fighters of $unit($unit) launch their catapults.\"" diff --git a/res/translations/strings.de.po b/res/translations/strings.de.po index f4b166221..47d70ecc0 100644 --- a/res/translations/strings.de.po +++ b/res/translations/strings.de.po @@ -2772,10 +2772,6 @@ msgstr "Dieser wunderschoen geschmueckte Baum entfaltet in den Wintermonaten ein msgid "h10" msgstr "Kakteenschwitz" -msgctxt "keyword" -msgid "besiege" -msgstr "BELAGERE" - msgid "h11" msgstr "Sandfäule" diff --git a/res/translations/strings.en.po b/res/translations/strings.en.po index 32924310c..8a5dcb30f 100644 --- a/res/translations/strings.en.po +++ b/res/translations/strings.en.po @@ -2421,10 +2421,6 @@ msgctxt "iteminfo" msgid "xmastree" msgstr "In the winter months, this beautifully decorated tree has a magical effect on the entire forest." -msgctxt "keyword" -msgid "besiege" -msgstr "BESIEGE" - msgid "h10" msgstr "peyote" diff --git a/scripts/tests/bindings.lua b/scripts/tests/bindings.lua index 9aab6fd57..5820e0a47 100644 --- a/scripts/tests/bindings.lua +++ b/scripts/tests/bindings.lua @@ -31,7 +31,6 @@ function test_process() assert_equal("function", _G.type(eressea.process.movement)) assert_equal("function", _G.type(eressea.process.use)) assert_equal("function", _G.type(eressea.process.battle)) - assert_equal("function", _G.type(eressea.process.siege)) assert_equal("function", _G.type(eressea.process.leave)) assert_equal("function", _G.type(eressea.process.promote)) assert_equal("function", _G.type(eressea.process.restack)) diff --git a/src/attributes/attributes.c b/src/attributes/attributes.c index fa6f15d73..6bf78da63 100644 --- a/src/attributes/attributes.c +++ b/src/attributes/attributes.c @@ -182,13 +182,13 @@ void register_attributes(void) at_register(&at_seenspell); at_register(&at_seenspells); - /* neue REGION-Attribute */ + /* REGION Attribute */ at_register(&at_moveblock); at_register(&at_deathcount); at_register(&at_woodcount); + at_register(&at_germs); - /* neue UNIT-Attribute */ - at_register(&at_siege); + /* UNIT Attribute */ at_register(&at_effect); at_register(&at_private); @@ -205,8 +205,7 @@ void register_attributes(void) register_bordertype(&bt_illusionwall); register_bordertype(&bt_road); - at_register(&at_germs); - + at_deprecate("siege", a_readint); at_deprecate("maxmagicians", a_readint); /* factions with differnt magician limits, probably unused */ at_deprecate("hurting", a_readint); /* an old arena attribute */ at_deprecate("chaoscount", a_readint); /* used to increase the chance of monster spawns */ diff --git a/src/battle.c b/src/battle.c index 3f61269a0..1e256f9ca 100644 --- a/src/battle.c +++ b/src/battle.c @@ -3577,17 +3577,6 @@ static void join_allies(battle * b) } if (se == s_end) continue; - /* Wenn die Einheit belagert ist, mu� auch einer der Alliierten belagert sein: */ - if (besieged(u)) { - fighter *ally; - for (ally = s->fighters; ally; ally = ally->next) { - if (besieged(ally->unit)) { - break; - } - } - if (ally == NULL) - continue; - } /* keine Einw�nde, also soll er mitmachen: */ if (c == NULL) { if (!join_battle(b, u, false, &c)) { diff --git a/src/bind_process.c b/src/bind_process.c index 947458ce5..58f90076f 100755 --- a/src/bind_process.c +++ b/src/bind_process.c @@ -76,10 +76,6 @@ void process_battle(void) { do_battles(); } -void process_siege(void) { - process_cmd(K_BESIEGE, siege_cmd, PROC_LAND_REGION); -} - void process_update_long_order(void) { region * r; for (r = regions; r; r = r->next) { diff --git a/src/creport.c b/src/creport.c index 137259083..ce67493da 100644 --- a/src/creport.c +++ b/src/creport.c @@ -645,7 +645,6 @@ static void cr_output_building(struct stream *out, building *b, const unit *owner, int fno, faction *f) { const char *bname, *billusion; - int i; stream_printf(out, "BURG %d\n", b->no); @@ -675,11 +674,6 @@ static void cr_output_building(struct stream *out, building *b, stream_printf(out, "%d;Partei\n", fno); } - i = building_get_siege(b); - if (i) { - stream_printf(out, "%d;Belagerer\n", i); - } - cr_output_curses(out, f, b, TYP_BUILDING); } @@ -784,7 +778,6 @@ void cr_output_unit(stream *out, const faction * f, const item_type *lasttype; int pr; item *itm, *show = NULL; - building *b; const char *pzTmp; skill *sv; item result[MAX_INVENTORY]; @@ -883,9 +876,6 @@ void cr_output_unit(stream *out, const faction * f, if (is_guard(u)) { stream_printf(out, "%d;bewacht\n", 1); } - if ((b = usiege(u)) != NULL) { - stream_printf(out, "%d;belagert\n", b->no); - } /* additional information for own units */ if (u->faction == f || omniscient(f)) { order *ord; diff --git a/src/economy.c b/src/economy.c index cc611d49d..f0c930a3f 100644 --- a/src/economy.c +++ b/src/economy.c @@ -980,11 +980,6 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want) } } - if (besieged(u)) { - cmistake(u, u->thisorder, 60, MSG_PRODUCE); - return; - } - if (rtype->modifiers) { message *msg = get_modifiers(u, sk, rtype, &save_mod, &skill_mod); if (msg) { @@ -1606,11 +1601,6 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord) cmistake(u, ord, 26, MSG_COMMERCE); return; } - if (besieged(u)) { - /* Belagerte Einheiten k�nnen nichts kaufen. */ - cmistake(u, ord, 60, MSG_COMMERCE); - return; - } /* Entweder man ist Insekt in Sumpf/Wueste, oder es muss * einen Handelsposten in der Region geben: */ @@ -1930,12 +1920,6 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord) return false; } } - /* Belagerte Einheiten k�nnen nichts verkaufen. */ - - if (besieged(u)) { - ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error60", "")); - return false; - } /* In der Region mu� es eine Burg geben. */ if (u_race(u) == get_race(RC_INSECT)) { @@ -2409,10 +2393,6 @@ void entertain_cmd(unit * u, struct order *ord) cmistake(u, ord, 58, MSG_INCOME); return; } - if (besieged(u)) { - cmistake(u, ord, 60, MSG_INCOME); - return; - } if (u->ship && is_guarded(r, u)) { cmistake(u, ord, 69, MSG_INCOME); return; @@ -2501,11 +2481,6 @@ static int do_work(unit * u, order * ord, econ_request * o) cmistake(u, ord, 313, MSG_INCOME); return -1; } - if (besieged(u)) { - if (ord) - cmistake(u, ord, 60, MSG_INCOME); - return -1; - } if (u->ship && is_guarded(r, u)) { if (ord) cmistake(u, ord, 69, MSG_INCOME); @@ -2614,10 +2589,6 @@ void tax_cmd(unit * u, struct order *ord, econ_request ** taxorders) return; } - if (besieged(u)) { - cmistake(u, ord, 60, MSG_INCOME); - return; - } n = armedmen(u, false); if (!n) { @@ -2688,10 +2659,6 @@ void loot_cmd(unit * u, struct order *ord, econ_request ** lootorders) return; } - if (besieged(u)) { - cmistake(u, ord, 60, MSG_INCOME); - return; - } n = armedmen(u, false); if (!n) { diff --git a/src/guard.c b/src/guard.c index 118ede5fc..468dd99bc 100644 --- a/src/guard.c +++ b/src/guard.c @@ -105,8 +105,6 @@ static bool is_guardian_r(const unit * guard) { if (guard->number == 0) return false; - if (besieged(guard)) - return false; /* if region_owners exist then they may be guardians: */ if (guard->building && rule_region_owners() && guard == building_owner(guard->building)) { diff --git a/src/jsonconf.test.c b/src/jsonconf.test.c index 7c15b63f1..9e0e8f6b6 100644 --- a/src/jsonconf.test.c +++ b/src/jsonconf.test.c @@ -120,7 +120,7 @@ static void test_disable(CuTest * tc) const char * data = "{\"disabled\": [ " "\"alchemy\"," "\"pay\"," - "\"besiege\"," + "\"attack\"," "\"module\"" "]}"; cJSON *json = cJSON_Parse(data); @@ -129,13 +129,13 @@ static void test_disable(CuTest * tc) CuAssertTrue(tc, skill_enabled(SK_ALCHEMY)); CuAssertTrue(tc, !keyword_disabled(K_BANNER)); CuAssertTrue(tc, !keyword_disabled(K_PAY)); - CuAssertTrue(tc, !keyword_disabled(K_BESIEGE)); + CuAssertTrue(tc, !keyword_disabled(K_ATTACK)); CuAssertIntEquals(tc, 1, config_get_int("module.enabled", 1)); json_config(json); CuAssertTrue(tc, !skill_enabled(SK_ALCHEMY)); CuAssertTrue(tc, !keyword_disabled(K_BANNER)); CuAssertTrue(tc, keyword_disabled(K_PAY)); - CuAssertTrue(tc, keyword_disabled(K_BESIEGE)); + CuAssertTrue(tc, keyword_disabled(K_ATTACK)); CuAssertIntEquals(tc, 0, config_get_int("module.enabled", 1)); cJSON_Delete(json); test_teardown(); diff --git a/src/kernel/build.c b/src/kernel/build.c index 11324f752..4e3dc4721 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -279,10 +279,6 @@ void build_road(unit * u, int size, direction_t d) cmistake(u, u->thisorder, 103, MSG_PRODUCE); return; } - if (besieged(u)) { - cmistake(u, u->thisorder, 60, MSG_PRODUCE); - return; - } if (rn == NULL || rn->terrain->max_road < 0) { cmistake(u, u->thisorder, 94, MSG_PRODUCE); @@ -780,11 +776,6 @@ build_building(unit * u, const building_type * btype, int id, int want, order * cmistake(u, ord, 93, MSG_PRODUCE); return 0; } - if (besieged(u)) { - /* units under siege can not build */ - cmistake(u, ord, 60, MSG_PRODUCE); - return 0; - } if (btype->flags & BTF_NOBUILD) { /* special building, cannot be built */ cmistake(u, ord, 221, MSG_PRODUCE); @@ -949,10 +940,6 @@ create_ship(unit * u, const struct ship_type *newtype, int want, cmistake(u, ord, 100, MSG_PRODUCE); return; } - if (besieged(u)) { - cmistake(u, ord, 60, MSG_PRODUCE); - return; - } /* check if skill and material for 1 size is available */ if (effskill(u, cons->skill, 0) < cons->minskill) { diff --git a/src/kernel/building.c b/src/kernel/building.c index 9dfc7db35..75cad30f7 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -870,14 +870,3 @@ int cmp_current_owner(const building * b, const building * a) } return 0; } - -int building_get_siege(const struct building *b) -{ - return b->_besieged; -} - -int building_add_siege(struct building *b, int delta) -{ - b->_besieged += delta; - return b->_besieged; -} diff --git a/src/kernel/building.h b/src/kernel/building.h index 319304d79..af605b448 100644 --- a/src/kernel/building.h +++ b/src/kernel/building.h @@ -118,7 +118,6 @@ extern "C" { int no; int size; int sizeleft; /* is only used during battle. should be a temporary attribute */ - int _besieged; /* should be an attribute */ int flags; } building; @@ -134,9 +133,6 @@ extern "C" { int id, int size, struct order *ord); bool building_finished(const struct building *b); - int building_get_siege(const struct building *b); - int building_add_siege(struct building *b, int delta); - int wage(const struct region *r, const struct faction *f, const struct race *rc, int in_turn); diff --git a/src/kernel/order.c b/src/kernel/order.c index c14a2b30b..2fd7c6eb8 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -373,7 +373,6 @@ bool is_repeated(keyword_t kwd) case K_ROUTE: case K_DRIVE: case K_WORK: - case K_BESIEGE: case K_ENTERTAIN: case K_TAX: case K_RESEARCH: @@ -414,7 +413,6 @@ bool is_exclusive(const order * ord) case K_ROUTE: case K_DRIVE: case K_WORK: - case K_BESIEGE: case K_ENTERTAIN: case K_TAX: case K_RESEARCH: @@ -456,7 +454,6 @@ bool is_long(keyword_t kwd) case K_ROUTE: case K_DRIVE: case K_WORK: - case K_BESIEGE: case K_ENTERTAIN: case K_TAX: case K_RESEARCH: diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 146761f05..30971310d 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -530,60 +530,6 @@ attrib_type at_target = { NO_READ }; -/*********************/ -/* at_siege */ -/*********************/ - -void a_writesiege(const variant *var, const void *owner, struct storage *store) -{ - struct building *b = (struct building *)var->v; - write_building_reference(b, store); -} - -int a_readsiege(variant *var, void *owner, gamedata *data) -{ - if (read_building_reference(data, (building **)&var->v, NULL) <= 0) { - return AT_READ_FAIL; - } - return AT_READ_OK; -} - -attrib_type at_siege = { - "siege", - DEFAULT_INIT, - DEFAULT_FINALIZE, - DEFAULT_AGE, - a_writesiege, - a_readsiege -}; - -struct building *usiege(const unit * u) -{ - attrib *a; - if (!fval(u, UFL_SIEGE)) - return NULL; - a = a_find(u->attribs, &at_siege); - assert(a || !"flag set, but no siege found"); - return (struct building *)a->data.v; -} - -void usetsiege(unit * u, const struct building *t) -{ - attrib *a = a_find(u->attribs, &at_siege); - if (!a && t) - a = a_add(&u->attribs, a_new(&at_siege)); - if (a) { - if (!t) { - a_remove(&u->attribs, a); - freset(u, UFL_SIEGE); - } - else { - a->data.v = (void *)t; - fset(u, UFL_SIEGE); - } - } -} - /*********************/ /* at_contact */ /*********************/ @@ -1914,16 +1860,6 @@ int getunit(const region * r, const faction * f, unit **uresult) return result; } -int besieged(const unit * u) -{ - /* belagert kann man in schiffen und burgen werden */ - if (u && !keyword_disabled(K_BESIEGE) && u->building) { - building * b = u->building; - return building_get_siege(b) >= b->size * SIEGEFACTOR; - } - return false; -} - bool has_horses(const unit * u) { item *itm = u->items; diff --git a/src/kernel/unit.h b/src/kernel/unit.h index a6135715c..3f82ef80a 100644 --- a/src/kernel/unit.h +++ b/src/kernel/unit.h @@ -47,7 +47,6 @@ extern "C" { #define UFL_NOTMOVING (1<<9) /* Die Einheit kann sich wg. langen Kampfes nicht bewegen */ #define UFL_DEFENDER (1<<10) #define UFL_HUNGER (1<<11) /* kann im Folgemonat keinen langen Befehl außer ARBEITE ausführen */ -#define UFL_SIEGE (1<<12) /* speedup: belagert eine burg, siehe attribut */ #define UFL_TARGET (1<<13) /* speedup: hat ein target, siehe attribut */ #define UFL_WERE (1<<14) #define UFL_ENTER (1<<15) /* unit has entered a ship/building and will not leave it */ @@ -121,7 +120,6 @@ extern "C" { extern struct attrib_type at_creator; extern struct attrib_type at_alias; - extern struct attrib_type at_siege; extern struct attrib_type at_target; extern struct attrib_type at_potionuser; extern struct attrib_type at_contact; @@ -138,8 +136,6 @@ extern "C" { const struct race *u_irace(const struct unit *u); const struct race *u_race(const struct unit *u); void u_setrace(struct unit *u, const struct race *); - struct building *usiege(const struct unit *u); - void usetsiege(struct unit *u, const struct building *b); const char *uprivate(const struct unit *u); void usetprivate(struct unit *u, const char *c); @@ -257,7 +253,6 @@ extern "C" { int read_unitid(const struct faction *f, const struct region *r); /* !< sets combatstatus of a unit */ - int besieged(const struct unit *u); bool has_horses(const struct unit *u); int maintenance_cost(const struct unit *u); bool has_limited_skills(const struct unit *u); diff --git a/src/keyword.c b/src/keyword.c index 48726bcbc..47fcc3c8e 100644 --- a/src/keyword.c +++ b/src/keyword.c @@ -94,7 +94,7 @@ const char *keywords[MAXKEYWORDS] = { "work", "attack", "steal", - "besiege", + "deprecated_besiege", "name", "use", "describe", diff --git a/src/keyword.h b/src/keyword.h index 6e4832708..bd4ab02d0 100644 --- a/src/keyword.h +++ b/src/keyword.h @@ -17,7 +17,7 @@ extern "C" K_WORK, K_ATTACK, K_STEAL, - K_BESIEGE, + K_BESIEGE_UNUSED, K_NAME, K_USE, K_DISPLAY, diff --git a/src/laws.c b/src/laws.c index 67a44c673..0e9285281 100644 --- a/src/laws.c +++ b/src/laws.c @@ -901,61 +901,6 @@ void demographics(void) immigration(); } -/* ------------------------------------------------------------- */ - -/* test if the unit can slip through a siege undetected. - * returns 0 if siege is successful, or 1 if the building is either - * not besieged or the unit can slip through the siege due to better stealth. - */ -static int slipthru(const region * r, const unit * u, const building * b) -{ - unit *u2; - int n, o; - - /* b ist die burg, in die man hinein oder aus der man heraus will. */ - if (b == NULL || building_get_siege(b) < b->size * SIEGEFACTOR) { - return 1; - } - - /* u wird am hinein- oder herausschluepfen gehindert, wenn STEALTH <= - * OBSERVATION +2 der belagerer u2 ist */ - n = effskill(u, SK_STEALTH, r); - - for (u2 = r->units; u2; u2 = u2->next) { - if (usiege(u2) == b) { - - if (invisible(u, u2) >= u->number) - continue; - - o = effskill(u2, SK_PERCEPTION, r); - - if (o + 2 >= n) { - return 0; /* entdeckt! */ - } - } - } - return 1; -} - -int can_contact(const region * r, const unit * u, const unit * u2) { - - /* hier geht es nur um die belagerung von burgen */ - UNUSED_ARG(r); - if (u->building == u2->building) { - return 1; - } - - /* unit u is trying to contact u2 - unasked for contact. wenn u oder u2 - * nicht in einer burg ist, oder die burg nicht belagert ist, ist - * slipthru () == 1. ansonsten ist es nur 1, wenn man die belagerer */ - - if (slipthru(u->region, u, u->building) && slipthru(u->region, u2, u2->building)) { - return 1; - } - - return (alliedunit(u, u2->faction, HELP_GIVE)); -} - int contact_cmd(unit * u, order * ord) { unit *u2; @@ -966,10 +911,6 @@ int contact_cmd(unit * u, order * ord) u2 = findunit(n); if (u2 != NULL) { - if (!can_contact(u->region, u, u2)) { - cmistake(u, u->thisorder, 23, MSG_EVENT); - return -1; - } usetcontact(u, u2); } return 0; @@ -994,13 +935,7 @@ int leave_cmd(unit * u, struct order *ord) return 0; } } - if (!slipthru(r, u, u->building)) { - ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "entrance_besieged", - "building", u->building)); - } - else { - leave(u, true); - } + leave(u, true); return 0; } @@ -1148,13 +1083,6 @@ int enter_building(unit * u, order * ord, int id, bool report) } return 0; } - if (!slipthru(r, u, b)) { - if (report) { - ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "entrance_besieged", - "building", b)); - } - return 0; - } if (leave(u, 0)) { fset(u, UFL_ENTER); @@ -3804,98 +3732,6 @@ int armedmen(const unit * u, bool siege_weapons) return n; } -int siege_cmd(unit * u, order * ord) -{ - region *r = u->region; - building *b; - int d, pooled; - int bewaffnete, katapultiere = 0; - resource_type *rt_catapultammo = NULL; - resource_type *rt_catapult = NULL; - - init_order_depr(ord); - b = getbuilding(r); - - if (!b) { - cmistake(u, ord, 31, MSG_BATTLE); - return 31; - } - - if (!playerrace(u_race(u))) { - /* keine Drachen, Illusionen, Untote etc */ - cmistake(u, ord, 166, MSG_BATTLE); - return 166; - } - /* schaden durch katapulte */ - - rt_catapultammo = rt_find("catapultammo"); - rt_catapult = rt_find("catapult"); - - d = i_get(u->items, rt_catapult->itype); - if (d > u->number) d = u->number; - pooled = get_pooled(u, rt_catapultammo, GET_DEFAULT, d); - if (d > pooled) d = pooled; - if (effskill(u, SK_CATAPULT, 0) >= 1) { - katapultiere = d; - d *= effskill(u, SK_CATAPULT, 0); - } - else { - d = 0; - } - - bewaffnete = armedmen(u, true); - if (d == 0 && bewaffnete == 0) { - /* abbruch, falls unbewaffnet oder unfaehig, katapulte zu benutzen */ - cmistake(u, ord, 80, MSG_EVENT); - return 80; - } - - if (!is_guard(u)) { - /* abbruch, wenn die einheit nicht vorher die region bewacht - als - * warnung fuer alle anderen! */ - cmistake(u, ord, 81, MSG_EVENT); - return 81; - } - /* einheit und burg markieren - spart zeit beim behandeln der einheiten - * in der burg, falls die burg auch markiert ist und nicht alle - * einheiten wieder abgesucht werden muessen! */ - - usetsiege(u, b); - if (katapultiere < bewaffnete) katapultiere = bewaffnete; - building_add_siege(b, katapultiere); - - /* definitiver schaden eingeschraenkt */ - if (d > b->size - 1) d = b->size - 1; - - /* meldung, schaden anrichten */ - if (d && !curse_active(get_curse(b->attribs, &ct_magicwalls))) { - b->size -= d; - use_pooled(u, rt_catapultammo, - GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, d); - /* send message to the entire region */ - ADDMSG(&r->msgs, msg_message("siege_catapults", - "unit building destruction", u, b, d)); - } - else { - /* send message to the entire region */ - ADDMSG(&r->msgs, msg_message("siege", "unit building", u, b)); - } - return 0; -} - -void do_siege(region * r) -{ - if (fval(r->terrain, LAND_REGION)) { - unit *u; - - for (u = r->units; u; u = u->next) { - if (getkeyword(u->thisorder) == K_BESIEGE) { - siege_cmd(u, u->thisorder); - } - } - } -} - static void enter_1(region * r) { do_enter(r, 0); @@ -3979,11 +3815,6 @@ void init_processor(void) p += 10; add_proc_global(p, do_battles, "Attackieren"); - if (!keyword_disabled(K_BESIEGE)) { - p += 10; - add_proc_region(p, do_siege, "Belagern"); - } - p += 10; /* can't allow reserve before siege (weapons) */ add_proc_region(p, enter_1, "Betreten (3. Versuch)"); /* to claim a castle after a victory and to be able to DESTROY it in the same turn */ if (config_get_int("rules.reserve.twophase", 0)) { @@ -4201,7 +4032,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier) } /* simple visibility, just gotta have a viewer in the region to see 'em */ - if (leftship(u) || is_guard(u) || usiege(u) || u->building || u->ship) { + if (leftship(u) || is_guard(u) || u->building || u->ship) { return true; } @@ -4239,7 +4070,7 @@ bool cansee_unit(const unit * u, const unit * target, int modifier) else { int n, rings; - if (is_guard(target) || usiege(target) || target->building + if (is_guard(target) || target->building || target->ship) { return true; } @@ -4282,7 +4113,7 @@ cansee_durchgezogen(const faction * f, const region * r, const unit * u, else { int rings, n; - if (is_guard(u) || usiege(u) || u->building || u->ship) { + if (is_guard(u) || u->building || u->ship) { return true; } diff --git a/src/laws.h b/src/laws.h index 0b5db17c7..b7958891f 100755 --- a/src/laws.h +++ b/src/laws.h @@ -48,7 +48,6 @@ extern "C" { bool renamed_building(const struct building * b); int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name); void get_food(struct region * r); - int can_contact(const struct region *r, const struct unit *u, const struct unit *u2); int enter_building(struct unit *u, struct order *ord, int id, bool report); int enter_ship(struct unit *u, struct order *ord, int id, bool report); @@ -82,7 +81,6 @@ extern "C" { int quit_cmd(struct unit *u, struct order *ord); int name_cmd(struct unit *u, struct order *ord); int use_cmd(struct unit *u, struct order *ord); - int siege_cmd(struct unit *u, struct order *ord); int leave_cmd(struct unit *u, struct order *ord); int pay_cmd(struct unit *u, struct order *ord); int promotion_cmd(struct unit *u, struct order *ord); diff --git a/src/laws.test.c b/src/laws.test.c index fb644dc90..778ee3323 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -95,38 +95,6 @@ static void test_rename_building_twice(CuTest * tc) test_teardown(); } -static void test_contact(CuTest * tc) -{ - region *r; - unit *u1, *u2, *u3; - building *b; - building_type *btype; - ally *al; - - test_setup(); - test_create_locale(); - btype = test_create_buildingtype("castle"); - r = test_create_region(0, 0, NULL); - b = new_building(btype, r, default_locale); - u1 = test_create_unit(test_create_faction(NULL), r); - u2 = test_create_unit(test_create_faction(NULL), r); - u3 = test_create_unit(test_create_faction(NULL), r); - set_level(u3, SK_PERCEPTION, 2); - usetsiege(u3, b); - building_add_siege(b, 1); - CuAssertIntEquals(tc, 1, building_get_siege(b)); - CuAssertIntEquals(tc, 1, can_contact(r, u1, u2)); - - u_set_building(u1, b); - CuAssertIntEquals(tc, 0, can_contact(r, u1, u2)); - al = ally_add(&u1->faction->allies, u2->faction); - al->status = HELP_ALL; - CuAssertIntEquals(tc, HELP_GIVE, can_contact(r, u1, u2)); - u_set_building(u2, b); - CuAssertIntEquals(tc, 1, can_contact(r, u1, u2)); - test_teardown(); -} - static void test_enter_building(CuTest * tc) { unit *u; @@ -1833,7 +1801,6 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_pay_cmd_must_be_owner); SUITE_ADD_TEST(suite, test_new_units); SUITE_ADD_TEST(suite, test_cannot_create_unit_above_limit); - SUITE_ADD_TEST(suite, test_contact); SUITE_ADD_TEST(suite, test_enter_building); SUITE_ADD_TEST(suite, test_enter_ship); SUITE_ADD_TEST(suite, test_display_cmd); diff --git a/src/process.pkg b/src/process.pkg index a81917293..89e8f2fa7 100755 --- a/src/process.pkg +++ b/src/process.pkg @@ -21,7 +21,6 @@ module eressea { void process_movement @ movement(void); /* MOVE/FOLLOW/ROUTE */ void process_use @ use(void); /* USE */ void process_battle @ battle(void); /* ATTACK */ - void process_siege @ siege(void); /* SIEGE */ void process_leave @ leave(void); /* LEAVE */ void process_maintenance @ maintenance(void); /* PAY */ void process_promote @ promote(void); /* PROMOTE */ diff --git a/src/process.pkg.c b/src/process.pkg.c index 42dff20ff..3e818f7ce 100644 --- a/src/process.pkg.c +++ b/src/process.pkg.c @@ -435,30 +435,6 @@ static int tolua_process_eressea_process_battle00(lua_State* tolua_S) #endif } -/* function: process_siege */ -static int tolua_process_eressea_process_siege00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnoobj(tolua_S,1,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - process_siege(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'siege'.",&tolua_err); - return 0; -#endif -} - /* function: process_leave */ static int tolua_process_eressea_process_leave00(lua_State* tolua_S) { @@ -993,7 +969,6 @@ LUALIB_API int luaopen_process (lua_State* tolua_S) tolua_function(tolua_S,"movement",tolua_process_eressea_process_movement00); tolua_function(tolua_S,"use",tolua_process_eressea_process_use00); tolua_function(tolua_S,"battle",tolua_process_eressea_process_battle00); - tolua_function(tolua_S,"siege",tolua_process_eressea_process_siege00); tolua_function(tolua_S,"leave",tolua_process_eressea_process_leave00); tolua_function(tolua_S,"maintenance",tolua_process_eressea_process_maintenance00); tolua_function(tolua_S,"promote",tolua_process_eressea_process_promote00); diff --git a/src/report.c b/src/report.c index 7de2550a4..29f124cef 100644 --- a/src/report.c +++ b/src/report.c @@ -1821,7 +1821,6 @@ nr_building(struct stream *out, const region *r, const building *b, const factio const char *name, *bname, *billusion = NULL; const struct locale *lang; char buffer[8192]; - message *msg; size_t size; sbstring sbs; @@ -1853,17 +1852,6 @@ nr_building(struct stream *out, const region *r, const building *b, const factio sbs_strcat(&sbs, LOC(lang, "nr_building_inprogress")); } - if (!keyword_disabled(K_BESIEGE) && r->seen.mode >= seen_lighthouse) { - int s = building_get_siege(b); - if (s > 0) { - msg = msg_message("nr_building_besieged", "soldiers diff", s, - s - b->size * SIEGEFACTOR); - size = nr_render(msg, lang, sbs.end, sbs.size - (sbs.end - sbs.begin), f); - sbs.end += size; - - msg_release(msg); - } - } i = 0; if (b->display && b->display[0]) { sbs_strcat(&sbs, "; "); diff --git a/src/reports.c b/src/reports.c index 9d9ab5f6f..25c331a9f 100644 --- a/src/reports.c +++ b/src/reports.c @@ -683,7 +683,6 @@ bufunit(const faction * f, const unit * u, seen_mode mode, char *buf, int i, dh; int getarnt = fval(u, UFL_ANON_FACTION); const char *pzTmp, *str; - building *b; bool isbattle = (bool)(mode == seen_battle); item *itm, *show = NULL; faction *fv; @@ -807,11 +806,6 @@ bufunit(const faction * f, const unit * u, seen_mode mode, char *buf, bufp = STRLCPY(bufp, LOC(lang, "unit_guards"), size); } - if ((b = usiege(u)) != NULL) { - bufp = STRLCPY(bufp, ", belagert ", size); - bufp = STRLCPY(bufp, buildingname(b), size); - } - dh = 0; if (u->faction == f) { skill *sv; diff --git a/src/spy.c b/src/spy.c index ae70f4db8..9dc9de35a 100644 --- a/src/spy.c +++ b/src/spy.c @@ -137,10 +137,6 @@ int spy_cmd(unit * u, struct order *ord) msg_feedback(u, u->thisorder, "feedback_unit_not_found", "")); return 0; } - if (!can_contact(r, u, target)) { - cmistake(u, u->thisorder, 24, MSG_EVENT); - return 0; - } if (effskill(u, SK_SPY, 0) < 1) { cmistake(u, u->thisorder, 39, MSG_EVENT); return 0; diff --git a/src/spy.test.c b/src/spy.test.c index 0224698a0..d8b879e3f 100644 --- a/src/spy.test.c +++ b/src/spy.test.c @@ -198,17 +198,17 @@ static void test_setstealth_cmd(CuTest *tc) { test_setup(); u = test_create_unit(test_create_faction(NULL), test_create_plain(0, 0)); lang = u->faction->locale; - u->flags = UFL_ANON_FACTION | UFL_SIEGE; + u->flags = UFL_ANON_FACTION | UFL_DEFENDER; u->thisorder = create_order(K_SETSTEALTH, lang, "%s %s", LOC(lang, parameters[P_FACTION]), LOC(lang, parameters[P_NOT])); setstealth_cmd(u, u->thisorder); - CuAssertIntEquals(tc, UFL_SIEGE, u->flags); + CuAssertIntEquals(tc, UFL_DEFENDER, u->flags); free_order(u->thisorder); u->thisorder = create_order(K_SETSTEALTH, lang, "%s", LOC(lang, parameters[P_FACTION])); setstealth_cmd(u, u->thisorder); - CuAssertIntEquals(tc, UFL_SIEGE | UFL_ANON_FACTION, u->flags); + CuAssertIntEquals(tc, UFL_DEFENDER | UFL_ANON_FACTION, u->flags); test_teardown(); } diff --git a/src/steal.c b/src/steal.c index 68a4239ec..8a390c8fb 100644 --- a/src/steal.c +++ b/src/steal.c @@ -188,10 +188,6 @@ void steal_cmd(unit * u, struct order *ord, econ_request ** stealorders) } assert(u->region == u2->region); - if (!can_contact(r, u, u2)) { - ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error60", "")); - return; - } effsk = effskill(u, SK_STEALTH, 0); n = effsk - max_skill(r, f, SK_PERCEPTION);