… | |
… | |
19 | use File::Temp; |
19 | use File::Temp; |
20 | use Crossfire; |
20 | use Crossfire; |
21 | use Coro; |
21 | use Coro; |
22 | use Coro::AIO; |
22 | use Coro::AIO; |
23 | use POSIX (); |
23 | use POSIX (); |
|
|
24 | use Digest::MD5; |
|
|
25 | use Coro::Storable; $Storable::canonical = 1; |
24 | |
26 | |
25 | sub usage { |
27 | sub usage { |
26 | warn <<EOF; |
28 | warn <<EOF; |
27 | Usage: cfutil [-v] [-q] [--force] [--cache] |
29 | Usage: cfutil [-v] [-q] [--force] [--cache] |
28 | [--install-arch path] |
30 | [--install-arch path] |
… | |
… | |
66 | } |
68 | } |
67 | |
69 | |
68 | sub inst_maps($) { |
70 | sub inst_maps($) { |
69 | my (undef, $path) = @_; |
71 | my (undef, $path) = @_; |
70 | |
72 | |
71 | print "installing '$path' to '$DATADIR/maps'\n\n"; |
73 | print "\nInstalling '$path' to '$DATADIR/maps'\n\n"; |
72 | |
74 | |
73 | if (!-f "$path/regions") { |
75 | if (!-f "$path/regions") { |
74 | 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"; |
75 | exit 1 unless $FORCE; |
77 | exit 1 unless $FORCE; |
76 | } |
78 | } |
77 | |
79 | |
78 | system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"; |
80 | system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" |
|
|
81 | and die "map installation failed.\n"; |
|
|
82 | |
|
|
83 | print "maps installed successfully.\n"; |
79 | } |
84 | } |
80 | |
85 | |
81 | { |
86 | { |
82 | our @PNG; |
87 | our %ANIMINFO; |
|
|
88 | our %FACEINFO; |
83 | our @ARC; |
89 | our %ARC; |
|
|
90 | our $TRS; |
84 | our $NFILE; |
91 | our $NFILE; |
85 | our @FACE; |
92 | |
86 | our $ANIM; |
93 | our $QUANTIZE = "+dither -colorspace RGB -colors 256"; |
87 | |
94 | |
88 | our (@png, @trs, @arc); # files we are interested in |
95 | our (@png, @trs, @arc); # files we are interested in |
89 | |
96 | |
90 | sub commit_png { |
97 | sub commit_png($$$) { |
91 | my ($name, $data) = @_; |
98 | my ($name, $data, $T) = @_; |
92 | |
99 | |
93 | push @PNG, [$name => $data]; |
100 | $FACEINFO{$name}{"data$T"} = $data; |
94 | } |
101 | } |
95 | |
102 | |
96 | sub process_png { |
103 | sub process_png { |
97 | while (@png) { |
104 | while (@png) { |
98 | my $path = pop @png; |
105 | my ($path, $delete) = @{pop @png}; |
99 | |
106 | |
100 | my $png; |
107 | my $png; |
101 | aio_lstat $path; |
108 | aio_lstat $path; |
102 | my ($size, $mtime) = (stat _)[7,9]; |
109 | my ($size, $mtime) = (stat _)[7,9]; |
103 | |
110 | |
104 | if (0 > aio_load $path, $png) { |
111 | if (0 > aio_load $path, $png) { |
105 | warn "$path: $!, skipping.\n"; |
112 | warn "$path: $!, skipping.\n"; |
106 | next; |
113 | next; |
107 | } |
114 | } |
108 | |
115 | |
|
|
116 | my $stem = $path; |
|
|
117 | my $T; |
|
|
118 | |
|
|
119 | if ($stem =~ s/\.32x32\.png~?$//) { |
|
|
120 | $T = 32; |
|
|
121 | } elsif ($stem =~ s/\.64x64\.png~?$//) { |
|
|
122 | $T = 64; |
|
|
123 | } else { |
|
|
124 | warn "$path: weird filename, skipping.\n"; |
|
|
125 | next; |
|
|
126 | } |
|
|
127 | |
109 | # quickly extratc width and height of the (necessarily PNG) image |
128 | # quickly extract width and height of the (necessarily PNG) image |
110 | unless ($png =~ /^\x89PNG\x0d\x0a\x1a\x0a....IHDR(........)/s) { |
129 | unless ($png =~ /^\x89PNG\x0d\x0a\x1a\x0a....IHDR(........)/s) { |
111 | warn "$path: not a recongized png file, skipping.\n"; |
130 | warn "$path: not a recognized png file, skipping.\n"; |
112 | next; |
131 | next; |
113 | } |
132 | } |
114 | |
133 | |
115 | my ($w, $h) = unpack "NN", $1; |
134 | my ($w, $h) = unpack "NN", $1; |
116 | |
|
|
117 | (my $face = $path) =~ s/^.*\///; |
|
|
118 | my $T = 32; |
|
|
119 | |
|
|
120 | unless ($face =~ s/\.base\.(...)\.png$/.$1/) { |
|
|
121 | warn "$path: weird filename, skipping.\n"; |
|
|
122 | next; |
|
|
123 | } |
|
|
124 | |
135 | |
125 | if ($w < $T || $h < $T) { |
136 | if ($w < $T || $h < $T) { |
126 | warn "$path: too small ($w $h), skipping.\n"; |
137 | warn "$path: too small ($w $h), skipping.\n"; |
127 | next; |
138 | next; |
128 | } |
139 | } |
… | |
… | |
130 | if ($w % $T || $h % $T) { |
141 | if ($w % $T || $h % $T) { |
131 | warn "$path: weird png size ($w $h), skipping.\n"; |
142 | warn "$path: weird png size ($w $h), skipping.\n"; |
132 | next; |
143 | next; |
133 | } |
144 | } |
134 | |
145 | |
|
|
146 | unless ($path =~ /~$/) { |
|
|
147 | # possibly enlarge |
|
|
148 | if (0 > aio_stat "$stem.64x64.png") { |
|
|
149 | my $other = "$stem.64x64.png~"; |
|
|
150 | |
|
|
151 | if (0 > aio_lstat $other or (-M _) > (-M $path)) { |
|
|
152 | my $wrap = 0; # for the time being |
|
|
153 | fork_sub { |
|
|
154 | system "convert png:\Q$path\E -depth 8 rgba:-" |
|
|
155 | . "| $exec_prefix/bin/cfhq2xa $w $h $wrap" |
|
|
156 | . "| convert -depth 8 -size ".($w * 2)."x".($h * 2)." rgba:- $QUANTIZE -quality 00 png32:\Q$other\E~" |
|
|
157 | and die "convert/hq2xa pipeline error: status $? ($!)"; |
|
|
158 | system $OPTIPNG, "-o5", "-i0", "-q", "$other~"; |
|
|
159 | die "$other~ has zero size, aborting." unless -s "$other~"; |
|
|
160 | rename "$other~", $other; |
|
|
161 | }; |
|
|
162 | } |
|
|
163 | |
|
|
164 | push @png, [$other, !$CACHE]; |
|
|
165 | } |
|
|
166 | |
|
|
167 | # possibly scale down |
|
|
168 | if (0 > aio_stat "$stem.32x32.png") { |
|
|
169 | my $other = "$stem.32x32.png~"; |
|
|
170 | |
|
|
171 | if (0 > aio_lstat $other or (-M _) > (-M $path)) { |
|
|
172 | fork_sub { |
|
|
173 | system "convert png:\Q$path\E -geometry 50% -filter lanczos $QUANTIZE -quality 00 png32:\Q$other\E~"; |
|
|
174 | system $OPTIPNG, "-o5", "-i0", "-q", "$other~"; |
|
|
175 | die "$other~ has zero size, aborting." unless -s "$other~"; |
|
|
176 | rename "$other~", $other; |
|
|
177 | }; |
|
|
178 | } |
|
|
179 | |
|
|
180 | #warn "scaled down $path to $other\n";#d# |
|
|
181 | push @png, [$other, !$CACHE]; |
|
|
182 | } |
|
|
183 | } |
|
|
184 | |
|
|
185 | (my $face = $stem) =~ s/^.*\///; |
|
|
186 | |
|
|
187 | # split all bigfaces, but avoid smoothfaces (*_S) |
135 | if (($w > $T || $h > $T) && $face !~ /_S\./) { |
188 | if (($w > $T || $h > $T) && $face !~ /_S\./) { |
136 | # split |
189 | # split |
137 | my @tile; |
190 | my @tile; |
138 | for my $x (0 .. (int $w / $T) - 1) { |
191 | for my $x (0 .. (int $w / $T) - 1) { |
139 | for my $y (0 .. (int $h / $T) - 1) { |
192 | for my $y (0 .. (int $h / $T) - 1) { |
… | |
… | |
147 | my @todo = grep { $_->[3] <= $mtime } @tile; |
200 | my @todo = grep { $_->[3] <= $mtime } @tile; |
148 | if (@todo) { |
201 | if (@todo) { |
149 | fork_sub { |
202 | fork_sub { |
150 | open my $convert, "|-", $CONVERT, |
203 | open my $convert, "|-", $CONVERT, |
151 | "png:-", |
204 | "png:-", |
152 | -negate,#d# |
|
|
153 | (map { |
205 | (map { |
154 | ( |
206 | ( |
155 | "(", |
207 | "(", |
156 | "+clone", |
208 | "+clone", |
157 | -crop => (sprintf "%dx%d+%d+%d", $T, $T, $_->[0] * $T, $_->[1] * $T), |
209 | -crop => (sprintf "%dx%d+%d+%d", $T, $T, $_->[0] * $T, $_->[1] * $T), |
|
|
210 | "+repage", |
|
|
211 | -quality => "00", |
158 | -write => "png:$_->[2]~", |
212 | -write => "png32:$_->[2]~", |
159 | "+delete", |
213 | "+delete", |
160 | ")", |
214 | ")", |
161 | ) |
215 | ) |
162 | } @todo), |
216 | } @todo), |
163 | "null:"; |
217 | "null:"; |
… | |
… | |
167 | close $convert; |
221 | close $convert; |
168 | |
222 | |
169 | # pass 2, optimise, and rename |
223 | # pass 2, optimise, and rename |
170 | for (@todo) { |
224 | for (@todo) { |
171 | system $OPTIPNG, "-o5", "-i0", "-q", "$_->[2]~"; |
225 | system $OPTIPNG, "-o5", "-i0", "-q", "$_->[2]~"; |
|
|
226 | die "$_->[2]~ has zero size, aborting." unless -s "$_->[2]~"; |
172 | rename "$_->[2]~", $_->[2]; |
227 | rename "$_->[2]~", $_->[2]; |
173 | } |
228 | } |
174 | }; |
229 | }; |
175 | } |
230 | } |
176 | |
231 | |
… | |
… | |
180 | |
235 | |
181 | if (0 > aio_load $file, $tile) { |
236 | if (0 > aio_load $file, $tile) { |
182 | die "$path: unable to read tile +$x+$y, aborting.\n"; |
237 | die "$path: unable to read tile +$x+$y, aborting.\n"; |
183 | } |
238 | } |
184 | IO::AIO::aio_unlink $file unless $CACHE; |
239 | IO::AIO::aio_unlink $file unless $CACHE; |
185 | commit_png $x|$y ? "$face+$x+$y" : $face, $tile; |
240 | commit_png $x|$y ? "$face+$x+$y" : $face, $tile, $T; |
186 | } |
241 | } |
187 | } else { |
242 | } else { |
188 | # use as-is (either small, use smooth) |
243 | # use as-is (either small, use smooth) |
189 | commit_png $face, $png; |
244 | commit_png $face, $png, $T; |
190 | } |
245 | } |
|
|
246 | |
|
|
247 | aio_unlink $path if $delete; |
191 | } |
248 | } |
192 | } |
249 | } |
193 | |
250 | |
194 | sub process_arc { |
251 | sub process_arc { |
195 | while (@arc) { |
252 | while (@arc) { |
… | |
… | |
198 | my $arc; |
255 | my $arc; |
199 | aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ |
256 | aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ |
200 | |
257 | |
201 | my $arc = read_arch "$dir/$file"; |
258 | my $arc = read_arch "$dir/$file"; |
202 | for my $o (values %$arc) { |
259 | for my $o (values %$arc) { |
203 | push @ARC, $o; |
260 | $ARC{$o->{_name}} = $o; |
|
|
261 | |
|
|
262 | $o->{editor_folder} = $dir; |
|
|
263 | |
|
|
264 | my $visibility = delete $o->{visibility}; |
|
|
265 | my $magicmap = delete $o->{magicmap}; |
|
|
266 | |
|
|
267 | # find upper left corner :/ |
|
|
268 | # omg, this is sooo broken |
204 | my ($dx, $dy); |
269 | my ($dx, $dy); |
205 | # omg, this is sooo broken |
|
|
206 | for (my $o = $o; $o; $o = $o->{more}) { |
270 | for (my $o = $o; $o; $o = $o->{more}) { |
207 | $dx = $o->{x} if $o->{x} < $dx; |
271 | $dx = $o->{x} if $o->{x} < $dx; |
208 | $dy = $o->{y} if $o->{y} < $dy; |
272 | $dy = $o->{y} if $o->{y} < $dy; |
209 | } |
273 | } |
|
|
274 | |
210 | for (my $o = $o; $o; $o = $o->{more}) { |
275 | for (my $o = $o; $o; $o = $o->{more}) { |
211 | my $x = $o->{x} - $dx; |
276 | my $x = $o->{x} - $dx; |
212 | my $y = $o->{y} - $dy; |
277 | my $y = $o->{y} - $dy; |
213 | if ($x|$y) { |
278 | |
214 | $_ .= "+$x+$y" for $o->{face}, @{$o->{anim} || []}; |
279 | my $ext = $x|$y ? "+$x+$y" : ""; |
215 | } |
280 | |
216 | } |
281 | $o->{face} .= $ext unless /^blank.x11$|^empty.x11$/ || !$o->{face}; |
|
|
282 | |
|
|
283 | my $visibility = delete $o->{visibility} if exists $o->{visibility}; |
|
|
284 | my $magicmap = delete $o->{magicmap} if exists $o->{magicmap}; |
|
|
285 | |
217 | if (my $anim = delete $o->{anim}) { |
286 | my $anim = delete $o->{anim}; |
|
|
287 | |
|
|
288 | if ($anim) { |
|
|
289 | # possibly add $ext to the animation name to avoid |
|
|
290 | # the need to specify archnames for all parts |
|
|
291 | # of a multipart archetype. |
218 | $o->{animation} = $o->{_name}; |
292 | $o->{animation} = "$o->{_name}"; |
219 | $ANIM .= join "", map "$_\n", |
293 | my $facings = 1; |
220 | "anim $o->{_name}", |
294 | my @frames; |
|
|
295 | |
|
|
296 | for (@$anim) { |
|
|
297 | if (/^facings\s+(\d+)/) { |
|
|
298 | $facings = $1*1; |
|
|
299 | } elsif (/^blank.x11$|^empty.x11$/) { |
|
|
300 | push @frames, $_; |
|
|
301 | } else { |
|
|
302 | push @frames, "$_$ext"; |
221 | @$anim, |
303 | } |
222 | "mina"; |
304 | } |
|
|
305 | |
|
|
306 | $ANIMINFO{$o->{animation}} = { |
|
|
307 | facings => $facings, |
|
|
308 | frames => \@frames, |
|
|
309 | }; |
|
|
310 | } |
|
|
311 | |
|
|
312 | for my $face ($o->{face} || (), @{$anim || []}) { |
|
|
313 | next if $face =~ /^facings\s|^blank.x11$|^empty.x11$/; |
|
|
314 | |
|
|
315 | my $info = $FACEINFO{$face} ||= {}; |
|
|
316 | |
|
|
317 | $info->{visibility} = $visibility if defined $visibility; |
|
|
318 | $info->{magicmap} = $magicmap if defined $magicmap; |
|
|
319 | } |
|
|
320 | |
|
|
321 | if (my $smooth = delete $o->{smoothface}) { |
|
|
322 | my %kv =split /\s+/, $smooth; |
|
|
323 | my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support |
|
|
324 | while (my ($face, $smooth) = each %kv) { |
|
|
325 | $FACEINFO{$face}{smooth} = $smooth; |
|
|
326 | $FACEINFO{$face}{smoothlevel} = $level; |
|
|
327 | } |
|
|
328 | } |
223 | } |
329 | } |
224 | } |
330 | } |
225 | } |
331 | } |
226 | } |
332 | } |
227 | |
333 | |
228 | sub process_trs { |
334 | sub process_trs { |
229 | while (@trs) { |
335 | while (@trs) { |
230 | my ($dir, $file) = @{pop @trs}; |
336 | my ($dir, $file) = @{pop @trs}; |
|
|
337 | my $path = "$dir/$file"; |
|
|
338 | |
|
|
339 | my $trs; |
|
|
340 | if (0 > aio_load $path, $trs) { |
|
|
341 | warn "$path: $!, skipping.\n"; |
|
|
342 | next; |
|
|
343 | } |
|
|
344 | |
|
|
345 | $TRS .= $trs; |
231 | } |
346 | } |
232 | } |
347 | } |
233 | |
348 | |
234 | sub find_files; |
349 | sub find_files; |
235 | sub find_files { |
350 | sub find_files { |
… | |
… | |
242 | find_files "$path/$_" |
357 | find_files "$path/$_" |
243 | for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; |
358 | for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; |
244 | |
359 | |
245 | for my $file (@$nondirs) { |
360 | for my $file (@$nondirs) { |
246 | if ($file =~ /\.png$/) { |
361 | if ($file =~ /\.png$/) { |
247 | push @png, "$path/$file"; |
362 | push @png, ["$path/$file", 0]; |
248 | } elsif ($file =~ /\.trs$/) { |
363 | } elsif ($file =~ /\.trs$/) { |
249 | push @trs, [$path, $file]; |
364 | push @trs, [$path, $file]; |
250 | } elsif ($file =~ /\.arc$/) { |
365 | } elsif ($file =~ /\.arc$/) { |
251 | push @arc, [$path, $file]; |
366 | push @arc, [$path, $file]; |
252 | } else { |
367 | } else { |
… | |
… | |
257 | } |
372 | } |
258 | |
373 | |
259 | sub inst_arch($) { |
374 | sub inst_arch($) { |
260 | my (undef, $path) = @_; |
375 | my (undef, $path) = @_; |
261 | |
376 | |
|
|
377 | print "\n", |
262 | print "installing '$path' to '$DATADIR'\n\n"; |
378 | "Installing '$path' to '$DATADIR'\n", |
|
|
379 | "\n", |
|
|
380 | "This can take a long time if you run this\n", |
|
|
381 | "for the first time or do not use --cache.\n", |
|
|
382 | "\n", |
|
|
383 | "Unless you run verbosely, all following warning\n", |
|
|
384 | "or error messages indicate serious problems.\n", |
|
|
385 | "\n"; |
263 | |
386 | |
264 | if (!-d "$path/treasures") { |
387 | if (!-d "$path/treasures") { |
265 | warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; |
388 | warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; |
266 | exit 1 unless $FORCE; |
389 | exit 1 unless $FORCE; |
267 | } |
390 | } |
268 | |
391 | |
269 | find_files $path; |
392 | find_files $path; |
270 | IO::AIO::flush; |
393 | IO::AIO::flush; |
271 | |
394 | |
272 | $_->join for ( |
395 | $_->join for ( |
273 | (async \&process_png), (async \&process_png), |
396 | # four png crunchers work fine for my 2x smp machine |
|
|
397 | (async \&process_png), (async \&process_png), (async \&process_png), (async \&process_png), |
274 | (async \&process_trs), (async \&process_trs), |
398 | (async \&process_trs), (async \&process_trs), |
275 | (async \&process_arc), (async \&process_arc), |
399 | (async \&process_arc), (async \&process_arc), |
276 | ); |
400 | ); |
277 | |
401 | |
278 | { |
402 | { |
279 | open my $fh, ">:utf8", "$DATADIR/animations~" |
403 | # remove path prefix from editor_folder |
280 | or die "$DATADIR/animations~: $!"; |
404 | substr $_->{editor_folder}, 0, 1 + length $path, "" |
281 | print $fh $ANIM; |
405 | for values %ARC; |
|
|
406 | |
|
|
407 | # resolve inherit |
|
|
408 | while () { |
|
|
409 | my $progress; |
|
|
410 | my $loop; |
|
|
411 | |
|
|
412 | for my $o (values %ARC) { |
|
|
413 | if (my $other = $o->{inherit}) { |
|
|
414 | if (my $s = $ARC{$other}) { |
|
|
415 | if ($s->{inherit}) { |
|
|
416 | $loop = $s; |
|
|
417 | } else { |
|
|
418 | delete $o->{inherit}; |
|
|
419 | %$o = ( %$s, %$o ); |
|
|
420 | ++$progress; |
|
|
421 | } |
|
|
422 | } else { |
|
|
423 | warn "'$o->{_name}' tries to inherit from undefined archetype '$other', skipping.\n"; |
|
|
424 | delete $ARC{$o->{_name}}; |
|
|
425 | } |
|
|
426 | } |
|
|
427 | } |
|
|
428 | |
|
|
429 | unless ($progress) { |
|
|
430 | die "inheritance loop detected starting at archetype '$loop->{_name}', aborting.\n" |
|
|
431 | if $loop; |
|
|
432 | |
|
|
433 | last; |
|
|
434 | } |
282 | } |
435 | } |
283 | |
436 | |
284 | { |
|
|
285 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
437 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
286 | or die "$DATADIR/archetypes~: $!"; |
438 | or die "$DATADIR/archetypes~: $!"; |
287 | print $fh Crossfire::archlist_to_string \@ARC; |
439 | print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } values %ARC]; |
288 | } |
440 | } |
289 | |
|
|
290 | @PNG = sort { $a->[0] cmp $b->[0] } @PNG; |
|
|
291 | |
441 | |
292 | { |
442 | { |
|
|
443 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
|
|
444 | or die "$DATADIR/treasures~: $!"; |
|
|
445 | print $fh $TRS; |
|
|
446 | } |
|
|
447 | |
|
|
448 | { |
|
|
449 | while (my ($k, $v) = each %FACEINFO) { |
|
|
450 | length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n"; |
|
|
451 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
|
|
452 | |
|
|
453 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
|
|
454 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
|
|
455 | |
|
|
456 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
|
|
457 | $v->{chksum64} = Digest::MD5::md5 $v->{data64}; |
|
|
458 | } |
|
|
459 | |
293 | open my $fh, ">:perlio", "$DATADIR/crossfire.0~" |
460 | open my $fh, ">:perlio", "$DATADIR/facedata~" |
294 | or die "$DATADIR/crossfire.0~: $!"; |
461 | or die "$DATADIR/facedata~: $!"; |
295 | printf $fh "IMAGE %d %d %s\x0a%s", $_, (length $PNG[$_][1]), $PNG[$_][0], $PNG[$_][1] |
462 | |
296 | for 0.. $#PNG; |
463 | print $fh freeze { |
|
|
464 | version => 2, |
|
|
465 | faceinfo => \%FACEINFO, |
|
|
466 | animinfo => \%ANIMINFO, |
297 | } |
467 | }; |
|
|
468 | } |
298 | |
469 | |
299 | rename "$DATADIR/archetypes~" , "$DATADIR/archetypes"; |
470 | for (qw(archetypes facedata treasures)) { |
300 | rename "$DATADIR/crossfire.0~", "$DATADIR/crossfire.0"; |
471 | chmod 0644, "$DATADIR/$_~"; |
301 | rename "$DATADIR/animations~" , "$DATADIR/animations"; |
472 | rename "$DATADIR/$_~", "$DATADIR/$_" |
|
|
473 | or die "$DATADIR/$_: $!"; |
|
|
474 | } |
302 | |
475 | |
303 | die "--install-arch not fully implemented\n"; |
476 | print "archetype data installed successfully.\n"; |
304 | } |
477 | } |
305 | } |
478 | } |
306 | |
479 | |
307 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
480 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
308 | GetOptions ( |
481 | GetOptions ( |