From f2261a7c8f5fcc4d26fa99bd24069112f76d4a81 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 27 Nov 2017 10:48:20 +0100 Subject: [PATCH] fix: oasis displayed incorrectly in Admin #386 PHP error caused array pointers to miss-align and the last one to point to the previous record. --- Admin/Templates/village.tpl | 61 ++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index 611cb944..b3946cc3 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -39,21 +39,52 @@ if(isset($id)) $result = $database->query_return($q); if(count($result) >0) { - foreach($result as &$row) + $newResult = []; + foreach($result as $row) { $type = $row['type']; - if($type==1) { $row['type'] = ' + 25%'; $wood+=1;} - elseif($type==2) { $row['type'] = ' + 25%'; $wood+=1;} - elseif($type==3) { $row['type'] = ' + 25%
+ 25%'; $wood+=1; $crop+=1;} - elseif($type==4) { $row['type'] = ' + 25%'; $clay+=1;} - elseif($type==5) { $row['type'] = ' + 25%'; $clay+=1;} - elseif($type==6) { $row['type'] = ' + 25%
+ 25%'; $clay+=1;$crop+=1;} - elseif($type==7) { $row['type'] = ' + 25%'; $iron+=1;} - elseif($type==8) { $row['type'] = ' + 25%'; $iron+=1;} - elseif($type==9) { $row['type'] = ' + 25%
+ 25%'; $iron+=1; $crop+=1;} - elseif($type==10){ $row['type'] = ' + 25%'; $crop+=1;} - elseif($type==11){ $row['type'] = ' + 25%'; $crop+=1;} - elseif($type==12){ $row['type'] = ' + 50%'; $crop+=2;} + if ( $type == 1 ) { + $row['type'] = ' + 25%'; + $wood += 1; + } elseif ( $type == 2 ) { + $row['type'] = ' + 25%'; + $wood += 1; + } elseif ( $type == 3 ) { + $row['type'] = ' + 25%
+ 25%'; + $wood += 1; + $crop += 1; + } elseif ( $type == 4 ) { + $row['type'] = ' + 25%'; + $clay += 1; + } elseif ( $type == 5 ) { + $row['type'] = ' + 25%'; + $clay += 1; + } elseif ( $type == 6 ) { + $row['type'] = ' + 25%
+ 25%'; + $clay += 1; + $crop += 1; + } elseif ( $type == 7 ) { + $row['type'] = ' + 25%'; + $iron += 1; + } elseif ( $type == 8 ) { + $row['type'] = ' + 25%'; + $iron += 1; + } elseif ( $type == 9 ) { + $row['type'] = ' + 25%
+ 25%'; + $iron += 1; + $crop += 1; + } elseif ( $type == 10 ) { + $row['type'] = ' + 25%'; + $crop += 1; + } elseif ( $type == 11 ) { + $row['type'] = ' + 25%'; + $crop += 1; + } elseif ( $type == 12 ) { + $row['type'] = ' + 50%'; + $crop += 2; + } + + $newResult[] = $row; } } $ocounter = array($wood,$clay,$iron,$crop); @@ -237,9 +268,9 @@ if(isset($id)) 0) + if(count($newResult)) { - foreach($result as $row) + foreach($newResult as $row) { echo "