fix(combat): bounce attacks home when a multi-wave razes their target [#298] (#311)

This commit is contained in:
Ferywir
2026-06-29 16:41:19 +02:00
committed by GitHub
parent 61d0868c18
commit 58475a0358
+15 -1
View File
@@ -4240,7 +4240,21 @@ class MYSQLi_DB implements IDbConnection {
$this->query($q); $this->query($q);
$this->removeOases($wref, 1); $this->removeOases($wref, 1);
$getmovement = $this->getMovement(3, $wref, 1); // In-flight attacks still heading for the deleted village(s) must be
// bounced straight home. Query them directly instead of using
// getMovement(3, $wref, 1): when passed an array, getMovement() returns
// the WHOLE movement cache (a map of "type.village.mode" => record list),
// not the flat record list this loop expects — so $movedata['moveid'] /
// ['starttime'] were NULL and the follow-up waves were never bounced,
// leaving them stuck at sort_type=3/proc=0 and looping forever once the
// village is gone. Pre-dates the sendunitsComplete() split (issue #298).
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks
WHERE ".TB_PREFIX."movement.`to` IN($wrefs)
AND ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id
AND ".TB_PREFIX."movement.proc = 0
AND ".TB_PREFIX."movement.sort_type = 3
ORDER BY endtime ASC";
$getmovement = $this->mysqli_fetch_all(mysqli_query($this->dblink, $q));
$moveIDs = []; $moveIDs = [];
$time = microtime(true); $time = microtime(true);