From bf779fc810afb39c9791ee3e0cb9e9ddc686dc90 Mon Sep 17 00:00:00 2001 From: Philipp Dreher Date: Mon, 2 Nov 2015 13:06:14 +0100 Subject: [PATCH 1/3] removed obsolete code --- src/randenc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/randenc.c b/src/randenc.c index 801aac4c4..ddc0dd386 100644 --- a/src/randenc.c +++ b/src/randenc.c @@ -528,24 +528,13 @@ void drown(region * r) unit **up = up = &r->units; while (*up) { unit *u = *up; - int amphibian_level = 0; + if (u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0) { up = &u->next; continue; } - if (amphibian_level) { - int dead = damage_unit(u, "5d1", false, false); - if (dead) { - ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_dead", - "amount unit region", dead, u, r)); - } - else { - ADDMSG(&u->faction->msgs, msg_message("drown_amphibian_nodead", - "unit region", u, r)); - } - } - else if (!(canswim(u) || canfly(u))) { + if (!(canswim(u) || canfly(u))) { scale_number(u, 0); ADDMSG(&u->faction->msgs, msg_message("drown", "unit region", u, r)); } From 153db447de64e11887118d3f4c96bf1059110fc5 Mon Sep 17 00:00:00 2001 From: Philipp Dreher Date: Mon, 2 Nov 2015 13:09:45 +0100 Subject: [PATCH 2/3] removed obsolete messages --- res/core/messages.xml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 43939b2b4..a3d7ad6e8 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -1212,23 +1212,6 @@ "$unit($unit) dies from poison damage taken in $region($region)." - - - - - - - "$int($amount) Personen in $unit($unit) in $region($region) ertrinken." - "$int($amount) people in $unit($unit) in $region($region) drown." - - - - - - - "$unit($unit) nimmt Schaden auf dem Wasser in $region($region)." - "$unit($unit) is taking damage on the water." - From 2fe95f3d615d53744ce0f463f6f232cb08d55bc0 Mon Sep 17 00:00:00 2001 From: Philipp Dreher Date: Mon, 2 Nov 2015 13:12:19 +0100 Subject: [PATCH 3/3] integration of the separate if-conditions and simplification of the loop --- src/randenc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/randenc.c b/src/randenc.c index ddc0dd386..fa6e3e951 100644 --- a/src/randenc.c +++ b/src/randenc.c @@ -529,17 +529,12 @@ void drown(region * r) while (*up) { unit *u = *up; - if (u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0) { - up = &u->next; - continue; - } - - if (!(canswim(u) || canfly(u))) { + if (!(u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0 || canswim(u) || canfly(u))) { scale_number(u, 0); ADDMSG(&u->faction->msgs, msg_message("drown", "unit region", u, r)); } - if (*up == u) - up = &u->next; + + up = &u->next; } remove_empty_units_in_region(r); }