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.55 by root, Sun Aug 19 13:45:43 2007 UTC vs.
Revision 1.62 by root, Mon Sep 10 18:30:30 2007 UTC

21use Crossfire; 21use Crossfire;
22use Coro; 22use Coro;
23use Coro::AIO; 23use Coro::AIO;
24use Coro::Util; 24use Coro::Util;
25use POSIX (); 25use POSIX ();
26use Digest::MD5;
27use Carp; 26use Carp;
28use Coro::Channel; 27use Coro::Channel;
29use Coro::Storable; $Storable::canonical = 1; 28use Coro::Storable; $Storable::canonical = 1;
30 29
31$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 30$SIG{QUIT} = sub { Carp::cluck "QUIT" };
97 if (!-f "$path/regions") { 96 if (!-f "$path/regions") {
98 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 97 warn "'$path' does not look like a maps directory ('regions' file is missing).\n";
99 exit 1 unless $FORCE; 98 exit 1 unless $FORCE;
100 } 99 }
101 100
102 system $RSYNC, "-a", "--chmod=u=rwX,go=rX", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" 101 system $RSYNC, "-av", "--chmod=u=rwX,go=rX",
102 "$path/.", "$DATADIR/maps/.",
103 "--exclude", "CVS", "--exclude", "/world-precomposed",
104 "--delete", "--delete-excluded"
103 and die "map installation failed.\n"; 105 and die "map installation failed.\n";
104 106
105 print "maps installed successfully.\n"; 107 print "maps installed successfully.\n";
106} 108}
107 109
174 176
175 (my $base = $stem) =~ s/^.*\///; 177 (my $base = $stem) =~ s/^.*\///;
176 178
177 my $fi = $FACEINFO{$base}; 179 my $fi = $FACEINFO{$base};
178 unless ($fi) { 180 unless ($fi) {
179 warn "$path: <$base> not referenced by any archetype, skipping.\n"; 181 #warn "$path: <$base> not referenced by any archetype, skipping.\n";
180 next; 182 #next;
181 } 183 }
182 184
183 my $arc = $FACEINFO{$base}{arc} 185 my $arc = $fi->{arc} || { };
184 or die "FATAL: internal error, cannot continue";
185 186
186 unless ($path =~ /~$/) { 187 unless ($path =~ /~$/) {
187 # possibly enlarge 188 # possibly enlarge
188 if (0 > aio_stat "$stem.64x64.png") { 189 if (0 > aio_stat "$stem.64x64.png") {
189 my $other = "$stem.64x64.png~"; 190 my $other = "$stem.64x64.png~";
426 facings => $facings, 427 facings => $facings,
427 frames => \@frames, 428 frames => \@frames,
428 }; 429 };
429 } 430 }
430 431
431 for my $face ($o->{face} || (), @{$anim || []}) { 432 for ($o->{face} || (), @{$anim || []}) {
432 next if $face =~ /^facings\s|^blank.x11$|^empty.x11$/; 433 next if /^facings\s/;
433 434
435 my $face = $_;
436 $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates
437
434 my $info = $FACEINFO{$face} ||= {}; 438 my $info = $FACEINFO{$face} ||= { };
435
436 $info->{arc} = $o; 439 $info->{arc} = $o;
440
441 next if $face =~ /^blank.x11$|^empty.x11$/;
442
437 $info->{visibility} = $visibility if defined $visibility; 443 $info->{visibility} = $visibility if defined $visibility;
438 $info->{magicmap} = $magicmap if defined $magicmap; 444 $info->{magicmap} = $magicmap if defined $magicmap;
439 } 445 }
440 446
441 if (my $smooth = delete $o->{smoothface}) { 447 if (my $smooth = delete $o->{smoothface}) {
491 my ($dir, $file, $type) = @$job; 497 my ($dir, $file, $type) = @$job;
492 498
493 my $data; 499 my $data;
494 aio_load "$dir/$file", $data; 500 aio_load "$dir/$file", $data;
495 501
502
496 my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift }; 503 my $meta = load_cached "$dir/meta", sub { JSON::XS->new->utf8->relaxed->decode (shift) };
497 504
498 next if $meta && !exists $meta->{$file}; 505 utf8::decode $dir;
506 utf8::decode $file;
507
508 # a meta file for resources is now mandatory
509 unless (exists $meta->{$file}) {
510 warn "skipping $dir/$file\n" if $VERBOSE >= 3;
511 next;
512 }
499 513
500 $meta = { 514 $meta = {
501 %{ $meta->{"" } || {} }, 515 %{ $meta->{"" } || {} },
502 %{ $meta->{$file} || {} }, 516 %{ $meta->{$file} || {} },
503 }; 517 };
519 substr $dir, 0, 1 + length $PATH, ""; 533 substr $dir, 0, 1 + length $PATH, "";
520 534
521 $RESOURCE{"$dir/$file"} = { 535 $RESOURCE{"$dir/$file"} = {
522 type => (delete $meta->{type}) || $type, 536 type => (delete $meta->{type}) || $type,
523 data => $data, 537 data => $data,
524 chksum => (Digest::MD5::md5 $data),
525 %$meta ? (meta => $meta) : (), 538 %$meta ? (meta => $meta) : (),
526 }; 539 };
527 } 540 }
528 } 541 }
529 542
679 length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; 692 length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n";
680 693
681 length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 694 length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
682 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 695 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
683 696
684 $v->{chksum32} = Digest::MD5::md5 $v->{data32};
685 $v->{chksum64} = Digest::MD5::md5 $v->{data64};
686
687 if (my $magicmap = $v->{magicmap}) { 697 if (my $magicmap = $v->{magicmap}) {
688 $magicmap =~ y/A-Z_\-/a-z/d; 698 $magicmap =~ y/A-Z_\-/a-z/d;
689 $v->{magicmap} = $COLOR{$magicmap}; 699 $v->{magicmap} = $COLOR{$magicmap};
690 } 700 }
691 701

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines