function rail_ironhorse_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "moderate":
            $args['Riding the Train'] = "Riding the Train";
            break;
        case "newday":
            if (rail_discard_item("railpass_active")) {
                output("`2The `bImprobable Island Railway Company`b rail pass you used yesterday has mysteriously vanished from your card case! Oh well, they did say that it was only good for one day.`n`n");
            }
            if (rail_discard_item("railpassfirst_active")) {
                output("`2The `bImprobable Island Railway Company`b First Class rail pass you used yesterday has mysteriously vanished from your card case! Oh well, they did say that it was only good for one day.`n`n");
            }
            break;
        case "improbablehousing_interior":
            $hid = $args['hid'];
            $rid = $args['rid'];
            $locs = rail_ironhorse_getlocs();
            $station = 0;
            foreach ($locs as $loc => $locarray) {
                if ($hid == $locarray[0] && $rid == $locarray[1]) {
                    if (!($loc == "WA") && !($loc == "DB")) {
                        // Ah, found it! We're in a train station
                        $station = 1;
                        break;
                        // no need to keep looking through the rest of the array
                    }
                }
            }
            if ($station) {
                if (rail_ironhorse_canboard()) {
                    output("`2A lonesome whistle wails. Distant chuffing grows closer and louder. Is it...? Yes, it is! The train is here! With another very long blast on the whistle, clanging bell, hissing clouds of steam, and wheels screeching steel-on-steel, the great black `~`bsteam engine`b`2 pulls into the station.`0`n`n");
                    addnav("All aboard!");
                    addnav("Board the train", "runmodule.php?module=rail_ironhorse&op=board&hid={$hid}&rid={$rid}");
                }
                // stationmaster interaction
                $val = rail_collector_valuehand();
                //				debug($val);
                if ($val['firstclass'] && $val['value'] > 0) {
                    output("`2Ah! You seem to be in luck. The busy stationmaster is here today.`0`n`n");
                    addnav("Stationmaster");
                    addnav("Ask about rail passes", "runmodule.php?module=rail_ironhorse&op=stationmaster&hid={$hid}&rid={$rid}");
                }
            }
            break;
    }
    return $args;
}
function rail_ironhorse_activatepass($pass)
{
    // remove railpass or railpassfirst, and replace with railpass_active or railpassfirst_active
    $activepass = $pass . "_active";
    rail_discard_item($pass);
    give_item($activepass);
    return true;
}