--- deliantra/server/lib/cf.pm 2007/01/01 11:21:55 1.110 +++ deliantra/server/lib/cf.pm 2007/01/01 12:28:47 1.111 @@ -1122,6 +1122,7 @@ $map or return; + $map->{load_original} = 1; $map->{instantiate_time} = $cf::RUNTIME; $map->instantiate; @@ -1152,6 +1153,8 @@ $self->load_objects ($self->{load_path}, 1) or return; + $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1) if delete $self->{load_original}; + if (my $uniq = $path->uniq_path) { utf8::encode $uniq; if (aio_open $uniq, O_RDONLY, 0) { @@ -1237,8 +1240,18 @@ #return unless $map->reset_timeout; my $time = $map->fixed_resettime ? $map->{instantiate_time} : $map->last_access; + my $to = $map->reset_timeout || $DEFAULT_RESET; + $to = $MAX_RESET if $to > $MAX_RESET; - $time + ($map->reset_timeout || $DEFAULT_RESET) < $cf::RUNTIME + $time + $to < $cf::RUNTIME +} + +sub unlink_save { + my ($self) = @_; + + utf8::encode (my $save = $self->{path}->save_path); + aioreq_pri 3; IO::AIO::aio_unlink $save; + aioreq_pri 3; IO::AIO::aio_unlink "$save.pst"; } sub reset { @@ -1249,15 +1262,12 @@ warn "resetting map ", $self->path;#d# - utf8::encode (my $save = $self->{path}->save_path); - aioreq_pri 3; IO::AIO::aio_unlink $save; - aioreq_pri 3; IO::AIO::aio_unlink "$save.pst"; + delete $cf::MAP{$self->path}; $_->clear_links_to ($self) for values %cf::MAP; - $self->clear; - $self->in_memory (cf::MAP_SWAPPED); - utf8::encode ($self->{load_path} = $self->{path}->load_path); + $self->unlink_save; + $self->destroy; } sub customise_for { @@ -1828,7 +1838,7 @@ ############################################################################# # initialisation -sub perl_reload() { +sub reload() { # can/must only be called in main if ($Coro::current != $Coro::main) { warn "can only reload from main coroutine\n"; @@ -1965,12 +1975,12 @@ register "", __PACKAGE__; -register_command "perl-reload" => sub { +register_command "reload" => sub { my ($who, $arg) = @_; if ($who->flag (FLAG_WIZ)) { $who->message ("start of reload."); - perl_reload; + reload; $who->message ("end of reload."); } };