From d8ff747ca10be7387869a0a11994998ca42b6097 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Fri, 3 Jul 2026 15:00:36 +0300 Subject: [PATCH] Fix Milestone 1000 pop (invalidate cache for count pop) Fix Milestone 1000 pop (invalidate cache for count pop) --- GameEngine/Automation.php | 5 ++++- GameEngine/Database.php | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 3c8ec073..f089c597 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -152,7 +152,10 @@ class Automation { $q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid"; mysqli_query($database->dblink, $q); $owner = $database->getVillageField($vid, "owner"); - + // Invalidăm cache-ul sumei de populație al jucătorului + if ($owner > 0) { + Database::clearUserSumFieldCache($owner, 'pop'); + } // Milestone: first player ever to reach 1000 total population, // summed across all their villages. recountPop() is the single // funnel every population-changing event (building, demolishing, diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 4e66370e..0ebdd31a 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4091,6 +4091,10 @@ class MYSQLi_DB implements IDbConnection { return ($array_passed ? $result : self::$userSumFieldCache[$uid[0].$field]); } + + public static function clearUserSumFieldCache($uid, $field){ + unset(self::$userSumFieldCache[(int)$uid.$field]); + } function updateVillage($vid) { list($vid) = $this->escape_input((int) $vid);