--- deliantra/server/ext/map-world.ext 2007/04/18 17:32:06 1.23 +++ deliantra/server/ext/map-world.ext 2007/09/10 17:24:36 1.29 @@ -1,4 +1,4 @@ -#! perl # OPTIONAL +#! perl # optional # optional plug-in to speed up worldmap rendering by dynamically # generating it out of an image @@ -121,8 +121,12 @@ $self->tile_path (2, sprintf "/world/world_%03d_%03d", $x, $y + 1) if $y < 999; $self->tile_path (3, sprintf "/world/world_%03d_%03d", $x - 1, $y) if $x > 0; - $self->{load_path} = sprintf "%s/world-overlay/world_%03d_%03d.map", $cf::MAPDIR, $x, $y - if $x >= 100 && $x <= 129 && $y >= 100 && $y <= 129; + my $overlay = sprintf "%s/world/world_%03d_%03d.map", $cf::MAPDIR, $x, $y; + + $self->{load_path} = $overlay + unless Coro::AIO::aio_stat $overlay; + + $self->{need_create_treasure} = 1; 1 } @@ -143,27 +147,33 @@ $self->alloc; $self->fill; $self->in_memory (cf::MAP_IN_MEMORY); + $self->activate; } } sub post_load { my ($self) = @_; - my $guard = cf::lock_acquire "ext::world_gridmap"; + { + my $guard = cf::lock_acquire "ext::world_gridmap"; - my ($x, $y) = $self->wxwy; + my ($x, $y) = $self->wxwy; - if ($x >= 100 && $x <= 129 && $y >= 100 && $y <= 129) { - my $stride = $WORLD->{grid_w} * $WORLD->{tile_w}; - my $top = ($y - 100) * $WORLD->{tile_h} * $stride - + ($x - 100) * $WORLD->{tile_w}; + if ($x >= 100 && $x <= 129 && $y >= 100 && $y <= 129) { + my $stride = $WORLD->{grid_w} * $WORLD->{tile_w}; + my $top = ($y - 100) * $WORLD->{tile_h} * $stride + + ($x - 100) * $WORLD->{tile_w}; - $self->add_underlay ($WORLD->{arc_data}, $top, $stride, $WORLD->{arc_plt}); - $self->set_regiondata ($WORLD->{reg_data}, $top, $stride, $WORLD->{reg_plt}); + $self->add_underlay ($WORLD->{arc_data}, $top, $stride, $WORLD->{arc_plt}); + $self->set_regiondata ($WORLD->{reg_data}, $top, $stride, $WORLD->{reg_plt}); - } else { - $self->fill; + } else { + $self->fill; + } } + + $self->create_region_treasure + if delete $self->{need_create_treasure}; } 1