From ae58215a9e63977d8ad0020ee1d7598f568c33d4 Mon Sep 17 00:00:00 2001 From: armando1980 Date: Mon, 9 Dec 2013 18:28:46 -0500 Subject: [PATCH] if more than 400 players are registered before the 10th day if more than 400 players are registered before the 10th day since records cordenadas jump to 20 to 40 --- GameEngine/Database/db_MYSQL.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index b978a80f..f660b021 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -392,15 +392,18 @@ class MYSQL_DB { */ function generateBase($sector, $mode=1) { + $num_rows = 0; + $count_while = 0; + while (!$num_rows){ if (!$mode) { $gamesday=time()-COMMENCE; - if ($gamesday<3600*24*10) { //10 day + if ($gamesday<3600*24*10 && $count_while==0) { //10 day $wide1=1; $wide2=20; - } elseif ($gamesday<3600*24*20) { //20 day + } elseif ($gamesday<3600*24*20 && $count_while==1) { //20 day $wide1=20; $wide2=40; - } elseif ($gamesday<3600*24*30) { //30 day + } elseif ($gamesday<3600*24*30 && $count_while==2) { //30 day $wide1=40; $wide2=80; } else { // over 30 day @@ -428,6 +431,8 @@ class MYSQL_DB { } $result = mysql_query($q, $this->connection); $num_rows = mysql_num_rows($result); + $count_while++; + } $result = $this->mysql_fetch_all($result); $base = rand(0, ($num_rows-1)); return $result[$base]['id'];