… | |
… | |
78 | my $max_line_height = 1; |
78 | my $max_line_height = 1; |
79 | |
79 | |
80 | for (my $i = 0; $i < $num; $i++) { |
80 | for (my $i = 0; $i < $num; $i++) { |
81 | # check whether this tile was already written (see below at (b)) |
81 | # check whether this tile was already written (see below at (b)) |
82 | unless (defined $map->{map}[$x][$y]) { |
82 | unless (defined $map->{map}[$x][$y]) { |
83 | my ($x1, $y1, $x2, $y2) = arch_extents ${$archs->[$i]}; |
83 | my ($x1, $y1, $x2, $y2) = arch_extents $archs->[$i]; |
84 | |
84 | |
85 | if ($x + $x2 - $x1 + 1 > $width) { |
85 | if ($x + $x2 - $x1 + 1 > $width) { |
86 | $y += $max_line_height; |
86 | $y += $max_line_height; |
87 | $max_line_height = 1; |
87 | $max_line_height = 1; |
88 | $x = 0; |
88 | $x = 0; |
89 | } |
89 | } |
90 | |
90 | |
91 | $map->{map}[$x - $x1][$y - $y1] = [${$archs->[$i]}]; |
91 | $map->{map}[$x - $x1][$y - $y1] = [$archs->[$i]]; |
92 | |
92 | |
93 | $x += $x2 - $x1 + 1; |
93 | $x += $x2 - $x1 + 1; |
94 | |
94 | |
95 | $max_line_height = List::Util::max $max_line_height, $y2 - $y1 + 1; |
95 | $max_line_height = List::Util::max $max_line_height, $y2 - $y1 + 1; |
96 | |
96 | |