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.12 by root, Mon Feb 12 19:57:34 2007 UTC vs.
Revision 1.13 by root, Tue Feb 13 19:25:44 2007 UTC

131 if $x >= 100 && $x <= 129 && $y >= 100 && $y <= 129; 131 if $x >= 100 && $x <= 129 && $y >= 100 && $y <= 129;
132 132
133 1 133 1
134} 134}
135 135
136sub fill {
137 my ($self) = @_;
138
139 for my $X (0 .. $WORLD->{tile_w} - 1) {
140 Coro::cede;
141 for my $Y (0 .. $WORLD->{tile_h} - 1) {
142 my $ob = cf::object::new "deep_sea";
143 $ob->flag (cf::FLAG_NO_MAP_SAVE, 1);
144 $self->insert ($ob, $X, $Y, undef, cf::INS_ABOVE_FLOOR_ONLY);
145 }
146 }
147 $self->set_object_flag (cf::FLAG_NO_MAP_SAVE, 1);
148 $self->default_region (cf::region::find "panthalassia");
149}
150
136sub load { 151sub load {
137 my ($self) = @_; 152 my ($self) = @_;
138 153
139 if ($self->{load_path}) { 154 if ($self->{load_path}) {
140 $self->SUPER::load; 155 $self->SUPER::load;
141 } else { 156 } else {
142 $self->alloc; 157 $self->alloc;
143 158 $self->fill;
144 for my $X (0 .. $WORLD->{tile_w} - 1) {
145 Coro::cede;
146 for my $Y (0 .. $WORLD->{tile_h} - 1) {
147 my $ob = cf::object::new "deep_sea";
148 $ob->flag (cf::FLAG_NO_MAP_SAVE, 1);
149 $self->insert ($ob, $X, $Y);
150 }
151 }
152 $self->set_object_flag (cf::FLAG_NO_MAP_SAVE, 1);
153 $self->default_region (cf::region::find "panthalassia");
154
155 $self->in_memory (cf::MAP_IN_MEMORY); 159 $self->in_memory (cf::MAP_IN_MEMORY);
156 } 160 }
157} 161}
158 162
159sub post_load { 163sub post_load {
161 165
162 my $guard = cf::lock_acquire "ext::world_gridmap"; 166 my $guard = cf::lock_acquire "ext::world_gridmap";
163 167
164 my ($x, $y) = $self->wxwy; 168 my ($x, $y) = $self->wxwy;
165 169
166 return
167 unless $x >= 100 && $x <= 129 && $y >= 100 && $y <= 129; 170 if ($x >= 100 && $x <= 129 && $y >= 100 && $y <= 129) {
171 my $stride = $WORLD->{grid_w} * $WORLD->{tile_w};
172 my $top = ($y - 100) * $WORLD->{tile_h} * $stride
173 + ($x - 100) * $WORLD->{tile_w};
168 174
169 my $stride = $WORLD->{grid_w} * $WORLD->{tile_w}; 175 my $reg;
170 my $top = ($y - 100) * $WORLD->{tile_h} * $stride
171 + ($x - 100) * $WORLD->{tile_w};
172 176
173 my $reg; 177 for my $Y (0 .. $WORLD->{tile_h} - 1) {
178 Coro::cede;
179 my $row = substr $WORLD->{arc_data}, $top + $Y * $stride, $WORLD->{tile_w};
180 $reg .= substr $WORLD->{reg_data}, $top + $Y * $stride, $WORLD->{tile_w};
181 for my $X (0 .. $WORLD->{tile_w} - 1) {
182 next if grep $_->flag (cf::FLAG_IS_FLOOR), $self->at ($X, $Y);
183 my $ob = cf::object::new $WORLD->{arc_plt}[ord substr $row, $X];
184 $ob->flag (cf::FLAG_NO_MAP_SAVE, 1);
185 $self->insert ($ob, $X, $Y, undef, cf::INS_ABOVE_FLOOR_ONLY);
186 }
187 }
174 188
175 for my $Y (0 .. $WORLD->{tile_h} - 1) { 189 $self->set_regiondata ($reg, $WORLD->{reg_plt});
176 Coro::cede; 190 } else {
177 my $row = substr $WORLD->{arc_data}, $top + $Y * $stride, $WORLD->{tile_w}; 191 $self->fill;
178 $reg .= substr $WORLD->{reg_data}, $top + $Y * $stride, $WORLD->{tile_w};
179 for my $X (0 .. $WORLD->{tile_w} - 1) {
180 next if grep $_->flag (cf::FLAG_IS_FLOOR), $self->at ($X, $Y);
181 my $ob = cf::object::new $WORLD->{arc_plt}[ord substr $row, $X];
182 $ob->flag (cf::FLAG_NO_MAP_SAVE, 1);
183 $self->insert ($ob, $X, $Y, undef, cf::INS_ABOVE_FLOOR_ONLY);
184 }
185 } 192 }
186
187 $self->set_regiondata ($reg, $WORLD->{reg_plt});
188} 193}
189 194
1901 1951
191 196

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines