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.37 by root, Sun Mar 12 23:21:53 2006 UTC vs.
Revision 1.46 by root, Thu Mar 16 01:34:01 2006 UTC

263 my ($a) = @_; 263 my ($a) = @_;
264 264
265 my $o = $ARCH{$a->{_name}} 265 my $o = $ARCH{$a->{_name}}
266 or return; 266 or return;
267 267
268 my $face = $FACE{$a->{face} || $o->{face}} 268 my $face = $FACE{$a->{face} || $o->{face} || "blank.111"}
269 or (warn "no face data found for arch '$a->{_name}'"), return; 269 or (warn "no face data found for arch '$a->{_name}'"), return;
270 270
271 if ($face->{w} > 1 || $face->{h} > 1) { 271 if ($face->{w} > 1 || $face->{h} > 1) {
272 # bigface 272 # bigface
273 return (0, 0, $face->{w} - 1, $face->{h} - 1); 273 return (0, 0, $face->{w} - 1, $face->{h} - 1);
305 import 305 import
306 306
307=cut 307=cut
308 308
309sub arch_attr($) { 309sub arch_attr($) {
310 my ($arch) = @_; 310 my ($obj) = @_;
311 311
312 require Crossfire::Data; 312 require Crossfire::Data;
313 313
314 my $root; 314 my $root;
315
316 my $arch = $ARCH{ $obj->{_name} };
317 my $type = $obj->{type} || $arch->{type};
315 318
316 if ($arch->{type} > 0) { 319 if ($type > 0) {
317 $root = $Crossfire::Data::ATTR{$arch->{type}+0}; 320 $root = $Crossfire::Data::ATTR{$type};
318 } else { 321 } else {
319 $root = $Crossfire::Data::TYPE{Misc}; 322 $root = $Crossfire::Data::TYPE{Misc};
320 323
321 type: 324 type:
322 for (@Crossfire::Data::ATTR0) { 325 for (@Crossfire::Data::ATTR0) {
324 or die "internal error: ATTR0 without 'required'"; 327 or die "internal error: ATTR0 without 'required'";
325 328
326 keys %$req; 329 keys %$req;
327 while (my ($k, $v) = each %$req) { 330 while (my ($k, $v) = each %$req) {
328 next type 331 next type
329 unless $arch->{$k} == $v; 332 unless $obj->{$k} eq $v || $arch->{$k} eq $v;
330 } 333 }
331 334
332 $root = $_; 335 $root = $_;
333 } 336 }
334 } 337 }
335 338
336 my $attr = { }; 339 my $attr = { };
337 340
338 my @import = $root || \%Crossfire::Data::DEFAULT_ATTR; 341 my @import = (\%Crossfire::Data::DEFAULT_ATTR, $root);
339 my (%ignore); 342 my (%ignore);
340 my (@section_order, %section, @attr_order); 343 my (@section_order, %section, @attr_order);
341 344
342 while (my $type = shift @import) { 345 while (my $type = shift @import) {
343 push @import, @{$type->{import} || []}; 346 push @import, @{$type->{import} || []};
347 350
348 for (@{$type->{ignore} || []}) { 351 for (@{$type->{ignore} || []}) {
349 $ignore{$_}++ for ref $_ ? @$_ : $_; 352 $ignore{$_}++ for ref $_ ? @$_ : $_;
350 } 353 }
351 354
352 for ([general => ($type->{attr} || {})], @{$type->{section} || []}) { 355 for ([general => ($type->{attr} || [])], @{$type->{section} || []}) {
353 my ($name, $attr) = @$_; 356 my ($name, $attr) = @$_;
354 push @section_order, $name; 357 push @section_order, $name;
355 for (@$attr) { 358 for (@$attr) {
356 my ($k, $v) = @$_; 359 my ($k, $v) = @$_;
357 push @attr_order, $k; 360 push @attr_order, $k;
364 map !exists $section{$_} ? () : do { 367 map !exists $section{$_} ? () : do {
365 my $attr = delete $section{$_}; 368 my $attr = delete $section{$_};
366 369
367 [ 370 [
368 $_, 371 $_,
369 map exists $attr->{$_} && !ignore{$_} ? [$_ => delete $attr->{$_}] : (), 372 map exists $attr->{$_} && !$ignore{$_}
373 ? [$_ => delete $attr->{$_}] : (),
370 @attr_order 374 @attr_order
371 ] 375 ]
372 }, 376 },
373 377
374 exists $section{$_} ? [$_ => delete $section{$_}] : (), 378 exists $section{$_} ? [$_ => delete $section{$_}] : (),
375 @section_order 379 @section_order
376 ]; 380 ];
377
378 use PApp::Util;
379 warn PApp::Util::dumpval $attr;
380 381
381 $attr 382 $attr
382} 383}
383 384
384sub arch_edit_sections { 385sub arch_edit_sections {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines