… | |
… | |
764 | defined $path or return; |
764 | defined $path or return; |
765 | |
765 | |
766 | unlink "$path.pst"; |
766 | unlink "$path.pst"; |
767 | }; |
767 | }; |
768 | |
768 | |
769 | # old style persistent data, TODO: remove #d# |
|
|
770 | *cf::mapsupport::on_swapin = |
|
|
771 | *cf::mapsupport::on_load = sub { |
|
|
772 | my ($map) = @_; |
|
|
773 | |
|
|
774 | my $path = $map->tmpname; |
|
|
775 | $path = $map->path unless defined $path; |
|
|
776 | |
|
|
777 | open my $fh, "<:raw", "$path.cfperl" |
|
|
778 | or return; # no perl data |
|
|
779 | |
|
|
780 | my $data = Storable::thaw do { local $/; <$fh> }; |
|
|
781 | |
|
|
782 | $data->{version} <= 1 |
|
|
783 | or return; # too new |
|
|
784 | |
|
|
785 | $map->_set_obs ($data->{obs}); |
|
|
786 | $map->invoke (EVENT_MAP_UPGRADE); |
|
|
787 | }; |
|
|
788 | |
|
|
789 | attach_to_maps prio => -10000, package => cf::mapsupport::; |
769 | attach_to_maps prio => -10000, package => cf::mapsupport::; |
790 | |
770 | |
791 | ############################################################################# |
771 | ############################################################################# |
792 | # load/save perl data associated with player->ob objects |
772 | # load/save perl data associated with player->ob objects |
793 | |
773 | |