mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-29 00:54:31 +00:00
fix: demolition could bring building level to negative numbers
Closes #412
This commit is contained in:
@@ -4564,6 +4564,11 @@ class Automation {
|
||||
if ($vil['timetofinish'] <= time()) {
|
||||
$type = $database->getFieldType($vil['vref'],$vil['buildnumber']);
|
||||
$level = $database->getFieldLevel($vil['vref'],$vil['buildnumber']);
|
||||
|
||||
if ($level < 0) {
|
||||
$level = 0;
|
||||
}
|
||||
|
||||
$buildarray = $GLOBALS["bid".$type];
|
||||
|
||||
if ($type==10 || $type==38) {
|
||||
@@ -4588,7 +4593,7 @@ class Automation {
|
||||
|
||||
if ($village->natar==1 && $type==40) $clear=""; //fix by ronix
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".($level-1).$clear." WHERE vref=".(int) $vil['vref'];
|
||||
$q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".(($level-1 >= 0) ? $level-1 : 0).$clear." WHERE vref=".(int) $vil['vref'];
|
||||
$database->query($q);
|
||||
|
||||
$pop = $this->getPop($type,$level-1);
|
||||
|
||||
Reference in New Issue
Block a user