--- deliantra/server/ext/map-world.ext 2011/04/22 06:10:33 1.41 +++ deliantra/server/ext/map-world.ext 2011/05/04 07:41:13 1.44 @@ -1,4 +1,4 @@ -#! perl # optional +#! perl # mandatory # manages the worldmap by directing to other handlers @@ -48,18 +48,18 @@ my ($x, $y, $z) = @$self{qw(x y z)} = ($1, $2, $3+0); # find handler for this area - for (@AREAS) { - if ( $_->{x0} <= $x && $x <= $_->{x1} - && $_->{y0} <= $y && $y <= $_->{y1} - && $_->{z0} <= $z && $z <= $_->{z1} + for my $meta (@AREAS) { + if ( $meta->{x0} <= $x && $x <= $meta->{x1} + && $meta->{y0} <= $y && $y <= $meta->{y1} + && $meta->{z0} <= $z && $z <= $meta->{z1} ) { - $self->{ox} = $x - $_->{x0}; - $self->{oy} = $y - $_->{y0}; - $self->{oz} = $z - $_->{z0}; + $self->{ox} = $x - $meta->{x0}; + $self->{oy} = $y - $meta->{y0}; + $self->{oz} = $z - $meta->{z0}; - bless $self, $_->{pkg}; + bless $self, $meta->{pkg}; - $self->init_worldmap; + $self->init_worldmap ($meta); last; } @@ -120,18 +120,23 @@ } } -sub load { - my ($self) = @_; - - if ($self->{load_path}) { - $self->SUPER::load; - } else { - $self->alloc; - $self->fill; - $self->in_memory (cf::MAP_ACTIVE); - $self->activate; - } -} +#sub load { +# my ($self) = @_; +# +# if ($self->{load_path}) { +# warn "load $self\n";#d# +# $self->SUPER::load; +# } else { +# warn "fill $self\n";#d# +# my $guard = cf::lock_acquire "map_data:$self->{path}"; +# +# $self->alloc; +# $self->fill; +# $self->state (cf::MAP_ACTIVE); +# $self->activate; +# $self->post_load; +# } +#} # MUST be overwritten to call at least ->fill sub post_load {