$params = array(); $DEBUG = 0; // 0 means turn off debugging; 1 means turn on debugging // population control $where = "username='******' and race <> 'Dwarf'"; $result = mysql_query("select count(id) from phaos_characters where {$where}"); list($count) = mysql_fetch_row($result); //number of $lowerlimit = 3000; $upperlimit = $lowerlimit + 200; if ($count > $upperlimit) { $delta = 3 + (int) (($count - $upperlimit) / 100); $result = mysql_query("select id,location,username,name,race from phaos_characters where {$where} order by rand() LIMIT {$delta}"); while ($row = mysql_fetch_assoc($result)) { $mob = new character($row['id']); $mob->kill_characterid(); } } //@$_COOKIE['_speed'] is just a HACK to speed up testing on my PC, which is very slow if ($count < $lowerlimit) { $n = ceil(sqrt($lowerlimit - $count) * 0.2 * (@$_COOKIE['_speed'] ? 0.5 : 1.0)); $n > 6 and $n = 6; for ($i = 0; $i < $n; ++$i) { npcgen(); } } if (@$_COOKIE['_timing']) { echo "time end pop control=" . endTiming() . "<br>\n"; } // move some NPC first $npctomov = @$_COOKIE['_speed'] ? 3 : 9;