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 | |
5 | cf::map->register (qr{^/world/world_(-?\d+)_(-?\d+)(?:_(-?\d+))?$}, 100); |
5 | cf::map->register (qr{^/world/world_(-?\d+)_(-?\d+)(?:_(-?\d+))?$}, 100); |
6 | |
6 | |
… | |
… | |
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 | |
123 | sub 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->in_memory (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 |
137 | sub post_load { |
142 | sub post_load { |
138 | my ($self) = @_; |
143 | my ($self) = @_; |
139 | |
144 | |