From 65f6eb2da1e0977aa80c2ed9fbc91ea1303d4d65 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 11:08:41 +0100 Subject: [PATCH] fix: WW building plans must be in player's village to start building WW #337 --- GameEngine/Building.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 19239a2b..17e81ff6 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -95,11 +95,14 @@ class Building { // count building plans if ( $needed_plan ) { $wwbuildingplan = 0; + $planFoundInOwnersVillage = false; $villages = $database->getVillagesID( $session->uid ); + foreach ( $villages as $village1 ) { $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); if ( $plan > 0 ) { $wwbuildingplan = 1; + $planFoundInOwnersVillage = true; } } @@ -118,7 +121,11 @@ class Building { } } - $cached = $wwbuildingplan >= $needed_plan; + if ($needed_plan == 1) { + $cached = ($wwbuildingplan >= $needed_plan && $planFoundInOwnersVillage); + } else { + $cached = $wwbuildingplan >= $needed_plan; + } } else { // no need for building plans, we can still upgrade WW $cached = true;