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.16 by root, Tue Feb 21 21:37:01 2006 UTC vs.
Revision 1.21 by root, Thu Feb 23 01:55:29 2006 UTC

12 12
13use base 'Exporter'; 13use base 'Exporter';
14 14
15use Carp (); 15use Carp ();
16use Storable; 16use Storable;
17use File::Spec;
17use List::Util qw(min max); 18use List::Util qw(min max);
18 19
19#XXX: The map_* procedures scream for a map-object 20#XXX: The map_* procedures scream for a map-object
20 21
21our @EXPORT = 22our @EXPORT =
224 } 225 }
225 226
226 \%paths 227 \%paths
227} 228}
228 229
230=item ($minx, $miny, $maxx, $maxy) = arch_extents $arch
231
229# arch_extents determines the extents of a given arch 232arch_extents determines the extents of the given arch's face(s), linked
230# bigfaces, linked faces and single faces are handled here 233faces and single faces are handled here it returns (minx, miny, maxx,
231# it returns (minx, miny, maxx, maxy) 234maxy)
235
236=cut
237
232sub arch_extents { 238sub arch_extents {
233 my ($a) = @_; 239 my ($a) = @_;
234 240
235 my $o = $ARCH{$a->{_name}} 241 my $o = $ARCH{$a->{_name}}
236 or return; 242 or return;
265 my ($cachedir) = @_; 271 my ($cachedir) = @_;
266 272
267 return if %ARCH; 273 return if %ARCH;
268 274
269 *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; 275 *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst";
276}
277
278=item $type = arch_attr $arch
279
280Returns a hashref describing the object and its attributes. It can contain
281the following keys:
282
283 name the name, suitable for display purposes
284 ignore
285 attr
286 desc
287 use
288 section => [name => \%attr, name => \%attr]
289 import
290
291=cut
292
293sub arch_attr($) {
294 my ($arch) = @_;
295
296 require Crossfire::Data;
297
298 my $attr;
299
300 if ($arch->{type} > 0) {
301 $attr = $Crossfire::Data::ATTR{$arch->{type}+0};
302 } else {
303 $attr = $Crossfire::Data::TYPE{Misc};
304
305 type:
306 for (@Crossfire::Data::ATTR0) {
307 my $req = $_->{required}
308 or die "internal error: ATTR0 without 'required'";
309
310 while (my ($k, $v) = each %$req) {
311 next type
312 unless $arch->{$k} == $v;
313 }
314
315 $attr = $_;
316 }
317 }
318
319 $attr || \%Crossfire::Data::DEFAULT_ATTR;
270} 320}
271 321
272sub arch_edit_sections { 322sub arch_edit_sections {
273# if (edit_type == IGUIConstants.TILE_EDIT_NONE) 323# if (edit_type == IGUIConstants.TILE_EDIT_NONE)
274# edit_type = 0; 324# edit_type = 0;
328# return(edit_type); 378# return(edit_type);
329# 379#
330# 380#
331} 381}
332 382
333$CACHEDIR ||= "$ENV{HOME}/.crossfire"; 383$CACHEDIR ||= $ENV{HOME} ? "$ENV{HOME}/.crossfire" : File::Spec->tmpdir;
334 384
335init $CACHEDIR; 385init $CACHEDIR;
336 386
337=head1 AUTHOR 387=head1 AUTHOR
338 388

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines