$stackedrooms += 1;
                        }
                    }
                }
            }
        }
        if ($stackedrooms) {
            if ($stackedrooms == 1) {
                output("`c`b`\$Careful!`0`b`nYou've already set up a build job to create a new room branching from this one!  If you add a new build job, then you and your friends will be able to perform this new room creation once the current room size creation is finished.  In other words, you can have multiple build jobs queued up per room, but you can only add materials to them sequentially.`c`n`n");
            } else {
                output("`c`b`\$Careful!`0`b`nYou've already set up a build job to create %s new rooms branching from this one!  If you add a further build job, then you and your friends will have to complete the new rooms in sequence.`c`n`n", $stackedrooms);
            }
        }
        addnav("Confirm");
        addnav("Yeah, do it!", "runmodule.php?module=improbablehousing&op=buildjobs&sub=newroom-confirm&hid={$hid}&rid={$rid}");
        break;
    case "increasesize-confirm":
        output("You've started a new build job to increase the size of this room!`n`n");
        $newjob = array("name" => "Room Size Increase (" . $house['data']['rooms'][$rid]['name'] . "`0)", "jobs" => array(0 => array("name" => "Add wood", "iitems" => array("wood" => 1, "toolbox_carpentry" => 1), "actions" => array("Carpentry" => 1), "req" => 20, "done" => 0, "desc" => "You set about hammering and sawing.  Before too long, the room expansion is one step closer to completion."), 1 => array("name" => "Add stone", "iitems" => array("stone" => 1, "toolbox_masonry" => 1), "actions" => array("Masonry" => 1), "req" => 5, "done" => 0, "desc" => "You set about chiseling and tinkering.  Before too long, the room expansion is one step closer to completion.")), "completioneffects" => array("rooms" => array($rid => array("deltas" => array("size" => 1), "newsleepslots" => array(0 => array("name" => "Floor space", "stamina" => 50000, "desc" => "You settle down for a good night's kip on the floor.")))), "msg" => "The room expansion is now complete!"));
        $house['data']['buildjobs'][] = $newjob;
        improbablehousing_sethousedata($house);
        break;
    case "newroom-confirm":
        output("You've started a new build job to create a new room.  Have at it!`n`n");
        $newjob = array("name" => "New Room Construction (extension from " . $house['data']['rooms'][$rid]['name'] . "`0)", "jobs" => array(0 => array("name" => "Add wood", "iitems" => array("wood" => 1, "toolbox_carpentry" => 1), "actions" => array("Carpentry" => 1), "req" => 70, "done" => 0, "desc" => "You set about hammering and sawing.  Before too long, the new room is one step closer to completion."), 1 => array("name" => "Add stone", "iitems" => array("stone" => 1, "toolbox_masonry" => 1), "actions" => array("Masonry" => 1), "req" => 20, "done" => 0, "desc" => "You set about chiseling and tinkering.  Before too long, the new room is one step closer to completion.")), "completioneffects" => array("newrooms" => array(0 => array("name" => "Extension", "size" => 1, "enterfrom" => $rid, "desc" => "You're standing in a small, undecorated extension room.", "sleepslots" => array())), "msg" => "The new room is now complete!"));
        $house['data']['buildjobs'][] = $newjob;
        improbablehousing_sethousedata($house);
        break;
}
improbablehousing_bottomnavs($house, $rid);
page_footer();
        $actinfo = process_action("Decorating");
        if ($actinfo['lvlinfo']['levelledup']) {
            output("`n`c`b`0You gained a level in Decorating!  You are now level %s!  This action will cost fewer Stamina points now.`b`c`n", $actinfo['lvlinfo']['newlvl']);
        }
        $house['data']['rooms'][$rid]['dec']['done'] += 1;
        //check if the job's done
        if ($house['data']['rooms'][$rid]['dec']['done'] == $house['data']['rooms'][$rid]['dec']['req']) {
            output("The decorating job is completed!  You step back and admire your work.  Pretty nice!`n`n");
            $house['data']['rooms'][$rid]['desc'] = $house['data']['rooms'][$rid]['dec']['desc'];
            unset($house['data']['rooms'][$rid]['dec']);
            $eraseroomdec = "DELETE FROM " . db_prefix("room_prefs") . " WHERE pref = 'dec' AND hid = '{$hid}' AND rid = '{$rid}'";
            db_query($eraseroomdec);
        } else {
            output("You set about painting and decorating.  Before too long, the room is one step closer to being fully decorated.`n`n");
            require_once "lib/bars.php";
            $bar = fadebar($house['data']['rooms'][$rid]['dec']['done'], $house['data']['rooms'][$rid]['dec']['req'], 150, 5);
            rawoutput("Decoration completion status: " . $bar);
            addnav("Decorate some more?");
            require_once "modules/staminasystem/lib/lib.php";
            if (get_stamina() == 100) {
                $cost = stamina_getdisplaycost("Decorating");
                addnav(array("Decorate some more (`Q%s%%`0)", $cost), "runmodule.php?module=improbablehousing&op=decorate&subop=decorate&hid={$hid}&rid={$rid}");
            } else {
                addnav("You're too tired to do any more sprucing up right now.", "");
            }
        }
        improbablehousing_sethousedata($house);
        break;
}
improbablehousing_bottomnavs($house);
page_footer();