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.47 by root, Thu Mar 16 01:42:22 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
341 my @import = ($root);
342
338 my @import = $root || \%Crossfire::Data::DEFAULT_ATTR; 343 unshift @import, \%Crossfire::Data::DEFAULT_ATTR
344 unless $type == 116;
345
339 my (%ignore); 346 my (%ignore);
340 my (@section_order, %section, @attr_order); 347 my (@section_order, %section, @attr_order);
341 348
342 while (my $type = shift @import) { 349 while (my $type = shift @import) {
343 push @import, @{$type->{import} || []}; 350 push @import, @{$type->{import} || []};
347 354
348 for (@{$type->{ignore} || []}) { 355 for (@{$type->{ignore} || []}) {
349 $ignore{$_}++ for ref $_ ? @$_ : $_; 356 $ignore{$_}++ for ref $_ ? @$_ : $_;
350 } 357 }
351 358
352 for ([general => ($type->{attr} || {})], @{$type->{section} || []}) { 359 for ([general => ($type->{attr} || [])], @{$type->{section} || []}) {
353 my ($name, $attr) = @$_; 360 my ($name, $attr) = @$_;
354 push @section_order, $name; 361 push @section_order, $name;
355 for (@$attr) { 362 for (@$attr) {
356 my ($k, $v) = @$_; 363 my ($k, $v) = @$_;
357 push @attr_order, $k; 364 push @attr_order, $k;
364 map !exists $section{$_} ? () : do { 371 map !exists $section{$_} ? () : do {
365 my $attr = delete $section{$_}; 372 my $attr = delete $section{$_};
366 373
367 [ 374 [
368 $_, 375 $_,
369 map exists $attr->{$_} && !ignore{$_} ? [$_ => delete $attr->{$_}] : (), 376 map exists $attr->{$_} && !$ignore{$_}
377 ? [$_ => delete $attr->{$_}] : (),
370 @attr_order 378 @attr_order
371 ] 379 ]
372 }, 380 },
373 381
374 exists $section{$_} ? [$_ => delete $section{$_}] : (), 382 exists $section{$_} ? [$_ => delete $section{$_}] : (),
375 @section_order 383 @section_order
376 ]; 384 ];
377
378 use PApp::Util;
379 warn PApp::Util::dumpval $attr;
380 385
381 $attr 386 $attr
382} 387}
383 388
384sub arch_edit_sections { 389sub arch_edit_sections {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines