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.73 by root, Mon Oct 26 11:31:39 2009 UTC vs.
Revision 1.78 by root, Wed Nov 4 13:46:37 2009 UTC

1#!@PERL@ 1#!@PERL@
2
3#
4# This file is part of Deliantra, the Roguelike Realtime MMORPG.
5#
6# Copyright (©) 2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
7#
8# Deliantra is free software: you can redistribute it and/or modify it under
9# the terms of the Affero GNU General Public License as published by the
10# Free Software Foundation, either version 3 of the License, or (at your
11# option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the Affero GNU General Public License
19# and the GNU General Public License along with this program. If not, see
20# <http://www.gnu.org/licenses/>.
21#
22# The authors can be reached via e-mail to <support@deliantra.net>
23#
2 24
3use strict; 25use strict;
4 26
5my $prefix = "@prefix@"; 27my $prefix = "@prefix@";
6my $exec_prefix = "@exec_prefix@"; 28my $exec_prefix = "@exec_prefix@";
383 push @ARC, $o; 405 push @ARC, $o;
384 for (my $m = $o; $m; $m = $m->{more}) { 406 for (my $m = $o; $m; $m = $m->{more}) {
385 $ARC{$m->{_name}} = $m; 407 $ARC{$m->{_name}} = $m;
386 } 408 }
387 409
388 $o->{editor_folder} = $dir; 410 $o->{editor_folder} ||= "\x00$dir"; # horrible kludge
389 411
390 my $visibility = delete $o->{visibility}; 412 my $visibility = delete $o->{visibility};
391 my $magicmap = delete $o->{magicmap}; 413 my $magicmap = delete $o->{magicmap};
392 414
393 # find upper left corner :/ 415 # find upper left corner :/
607 } 629 }
608 630
609 sub generate_plurals { 631 sub generate_plurals {
610# use Lingua::EN::Inflect (); 632# use Lingua::EN::Inflect ();
611# Lingua::EN::Inflect::classical; 633# Lingua::EN::Inflect::classical;
612# Lingua::EN::Inflect::def_noun 'talisman' => 'talismans'; 634# Lingua::EN::Inflect::def_noun '(.*)staff' => '$1staves'; # policy
613# Lingua::EN::Inflect::def_noun '(.*)boots' => '$1boots'; # hack 635# Lingua::EN::Inflect::def_noun '(.*)boots' => '$1boots'; # hack
614# 636#
615# for my $a (@ARC) { 637# for my $a (@ARC) {
616# my $name = $a->{name} || $a->{_name}; 638# my $name = $a->{name} || $a->{_name};
617# 639#
618# next unless $a->{name_pl}; 640# next unless $a->{name_pl};
619# 641# next if $a->{invisible};
642# next if $a->{is_floor};
643# next if $a->{no_pick};
620# 644#
621# my $test = Lingua::EN::Inflect::PL_N_eq $name, Lingua::EN::Inflect::PL $name; 645# my $test = Lingua::EN::Inflect::PL_N_eq $name, Lingua::EN::Inflect::PL $name;
622# my $pl = $test =~ /^(?:eq|p:.)$/ 646# my $pl = $test =~ /^(?:eq|p:.)$/
623# ? $name 647# ? $name
624# : Lingua::EN::Inflect::PL $name; 648# : Lingua::EN::Inflect::PL $name;
625# die "$test $pl" if $pl =~ /bootss/;#d#
626# 649#
627# if ($pl ne $a->{name_pl}) { 650# if ($pl ne $a->{name_pl}) {
628# warn "$a->{_name}: plural differs, $pl vs $a->{name_pl}\n"; 651# warn "$a->{_name}: plural differs, $pl vs $a->{name_pl}\n";
629# } 652# }
630# } 653# }
676 $_->join for (@a_trs, @a_res, @a_png); 699 $_->join for (@a_trs, @a_res, @a_png);
677 700
678 print "scanning done, processing results...\n" if $VERBOSE; 701 print "scanning done, processing results...\n" if $VERBOSE;
679 { 702 {
680 # remove path prefix from editor_folder 703 # remove path prefix from editor_folder
704 $_->{editor_folder} =~ /^\x00/
681 substr $_->{editor_folder}, 0, 1 + length $path, "" 705 and substr $_->{editor_folder}, 0, 2 + length $path, ""
682 for values %ARC; 706 for values %ARC;
683 707
684 print "resolving inheritance tree...\n" if $VERBOSE; 708 print "resolving inheritance tree...\n" if $VERBOSE;
685 # resolve inherit 709 # resolve inherit
686 while () { 710 while () {
687 my $progress; 711 my $progress;
718 @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC; 742 @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC;
719 743
720 print "generating plurals...\n" if $VERBOSE; 744 print "generating plurals...\n" if $VERBOSE;
721 generate_plurals; 745 generate_plurals;
722 746
723 print "writing archetypes...\n" if $VERBOSE; 747 printf "writing %d archetypes...\n", scalar @ARC if $VERBOSE;
724 open my $fh, ">:utf8", "$DATADIR/archetypes~" 748 open my $fh, ">:utf8", "$DATADIR/archetypes~"
725 or die "$DATADIR/archetypes~: $!"; 749 or die "$DATADIR/archetypes~: $!";
726 print $fh Deliantra::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; 750 print $fh Deliantra::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC];
727 } 751 }
728 752
729 { 753 {
730 print "writing treasures...\n" if $VERBOSE; 754 printf "writing treasures (%d octets)...\n", length $TRS if $VERBOSE;
731 open my $fh, ">:utf8", "$DATADIR/treasures~" 755 open my $fh, ">:utf8", "$DATADIR/treasures~"
732 or die "$DATADIR/treasures~: $!"; 756 or die "$DATADIR/treasures~: $!";
733 print $fh $TRS; 757 print $fh $TRS;
734 } 758 }
735 759
748 } 772 }
749 773
750 delete $v->{arc}; 774 delete $v->{arc};
751 } 775 }
752 776
753 print "writing facedata...\n" if $VERBOSE; 777 printf "writing facedata (%d faces, %d anims, %d resources)...\n",
778 scalar keys %FACEINFO,
779 scalar keys %ANIMINFO,
780 scalar keys %RESOURCE
781 if $VERBOSE;
782
754 open my $fh, ">:perlio", "$DATADIR/facedata~" 783 open my $fh, ">:perlio", "$DATADIR/facedata~"
755 or die "$DATADIR/facedata~: $!"; 784 or die "$DATADIR/facedata~: $!";
756 785
757 print $fh freeze { 786 print $fh freeze {
758 version => 2, 787 version => 2,
759 faceinfo => \%FACEINFO, 788 faceinfo => \%FACEINFO,
760 animinfo => \%ANIMINFO, 789 animinfo => \%ANIMINFO,
761 resource => \%RESOURCE, 790 resource => \%RESOURCE,
762 }; 791 };
792
763 } 793 }
764 794
765 print "committing files...\n" if $VERBOSE; 795 print "committing files...\n" if $VERBOSE;
766 796
767 for (qw(archetypes facedata treasures)) { 797 for (qw(archetypes facedata treasures)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines