From f8e23119bfde52d4b8ee60eecf118f142b9339f4 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 9 Jul 2020 03:14:17 -0700 Subject: [PATCH] Use case-switch for warp line creation No need to repeat the left part of a conditional if we can just use case-switches instead. --- desktop_version/src/Map.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 4a1388f8..f0f00243 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1806,14 +1806,20 @@ void mapclass::loadlevel(int rx, int ry) break; case 50: //Warp Lines obj.customwarpmode=true; - if(ent.p1==0){ // + switch (ent.p1) + { + case 0: // obj.createentity(ex + 4, ent.p2 * 8, 51, ent.p3); - }else if(ent.p1==1){ //Horizontal, right + break; + case 1: //Horizontal, right obj.createentity(ex + 4, ent.p2 * 8, 52, ent.p3); - }else if(ent.p1==2){ //Vertical, top + break; + case 2: //Vertical, top obj.createentity(ent.p2 * 8, ey + 7, 53, ent.p3); - }else if(ent.p1==3){ + break; + case 3: obj.createentity(ent.p2 * 8, ey, 54, ent.p3); + break; } break; }