<?php
if(isset($_GET['size'])) {
$size = $_GET['size'];
} else {
$size = 1;
}
$img = ImageCreate((WORLD_MAX*2+1)*$size, (WORLD_MAX*2+1)*$size);
$white = ImageColorAllocate($img, 255, 255, 255);
// Overview
$size4 = ImageColorAllocate($img, 255, 0, 0);
$size3 = ImageColorAllocate($img, 255, 50, 0);
$size2 = ImageColorAllocate($img, 255, 100, 0);
$size1 = ImageColorAllocate($img, 255, 150, 0);
$oasisfree = ImageColorAllocate($img, 0, 150, 0);
$oasistaken = ImageColorAllocate($img, 150, 150, 0);
$free = ImageColorAllocate($img, 150, 200, 0);
// Player overview
$own = ImageColorAllocate($img, 255, 255, 0);
$ownally = ImageColorAllocate($img, 0, 0, 255);
$confederatedally = ImageColorAllocate($img, 0, 255, 0);
$napally = ImageColorAllocate($img, 0, 255, 0);
$warally = ImageColorAllocate($img, 0, 0, 0);
$x1 = (WORLD_MAX*2+1)*$size;
$y1 = $size;
for($i=0;$i < (WORLD_MAX*2+1)*(WORLD_MAX*2+1);$i++) {
$mapinfo = $database->getMInfo($i+1);
if ($y1 > (WORLD_MAX*2+1)*$size) {
$x1 -= $size;
$y1 = $size;
}
$x = $x1-$size;
$y = $y1-$size;
if ($mapinfo['occupied'] == 0) {
if($mapinfo['oasistype'] == 0) {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $free);
} else {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $oasisfree);
}
} else {
if($mapinfo['oasistype'] != 0) {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $oasistaken);
} else {
if($mapinfo['pop'] <= 50) {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $size1);
} elseif($mapinfo['pop'] <= 100) {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $size2);
} elseif($mapinfo['pop'] <= 200) {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $size3);
} else {
ImageFilledRectangle ($img, $x, $y, $x1 ,$y1, $size4);
}
}
}
$y1 += $size;
}
Header("Content-Type: image/png");
ImagePNG($img); # Hier wird das Bild PNG zugewiesen
ImageDestroy($img) # Hier wird der Speicherplatz für andere Sachen geereinigt
?>