… | |
… | |
817 | (aio_load "$filename.pst", $av) >= 0 |
817 | (aio_load "$filename.pst", $av) >= 0 |
818 | or return; |
818 | or return; |
819 | $av = eval { (Storable::thaw $av)->{objs} }; |
819 | $av = eval { (Storable::thaw $av)->{objs} }; |
820 | } |
820 | } |
821 | |
821 | |
|
|
822 | warn sprintf "loading %s (%d)\n", |
|
|
823 | $filename, length $data, scalar @{$av || []};#d# |
822 | return ($data, $av); |
824 | return ($data, $av); |
823 | } |
825 | } |
824 | |
826 | |
825 | ############################################################################# |
827 | ############################################################################# |
826 | # command handling &c |
828 | # command handling &c |
… | |
… | |
1140 | $map->instantiate; |
1142 | $map->instantiate; |
1141 | |
1143 | |
1142 | # per-player maps become, after loading, normal maps |
1144 | # per-player maps become, after loading, normal maps |
1143 | $map->per_player (0) if $path->{user_rel}; |
1145 | $map->per_player (0) if $path->{user_rel}; |
1144 | } |
1146 | } |
|
|
1147 | #Coro::Timer::sleep 1;#d# |
1145 | |
1148 | |
1146 | $map->path ($key); |
1149 | $map->path ($key); |
1147 | $map->{path} = $path; |
1150 | $map->{path} = $path; |
|
|
1151 | $map->{last_save} = $cf::RUNTIME; |
1148 | $map->last_access ($cf::RUNTIME); |
1152 | $map->last_access ($cf::RUNTIME); |
1149 | |
1153 | |
1150 | if ($map->should_reset) { |
1154 | if ($map->should_reset) { |
1151 | $map->reset; |
1155 | $map->reset; |
1152 | $map = find_map $path; |
1156 | $map = find_map $path; |
… | |
… | |
1213 | } |
1217 | } |
1214 | |
1218 | |
1215 | sub save { |
1219 | sub save { |
1216 | my ($self) = @_; |
1220 | my ($self) = @_; |
1217 | |
1221 | |
|
|
1222 | $self->{last_save} = $cf::RUNTIME; |
|
|
1223 | |
|
|
1224 | return unless $self->dirty; |
|
|
1225 | |
1218 | my $save = $self->{path}->save_path; utf8::encode $save; |
1226 | my $save = $self->{path}->save_path; utf8::encode $save; |
1219 | my $uniq = $self->{path}->uniq_path; utf8::encode $uniq; |
1227 | my $uniq = $self->{path}->uniq_path; utf8::encode $uniq; |
1220 | |
|
|
1221 | $self->{last_save} = $cf::RUNTIME; |
|
|
1222 | |
|
|
1223 | return unless $self->dirty; |
|
|
1224 | |
1228 | |
1225 | $self->{load_path} = $save; |
1229 | $self->{load_path} = $save; |
1226 | |
1230 | |
1227 | return if $self->{deny_save}; |
1231 | return if $self->{deny_save}; |
1228 | |
1232 | |
… | |
… | |
1443 | |
1447 | |
1444 | $self->activate_recursive; |
1448 | $self->activate_recursive; |
1445 | $self->enter_map ($map, $x, $y); |
1449 | $self->enter_map ($map, $x, $y); |
1446 | } |
1450 | } |
1447 | |
1451 | |
1448 | =item $player_object->goto_map ($map, $x, $y) |
1452 | =item $player_object->goto_map ($path, $x, $y) |
1449 | |
1453 | |
1450 | =cut |
1454 | =cut |
1451 | |
1455 | |
1452 | sub cf::object::player::goto_map { |
1456 | sub cf::object::player::goto_map { |
1453 | my ($self, $path, $x, $y) = @_; |
1457 | my ($self, $path, $x, $y) = @_; |