… | |
… | |
143 | $self->SUPER::load; |
143 | $self->SUPER::load; |
144 | } else { |
144 | } else { |
145 | $self->alloc; |
145 | $self->alloc; |
146 | $self->fill; |
146 | $self->fill; |
147 | $self->in_memory (cf::MAP_IN_MEMORY); |
147 | $self->in_memory (cf::MAP_IN_MEMORY); |
|
|
148 | $self->activate; |
148 | } |
149 | } |
149 | } |
150 | } |
150 | |
151 | |
151 | sub post_load { |
152 | sub post_load { |
152 | my ($self) = @_; |
153 | my ($self) = @_; |
153 | |
154 | |
|
|
155 | { |
154 | my $guard = cf::lock_acquire "ext::world_gridmap"; |
156 | my $guard = cf::lock_acquire "ext::world_gridmap"; |
155 | |
157 | |
156 | my ($x, $y) = $self->wxwy; |
158 | my ($x, $y) = $self->wxwy; |
157 | |
159 | |
158 | if ($x >= 100 && $x <= 129 && $y >= 100 && $y <= 129) { |
160 | if ($x >= 100 && $x <= 129 && $y >= 100 && $y <= 129) { |
159 | my $stride = $WORLD->{grid_w} * $WORLD->{tile_w}; |
161 | my $stride = $WORLD->{grid_w} * $WORLD->{tile_w}; |
160 | my $top = ($y - 100) * $WORLD->{tile_h} * $stride |
162 | my $top = ($y - 100) * $WORLD->{tile_h} * $stride |
161 | + ($x - 100) * $WORLD->{tile_w}; |
163 | + ($x - 100) * $WORLD->{tile_w}; |
162 | |
164 | |
163 | $self->add_underlay ($WORLD->{arc_data}, $top, $stride, $WORLD->{arc_plt}); |
165 | $self->add_underlay ($WORLD->{arc_data}, $top, $stride, $WORLD->{arc_plt}); |
164 | $self->set_regiondata ($WORLD->{reg_data}, $top, $stride, $WORLD->{reg_plt}); |
166 | $self->set_regiondata ($WORLD->{reg_data}, $top, $stride, $WORLD->{reg_plt}); |
165 | |
167 | |
166 | } else { |
168 | } else { |
167 | $self->fill; |
169 | $self->fill; |
|
|
170 | } |
168 | } |
171 | } |
169 | |
172 | |
170 | if (delete $self->{need_create_treasure}) { |
|
|
171 | $self->create_region_treasure; |
173 | $self->create_region_treasure |
172 | # TODO: temporary? hack to fix multipart objects because treausres only create the head |
174 | if delete $self->{need_create_treasure}; |
173 | $self->link_multipart_objects; |
|
|
174 | } |
|
|
175 | } |
175 | } |
176 | |
176 | |
177 | 1 |
177 | 1 |
178 | |
178 | |