From 2f769decce7921fd3673ad55ee8b43dcb5b85adc Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 29 Oct 2017 23:10:54 +0100 Subject: [PATCH] fix: "instant-finish" gold decreased 2x when demolition was in progress Closes #257 --- GameEngine/Building.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 37357490..45d33a3f 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -815,8 +815,11 @@ class Building { } } if($finish != 2){ - $newgold = $session->gold-2; - $database->updateUserField($session->uid, "gold", $newgold, 1); + // only decrease gold if we didn't already do it for the building phase + if (!isset($newgold)) { + $newgold = $session->gold-2; + $database->updateUserField($session->uid, "gold", $newgold, 1); + } $demolition=$database->finishDemolition($village->wid); $tech=$technology->finishTech(); if ($finish==1 || $demolition>0 || $tech>0) {