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.80 by root, Tue Feb 6 22:08:14 2007 UTC vs.
Revision 1.81 by root, Tue Feb 6 22:27:44 2007 UTC

421 push @{ $arc{anim} }, $_; 421 push @{ $arc{anim} }, $_;
422 } 422 }
423 } elsif (/^(\S+)\s*(.*)$/) { 423 } elsif (/^(\S+)\s*(.*)$/) {
424 $arc{lc $1} = $2; 424 $arc{lc $1} = $2;
425 } elsif (/^\s*#/) { 425 } elsif (/^\s*#/) {
426 $arc{_comment} .= $_; 426 $arc{_comment} .= "$_\n";
427 427
428 } elsif (/^\s*$/) { 428 } elsif (/^\s*$/) {
429 # 429 #
430 } else { 430 } else {
431 warn "$path: unparsable line '$_' in arch $arc{_name}"; 431 warn "$path: unparsable line '$_' in arch $arc{_name}";
437 437
438 while (<$fh>) { 438 while (<$fh>) {
439 s/\s+$//; 439 s/\s+$//;
440 if (/^more$/i) { 440 if (/^more$/i) {
441 $more = $prev; 441 $more = $prev;
442 } elsif (/^\s*#/) {
443 $comment .= $_;
444 } elsif (/^object (\S+)$/i) { 442 } elsif (/^object (\S+)$/i) {
445 my $name = $1; 443 my $name = $1;
446 my $arc = attr_thaw normalize_object $parse_block->(_name => $name, _comment => $comment); 444 my $arc = attr_thaw normalize_object $parse_block->(_name => $name, _comment => $comment);
445 undef $comment;
447 delete $arc{_comment} unless length $arc{_comment}; 446 delete $arc{_comment} unless length $arc{_comment};
448 $arc->{_atype} = 'object'; 447 $arc->{_atype} = 'object';
449 448
450 if ($more) { 449 if ($more) {
451 $more->{more} = $arc; 450 $more->{more} = $arc;
455 $prev = $arc; 454 $prev = $arc;
456 $more = undef; 455 $more = undef;
457 } elsif (/^arch (\S+)$/i) { 456 } elsif (/^arch (\S+)$/i) {
458 my $name = $1; 457 my $name = $1;
459 my $arc = attr_thaw normalize_arch $parse_block->(_name => $name, _comment => $comment); 458 my $arc = attr_thaw normalize_arch $parse_block->(_name => $name, _comment => $comment);
459 undef $comment;
460 delete $arc{_comment} unless length $arc{_comment}; 460 delete $arc{_comment} unless length $arc{_comment};
461 $arc->{_atype} = 'arch'; 461 $arc->{_atype} = 'arch';
462 462
463 if ($more) { 463 if ($more) {
464 $more->{more} = $arc; 464 $more->{more} = $arc;
474 push @{$toplevel->{lev_array}}, $_+0; 474 push @{$toplevel->{lev_array}}, $_+0;
475 } 475 }
476 } else { 476 } else {
477 $toplevel->{$1} = $2; 477 $toplevel->{$1} = $2;
478 } 478 }
479 } elsif (/^\s*#/) {
480 $comment .= "$_\n";
479 } elsif (/^\s*($|#)/) { 481 } elsif (/^\s*($|#)/) {
480 # 482 #
481 } else { 483 } else {
482 die "$path: unparseable top-level line '$_'"; 484 die "$path: unparseable top-level line '$_'";
483 } 485 }
503 if (exists $a{attack_movement_bits_0_3} or exists $a{attack_movement_bits_4_7}) { 505 if (exists $a{attack_movement_bits_0_3} or exists $a{attack_movement_bits_4_7}) {
504 $a{attack_movement} = (delete $a{attack_movement_bits_0_3}) 506 $a{attack_movement} = (delete $a{attack_movement_bits_0_3})
505 | (delete $a{attack_movement_bits_4_7}); 507 | (delete $a{attack_movement_bits_4_7});
506 } 508 }
507 509
510 if (my $comment = delete $a{_comment}) {
511 if ($comment =~ /[^\n\s#]/) {
512 $str .= $comment;
513 }
514 }
515
508 $str .= ((exists $a{_atype}) ? $a{_atype} : 'arch'). " $a{_name}\n"; 516 $str .= ((exists $a{_atype}) ? $a{_atype} : 'arch'). " $a{_name}\n";
509 517
510 my $inv = delete $a{inventory}; 518 my $inv = delete $a{inventory};
511 my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some 519 my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some
512 my $anim = delete $a{anim}; 520 my $anim = delete $a{anim};
513 521
514 my @kv; 522 my @kv;
515 523
571 if $anim; 579 if $anim;
572 } 580 }
573 581
574 $str .= "end\n"; 582 $str .= "end\n";
575 583
576 if (($a{_atype} eq 'object') && $more) { 584 if ($a{_atype} eq 'object') {
585 if ($more) {
577 $str .= "\nmore\n"; 586 $str .= "more\n";
578 $append->($more) if $more; 587 $append->($more) if $more;
588 } else {
589 $str .= "\n";
590 }
579 } 591 }
580 }; 592 };
581 593
582 for (@$arch) { 594 for (@$arch) {
583 $append->($_); 595 $append->($_);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines