--- deliantra/server/utils/cfutil.in 2007/03/12 14:47:53 1.10 +++ deliantra/server/utils/cfutil.in 2007/03/14 15:47:21 1.16 @@ -69,20 +69,24 @@ sub inst_maps($) { my (undef, $path) = @_; - print "installing '$path' to '$DATADIR/maps'\n\n"; + print "installing '$path' to '$DATADIR/maps'\n"; if (!-f "$path/regions") { warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; exit 1 unless $FORCE; } - system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"; + system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" + and die "map installation failed.\n"; + + print "maps installed successfully.\n"; } { our %PNG32; our %FACEINFO; our @ARC; + our $TRS; our $NFILE; our %ANIM; @@ -252,6 +256,15 @@ $info->{visibility} = $visibility if defined $visibility; $info->{magicmap} = $magicmap if defined $magicmap; } + + if (my $smooth = delete $o->{smoothface}) { + my ($face, $smooth) = split /\s+/, $smooth; + # skip empty_S.x11, it seems to server no purpose whatsoever + # but increases bandwidth demands and worse. + unless ($smooth eq "empty_S.x11") { + $FACEINFO{$face}{smooth} = $smooth; + } + } } } } @@ -260,6 +273,15 @@ sub process_trs { while (@trs) { my ($dir, $file) = @{pop @trs}; + my $path = "$dir/$file"; + + my $trs; + if (0 > aio_load $path, $trs) { + warn "$path: $!, skipping.\n"; + next; + } + + $TRS .= $trs; } } @@ -291,7 +313,7 @@ sub inst_arch($) { my (undef, $path) = @_; - print "installing '$path' to '$DATADIR'\n\n"; + print "installing '$path' to '$DATADIR'\n"; if (!-d "$path/treasures") { warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; @@ -316,17 +338,23 @@ { open my $fh, ">:utf8", "$DATADIR/archetypes~" or die "$DATADIR/archetypes~: $!"; - substr $_->{editor_folder}, 0, length $path, "" for @ARC; + substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; print $fh Crossfire::archlist_to_string \@ARC; } { + open my $fh, ">:utf8", "$DATADIR/treasures~" + or die "$DATADIR/treasures~: $!"; + print $fh $TRS; + } + + { while (my ($k, $v) = each %FACEINFO) { $v->{data32} ||= delete $PNG32{$k}; } while (my ($k, $v) = each %FACEINFO) { - length $v->{data32} or warn "$k: face has no png32. this will crash the server.\n"; + length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n"; $v->{chksum32} = Digest::MD5::md5 $v->{data32}; } @@ -334,17 +362,17 @@ open my $fh, ">:perlio", "$DATADIR/faces~" or die "$DATADIR/faces~: $!"; + $FACEINFO{""} = { version => 1}; print $fh Storable::nfreeze \%FACEINFO; - - #use PApp::Util; warn PApp::Util::dumpval \%FACEINFO; } - for (qw(archetypes faces animations)) { + for (qw(archetypes faces animations treasures)) { chmod 0644, "$DATADIR/$_~"; - rename "$DATADIR/$_~", "$DATADIR/$_"; + rename "$DATADIR/$_~", "$DATADIR/$_" + or die "$DATADIR/$_: $!"; } - die "--install-arch not fully implemented\n"; + print "archetype data installed successfully.\n"; } }