fix: master builder doesn't subtract gold but insta-builds anyway

This commit is contained in:
Martin Ambrus
2017-11-05 15:04:20 +01:00
parent eab942f291
commit 8933b0b55f
+2 -1
View File
@@ -806,12 +806,13 @@ class Building {
} else { } else {
// if we only have 2 gold, we need to cancel this job, as there will never // if we only have 2 gold, we need to cancel this job, as there will never
// be enough gold now in our account to finish this up // be enough gold now in our account to finish this up
$exclude_master = true;
$q = "DELETE FROM ".TB_PREFIX."bdata WHERE id = ".(int) $jobs['id']; $q = "DELETE FROM ".TB_PREFIX."bdata WHERE id = ".(int) $jobs['id'];
$database->query($q); $database->query($q);
} }
} }
if ($database->query($q) && ($enought_res == 1 or $jobs['master'] == 0)) { if (!isset($exclude_master) && $database->query($q) && ($enought_res == 1 or $jobs['master'] == 0)) {
$database->modifyPop($jobs['wid'],$resource['pop'],0); $database->modifyPop($jobs['wid'],$resource['pop'],0);
$database->addCP($jobs['wid'],$resource['cp']); $database->addCP($jobs['wid'],$resource['cp']);
$q = "DELETE FROM ".TB_PREFIX."bdata where id = ".(int) $jobs['id']; $q = "DELETE FROM ".TB_PREFIX."bdata where id = ".(int) $jobs['id'];