From ccb5bc4b55343f0f5e5f5a4a3bcba9b8afbae02c Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 15 Nov 2020 19:56:35 +0200 Subject: [PATCH] Avoid hard-coded bit twiddling --- src/sp_lev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sp_lev.c b/src/sp_lev.c index cb81076c6..348f023e0 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1025,10 +1025,9 @@ link_doors_rooms() static int rnddoor() { - int i = 1 << rn2(5); + static int state[] = { D_NODOOR, D_BROKEN, D_ISOPEN, D_CLOSED, D_LOCKED }; - i >>= 1; - return i; + return state[rn2(SIZE(state))]; } /* -- 2.50.1