From c9f886078b665dbcd05965adadc3383f6e6d2a01 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 4 Nov 2015 19:08:45 +0100 Subject: [PATCH] CID 22452 'Constant' variable guards dead code github issue #353 there is no a_fshidden attribute. --- scripts/tests/e2/e2features.lua | 11 +++++++++++ src/creport.c | 12 ++---------- src/reports.c | 14 +++----------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index f5e40d42a..8505bfd39 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -335,3 +335,14 @@ function test_stonegolems() assert_equal(1 ,u2.number, "There shoud be one Stone Golems") -- end test Stone Golems four stones end + + +function test_birthdaycake() + r = region.create(0,0, "plain") + f = faction.create("cake@eressea.de", "human", "de") + u = unit.create(f, r, 1) + u:add_item("birthdaycake", 1) + u:clear_orders() + u:add_order("ZEIGE Geburtstagstorte") + process_orders() +end diff --git a/src/creport.c b/src/creport.c index c077db5f0..8078c545c 100644 --- a/src/creport.c +++ b/src/creport.c @@ -746,7 +746,6 @@ void cr_output_unit(stream *out, const region * r, const faction * f, building *b; const char *pzTmp; skill *sv; - const attrib *a_fshidden = NULL; bool itemcloak = false; static const curse_type *itemcloak_ct = 0; static bool init = false; @@ -834,13 +833,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f, stream_printf(out, "\"%s\";typprefix\n", translate(prefix, LOC(f->locale, prefix))); } - if (u->faction != f && a_fshidden - && a_fshidden->data.ca[0] == 1 && effskill(u, SK_STEALTH, 0) >= 6) { - stream_printf(out, "-1;Anzahl\n"); - } - else { - stream_printf(out, "%d;Anzahl\n", u->number); - } + stream_printf(out, "%d;Anzahl\n", u->number); pzTmp = get_racename(u->attribs); if (pzTmp) { @@ -981,8 +974,7 @@ void cr_output_unit(stream *out, const region * r, const faction * f, if (f == u->faction || omniscient(f)) { show = u->items; } - else if (!itemcloak && mode >= see_unit && !(a_fshidden - && a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH, 0) >= 3)) { + else if (!itemcloak && mode >= see_unit) { int n = report_items(u->items, result, MAX_INVENTORY, u, f); assert(n >= 0); if (n > 0) diff --git a/src/reports.c b/src/reports.c index 792f8c7fb..78518a9ce 100644 --- a/src/reports.c +++ b/src/reports.c @@ -456,7 +456,6 @@ size_t size) building *b; bool isbattle = (bool)(mode == see_battle); int telepath_see = 0; - attrib *a_fshidden = NULL; item *itm; item *show; faction *fv = visible_faction(f, u); @@ -520,14 +519,8 @@ size_t size) bufp = STRLCPY(bufp, ", ", size); - if (u->faction != f && a_fshidden && a_fshidden->data.ca[0] == 1 - && effskill(u, SK_STEALTH, 0) >= 6) { - bufp = STRLCPY(bufp, "? ", size); - } - else { - if (wrptr(&bufp, &size, _snprintf(bufp, size, "%d ", u->number))) - WARN_STATIC_BUFFER(); - } + if (wrptr(&bufp, &size, _snprintf(bufp, size, "%d ", u->number))) + WARN_STATIC_BUFFER(); pzTmp = get_racename(u->attribs); if (pzTmp) { @@ -607,8 +600,7 @@ size_t size) if (f == u->faction || telepath_see || omniscient(f)) { show = u->items; } - else if (!itemcloak && mode >= see_unit && !(a_fshidden - && a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH, 0) >= 3)) { + else if (!itemcloak && mode >= see_unit) { int n = report_items(u->items, results, MAX_INVENTORY, u, f); assert(n >= 0); if (n > 0)