fix: MySQL 5.7 compatibility + undefined variables

This commit is contained in:
Martin Ambrus
2017-11-10 14:07:32 +01:00
parent c07dd99627
commit 603d28f31a
3 changed files with 16 additions and 8 deletions
+3
View File
@@ -812,6 +812,9 @@ class Battle {
for($y=1;$y<=50;$y++) {
global ${'u'.$y};
if ($defenders['u'.$y]>0) {
if (!isset($def_ab[$y])) {
$def_ab[$y] = 0;
}
if ($def_ab[$y]>0) {
$dp += (${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1)) * $defenders['u'.$y];
$cdp += (${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1)) * $defenders['u'.$y];