Difference between revisions of "Main Page"

From SfzWiki
Jump to: navigation, search
Line 25: Line 25:
  
 
[[User:Ghoulsblade|Ghoulsblade]] 17:47, 21 November 2005 (CET): i think we should keep this wiki in english, and translate the existing entries
 
[[User:Ghoulsblade|Ghoulsblade]] 17:47, 21 November 2005 (CET): i think we should keep this wiki in english, and translate the existing entries
 +
 +
 +
<code>
 +
require_once("lib.minimap.php");
 +
 +
function FindRandomStartplace () {
 +
$o = sqlgetobject("SELECT MIN(`x`) as minx,MAX(`x`) as maxx,MIN(`y`) as miny,MAX(`y`) as maxy FROM `building`");
 +
for($i=0;$i<50;++$i){
 +
$x = rand($o->minx-20,$o->maxx+20);
 +
$y = rand($o->miny-20,$o->maxy+20);
 +
$d = 20;
 +
$count = sqlgetone("SELECT COUNT(`id`) FROM `building` WHERE (".($x-$d).")<=`x` AND `x`<=(".($x+$d).") AND (".($y-$d).")<=`y` AND `y`<=(".($y+$d).")");
 +
if($count == 0)break;
 +
}
 +
return array($x,$y);
 +
}
 +
 +
 +
function TypeCheck ($arr) {
 +
if (count($arr) == 0) return "1";
 +
return "`type` = ".implode(" OR `type` = ",$arr);
 +
}
 +
</code>

Revision as of 23:45, 21 November 2005

Willkommen beim SFZ-Wiki



sfz trac


sonstiges

Ghoulsblade 17:47, 21 November 2005 (CET): i think we should keep this wiki in english, and translate the existing entries


require_once("lib.minimap.php");

function FindRandomStartplace () {
	$o = sqlgetobject("SELECT MIN(`x`) as minx,MAX(`x`) as maxx,MIN(`y`) as miny,MAX(`y`) as maxy FROM `building`");
	for($i=0;$i<50;++$i){
		$x = rand($o->minx-20,$o->maxx+20);
		$y = rand($o->miny-20,$o->maxy+20);
		$d = 20;
		$count = sqlgetone("SELECT COUNT(`id`) FROM `building` WHERE (".($x-$d).")<=`x` AND `x`<=(".($x+$d).") AND (".($y-$d).")<=`y` AND `y`<=(".($y+$d).")");
		if($count == 0)break;
	}
	return array($x,$y);
}


function TypeCheck ($arr) {
	if (count($arr) == 0) return "1";
	return "`type` = ".implode(" OR `type` = ",$arr);
}