mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-10 22:56:07 +00:00
fix: expansion slots not being cleared up upon village destruction
#400
This commit is contained in:
@@ -364,6 +364,21 @@ class adm_DB {
|
||||
$q = "UPDATE ".TB_PREFIX."wdata SET occupied = 0 where id = $wref";
|
||||
mysqli_query($this->connection, $q);
|
||||
|
||||
// clear expansion slots, if this village is an expansion of any other village
|
||||
$q = "
|
||||
UPDATE
|
||||
".TB_PREFIX."vdata
|
||||
SET
|
||||
exp1 = IF(exp1 = $wref, 0, exp1),
|
||||
exp2 = IF(exp2 = $wref, 0, exp2),
|
||||
exp3 = IF(exp3 = $wref, 0, exp3)
|
||||
WHERE
|
||||
exp1 = $wref OR
|
||||
exp2 = $wref OR
|
||||
exp3 = $wref";
|
||||
|
||||
mysqli_query($this->connection, $q);
|
||||
|
||||
$getmovement = $database->getMovement(3,$wref,1);
|
||||
foreach($getmovement as $movedata) {
|
||||
$time = microtime(true);
|
||||
|
||||
@@ -3244,6 +3244,20 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = $wref";
|
||||
$database->query($q);
|
||||
|
||||
// clear expansion slots, if this village is an expansion of any other village
|
||||
$q = "
|
||||
UPDATE
|
||||
".TB_PREFIX."vdata
|
||||
SET
|
||||
exp1 = IF(exp1 = $wref, 0, exp1),
|
||||
exp2 = IF(exp2 = $wref, 0, exp2),
|
||||
exp3 = IF(exp3 = $wref, 0, exp3)
|
||||
WHERE
|
||||
exp1 = $wref OR
|
||||
exp2 = $wref OR
|
||||
exp3 = $wref";
|
||||
$database->query($q);
|
||||
|
||||
$getprisoners = $database->getPrisoners($wref);
|
||||
foreach($getprisoners as $pris) {
|
||||
$troops = 0;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
-- 2.12.2017 -> new indexes
|
||||
ALTER TABLE `s1_vdata` ADD INDEX(`exp1`);
|
||||
ALTER TABLE `s1_vdata` ADD INDEX(`exp2`);
|
||||
ALTER TABLE `s1_vdata` ADD INDEX(`exp3`);
|
||||
|
||||
-- 17.11.2017 -> query optimizations
|
||||
ALTER TABLE `s1_prisoners` DROP INDEX `from`, ADD INDEX `from-t11` (`from`, `t11`);
|
||||
ALTER TABLE `s1_enforcement` DROP INDEX `from`, ADD INDEX `from` (`from`, `hero`) USING BTREE;
|
||||
|
||||
+4
-1
@@ -1653,7 +1653,10 @@ KEY `clay` (`clay`),
|
||||
KEY `iron` (`iron`),
|
||||
KEY `crop` (`crop`),
|
||||
KEY `starv` (`starv`),
|
||||
KEY `loyalty` (`loyalty`)
|
||||
KEY `loyalty` (`loyalty`),
|
||||
KEY `exp1` (`exp1`),
|
||||
KEY `exp2` (`exp2`),
|
||||
KEY `exp3` (`exp3`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user