$alliance,
'population' => $pop,
'color' => $ColorIndex[$i]
);
if (!empty($Alliance[$aid]['alliance'])) {
if (!isset($ColorIndex[$i+1])) {
$i = 255;
} else {
$i++;
}
}
}
//echo "
"; print_r($Alliance); echo "
";
$i = 0;
for ($ty=-400; $ty<=400; $ty=$ty+10) {
for ($tx=-400; $tx<=400; $tx=$tx+10) {
$basequery = sprintf("SELECT aid FROM `%s` WHERE aid!=0 and SQRT(POW(ABS(x-%d),2)+POW(ABS(y-%d),2)) < %d GROUP BY aid ORDER BY sum(population) DESC limit 0,1", $table, $tx, $ty, 20);
$Result = mysql_query($basequery) or die(mysql_error());
//printf("%d,%d - %s
\n", $tx, $ty, $Alliance[$aid]['alliance']);
//$ty = 9000;
list($aid) = mysql_fetch_row($Result);
if (!empty($Alliance[$aid]['alliance'])) {
//marker($tx, $ty, 20, $Alliance[$aid]['color']);
marker($tx, $ty, 20, pow($aid,3));
if ($aid != $Old['aid']) {
marktest($Old['x'], $Old['y'], 20, $Alliance[$Old['aid']]['alliance'], $ColorIndex);
$Old['x'] = $tx;
$Old['y'] = $ty;
$Old['aid'] = $aid;
}
}
if (isset($ColorIndex[$i+1])) { $i++; } else { $i = 0; }
$aid = 0;
}
}
for ($y=-400; $y<=400; $y++) {
for ($x=-400; $x<=400; $x++) {
if ($x == 0 || $y == 0) { dot($x, $y, $ColorIndex[256]); }
}
}
// Select the HTTP-Header for the selected filetype
header("Content-Type: image/png");
// Generate image and print it
imagepng($image);
// imagepng($image,"../travian.scrolls.org/maps/".$table.".png");
?>