fix: undefined indexes

This commit is contained in:
Martin Ambrus
2017-11-01 21:35:24 +01:00
parent 396250f393
commit 041726fbd2
6 changed files with 22 additions and 15 deletions
+8 -1
View File
@@ -285,7 +285,14 @@ class Technology {
$movement = $database->getVillageMovement($base);
if(!empty($movement)) {
for($i=1;$i<=50;$i++) {
$ownunit['u'.$i] += $movement['u'.$i];
if (!isset($ownunit['u'.$i])) {
$ownunit['u'.$i] = 0;
}
$ownunit['u'.$i] += (isset($movement['u'.$i]) ? $movement['u'.$i] : 0);
}
if (!isset($ownunit['hero'])) {
$ownunit['hero'] = 0;
}
$ownunit['hero'] += $movement['hero'];
}