--- deliantra/server/ext/map-world.ext 2007/02/13 22:37:33 1.14 +++ deliantra/server/ext/map-world.ext 2007/02/17 02:34:45 1.18 @@ -81,7 +81,7 @@ ($map->{arc_data}, $map->{arc_plt}) = load_indexed "$path/gridmap.arch", $size; ($map->{reg_data}, $map->{reg_plt}) = load_indexed "$path/gridmap.regn", $size; - Storable::nstore $map, "/tmp/xxxx.gridmap";#d# + Storable::nstore $map, "/tmp/xxxx.gridmap" if 0;#d# $map } else { @@ -136,16 +136,8 @@ sub fill { my ($self) = @_; - for my $X (0 .. $WORLD->{tile_w} - 1) { - Coro::cede; - for my $Y (0 .. $WORLD->{tile_h} - 1) { - my $ob = cf::object::new "deep_sea"; - $ob->flag (cf::FLAG_NO_MAP_SAVE, 1); - $self->insert ($ob, $X, $Y, undef, cf::INS_ABOVE_FLOOR_ONLY); - } - } - $self->set_object_flag (cf::FLAG_NO_MAP_SAVE, 1); - $self->default_region (cf::region::find "panthalassia"); + $self->add_underlay ("\x00" x ($WORLD->{tile_w} * $WORLD->{tile_h}), 0, $WORLD->{tile_w}, $WORLD->{arc_plt}); + $self->default_region (cf::region::find $WORLD->{reg_plt}[0]); } sub load { @@ -172,21 +164,9 @@ my $top = ($y - 100) * $WORLD->{tile_h} * $stride + ($x - 100) * $WORLD->{tile_w}; - my $reg; - - for my $Y (0 .. $WORLD->{tile_h} - 1) { - Coro::cede; - my $row = substr $WORLD->{arc_data}, $top + $Y * $stride, $WORLD->{tile_w}; - $reg .= substr $WORLD->{reg_data}, $top + $Y * $stride, $WORLD->{tile_w}; - for my $X (0 .. $WORLD->{tile_w} - 1) { - next if grep $_->flag (cf::FLAG_IS_FLOOR), $self->at ($X, $Y); - my $ob = cf::object::new $WORLD->{arc_plt}[ord substr $row, $X]; - $ob->flag (cf::FLAG_NO_MAP_SAVE, 1); - $self->insert ($ob, $X, $Y, undef, cf::INS_ABOVE_FLOOR_ONLY); - } - } + $self->add_underlay ($WORLD->{arc_data}, $top, $stride, $WORLD->{arc_plt}); + $self->set_regiondata ($WORLD->{reg_data}, $top, $stride, $WORLD->{reg_plt}); - $self->set_regiondata ($reg, $WORLD->{reg_plt}); } else { $self->fill; }