diff --git a/GameEngine/Units.php b/GameEngine/Units.php index ca8a2172..4bc5c006 100755 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -89,7 +89,7 @@ class Units { $vid = $database->getVillageByName(stripslashes($post['dname'])); } if (!empty($vid)) { - if($database->isVillageOases($vid) != 0){ + if($database->isVillageOases($vid)){ $too = $database->getOasisField($vid,"conqured"); if($too == 0){ $disabledr ="disabled=disabled"; $disabled ="disabled=disabled"; @@ -122,12 +122,16 @@ class Units { $disabled ="disabled=disabled"; } } - if($disabledr != "" && $post['c'] == 2){ - $form->addError("error","You can't reinforce this village/oasis"); + if(!empty($disabledr) && $post['c'] == 2){ + $form->addError("error","You can't reinforce this village/oasis"); } - if($disabled != "" && $post['c'] == 3){ - $form->addError("error","You can't attack this village/oasis with normal attack"); + + if(!empty($disabled) && $post['c'] == 3){ + $form->addError("error","You can't attack this village/oasis with normal attack"); } + + if($post['c'] < 2 || $post['c'] > 4) $form->addError("error", "Invalid attack type."); + if(empty($post['t1']) && empty($post['t2']) && empty($post['t3']) && empty($post['t4']) && empty($post['t5']) && empty($post['t6']) && empty($post['t7']) && empty($post['t8']) && empty($post['t9']) && empty($post['t10']) && empty($post['t11'])){ $form->addError("error","You need to mark min. one troop"); @@ -364,6 +368,10 @@ class Units { $form->addError( "error", "You can't send negative units." ); } + if($data['type'] < 1 || $data['type'] > 4) $form->addError("error", "Invalid attack type."); + + if($data['type'] != 1 && $post['spy'] != 0) $post['spy'] = 0; + if ( $form->returnErrors() > 0 ) { $_SESSION['errorarray'] = $form->getErrors(); $_SESSION['valuearray'] = $_POST; @@ -415,11 +423,10 @@ class Units { ); $fromcoor = $database->getCoor( $village->wid ); - $from = array('x' => $fromcoor['x'], 'y' => $fromcoor['y']); + $from = ['x' => $fromcoor['x'], 'y' => $fromcoor['y']]; $tocoor = $database->getCoor( $data['to_vid'] ); - $to = array('x' => $tocoor['x'], 'y' => $tocoor['y']); - $speeds = array(); - $scout = 1; + $to = ['x' => $tocoor['x'], 'y' => $tocoor['y']]; + $speeds = []; //find slowest unit. for ( $i = 1; $i <= 10; $i ++ ) { diff --git a/Templates/a2b/attack.tpl b/Templates/a2b/attack.tpl index 7e43bc22..7d08d8a8 100644 --- a/Templates/a2b/attack.tpl +++ b/Templates/a2b/attack.tpl @@ -72,10 +72,8 @@ $ckey= $generator->generateRandStr(6); (!empty($process['t10']) ? $process['t10'] : 0) + (!empty($process['t11']) ? $process['t11'] : 0); } - if (isset($scout) && $scout==1 && isset($totalunits) && $totalunits==0) { -if ($process['c'] != 2){ -$process['c'] = 1; -} +if (isset($scout) && $scout == 1 && isset($totalunits) && $totalunits == 0 && $process['c'] != 2) { + $process['c'] = 1; } $id = $database->addA2b($ckey,time(),$process['0'],$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,$process['c']); @@ -332,16 +330,15 @@ $end = ($tribe*10); } else if($process['c']=='4') { - ?> - Destination: - - "> + ?> + + Destination: + colspan=""> ONLY shoot with a normal attack (they dont shoot with raids!)"; ?> - - + Thorned Warrior - Guardsman></td>
+                        <td><img src= Bird of Prey @@ -315,14 +315,14 @@ $actionType = "Raid"; else if($process['c']=='4') { ?> - Destination: - - "> + + Destination: + colspan=""> ONLY shoot with a normal attack (they dont shoot with raids!)"; ?> - +