Update Village.php

This commit is contained in:
Shadow
2013-11-21 08:07:43 +02:00
parent f99473e041
commit d41dccd705
+16 -9
View File
@@ -28,15 +28,22 @@ class Village {
private $production = array();
private $oasisowned,$ocounter = array();
function Village() {
global $session;
if(isset($_SESSION['wid'])) {
$this->wid = $_SESSION['wid'];
}
else {
$this->wid = $session->villages[0];
}
$this->LoadTown();
function Village() {
global $session, $database;
if(isset($_SESSION['wid'])) {
$this->wid = $_SESSION['wid'];
}
else {
$this->wid = $session->villages[0];
}
//add new line code
//check exist village if from village destroy to avoid error msg.
if (!$database-> checkVilExist($this->wid)) {
$this->wid=$database->getVillageID($session->uid);
$_SESSION['wid']=$this->wid;
}
$this->LoadTown();
$this->calculateProduction();
$this->processProduction();
$this->ActionControl();