mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-17 08:41:01 +00:00
Distance calculation optimization and bug fixing
-Removed a lot of redundant code and put into a function +Fixed a bug that permitted to found a new village in already founded village +Fixed a bug that permitted to found in an oasis +Fixed a bug that permitted to hack the time you need to found a new village +Fixed a bug that permitted to found a new village to an inexistent one
This commit is contained in:
@@ -283,35 +283,8 @@ $end = $tribe * 10;
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$speeds = [];
|
||||
$scout = 1;
|
||||
|
||||
//find slowest unit.
|
||||
for($i = 1; $i <= 11; $i++)
|
||||
{
|
||||
if (isset($process['t'.$i]))
|
||||
{
|
||||
if(!empty($process['t'.$i]) && $process['t'.$i] > 0)
|
||||
{
|
||||
if ($i < 11) $speeds[] = ${'u'.(($session->tribe-1) * 10 + $i)}['speed'];
|
||||
else
|
||||
{
|
||||
$hero_unit = $database->getHeroField($uid, 'unit');
|
||||
$speeds[] = ${'u'.$hero_unit}['speed'];
|
||||
}
|
||||
if($i != 4) $scout = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($scout) $process['c'] = 1;
|
||||
|
||||
$ownVillage = $database->getCoor($village->wid);
|
||||
$from = ['x' => $ownVillage['x'], 'y' => $ownVillage['y']];
|
||||
$to = ['x' => $coor['x'], 'y' => $coor['y']];
|
||||
|
||||
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
|
||||
<?php
|
||||
$troopsTime = $units->getWalkingTroopsTime($village->wid, $process[0], $session->uid, $session->tribe, $process, 1, 't');
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user