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:
iopietro
2018-04-29 00:49:24 +02:00
parent 48410e960b
commit a40accc101
11 changed files with 201 additions and 454 deletions
+2 -2
View File
@@ -123,7 +123,7 @@ class Market
$coor = $database->getCoor($id);
if($database->getVillageState($id))
{
$timetaken = $generator->procDistanceTime($coor,$village->coor,$session->tribe,0);
$timetaken = $generator->procDistanceTime($coor, $village->coor, $session->tribe, 0);
$res = $resource[0]+$resource[1]+$resource[2]+$resource[3];
if($res!=0)
{
@@ -308,7 +308,7 @@ class Market
foreach($displayarray as $value)
{
$targetcoor = $database->getCoor($value['vref']);
$duration = $generator->procDistanceTime($targetcoor,$village->coor,$session->tribe,0);
$duration = $generator->procDistanceTime($targetcoor, $village->coor, $session->tribe, 0);
if($duration <= ($value['maxtime'] * 3600) || $value['maxtime'] == 0)
{
$value['duration'] = $duration;