… | |
… | |
67 | } |
67 | } |
68 | |
68 | |
69 | sub inst_maps($) { |
69 | sub inst_maps($) { |
70 | my (undef, $path) = @_; |
70 | my (undef, $path) = @_; |
71 | |
71 | |
72 | print "installing '$path' to '$DATADIR/maps'\n\n"; |
72 | print "installing '$path' to '$DATADIR/maps'\n"; |
73 | |
73 | |
74 | if (!-f "$path/regions") { |
74 | if (!-f "$path/regions") { |
75 | warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; |
75 | warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; |
76 | exit 1 unless $FORCE; |
76 | exit 1 unless $FORCE; |
77 | } |
77 | } |
78 | |
78 | |
79 | system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"; |
79 | system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" |
|
|
80 | or die "map installation failed.\n"; |
|
|
81 | |
|
|
82 | print "maps installed successfully.\n"; |
80 | } |
83 | } |
81 | |
84 | |
82 | { |
85 | { |
83 | our %PNG32; |
86 | our %PNG32; |
84 | our %FACEINFO; |
87 | our %FACEINFO; |
85 | our @ARC; |
88 | our @ARC; |
86 | our $TRS; |
89 | our $TRS; |
87 | our $NFILE; |
90 | our $NFILE; |
88 | our %ANIM; |
91 | our %ANIM; |
89 | our $SMOOTH; |
|
|
90 | |
92 | |
91 | our (@png, @trs, @arc); # files we are interested in |
93 | our (@png, @trs, @arc); # files we are interested in |
92 | |
94 | |
93 | sub commit_png { |
95 | sub commit_png { |
94 | my ($name, $data) = @_; |
96 | my ($name, $data) = @_; |
… | |
… | |
254 | $info->{visibility} = $visibility if defined $visibility; |
256 | $info->{visibility} = $visibility if defined $visibility; |
255 | $info->{magicmap} = $magicmap if defined $magicmap; |
257 | $info->{magicmap} = $magicmap if defined $magicmap; |
256 | } |
258 | } |
257 | |
259 | |
258 | if (my $smooth = delete $o->{smoothface}) { |
260 | if (my $smooth = delete $o->{smoothface}) { |
259 | $SMOOTH .= "$smooth\n"; |
261 | my ($face, $smooth) = split /\s+/, $smooth; |
|
|
262 | # skip empty_S.x11, it seems to server no purpose whatsoever |
|
|
263 | # but increases bandwidth demands and worse. |
|
|
264 | unless ($smooth eq "empty_S.x11") { |
|
|
265 | $FACEINFO{$face}{smooth} = $smooth; |
|
|
266 | } |
260 | } |
267 | } |
261 | } |
268 | } |
262 | } |
269 | } |
263 | } |
270 | } |
264 | } |
271 | } |
… | |
… | |
304 | } |
311 | } |
305 | |
312 | |
306 | sub inst_arch($) { |
313 | sub inst_arch($) { |
307 | my (undef, $path) = @_; |
314 | my (undef, $path) = @_; |
308 | |
315 | |
309 | print "installing '$path' to '$DATADIR'\n\n"; |
316 | print "installing '$path' to '$DATADIR'\n"; |
310 | |
317 | |
311 | if (!-d "$path/treasures") { |
318 | if (!-d "$path/treasures") { |
312 | warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; |
319 | warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; |
313 | exit 1 unless $FORCE; |
320 | exit 1 unless $FORCE; |
314 | } |
321 | } |
… | |
… | |
334 | substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; |
341 | substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; |
335 | print $fh Crossfire::archlist_to_string \@ARC; |
342 | print $fh Crossfire::archlist_to_string \@ARC; |
336 | } |
343 | } |
337 | |
344 | |
338 | { |
345 | { |
339 | open my $fh, ">:utf8", "$DATADIR/smooth~" |
|
|
340 | or die "$DATADIR/smooth~: $!"; |
|
|
341 | print $fh $SMOOTH; |
|
|
342 | } |
|
|
343 | |
|
|
344 | { |
|
|
345 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
346 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
346 | or die "$DATADIR/treasures~: $!"; |
347 | or die "$DATADIR/treasures~: $!"; |
347 | print $fh $TRS; |
348 | print $fh $TRS; |
348 | } |
349 | } |
349 | |
350 | |
… | |
… | |
362 | or die "$DATADIR/faces~: $!"; |
363 | or die "$DATADIR/faces~: $!"; |
363 | |
364 | |
364 | print $fh Storable::nfreeze \%FACEINFO; |
365 | print $fh Storable::nfreeze \%FACEINFO; |
365 | } |
366 | } |
366 | |
367 | |
367 | for (qw(archetypes faces animations treasures smooth)) { |
368 | for (qw(archetypes faces animations treasures)) { |
368 | chmod 0644, "$DATADIR/$_~"; |
369 | chmod 0644, "$DATADIR/$_~"; |
369 | rename "$DATADIR/$_~", "$DATADIR/$_"; |
370 | rename "$DATADIR/$_~", "$DATADIR/$_" |
|
|
371 | or die "$DATADIR/$_: $!"; |
370 | } |
372 | } |
|
|
373 | |
|
|
374 | print "archetype data installed successfully.\n"; |
371 | } |
375 | } |
372 | } |
376 | } |
373 | |
377 | |
374 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
378 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
375 | GetOptions ( |
379 | GetOptions ( |