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.41 by root, Fri Apr 22 06:10:33 2011 UTC vs.
Revision 1.44 by root, Wed May 4 07:41:13 2011 UTC

1#! perl # optional 1#! perl # mandatory
2 2
3# manages the worldmap by directing to other handlers 3# manages the worldmap by directing to other handlers
4 4
5cf::map->register (qr{^/world/world_(-?\d+)_(-?\d+)(?:_(-?\d+))?$}, 100); 5cf::map->register (qr{^/world/world_(-?\d+)_(-?\d+)(?:_(-?\d+))?$}, 100);
6 6
46 my ($self) = @_; 46 my ($self) = @_;
47 47
48 my ($x, $y, $z) = @$self{qw(x y z)} = ($1, $2, $3+0); 48 my ($x, $y, $z) = @$self{qw(x y z)} = ($1, $2, $3+0);
49 49
50 # find handler for this area 50 # find handler for this area
51 for (@AREAS) { 51 for my $meta (@AREAS) {
52 if ( $_->{x0} <= $x && $x <= $_->{x1} 52 if ( $meta->{x0} <= $x && $x <= $meta->{x1}
53 && $_->{y0} <= $y && $y <= $_->{y1} 53 && $meta->{y0} <= $y && $y <= $meta->{y1}
54 && $_->{z0} <= $z && $z <= $_->{z1} 54 && $meta->{z0} <= $z && $z <= $meta->{z1}
55 ) { 55 ) {
56 $self->{ox} = $x - $_->{x0}; 56 $self->{ox} = $x - $meta->{x0};
57 $self->{oy} = $y - $_->{y0}; 57 $self->{oy} = $y - $meta->{y0};
58 $self->{oz} = $z - $_->{z0}; 58 $self->{oz} = $z - $meta->{z0};
59 59
60 bless $self, $_->{pkg}; 60 bless $self, $meta->{pkg};
61 61
62 $self->init_worldmap; 62 $self->init_worldmap ($meta);
63 63
64 last; 64 last;
65 } 65 }
66 66
67 } 67 }
118 } else { 118 } else {
119 $self->add_underlay ("\x00" x ($TILE_W * $TILE_H), 0, $TILE_W, ["deep_sea"]); 119 $self->add_underlay ("\x00" x ($TILE_W * $TILE_H), 0, $TILE_W, ["deep_sea"]);
120 } 120 }
121} 121}
122 122
123sub load { 123#sub load {
124 my ($self) = @_; 124# my ($self) = @_;
125 125#
126 if ($self->{load_path}) { 126# if ($self->{load_path}) {
127# warn "load $self\n";#d#
127 $self->SUPER::load; 128# $self->SUPER::load;
128 } else { 129# } else {
130# warn "fill $self\n";#d#
131# my $guard = cf::lock_acquire "map_data:$self->{path}";
132#
129 $self->alloc; 133# $self->alloc;
130 $self->fill; 134# $self->fill;
131 $self->in_memory (cf::MAP_ACTIVE); 135# $self->state (cf::MAP_ACTIVE);
132 $self->activate; 136# $self->activate;
137# $self->post_load;
133 } 138# }
134} 139#}
135 140
136# MUST be overwritten to call at least ->fill 141# MUST be overwritten to call at least ->fill
137sub post_load { 142sub post_load {
138 my ($self) = @_; 143 my ($self) = @_;
139 144

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines