… | |
… | |
152 | } |
152 | } |
153 | } |
153 | } |
154 | |
154 | |
155 | =item $text = $level->as_text |
155 | =item $text = $level->as_text |
156 | |
156 | |
|
|
157 | Returns the level in xsb/text format - every row of the level is one line |
|
|
158 | ended by a newline, e.g.: |
|
|
159 | |
|
|
160 | "###\n# #\n###\n" |
|
|
161 | |
157 | =cut |
162 | =cut |
158 | |
163 | |
159 | sub as_text { |
164 | sub as_text { |
160 | my ($self) = @_; |
165 | my ($self) = @_; |
161 | |
166 | |
… | |
… | |
208 | pack "wwB*", $w - 2, $s, $data |
213 | pack "wwB*", $w - 2, $s, $data |
209 | } |
214 | } |
210 | |
215 | |
211 | =item @lines = $level->as_lines |
216 | =item @lines = $level->as_lines |
212 | |
217 | |
|
|
218 | Returns the level as a list of rows, each row is a text representation of |
|
|
219 | the respective level row, e.g.: |
|
|
220 | |
|
|
221 | ("###", "# #", "###") |
|
|
222 | |
213 | =cut |
223 | =cut |
214 | |
224 | |
215 | sub as_lines { |
225 | sub as_lines { |
216 | split /\n/, $_[0]{data} |
226 | split /\n/, $_[0]{data} |
217 | } |
227 | } |
218 | |
228 | |
219 | =item $line = $level->as_rle |
229 | =item $line = $level->as_rle |
220 | |
230 | |
221 | http://www.sokobano.de/wiki/index.php?title=Level_format |
231 | http://www.sokobano.de/wiki/index.php?title=Level_format |
|
|
232 | |
|
|
233 | Example: |
|
|
234 | |
|
|
235 | "3#|# #|3#" |
222 | |
236 | |
223 | =cut |
237 | =cut |
224 | |
238 | |
225 | sub as_rle { |
239 | sub as_rle { |
226 | my $data = $_[0]{data}; |
240 | my $data = $_[0]{data}; |