ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Games-Sokoban/Sokoban.pm
(Generate patch)

Comparing Games-Sokoban/Sokoban.pm (file contents):
Revision 1.6 by root, Tue May 11 23:49:40 2010 UTC vs.
Revision 1.8 by root, Wed May 12 00:24:37 2010 UTC

163 "$self->{data}\n" 163 "$self->{data}\n"
164} 164}
165 165
166=item $binary = $level->as_binpack 166=item $binary = $level->as_binpack
167 167
168Binpack is a very compact binary format (usually 17% of the size of an xsb
169file), that is still reasonably easy to encode/decode.
170
171It only tries to store simplified levels with full fidelity - other levels
172can be slightly changed outside the playable area.
173
168=cut 174=cut
169 175
170sub as_binpack { 176sub as_binpack {
171 my ($self) = @_; 177 my ($self) = @_;
172 178
402 while (<$fh>) { 408 while (<$fh>) {
403 $data .= $_; 409 $data .= $_;
404 last if /^$/; 410 last if /^$/;
405 } 411 }
406 412
413 # sokevo internally locks some cells
414 $data =~ y/^%:,;-=?/ #.$* +#/;
415
407 push @levels, new Games::Sokoban data => $data; 416 push @levels, new Games::Sokoban data => $data;
408 } 417 }
409 } 418 }
410 419
411 \@levels 420 \@levels

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines