ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.594 by root, Fri Nov 9 02:50:50 2012 UTC vs.
Revision 1.595 by root, Fri Nov 9 16:27:55 2012 UTC

3720 my $face = cf::face::find "sound/$v"; 3720 my $face = cf::face::find "sound/$v";
3721 cf::sound::set $k => $face; 3721 cf::sound::set $k => $face;
3722 } 3722 }
3723} 3723}
3724 3724
3725#d# move docstuff to help or so
3726our %DOCSTRING;
3727
3728sub reload_pod {
3729 trace "loading pods $PODDIR\n";
3730
3731 %DOCSTRING = ();
3732 my @command_list;
3733
3734 for (
3735 [0, "command_help"],
3736 [1, "emote_help"],
3737 [2, "dmcommand_help"],
3738 ) {
3739 my ($type, $path) = @$_;
3740
3741 my $paragraphs = &cf::pod::load_pod ("$PODDIR/$path.pod")
3742 or die "unable to load $path";
3743
3744 my $level = 1e9;
3745 my $rpar;
3746
3747 for my $par (@$paragraphs) {
3748 if ($par->{type} eq "head2") {
3749 # this code taken almost verbatim from DC/Protocol.pm
3750
3751 if ($par->{markup} =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x) {
3752 my $cmd = $1;
3753 my @args = split /\|/, $2;
3754 @args = (".*") unless @args;
3755
3756 $_ = $_ eq ".*" ? "" : " $_"
3757 for @args;
3758
3759 my @variants = map "$cmd$_", sort { (length $a) <=> (length $b) } @args;
3760
3761 $rpar = \($DOCSTRING{"command/$cmd"} = &cf::pod::as_cfpod ([$par]));
3762
3763 push @command_list, [$type, \@variants];
3764 $level = $par->{level};
3765 } else {
3766 error "$par->{markup}: unparsable command heading";
3767 }
3768 } elsif ($par->{level} > $level) {
3769 $$rpar .= &cf::pod::as_cfpod ([$par]);
3770 }
3771
3772 cf::cede_to_tick;
3773 }
3774 }
3775
3776 @command_list = sort {
3777 $a->[0] <=> $b->[0]
3778 or $a->[1] cmp $b->[1]
3779 } @command_list;
3780
3781 cf::cede_to_tick;
3782
3783 add_face "res/command_list" => FT_RSRC,
3784 JSON::XS->new->utf8->encode (\@command_list);
3785}
3786
3787sub reload_resources { 3725sub reload_resources {
3788 trace "reloading resource files...\n"; 3726 trace "reloading resource files...\n";
3789 3727
3790 reload_materials; 3728 reload_materials;
3791 reload_facedata; 3729 reload_facedata;
3792 reload_exp_table; 3730 reload_exp_table;
3793 reload_sound; 3731 reload_sound;
3794 reload_archetypes; 3732 reload_archetypes;
3795 reload_regions; 3733 reload_regions;
3796 reload_treasures; 3734 reload_treasures;
3797 reload_pod;
3798 3735
3799 trace "finished reloading resource files\n"; 3736 trace "finished reloading resource files\n";
3800} 3737}
3801 3738
3802sub reload_config { 3739sub reload_config {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines