1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
|
// Returns true if all buildings of the planet are within the allowed distance to the construction center, otherwise false
function minLevel ($kz, $fz, $rw, $hl, $lk, $of, $wf, $sf, $fa, $tp, $az, $uom, $hap) {
// allowed distance, may be transfered to a configuration file
$allowedDistance = 2;
// controlls if all variables are set
if (isset($kz) && isset($fz) && isset($rw) && isset($hl) && isset($lk) && isset($of) && isset($wf) && isset($sf) && isset($fa) && isset($tp) && isset($az) && isset($uom) && isset($hap) {
// get the lowest building level of the planet
$lowestLevel = min ($kz, $fz, $rw, $hl, $lk, $of, $wf, $sf, $fa, $tp, $az, $uom, $hap);
// checks the distance
if (($lowestLevel + $allowedDistance) < $kz) {
return false;
} else {
return true;
}
return false;
} |