From 90e63747f4ec7857f04f3c9ce0f7dcec480a9825 Mon Sep 17 00:00:00 2001 From: Shadowss Date: Tue, 5 Nov 2013 08:04:47 +0200 Subject: [PATCH] fix , now you cannot make buildings with no resource --- GameEngine/Building.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 27484527..1ea90627 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -35,20 +35,41 @@ class Building { } } } + + public function canProcess($id,$tid) { + //add fix by ronix + global $session; + if($session->access==BANNED){ + header("Location: banned.php"); + exit; + } else { + if ($this->checkResource($id,$tid)!=4) { + if($tid >= 19) { + header("Location: dorf2.php"); + } + else { + header("Location: dorf1.php"); + } + exit; + } + } + } public function procBuild($get) { - global $session; + global $session, $village; if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) { if($get['a'] == 0) { $this->removeBuilding($get['d']); } else { $session->changeChecker(); + $this->canProcess($village->resarray['f'.$get['a'].'t'],$get['a']); $this->upgradeBuilding($get['a']); } } if(isset($get['a']) && $get['c'] == $session->checker && isset($get['id'])) { $session->changeChecker(); + $this->canProcess($get['a'],$get['id']); $this->constructBuilding($get['id'],$get['a']); } if(isset($get['buildingFinish'])) { @@ -574,7 +595,7 @@ class Building { return 3; } else { - if($village->awood-$wood > 0 && $village->aclay-$clay > 0 && $village->airon-$iron > 0 && $village->acrop-$crop >0){ + if($village->awood>=$wood && $village->aclay>=$clay && $village->airon>=$iron && $village->acrop>=$crop){ return 4; } else {