… | |
… | |
68 | } |
68 | } |
69 | |
69 | |
70 | sub inst_maps($) { |
70 | sub inst_maps($) { |
71 | my (undef, $path) = @_; |
71 | my (undef, $path) = @_; |
72 | |
72 | |
73 | print "installing '$path' to '$DATADIR/maps'\n"; |
73 | print "\nInstalling '$path' to '$DATADIR/maps'\n\n"; |
74 | |
74 | |
75 | if (!-f "$path/regions") { |
75 | if (!-f "$path/regions") { |
76 | warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; |
76 | warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; |
77 | exit 1 unless $FORCE; |
77 | exit 1 unless $FORCE; |
78 | } |
78 | } |
… | |
… | |
84 | } |
84 | } |
85 | |
85 | |
86 | { |
86 | { |
87 | our %ANIMINFO; |
87 | our %ANIMINFO; |
88 | our %FACEINFO; |
88 | our %FACEINFO; |
|
|
89 | our @ARC; |
89 | our %ARC; |
90 | our %ARC; |
90 | our $TRS; |
91 | our $TRS; |
91 | our $NFILE; |
92 | our $NFILE; |
92 | |
93 | |
93 | our $QUANTIZE = "+dither -colorspace RGB -colors 256"; |
94 | our $QUANTIZE = "+dither -colorspace RGB -colors 256"; |
… | |
… | |
255 | my $arc; |
256 | my $arc; |
256 | aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ |
257 | aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ |
257 | |
258 | |
258 | my $arc = read_arch "$dir/$file"; |
259 | my $arc = read_arch "$dir/$file"; |
259 | for my $o (values %$arc) { |
260 | for my $o (values %$arc) { |
|
|
261 | push @ARC, $o; |
|
|
262 | for (my $m = $o; $m; $m = $m->{more}) { |
260 | $ARC{$o->{_name}} = $o; |
263 | $ARC{$m->{_name}} = $m; |
|
|
264 | } |
261 | |
265 | |
262 | $o->{editor_folder} = $dir; |
266 | $o->{editor_folder} = $dir; |
263 | |
267 | |
264 | my $visibility = delete $o->{visibility}; |
268 | my $visibility = delete $o->{visibility}; |
265 | my $magicmap = delete $o->{magicmap}; |
269 | my $magicmap = delete $o->{magicmap}; |
… | |
… | |
372 | } |
376 | } |
373 | |
377 | |
374 | sub inst_arch($) { |
378 | sub inst_arch($) { |
375 | my (undef, $path) = @_; |
379 | my (undef, $path) = @_; |
376 | |
380 | |
|
|
381 | print "\n", |
377 | print "Installing '$path' to '$DATADIR'\n", |
382 | "Installing '$path' to '$DATADIR'\n", |
|
|
383 | "\n", |
378 | "This can take a long time if you run this\n", |
384 | "This can take a long time if you run this\n", |
379 | "for the first time or do not use --cache.\n", |
385 | "for the first time or do not use --cache.\n", |
380 | "\n", |
386 | "\n", |
381 | "Unless you run verbosely, all following warning\n", |
387 | "Unless you run verbosely, all following warning\n", |
382 | "or error messages indicate serious problems.\n", |
388 | "or error messages indicate serious problems.\n", |
… | |
… | |
412 | if (my $s = $ARC{$other}) { |
418 | if (my $s = $ARC{$other}) { |
413 | if ($s->{inherit}) { |
419 | if ($s->{inherit}) { |
414 | $loop = $s; |
420 | $loop = $s; |
415 | } else { |
421 | } else { |
416 | delete $o->{inherit}; |
422 | delete $o->{inherit}; |
|
|
423 | my %s = %$s; |
|
|
424 | delete @s{qw(_name more name name_pl)}; |
417 | %$o = ( %$s, %$o ); |
425 | %$o = ( %s, %$o ); |
418 | ++$progress; |
426 | ++$progress; |
419 | } |
427 | } |
420 | } else { |
428 | } else { |
421 | warn "'$o->{_name}' tries to inherit from undefined archetype '$other', skipping.\n"; |
429 | warn "'$o->{_name}' tries to inherit from undefined archetype '$other', skipping.\n"; |
422 | delete $ARC{$o->{_name}}; |
430 | delete $ARC{$o->{_name}}; |
… | |
… | |
432 | } |
440 | } |
433 | } |
441 | } |
434 | |
442 | |
435 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
443 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
436 | or die "$DATADIR/archetypes~: $!"; |
444 | or die "$DATADIR/archetypes~: $!"; |
437 | print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } values %ARC]; |
445 | print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; |
438 | } |
446 | } |
439 | |
447 | |
440 | { |
448 | { |
441 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
449 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
442 | or die "$DATADIR/treasures~: $!"; |
450 | or die "$DATADIR/treasures~: $!"; |