fix: fix various PHP problems and a few bugs

This commit is contained in:
Emmanuel BENOîT 2024-12-31 11:24:12 +01:00
parent c91440af72
commit a4b45ddaa4
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
34 changed files with 27 additions and 66 deletions
scripts/game
beta5
main/ticks/deathofrats

View file

@ -26,11 +26,12 @@ class beta5_fleet_sendMoveMessages {
$ownArrivals = array();
while ($r = dbFetchArray($q)) {
list($player,$status,$location) = $r;
$status = (int) $status;
$oa = $ha = $hd = $fa = $fd = array();
// Generate the list of fleet departures
if (is_array($this->lib->mainClass->fleetDepartures[$location])) {
foreach ($this->lib->mainClass->fleetDepartures[$location][(int)$status] as $fId) {
foreach ($this->lib->mainClass->fleetDepartures[$location][$status] as $fId) {
$f = $this->lib->call('get', $fId);
if ($f['owner'] == $player) {
continue;
@ -48,7 +49,7 @@ class beta5_fleet_sendMoveMessages {
// Generate the list of fleet arrivals
if (is_array($this->lib->mainClass->fleetArrivals[$location])) {
foreach ($this->lib->mainClass->fleetArrivals[$location][(int)$status] as $fdt) {
foreach ($this->lib->mainClass->fleetArrivals[$location][$status] as $fdt) {
list($fId, $from) = $fdt;
$f = $this->lib->call('get', $fId);
$f['from'] = $from;

View file

@ -105,10 +105,12 @@ class beta5_listing {
$rStr = array("$nMD5#$nPages");
foreach ($data as $e) {
$a = array();
l::debug("\$a is " . var_export($a, true));
foreach ($conf['output'] as $f) {
array_push($a, utf8entities($e[$f]));
l::debug("\$a is " . var_export($a, true));
}
array_push($rStr, join($a, "#"));
array_push($rStr, join("#", $a));
}
return join("\n", $rStr);

View file

@ -99,7 +99,7 @@ class beta5_updateRankings {
$income += $ir[0];
}
$upkeep = $this->fleets->call('getUpkeep', $r[0], $fld[0], $fld[1], $fld[2], $fld[3]);
$profit = max(0, $income[0] - $upkeep);
$profit = max(0, $income - $upkeep);
$fr = round($cash / 2000);
$fr += round($profit / 2) + round($income / 1.5);
$fr += round($pld[1] * 201);

View file

@ -513,7 +513,7 @@ class beta5_ticks_battle_library {
function btQuery($q) {
$r = $this->db->query($q);
l::trace("Result '$r' for query: $q");
//l::trace("Result '$r' for query: $q");
return $r;
}
}

View file

@ -105,7 +105,7 @@ class beta5_ticks_hour_library {
$losses = array();
$planets = array();
foreach ($fWait as $fw) {
if ($this->handleWait($fw, &$losses)) {
if ($this->handleWait($fw, $losses)) {
array_push($planets, $fw['drop_point']);
}
}

View file

@ -633,7 +633,7 @@ class main_ticks_deathofrats_library {
"SELECT account, tracking, ip_addr, action, t FROM account_log "
. "WHERE action IN ('IN', 'OUT', 'CREATE') "
. "AND t > {$this->lastExec} AND t <= {$this->now}"
. "ORDER BY t"
. " ORDER BY t"
);
$records = array();
while ($r = dbFetchHash($q)) {