ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/Util.pm
(Generate patch)

Comparing deliantra/gde/GCE/Util.pm (file contents):
Revision 1.14 by elmex, Sun Apr 2 09:54:18 2006 UTC vs.
Revision 1.20 by elmex, Mon Aug 14 18:52:48 2006 UTC

18use Crossfire; 18use Crossfire;
19use Crossfire::MapWidget; 19use Crossfire::MapWidget;
20use File::Spec::Functions; 20use File::Spec::Functions;
21use Cwd 'abs_path'; 21use Cwd 'abs_path';
22 22
23our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget quick_msg def arch_is_exit map2abs exit_paths pseudohtml2txt); 23our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb
24 fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall
25 stack_find arch_is_wall arch_is_monster add_table_widget quick_msg
26 def arch_is_exit map2abs exit_paths pseudohtml2txt arch_is_connector);
24 27
25sub pseudohtml2txt { 28sub pseudohtml2txt {
26 my ($html) = @_; 29 my ($html) = @_;
27 30
28 $html =~ s/<br\s*?\/?>/\n/gsi; 31 $html =~ s/<br\s*?\/?>/\n/gsi;
29 $html =~ s/<b>(.*?)<\/b>/_\1_/gsi; 32 $html =~ s/<b>(.*?)<\/b>/_\1_/gsi;
33 $html =~ s/<li>/\n* /gi;
34 $html =~ s/<\/?\s*li>//gi;
35 $html =~ s/<\/?\s*ul>//gi;
36 $html =~ s/&gt;/>/g;
37 $html =~ s/&lt;/</g;
30 $html 38 $html
31} 39}
32 40
33sub exit_paths { 41sub exit_paths {
34 my ($mappath, $map1path, $map2path) = @_; 42 my ($mappath, $map1path, $map2path) = @_;
60} 68}
61 69
62sub map2abs { 70sub map2abs {
63 my ($dest, $mape) = @_; 71 my ($dest, $mape) = @_;
64 72
73 $mappath = abs_path $mappath;
65 my $dir; 74 my $dir;
66 if (File::Spec->file_name_is_absolute($dest)) { 75 if (File::Spec->file_name_is_absolute($dest)) {
67 $dir = catdir ($::CFG->{MAPDIR}, $dest); 76 $dir = catdir ($::CFG->{MAPDIR}, $dest);
68 } else { 77 } else {
69 my ($v, $p, $f) = File::Spec->splitpath ($mape->{path}); 78 my ($v, $p, $f) = File::Spec->splitpath ($mape->{path});
147} 156}
148 157
149sub arch_is_floor { 158sub arch_is_floor {
150 my ($a) = @_; 159 my ($a) = @_;
151 my $ar = Crossfire::arch_attr $a; 160 my $ar = Crossfire::arch_attr $a;
161 return (
152 return (substr $ar->{name}, 0, 5) eq 'Floor'; 162 (substr $ar->{name}, 0, 5) eq 'Floor'
153#return $Crossfire::ARCH{$a->{_name}}->{is_floor}; 163 or (substr $ar->{name}, 0, 10) eq 'Shop Floor'
164 )
165}
166
167sub arch_is_connector {
168 my ($a) = @_;
169 my $ar = Crossfire::arch_attr $a;
170 my $has_connect_field = 0;
171
172 TOP: for (@{$ar->{section}}) {
173 my $name = shift @$_;
174 my @r = @$_;
175 if ($name eq 'general') {
176 for (@r) {
177 my ($k, $s) = ($_->[0], $_->[1]);
178 if ($k eq 'connected' && $s->{name} eq 'connection') {
179 $has_connect_field = 1;
180 last TOP;
181 }
182 }
183 last TOP;
184 }
185 }
186
187 return $has_connect_field;
154} 188}
155 189
156sub arch_is_wall { 190sub arch_is_wall {
157 my ($a) = @_; 191 my ($a) = @_;
158 my $ar = Crossfire::arch_attr $a; 192 my $ar = Crossfire::arch_attr $a;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines