… | |
… | |
272 | return if %ARCH; |
272 | return if %ARCH; |
273 | |
273 | |
274 | *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; |
274 | *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; |
275 | } |
275 | } |
276 | |
276 | |
277 | =item $data = arch_attr $arch |
277 | =item $type = arch_attr $arch |
278 | |
278 | |
279 | Returns a hashref describing the object and its attributes. It can contain |
279 | Returns a hashref describing the object and its attributes. It can contain |
280 | the following keys: |
280 | the following keys: |
281 | |
281 | |
282 | name the name, suitable for display purposes |
282 | name the name, suitable for display purposes |
283 | ignore |
283 | ignore |
284 | attr |
284 | attr |
285 | desc |
285 | desc |
286 | use |
286 | use |
287 | section => [name => \%attr, name => \%attr] |
287 | section => [name => \%attr, name => \%attr] |
|
|
288 | import |
288 | |
289 | |
289 | =cut |
290 | =cut |
290 | |
291 | |
291 | sub arch_attr($) { |
292 | sub arch_attr($) { |
292 | my ($arch) = @_; |
293 | my ($arch) = @_; |
293 | |
294 | |
294 | require Crossfire::Data; |
295 | require Crossfire::Data; |
295 | |
296 | |
296 | my %attr; |
297 | my $attr; |
297 | |
298 | |
298 | if ($arch->{type} > 0) { |
299 | if ($arch->{type} > 0) { |
299 | %attr = %{ $Crossfire::Data::ATTR{$arch->{type}+0} || {} }; |
300 | $attr = $Crossfire::Data::ATTR{$arch->{type}+0}; |
300 | } else { |
301 | } else { |
301 | die; |
302 | $attr = $Crossfire::Data::TYPE{Misc}; |
302 | } |
|
|
303 | |
303 | |
304 | use PApp::Util; |
304 | type: |
305 | warn PApp::Util::dumpval \%attr; |
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 | $attr || \%Crossfire::Data::DEFAULT_ATTR; |
306 | } |
319 | } |
307 | |
320 | |
308 | sub arch_edit_sections { |
321 | sub arch_edit_sections { |
309 | # if (edit_type == IGUIConstants.TILE_EDIT_NONE) |
322 | # if (edit_type == IGUIConstants.TILE_EDIT_NONE) |
310 | # edit_type = 0; |
323 | # edit_type = 0; |