mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-24 20:17:13 +00:00
This commit is contained in:
@@ -390,15 +390,19 @@ class Battle {
|
|||||||
******************************************************************/
|
******************************************************************/
|
||||||
foreach ($resourcearray as $key => $value) {
|
foreach ($resourcearray as $key => $value) {
|
||||||
|
|
||||||
// faster than array_keys + strpos + preg_replace
|
// The building TYPE is stored in the 'f<n>t' columns of fdata (e.g. the
|
||||||
|
// Brewery on slot 20 is 'f20t' == 35); the matching level lives in 'f<n>'.
|
||||||
|
// Match on the 't' SUFFIX, not the first character — a previous rewrite
|
||||||
|
// tested $key[0] === 't', which never matched 'f<n>t' and made this
|
||||||
|
// return 0 for every building (issue #294: Brewery bonus never applied).
|
||||||
|
// Mirrors Building::getTypeLevel()/Automation::getTypeLevel().
|
||||||
if (
|
if (
|
||||||
isset($value)
|
isset($value)
|
||||||
&& $value == $tid
|
&& $value == $tid
|
||||||
&& isset($key[0])
|
&& strpos($key, 't') !== false
|
||||||
&& $key[0] === 't'
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$keyholder[] = (int)substr($key, 1);
|
$keyholder[] = (int)preg_replace('/[^0-9]/', '', $key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$element = count($keyholder);
|
$element = count($keyholder);
|
||||||
|
|||||||
Reference in New Issue
Block a user