Fixed a bug in the troops training

If the speed of the server is very high and the single troop training time is 0, you can now train troops instantly.
This commit is contained in:
Pietro
2018-04-05 03:03:49 +02:00
committed by GitHub
parent c2587d855f
commit aec41019e9
3 changed files with 13 additions and 11 deletions
-1
View File
@@ -640,7 +640,6 @@ private function trainUnit($unit,$amt,$great=false) {
$clay = ${'u'.$unit}['clay'] * $amt * ($great?3:1);
$iron = ${'u'.$unit}['iron'] * $amt * ($great?3:1);
$crop = ${'u'.$unit}['crop'] * $amt * ($great?3:1);
$each = ($each == 0) ? 1 : $each;
$time = $each*$amt;
if($database->modifyResource($village->wid,$wood,$clay,$iron,$crop,0) && $amt > 0) {
$database->trainUnit($village->wid,$unit+($great?60:0),$amt,${'u'.$unit}['pop'],$each,time()+$time,0);