From ee64acff2180738f721dc73bbb75fa70e0210e37 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 28 Sep 2005 18:52:18 +0000 Subject: [PATCH] =?UTF-8?q?http://eressea.upb.de/mantis/view.php=3Fid=3D68?= =?UTF-8?q?4=20Stra=C3=9Fen=20durch=20W=C3=BCste=20ohne=20Karawanserei?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Code scheint okay zu sein, nur Altdaten nicht. Habe eine Korrektur-Routine eingebaut. --- src/eressea/korrektur.c | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 177e678da..58980d3ea 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -742,6 +742,52 @@ fix_gates(void) } } +static int +road_decay(void) +{ + const struct building_type * bt_caravan, * bt_dam, * bt_tunnel; + region * r; + + bt_caravan = bt_find("caravan"); + bt_dam = bt_find("dam"); + bt_tunnel = bt_find("tunnel"); + + for (r=regions;r;r=r->next) { + boolean half = false; + if (rterrain(r) == T_SWAMP) { + /* wenn kein Damm existiert */ + if (!buildingtype_exists(r, bt_dam)) { + half = true; + } + } + else if (rterrain(r) == T_DESERT) { + /* wenn keine Karawanserei existiert */ + if (!buildingtype_exists(r, bt_caravan)) { + half = true; + } + } + else if (rterrain(r) == T_GLACIER) { + /* wenn kein Tunnel existiert */ + if (!buildingtype_exists(r, bt_tunnel)) { + half = true; + } + } + + if (half) { + direction_t d; + short maxt = terrain[rterrain(r)].roadreq; + /* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon + * gebaute Straße zur Hälfte vernichtet */ + for (d=0;d!=MAXDIRECTIONS;++d) { + if (rroad(r, d) > maxt) { + rsetroad(r, d, maxt); + } + } + } + } + return 0; +} + static void frame_regions(void) { @@ -1169,6 +1215,7 @@ korrektur(void) } else { do_once("zvrm", nothing()); } + do_once("rdec", road_decay()); do_once("chgt", fix_chaosgates()); do_once("atrx", fix_attribflags());