--- deliantra/Deliantra/Deliantra.pm 2007/02/06 22:08:14 1.80 +++ deliantra/Deliantra/Deliantra.pm 2007/02/06 22:27:44 1.81 @@ -423,7 +423,7 @@ } elsif (/^(\S+)\s*(.*)$/) { $arc{lc $1} = $2; } elsif (/^\s*#/) { - $arc{_comment} .= $_; + $arc{_comment} .= "$_\n"; } elsif (/^\s*$/) { # @@ -439,11 +439,10 @@ s/\s+$//; if (/^more$/i) { $more = $prev; - } elsif (/^\s*#/) { - $comment .= $_; } elsif (/^object (\S+)$/i) { my $name = $1; my $arc = attr_thaw normalize_object $parse_block->(_name => $name, _comment => $comment); + undef $comment; delete $arc{_comment} unless length $arc{_comment}; $arc->{_atype} = 'object'; @@ -457,6 +456,7 @@ } elsif (/^arch (\S+)$/i) { my $name = $1; my $arc = attr_thaw normalize_arch $parse_block->(_name => $name, _comment => $comment); + undef $comment; delete $arc{_comment} unless length $arc{_comment}; $arc->{_atype} = 'arch'; @@ -476,6 +476,8 @@ } else { $toplevel->{$1} = $2; } + } elsif (/^\s*#/) { + $comment .= "$_\n"; } elsif (/^\s*($|#)/) { # } else { @@ -505,9 +507,15 @@ | (delete $a{attack_movement_bits_4_7}); } + if (my $comment = delete $a{_comment}) { + if ($comment =~ /[^\n\s#]/) { + $str .= $comment; + } + } + $str .= ((exists $a{_atype}) ? $a{_atype} : 'arch'). " $a{_name}\n"; - my $inv = delete $a{inventory}; + my $inv = delete $a{inventory}; my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some my $anim = delete $a{anim}; @@ -573,9 +581,13 @@ $str .= "end\n"; - if (($a{_atype} eq 'object') && $more) { - $str .= "\nmore\n"; - $append->($more) if $more; + if ($a{_atype} eq 'object') { + if ($more) { + $str .= "more\n"; + $append->($more) if $more; + } else { + $str .= "\n"; + } } };