… | |
… | |
4 | # tags that point to one of the maps given on the commandline |
4 | # tags that point to one of the maps given on the commandline |
5 | # (which must be relative paths starting at .!) |
5 | # (which must be relative paths starting at .!) |
6 | |
6 | |
7 | use strict; |
7 | use strict; |
8 | |
8 | |
9 | use Crossfire; |
9 | use Deliantra; |
10 | use Crossfire::Map; |
10 | use Deliantra::Map; |
11 | use Tie::Cache; |
11 | use Tie::Cache; |
12 | use Errno; |
12 | use Errno; |
13 | |
13 | |
14 | { |
14 | { |
15 | package mapcache; |
15 | package mapcache; |
16 | |
16 | |
17 | use base Tie::Cache::; |
17 | use base Tie::Cache::; |
18 | |
18 | |
19 | sub read { |
19 | sub read { |
20 | my $map = eval { |
20 | my $map = eval { |
21 | new_from_file Crossfire::Map $_[1] |
21 | new_from_file Deliantra::Map $_[1] |
22 | }; |
22 | }; |
23 | |
23 | |
24 | if ($@) { |
24 | if ($@) { |
25 | die unless $@ =~ /No such file or directory/; |
25 | die unless $@ =~ /No such file or directory/; |
26 | warn $@; |
26 | warn $@; |
… | |
… | |
40 | |
40 | |
41 | our %map; |
41 | our %map; |
42 | tie %map, mapcache::, 100, { Debug => 0, WriteSync => 0 } |
42 | tie %map, mapcache::, 100, { Debug => 0, WriteSync => 0 } |
43 | or die; |
43 | or die; |
44 | |
44 | |
45 | Crossfire::load_archetypes; |
45 | Deliantra::load_archetypes; |
46 | |
46 | |
47 | sub expand { |
47 | sub expand { |
48 | my ($path, $base) = @_; |
48 | my ($path, $base) = @_; |
49 | |
49 | |
50 | $path =~ s/\.map$//; |
50 | $path =~ s/\.map$//; |
… | |
… | |
139 | for my $fy (0 .. $map->{info}{height} - 1) { |
139 | for my $fy (0 .. $map->{info}{height} - 1) { |
140 | my $space = $map->{map}[$fx][$fy] |
140 | my $space = $map->{map}[$fx][$fy] |
141 | or next; |
141 | or next; |
142 | |
142 | |
143 | for my $o (@$space) { |
143 | for my $o (@$space) { |
144 | my $a = $Crossfire::ARCH{$o->{_name}} |
144 | my $a = $Deliantra::ARCH{$o->{_name}} |
145 | or next; |
145 | or next; |
146 | |
146 | |
147 | if ($is_exit{$o->{type} || $a->{type}}) { |
147 | if ($is_exit{$o->{type} || $a->{type}}) { |
148 | my ($exit, $x, $y) = ($o->{slaying}, $o->{hp}, $o->{sp}); |
148 | my ($exit, $x, $y) = ($o->{slaying}, $o->{hp}, $o->{sp}); |
149 | if ($exit =~ /^[\/0-9a-zA-Z\.]/ && $exit ne "/!") { |
149 | if ($exit =~ /^[\/0-9a-zA-Z\.]/ && $exit ne "/!") { |