Merge pull request #453 from Shadowss/patch-116

fix , now you cannot make buildings with no resource
This commit is contained in:
yi12345
2013-11-07 14:12:35 -08:00
+23 -2
View File
@@ -36,19 +36,40 @@ 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) { public function procBuild($get) {
global $session; global $session, $village;
if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) { if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) {
if($get['a'] == 0) { if($get['a'] == 0) {
$this->removeBuilding($get['d']); $this->removeBuilding($get['d']);
} }
else { else {
$session->changeChecker(); $session->changeChecker();
$this->canProcess($village->resarray['f'.$get['a'].'t'],$get['a']);
$this->upgradeBuilding($get['a']); $this->upgradeBuilding($get['a']);
} }
} }
if(isset($get['a']) && $get['c'] == $session->checker && isset($get['id'])) { if(isset($get['a']) && $get['c'] == $session->checker && isset($get['id'])) {
$session->changeChecker(); $session->changeChecker();
$this->canProcess($get['a'],$get['id']);
$this->constructBuilding($get['id'],$get['a']); $this->constructBuilding($get['id'],$get['a']);
} }
if(isset($get['buildingFinish'])) { if(isset($get['buildingFinish'])) {
@@ -574,7 +595,7 @@ class Building {
return 3; return 3;
} }
else { 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; return 4;
} }
else { else {