From 1c5ecac670e5b28a159193188fd2db71e7f3ffba Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sat, 1 Nov 2025 17:20:14 -0400 Subject: [PATCH] Simplify kind_outline and remove duplicate code of it from cellcolor --- graph.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/graph.cpp b/graph.cpp index adeedb3d..cffb2f78 100644 --- a/graph.cpp +++ b/graph.cpp @@ -143,13 +143,14 @@ EX transmatrix at_smart_lof(const transmatrix& V, ld lev) { EX shiftmatrix at_smart_lof(const shiftmatrix& V, ld lev) { return shiftless(at_smart_lof(V.T, lev), V.shift); } EX color_t kind_outline(eItem it) { - int k = itemclass(it); - if(k == IC_TREASURE) - return OUTLINE_TREASURE; - else if(k == IC_ORB) - return OUTLINE_ORB; - else - return OUTLINE_OTHER; + switch(itemclass(it)) { + case IC_TREASURE: + return OUTLINE_TREASURE; + case IC_ORB: + return OUTLINE_ORB; + default: + return OUTLINE_OTHER; + } } /** should objects fly slightly up and down in product/twisted product geometries */ @@ -195,15 +196,8 @@ EX int cellcolor(cell *c) { if(c->wall == waMirror) return c->land == laMirror ? OUTLINE_TREASURE : OUTLINE_ORB; - if(c->item && !itemHiddenFromSight(c)) { - int k = itemclass(c->item); - if(k == IC_TREASURE) - return OUTLINE_TREASURE; - else if(k == IC_ORB) - return OUTLINE_ORB; - else - return OUTLINE_OTHER; - } + if(c->item && !itemHiddenFromSight(c)) + return kind_outline(c->item); return OUTLINE_NONE; }