… | |
… | |
224 | } |
224 | } |
225 | |
225 | |
226 | \%paths |
226 | \%paths |
227 | } |
227 | } |
228 | |
228 | |
|
|
229 | =item ($minx, $miny, $maxx, $maxy) = arch_extents $arch |
|
|
230 | |
229 | # arch_extents determines the extents of a given arch |
231 | arch_extents determines the extents of the given arch's face(s), linked |
230 | # bigfaces, linked faces and single faces are handled here |
232 | faces and single faces are handled here it returns (minx, miny, maxx, |
231 | # it returns (minx, miny, maxx, maxy) |
233 | maxy) |
|
|
234 | |
|
|
235 | =cut |
|
|
236 | |
232 | sub arch_extents { |
237 | sub arch_extents { |
233 | my ($a) = @_; |
238 | my ($a) = @_; |
234 | |
239 | |
235 | my $o = $ARCH{$a->{_name}} |
240 | my $o = $ARCH{$a->{_name}} |
236 | or return; |
241 | or return; |
… | |
… | |
265 | my ($cachedir) = @_; |
270 | my ($cachedir) = @_; |
266 | |
271 | |
267 | return if %ARCH; |
272 | return if %ARCH; |
268 | |
273 | |
269 | *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; |
274 | *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; |
|
|
275 | } |
|
|
276 | |
|
|
277 | =item $type = arch_attr $arch |
|
|
278 | |
|
|
279 | Returns a hashref describing the object and its attributes. It can contain |
|
|
280 | the following keys: |
|
|
281 | |
|
|
282 | name the name, suitable for display purposes |
|
|
283 | ignore |
|
|
284 | attr |
|
|
285 | desc |
|
|
286 | use |
|
|
287 | section => [name => \%attr, name => \%attr] |
|
|
288 | import |
|
|
289 | |
|
|
290 | =cut |
|
|
291 | |
|
|
292 | sub arch_attr($) { |
|
|
293 | my ($arch) = @_; |
|
|
294 | |
|
|
295 | require Crossfire::Data; |
|
|
296 | |
|
|
297 | my $attr; |
|
|
298 | |
|
|
299 | if ($arch->{type} > 0) { |
|
|
300 | $attr = $Crossfire::Data::ATTR{$arch->{type}+0}; |
|
|
301 | } else { |
|
|
302 | $attr = $Crossfire::Data::TYPE{Misc}; |
|
|
303 | |
|
|
304 | type: |
|
|
305 | for (@Crossfire::Data::ATTR0) { |
|
|
306 | my $req = $_->{required} |
|
|
307 | or die "internal error: ATTR0 without 'required'"; |
|
|
308 | |
|
|
309 | while (my ($k, $v) = each %$req) { |
|
|
310 | next type |
|
|
311 | unless $arch->{$k} == $v; |
|
|
312 | } |
|
|
313 | |
|
|
314 | $attr = $_; |
|
|
315 | } |
|
|
316 | } |
|
|
317 | |
|
|
318 | use PApp::Util; |
|
|
319 | warn PApp::Util::dumpval $attr; |
|
|
320 | |
|
|
321 | $attr || \%Crossfire::Data::DEFAULT_ATTR; |
270 | } |
322 | } |
271 | |
323 | |
272 | sub arch_edit_sections { |
324 | sub arch_edit_sections { |
273 | # if (edit_type == IGUIConstants.TILE_EDIT_NONE) |
325 | # if (edit_type == IGUIConstants.TILE_EDIT_NONE) |
274 | # edit_type = 0; |
326 | # edit_type = 0; |