function improbablehousing_stakeable($loc)
{
    global $session;
    if (has_item('housing_stake')) {
        //debug("Has Stake");
        list($worldmapX, $worldmapY, $worldmapZ) = explode(",", $loc);
        require_once "modules/worldmapen/lib.php";
        $terrain = worldmapen_getTerrain($worldmapX, $worldmapY, $worldmapZ);
        if ($terrain['type'] != "River" && $terrain['type'] != "Ocean" && $terrain['type'] != "Swamp") {
            //For now, no river, ocean or swamp houses
            $list = improbablehousing_getnearbyhouses($loc);
            $nlist = count($list);
            //todo: make this a setting
            $maxhousespersquare = 4;
            if ($nlist < $maxhousespersquare) {
                addnav("Set up a new dwelling");
                addnav("Stake your claim!", "runmodule.php?module=improbablehousing&op=stakeclaim");
            } else {
                addnav("Set up a new dwelling");
                addnav("You can't set up a new dwelling here because there are already too many houses.");
            }
        }
    }
}
     rawoutput("<a href=\"moderate.php?op=dwellchat&hid={$hid}&rid={$rid}&x={$x}&y={$y}\">" . $room . "</a>");
     addnav("", "moderate.php?op=dwellchat&hid={$hid}&rid={$rid}&x={$x}&y={$y}");
     rawoutput(" | <a href=\"moderate.php?op=dwellmap&x={$x}&y={$y}\">");
     output("Accessible Dwellings at %s", $maploc);
     rawoutput("</a>");
     addnav("", "moderate.php?op=dwellmap&x={$x}&y={$y}");
     output("`b`n");
     viewcommentary($room, "Intervene:", 100);
     break;
 case "dwellmap":
     $x = httpget('x');
     $y = httpget('y');
     $maploc = $x . "," . $y . ",1";
     require_once "modules/improbablehousing/lib/lib.php";
     global $session;
     $list = improbablehousing_getnearbyhouses($maploc);
     $nlist = count($list);
     output("`bAccessible Dwellings at %s`b`n", $maploc);
     if ($nlist) {
         for ($i = 0; $i < $nlist; $i++) {
             $house = $list[$i];
             $house = improbablehousing_canenter_house($house);
             if ($house['canenter']) {
                 // assemble dwelling code here
                 $nrooms = count($house['data']['rooms']);
                 if ($nrooms) {
                     output("`n%s`0 (owner: %s)`n", $house['data']['name'], moderate_getlogin($house['ownedby']));
                     $hid = $house['id'];
                     foreach ($house['data']['rooms'] as $rid => $roomdet) {
                         if (improbablehousing_canenter_room($house, $rid)) {
                             rawoutput("<a href=\"moderate.php?op=dwellchat&hid={$hid}&rid={$rid}&x={$x}&y={$y}\">" . "[Mod]" . "</a>");