diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 137385c2..f1443145 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -2654,7 +2654,10 @@ class Automation { //remove oasis related to village $units->returnTroops($data['to'],1); $chiefing_village = 1; - + + //Remove trade routes related to village + $database->deleteTradeRoutesByVillage($data['to']); + // update data in the database $database->clearExpansionSlot($data['to']); $database->setVillageLevel($data['to'], $newLevels_fieldNames, $newLevels_fieldValues); diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 8c9583b7..1175b2dc 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4367,7 +4367,14 @@ References: User ID/Message ID, Mode $q = "DELETE FROM " . TB_PREFIX . "route where id = $id"; return mysqli_query($this->dblink,$q); } + + function deleteTradeRoutesByVillage($id) { + list($id) = $this->escape_input((int) $id); + $q = "DELETE FROM " . TB_PREFIX . "route where `from` = $id"; + return mysqli_query($this->dblink,$q); + } + function addBuilding($wid, $field, $type, $loop, $time, $master, $level) { list($wid, $field, $type, $loop, $time, $master, $level) = $this->escape_input((int) $wid, $field, (int) $type, (int) $loop, (int) $time, (int) $master, (int) $level);