ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.11 by root, Mon Mar 12 14:55:43 2007 UTC vs.
Revision 1.12 by root, Mon Mar 12 17:26:41 2007 UTC

81 81
82{ 82{
83 our %PNG32; 83 our %PNG32;
84 our %FACEINFO; 84 our %FACEINFO;
85 our @ARC; 85 our @ARC;
86 our $TRS;
86 our $NFILE; 87 our $NFILE;
87 our %ANIM; 88 our %ANIM;
89 our $SMOOTH;
88 90
89 our (@png, @trs, @arc); # files we are interested in 91 our (@png, @trs, @arc); # files we are interested in
90 92
91 sub commit_png { 93 sub commit_png {
92 my ($name, $data) = @_; 94 my ($name, $data) = @_;
250 my $info = $FACEINFO{$face} ||= {}; 252 my $info = $FACEINFO{$face} ||= {};
251 253
252 $info->{visibility} = $visibility if defined $visibility; 254 $info->{visibility} = $visibility if defined $visibility;
253 $info->{magicmap} = $magicmap if defined $magicmap; 255 $info->{magicmap} = $magicmap if defined $magicmap;
254 } 256 }
257
258 if (my $smooth = delete $o->{smoothface}) {
259 $SMOOTH .= "$smooth\n";
260 }
255 } 261 }
256 } 262 }
257 } 263 }
258 } 264 }
259 265
260 sub process_trs { 266 sub process_trs {
261 while (@trs) { 267 while (@trs) {
262 my ($dir, $file) = @{pop @trs}; 268 my ($dir, $file) = @{pop @trs};
269 my $path = "$dir/$file";
270
271 my $trs;
272 if (0 > aio_load $path, $trs) {
273 warn "$path: $!, skipping.\n";
274 next;
275 }
276
277 $TRS .= $trs;
263 } 278 }
264 } 279 }
265 280
266 sub find_files; 281 sub find_files;
267 sub find_files { 282 sub find_files {
319 substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; 334 substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC;
320 print $fh Crossfire::archlist_to_string \@ARC; 335 print $fh Crossfire::archlist_to_string \@ARC;
321 } 336 }
322 337
323 { 338 {
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 or die "$DATADIR/treasures~: $!";
347 print $fh $TRS;
348 }
349
350 {
324 while (my ($k, $v) = each %FACEINFO) { 351 while (my ($k, $v) = each %FACEINFO) {
325 $v->{data32} ||= delete $PNG32{$k}; 352 $v->{data32} ||= delete $PNG32{$k};
326 } 353 }
327 354
328 while (my ($k, $v) = each %FACEINFO) { 355 while (my ($k, $v) = each %FACEINFO) {
329 length $v->{data32} or warn "$k: face has no png32. this will crash the server.\n"; 356 length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n";
330 357
331 $v->{chksum32} = Digest::MD5::md5 $v->{data32}; 358 $v->{chksum32} = Digest::MD5::md5 $v->{data32};
332 } 359 }
333 360
334 open my $fh, ">:perlio", "$DATADIR/faces~" 361 open my $fh, ">:perlio", "$DATADIR/faces~"
335 or die "$DATADIR/faces~: $!"; 362 or die "$DATADIR/faces~: $!";
336 363
337 print $fh Storable::nfreeze \%FACEINFO; 364 print $fh Storable::nfreeze \%FACEINFO;
338
339 #use PApp::Util; warn PApp::Util::dumpval \%FACEINFO;
340 } 365 }
341 366
342 for (qw(archetypes faces animations)) { 367 for (qw(archetypes faces animations treasures smooth)) {
343 chmod 0644, "$DATADIR/$_~"; 368 chmod 0644, "$DATADIR/$_~";
344 rename "$DATADIR/$_~", "$DATADIR/$_"; 369 rename "$DATADIR/$_~", "$DATADIR/$_";
345 } 370 }
346
347 die "--install-arch not fully implemented\n";
348 } 371 }
349} 372}
350 373
351Getopt::Long::Configure ("bundling", "no_ignore_case"); 374Getopt::Long::Configure ("bundling", "no_ignore_case");
352GetOptions ( 375GetOptions (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines