Fixed a bug while destroying a village

+If a village is destroyed, all oasis of it, will return to the Nature
+If a village is destroyed all trade routes from and to it, will be
deleted
This commit is contained in:
iopietro
2018-04-29 21:29:14 +02:00
parent 2530dcac6d
commit 6443d2d490
2 changed files with 19 additions and 5 deletions
+4 -3
View File
@@ -3012,8 +3012,6 @@ class Automation {
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."market where vref = $wref";
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."odata where wref = $wref";
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."research where vref = $wref";
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."tdata where vref = $wref";
@@ -3028,9 +3026,12 @@ class Automation {
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."raidlist where towref = $wref";
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."route where wid = $wref OR `from` = $wref";
$database->query($q);
$q = "DELETE FROM ".TB_PREFIX."movement where proc = 0 AND ((`to` = $wref AND sort_type=4) OR (`from` = $wref AND sort_type=3))";
$database->query($q);
$database->removeOasesByVid($wref);
$getmovement = $database->getMovement(3,$wref,1);
$moveIDs = [];
+15 -2
View File
@@ -1568,6 +1568,20 @@ class MYSQLi_DB implements IDbConnection {
$q = "UPDATE ".TB_PREFIX."odata SET conqured = 0, owner = 2, name = 'Unoccupied Oasis' WHERE wref = ".$wref;
return mysqli_query($this->dblink,$q);
}
/**
* Remove all oasis of a specified village
*
* @param int $vid The village ID of the oasis owner
* @return bool Returns true if the query was successful, false otherwise
*/
function removeOasesByVid($vid) {
list($vid) = $this->escape_input((int) $vid);
$q = "UPDATE ".TB_PREFIX."odata SET conqured = 0, owner = 2, name = 'Unoccupied Oasis' WHERE conqured = ".$vid;
return mysqli_query($this->dblink, $q);
}
/***************************
@@ -6886,8 +6900,7 @@ References: User ID/Message ID, Mode
$chiefslots = 0;
}
$slots = array("chiefs" => $chiefslots, "settlers" => $settlerslots);
return $slots;
return ["chiefs" => $chiefslots, "settlers" => $settlerslots];
}
/**