--- deliantra/server/lib/cf.pm 2006/10/01 10:55:37 1.70 +++ deliantra/server/lib/cf.pm 2006/10/02 15:28:36 1.76 @@ -7,10 +7,14 @@ use Safe; use Safe::Hole; +use YAML::Syck (); use Time::HiRes; use Event; $Event::Eval = 1; # no idea why this is required, but it is +# work around bug in YAML::Syck - bad news for perl6, will it be as broken wrt. unicode? +$YAML::Syck::ImplicitUnicode = 1; + use strict; _init_vars; @@ -25,6 +29,10 @@ our %CFG; +our $uptime; + +$uptime ||= time; + ############################################################################# =head2 GLOBAL VARIABLES @@ -111,6 +119,8 @@ =back +=cut + ############################################################################# =head2 EVENTS AND OBJECT ATTACHMENTS @@ -423,6 +433,8 @@ =back +=cut + ############################################################################# =head2 METHODS VALID FOR ALL CORE OBJECTS @@ -764,7 +776,7 @@ or -f sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($_[0]) x 2; } -=item $player->reply ($npc, $msg[, $flags]) +=item $object->reply ($npc, $msg[, $flags]) Sends a message to the player, as if the npc C<$npc> replied. C<$npc> can be C. Does the right thing when the player is currently in a @@ -914,6 +926,8 @@ =back +=cut + ############################################################################# =head2 EXTENSION DATABASE SUPPORT @@ -1021,7 +1035,16 @@ ############################################################################# # the server's main() +sub cfg_load { + open my $fh, "<:utf8", cf::confdir . "/config" + or return; + + local $/; + *CFG = YAML::Syck::Load <$fh>; +} + sub main { + cfg_load; db_load; load_extensions; Event::loop; @@ -1083,7 +1106,8 @@ $msg->("reloading cf.pm"); require cf; - # load database again + # load config and database again + cf::cfg_load; cf::db_load; # load extensions