ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/minesweeper.ext
(Generate patch)

Comparing deliantra/server/ext/minesweeper.ext (file contents):
Revision 1.4 by root, Sat Jan 13 23:06:13 2007 UTC vs.
Revision 1.7 by root, Sun Jan 11 03:09:48 2009 UTC

1#! perl # MANDATORY 1#! perl # mandatory
2 2
3use Scalar::Util; 3use Scalar::Util;
4 4
5# minesweeper extension. dumb. 5# minesweeper extension. dumb.
6 6
9 9
10 if (my $teleport = $ob->{options}{"teleport_$status"}) { 10 if (my $teleport = $ob->{options}{"teleport_$status"}) {
11 my ($x, $y, $damned) = split /,/, $teleport; 11 my ($x, $y, $damned) = split /,/, $teleport;
12 my $pl = cf::player::find_active $ob->{player}; 12 my $pl = cf::player::find_active $ob->{player};
13 13
14 $pl->ob->transfer ($x, $y); 14 my $path = $pl->ob->map->path;
15
16 $pl->ob->goto ($path, $x, $y);
15 $pl->savebed ($pl->ob->map->path, $x, $y) 17 $pl->savebed ($path, $x, $y)
16 if $ob->{options}{"set_savebed_$status"}; 18 if $ob->{options}{"set_savebed_$status"};
17 } 19 }
18} 20}
19 21
20sub apply { 22sub apply {
104 106
105 # #tiles that need to be uncovered 107 # #tiles that need to be uncovered
106 $self->{todo} = $arg{width} * $arg{height} - $arg{bombs}; 108 $self->{todo} = $arg{width} * $arg{height} - $arg{bombs};
107 109
108 for (1 .. $arg{bombs}) { 110 for (1 .. $arg{bombs}) {
109 my $x = int rand $arg{width}; 111 my $x = cf::rndm $arg{width};
110 my $y = int rand $arg{height}; 112 my $y = cf::rndm $arg{height};
111 113
112 redo if $map->[$x][$y]{bomb}; 114 redo if $map->[$x][$y]{bomb};
113 115
114 $map->[$x][$y]{bomb} = 1; 116 $map->[$x][$y]{bomb} = 1;
115 } 117 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines