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

Comparing deliantra/server/ext/map-world.ext (file contents):
Revision 1.3 by root, Sun Jan 21 13:08:36 2007 UTC vs.
Revision 1.6 by root, Wed Jan 24 03:13:21 2007 UTC

38 $self->tile_path (2, sprintf "/world/world_%03d_%03d", $x, $y + 1) if $y < 999; 38 $self->tile_path (2, sprintf "/world/world_%03d_%03d", $x, $y + 1) if $y < 999;
39 $self->tile_path (3, sprintf "/world/world_%03d_%03d", $x - 1, $y) if $x > 0; 39 $self->tile_path (3, sprintf "/world/world_%03d_%03d", $x - 1, $y) if $x > 0;
40 40
41 $self->outdoor (1); 41 $self->outdoor (1);
42 42
43 $self->name ("'The World' at +$x+$y");
43 $self->msg ("worldmap dynamically created by map-world extension"); 44 $self->msg ("worldmap dynamically created by map-world extension");
44 45
45 #TODO: region 46 #TODO: region
46 47
47 $self->{load_path} = sprintf "%s/%s/world-overlay/world_%03d_%03d", cf::datadir, cf::mapdir, $x, $y 48 $self->{load_path} = sprintf "%s/%s/world-overlay/world_%03d_%03d", cf::datadir, cf::mapdir, $x, $y
76sub post_load { 77sub post_load {
77 my ($self) = @_; 78 my ($self) = @_;
78 79
79 my ($x, $y) = $self->wxwy; 80 my ($x, $y) = $self->wxwy;
80 81
82 return
83 unless $x >= $WORLD->{minx} && $x <= $WORLD->{maxx}
84 && $y >= $WORLD->{miny} && $y <= $WORLD->{maxy};
85
81 my $stride = ($WORLD->{maxx} - $WORLD->{minx} + 1) * $WORLD->{tilew}; 86 my $stride = ($WORLD->{maxx} - $WORLD->{minx} + 1) * $WORLD->{tilew};
82 my $top = ($y - $WORLD->{miny}) * $WORLD->{tileh} * $stride 87 my $top = ($y - $WORLD->{miny}) * $WORLD->{tileh} * $stride
83 + ($x - $WORLD->{minx}) * $WORLD->{tilew}; 88 + ($x - $WORLD->{minx}) * $WORLD->{tilew};
84 89
85 for my $Y (0 .. $WORLD->{tileh} - 1) { 90 for my $Y (0 .. $WORLD->{tileh} - 1) {
87 my $row = substr $WORLD->{data}, $top + $Y * $stride, $WORLD->{tilew}; 92 my $row = substr $WORLD->{data}, $top + $Y * $stride, $WORLD->{tilew};
88 for my $X (0 .. $WORLD->{tilew} - 1) { 93 for my $X (0 .. $WORLD->{tilew} - 1) {
89 next if grep $_->flag (cf::FLAG_IS_FLOOR), $self->at ($X, $Y); 94 next if grep $_->flag (cf::FLAG_IS_FLOOR), $self->at ($X, $Y);
90 my $ob = cf::object::new $WORLD->{arch}[ord substr $row, $X]; 95 my $ob = cf::object::new $WORLD->{arch}[ord substr $row, $X];
91 $ob->flag (cf::FLAG_NO_MAP_SAVE, 1); 96 $ob->flag (cf::FLAG_NO_MAP_SAVE, 1);
92 $self->insert ($ob, $X, $Y); 97 $self->insert ($ob, $X, $Y, undef, cf::INS_ABOVE_FLOOR_ONLY);
93 } 98 }
94 } 99 }
95} 100}
96 101
971 1021

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines