From 1e661b7a03a670f4c8e792ca17669a5b0243f159 Mon Sep 17 00:00:00 2001 From: Ferywir <65760459+Ferywir@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:37:54 +0200 Subject: [PATCH] Refactor(Units): collapse the duplicated procUnits() cases 1-4 [#219] (#281) Cases 1 to 4 of the procUnits() switch had a byte-identical body (send troops when the rally-point form is submitted, otherwise load the unit form). Stack the four case labels and keep a single shared body via switch fall-through. Behaviour-preserving. Co-authored-by: Claude Opus 4.8 --- GameEngine/Units.php | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/GameEngine/Units.php b/GameEngine/Units.php index 36f164c0..8ac41bbc 100755 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -24,32 +24,8 @@ class Units { switch($post['c']) { case 1: - if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post); - else - { - $post = $this->loadUnits($post); - return $post; - } - break; - case 2: - if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post); - else - { - $post = $this->loadUnits($post); - return $post; - } - break; - case 3: - if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post); - else - { - $post = $this->loadUnits($post); - return $post; - } - break; - case 4: if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post); else @@ -58,7 +34,7 @@ class Units { return $post; } break; - + case 5: if (isset($post['a']) && $post['a'] == "new") $this->Settlers($post); else