ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-grid-move-random.ext
(Generate patch)

Comparing deliantra/server/ext/map-grid-move-random.ext (file contents):
Revision 1.2 by root, Sun Sep 30 16:24:29 2007 UTC vs.
Revision 1.3 by root, Thu Apr 22 12:50:24 2010 UTC

16 my $num = $opt{"num_" . $ob->name} || 1; 16 my $num = $opt{"num_" . $ob->name} || 1;
17 17
18 for (1 .. $num) { 18 for (1 .. $num) {
19 my $ob = $ob->clone (0); 19 my $ob = $ob->clone (0);
20 20
21 $who->map->insert ($ob, $x1 + rand $opt{width}, $y1 + rand $opt{height}); 21 $who->map->insert ($ob, $x1 + cf::rndm $opt{width}, $y1 + cf::rndm $opt{height});
22 22
23 push @{ $opt{ob} }, $ob; 23 push @{ $opt{ob} }, $ob;
24 } 24 }
25 } 25 }
26 26
30 my ($x2, $y2) = ($x1 + $self->{width} - 1, $y1 + $self->{height} - 1); 30 my ($x2, $y2) = ($x1 + $self->{width} - 1, $y1 + $self->{height} - 1);
31 31
32 for my $ob (@{$self->{ob}}) { 32 for my $ob (@{$self->{ob}}) {
33 my ($x, $y) = ($ob->x, $ob->y); 33 my ($x, $y) = ($ob->x, $ob->y);
34 34
35 if (0.5 <= rand) { 35 if (0.5 <= cf::rndm) {
36 $x += 1 - int rand 3; 36 $x += 1 - cf::rndm 3;
37 } else { 37 } else {
38 $y += 1 - int rand 3; 38 $y += 1 - cf::rndm 3;
39 } 39 }
40 40
41 $x = List::Util::max $x1, List::Util::min $x2, $x; 41 $x = List::Util::max $x1, List::Util::min $x2, $x;
42 $y = List::Util::max $y1, List::Util::min $y2, $y; 42 $y = List::Util::max $y1, List::Util::min $y2, $y;
43 43

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines