From ecf55926bebbf3682928d660fe57fb27ac0fffc4 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 21 Sep 2022 17:02:45 -0700 Subject: [PATCH] github pull request #628 - duplicate code Pull request from argrath nearly a year ago: an 'if' and corresponding 'else' have the same code so there's no point in testing for if/else. I'm still not convinced that simply removing the if/else is the right fix here but nothing else is going on. I've put part of the removed code back inside '#if 0' in case it needs to be resurrected someday. Closes #628 --- src/role.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/role.c b/src/role.c index d8bc060b0..a83e45706 100644 --- a/src/role.c +++ b/src/role.c @@ -1387,7 +1387,15 @@ root_plselection_prompt( if (alignnum != ROLE_NONE && alignnum != ROLE_RANDOM && ok_align(rolenum, racenum, gendnum, alignnum)) { +#if 0 /* 'if' and 'else' had duplicate code here; probably a copy+parse + * oversight; if a problem with filtering of random role selection + * crops up, this is probably the place to start looking */ + /* if race specified, and multiple choice of alignments for it */ + if ((racenum >= 0) && (aligncount > 1)) { + } else { + } +#endif /* the four lines of code below were in both 'if' and 'else' above */ if (donefirst) Strcat(buf, " "); Strcat(buf, aligns[alignnum].adj); -- 2.49.0