here is the whole while statement:
while ($generating == yes)
{
$random_num = mt_rand (0, 32);
if ($random_num >= 0)
{
if ($random_num <= 1)
{
$random_distance = mt_rand (0.083, 0.25);
}
}
if ($random_num > 1)
{
if ($random_num <= 2)
{
$random_distance = mt_rand (0.25, 0.416);
}
}
if ($random_num > 2)
{
if ($random_num <= 4)
{
$random_distance = mt_rand (0.416, 0.583);
}
}
if ($random_num > 4)
{
if ($random_num <= 7)
{
$random_distance = mt_rand (0.583, 0.75);
}
}
// Trying something out.
if ($random_num > 7)
{
if ($random_num <= 12)
{
$random_distance = mt_rand (0.75, 0.916);
}
}
if ($random_num > 12)
{
if ($random_num <= 20)
{
$random_distance = mt_rand (0.916, 1.083);
}
}
if ($random_num > 20)
{
if ($random_num <= 25)
{
$random_distance = mt_rand (1.083, 1.25);
}
}
if ($random_num > 25)
{
if ($random_num <= 28)
{
$random_distance = mt_rand (1.25, 1.416);
}
}
if ($random_num > 28)
{
if ($random_num <= 30)
{
$random_distance = mt_rand (1.416, 1.583);
}
}
if ($random_num > 30)
{
if ($random_num <= 31)
{
$random_distance = mt_rand (1.583, 1.75);
}
}
// Line 100
if ($random_num > 31)
{
if ($random_num <= 32)
{
$random_distance = mt_rand (1.75, 1.916);
}
}
$location_d = ((pow ($location_x, 2)) + (pow ($location_y, 2)));
$location_d = pow ($location_d, 0.5);
// Determine the average distance between stars based on the distance of the origin form the center of the galaxy.
if ($location_d >= 33000) // If the origin is outside the area near Earth.
{
$medium_rd = 0.00024 * $location_d;
$medium_rd = $medium_rd - 2;
}
if ($location_d < 33000)
{
if ($location_d >= 7000) // If inside the area of Earth but outside the buldge.
{
$medium_rd = 0.00008 * $location_d;
$medium_rd = $medium_rd + 3.5;
}
}
if ($location_d < 7000) // If inside the buldge.
{
$medium_rd = 0.0004 * $location_d;
$medium_rd = $medium_rd + 1;
}
// Now determine the new distance.
$random_distance = $medium_rd * $random_distance;
// Based on the distance from the origin generate a new location.
$new_x = mt_rand (0, $random_distance);
$new_x = (round (($new_x * 10))) / 10;
$upper_y = (pow ($random_distance, 2)) - (pow ($new_x, 2));
$upper_y = pow ($upper_y, 0.5);
$new_y = mt_rand (0, $upper_y);
$new_y = (round (($new_y * 10))) / 10;
$new_z = (pow ($random_distance, 2)) - (pow ($new_x, 2)) - (pow ($new_y, 2));
$new_z = pow ($new_z, 0.5);
$new_z = (round (($new_z * 10))) / 10;
$random_num = mt_rand (0, 2);
if (random_num <= 1)
{
$new_x = -1 * $new_x;
}
$random_num = mt_rand (0, 2);
if (random_num <= 1)
{
$new_y = -1 * $new_y;
}
$random_num = mt_rand (0, 2);
if (random_num <= 1)
{
$new_z = -1 * $new_z;
}
$new_x = $new_x + $location_x;
$new_y = $new_y + $location_y;
$new_z = $new_z + $location_z;
// Determine the right delta given $random_distance.
// $fraction is the fraction of the $random_distance, which is the
$fraction = .75;
// $stars_close is the amount of stars allowed to be close to the new star.
$stars_close = 2;
$delta = 4.189 * (pow (($random_distance * $fraction), 3));
$delta = pow ($delta, 0.333);
// Determine if it is too dense.
$near_x = range (($new_x - $delta), ($new_x + $delta));
$near_y = range (($new_y - $delta), ($new_y + $delta));
$near_z = range (($new_z - $delta), ($new_z + $delta));
$query = "SELECT location_id FROM systems_location WHERE location_x='$near_x' AND location_y='$near_y' AND location_z='$near_z'";
$result = mysql_query($query)
// or die (mysql_error());
if (mysql_num_rows($result) <= 2)
{ // Available.
$generating = 'no';
}
else
{
$generating = 'yes';
}
//Determine the minimum distance. That is what is the distance stars cannot inhabit.
// $fraction is the fraction of the $random_distance, which is the
$fraction = 0.25;
$delta = 4.189 * (pow (($random_distance * $fraction), 3));
$delta = pow ($delta, 0.333);
// Determine if it is too dense.
$near_x = range (($new_x - $delta), ($new_x + $delta));
$near_y = range (($new_y - $delta), ($new_y + $delta));
$near_z = range (($new_z - $delta), ($new_z + $delta));
$query = "SELECT location_id FROM systems_location WHERE location_x='$near_x' AND location_y='$near_y' AND location_z='$near_z'";
$result = mysql_query($query)
// or die (mysql_error());
if (mysql_num_rows($result) == 0)
{ // Available.
$generating = 'no';
}
else
{
$generating = 'yes';
}
$location_newd = ((pow ($new_x, 2)) + (pow ($new_y, 2)));
$location_newd = pow ($location_newd, 0.5);
// Determine whether new location is inside bounds.
if ($location_newd <= 50000)
{
if ($location_newd < 7000)
{
$z_upper = ((2500000000 - (pow ($new_x, 2)) - (pow ($new_y, 2))) / 40000);
$z_upper = (pow ($z_upper, .5));
$z_upper = (round (($z_upper * 10))) / 10;
if ($new_z > $z_upper)
{
$generating = 'yes';
}
else
{
$generating = 'no';
}
}
if ($location_newd >= 7000)
{
$z_upper = (25000000 - (0.51 * (pow ($new_x, 2))) - (0.51 * (pow ($new_y, 2))));
$z_upper = (pow ($z_upper, .5));
$z_upper = (round (($z_upper * 10))) / 10;
if ($new_z > $z_upper)
{
$generating = 'yes';
}
else
{
$generating = 'no';
}
}
}
else
{
$generating = 'yes';
}
}
The problem is reported around the line I just told you about.