--- deliantra/server/lib/cf.pm 2007/01/10 01:16:54 1.157 +++ deliantra/server/lib/cf.pm 2007/01/10 19:52:43 1.158 @@ -369,6 +369,9 @@ package cf::path; +use overload + '""' => \&as_string; + # used to convert map paths into valid unix filenames by repalcing / by ∕ our $PATH_SEP = "∕"; # U+2215, chosen purely for visual reasons @@ -387,6 +390,8 @@ # ~/... per-player maps without a specific player (DO NOT USE) # ~user/... per-player map of a specific user + $path =~ s/$PATH_SEP/\//go; + if ($path =~ /^{/) { # fine as it is } elsif ($path =~ s{^\?random/}{}) { @@ -1242,9 +1247,8 @@ for (@$files) { utf8::decode $_; next if /\.(?:pl|pst)$/; - next unless /^$PATH_SEP/; + next unless /^$PATH_SEP/o; - s/$PATH_SEP/\//g; push @paths, new cf::path "~" . $pl->ob->name . "/" . $_; } @@ -1634,6 +1638,30 @@ $map } +=item cf::map::unique_maps + +Returns an arrayref of cf::path's of all shared maps that have +instantiated unique items. May block. + +=cut + +sub unique_maps() { + my $files = aio_readdir cf::localdir . "/" . cf::uniquedir + or return; + + my @paths; + + for (@$files) { + utf8::decode $_; + next if /\.pst$/; + next unless /^$PATH_SEP/o; + + push @paths, new cf::path $_; + } + + \@paths +} + package cf; =back @@ -1812,7 +1840,6 @@ my ($self, $path, $x, $y) = @_; $path = new cf::path $path; - $path ne "/" or Carp::cluck ("oy");#d# $self->enter_link; @@ -1899,7 +1926,7 @@ }) { $self->message ("Something went wrong deep within the crossfire server. " . "I'll try to bring you back to the map you were before. " - . "Please report this to the dungeon master", + . "Please report this to the dungeon master!", cf::NDI_UNIQUE | cf::NDI_RED); warn "ERROR in enter_exit: $@";