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

Comparing deliantra/Deliantra/Deliantra.pm (file contents):
Revision 1.10 by elmex, Mon Feb 6 23:01:31 2006 UTC vs.
Revision 1.11 by elmex, Tue Feb 7 14:30:08 2006 UTC

12 12
13use base 'Exporter'; 13use base 'Exporter';
14 14
15use Storable; 15use Storable;
16 16
17our @EXPORT = qw(read_pak read_arch arch2map $ARCH TILESIZE editor_archs arch2pickmap arch_extends); 17#XXX: The map_* procedures scream for a map-object
18
19our @EXPORT =
20 qw(read_pak read_arch arch2map $ARCH TILESIZE editor_archs
21 arch2pickmap arch_extends
22 map_get_tile_stack map_push_tile_stack map_pop_tile_stack
23 );
18 24
19our $LIB = $ENV{CROSSFIRE_LIBDIR} 25our $LIB = $ENV{CROSSFIRE_LIBDIR}
20 or die "\$CROSSFIRE_LIBDIR must be set\n"; 26 or die "\$CROSSFIRE_LIBDIR must be set\n";
21 27
22sub TILESIZE (){ 32 } 28sub TILESIZE (){ 32 }
124 130
125 \%arc 131 \%arc
126 } 132 }
127} 133}
128 134
135# returns the arch/object stack from a tile on a map
136sub map_get_tile_stack {
137 my ($map, $x, $y) = @_;
138 my $as;
139
140 if ($x > 0 || $x < $map->{width}
141 || $y > 0 || $y < $map->{height}) {
142
143 $as = $map->{map}{map}[$x][$y] || [];
144 }
145
146 return $as;
147}
148
149# pop the topmost arch/object from the stack of a tile on a map
150sub map_pop_tile_stack {
151 my ($map, $x, $y) = @_;
152
153 if ($x > 0 || $x < $map->{width}
154 || $y > 0 || $y < $map->{height}) {
155
156 pop @{$map->{map}{map}[$x][$y]};
157 }
158}
159
160# pushes the arch/object on the stack of a tile on a map
161sub map_push_tile_stack {
162 my ($map, $x, $y, $arch) = @_;
163
164 if ($x > 0 || $x < $map->{width}
165 || $y > 0 || $y < $map->{height}) {
166
167 push @{$map->{map}{map}[$x][$y]}, $arch;
168 }
169}
170
171
129# put all archs into a hash with editor_face as it's key 172# put all archs into a hash with editor_face as it's key
130# NOTE: the arrays in the hash values are references to 173# NOTE: the arrays in the hash values are references to
131# the archs from $ARCH 174# the archs from $ARCH
132sub editor_archs { 175sub editor_archs {
133 my %paths; 176 my %paths;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines