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.78 by root, Tue Nov 7 00:15:27 2006 UTC vs.
Revision 1.80 by root, Tue Nov 7 16:30:55 2006 UTC

523 unlink $filename; 523 unlink $filename;
524 unlink "$filename.pst"; 524 unlink "$filename.pst";
525 } 525 }
526} 526}
527 527
528sub object_freezer_as_string {
529 my ($rdata, $objs) = @_;
530
531 use Data::Dumper;
532
533 "$$rdata\n" . Dumper $objs
534}
535
528sub object_thawer_load { 536sub object_thawer_load {
529 my ($filename) = @_; 537 my ($filename) = @_;
530 538
531 local $/; 539 local $/;
532 540
775sub cf::player::exists($) { 783sub cf::player::exists($) {
776 cf::player::find $_[0] 784 cf::player::find $_[0]
777 or -f sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($_[0]) x 2; 785 or -f sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($_[0]) x 2;
778} 786}
779 787
780=item $object->reply ($npc, $msg[, $flags]) 788=item $player_object->reply ($npc, $msg[, $flags])
781 789
782Sends a message to the player, as if the npc C<$npc> replied. C<$npc> 790Sends a message to the player, as if the npc C<$npc> replied. C<$npc>
783can be C<undef>. Does the right thing when the player is currently in a 791can be C<undef>. Does the right thing when the player is currently in a
784dialogue with the given NPC character. 792dialogue with the given NPC character.
785 793
812 $msg{msgid} = $id; 820 $msg{msgid} = $id;
813 821
814 $self->send ("ext " . to_json \%msg); 822 $self->send ("ext " . to_json \%msg);
815} 823}
816 824
817=back 825=item $player_object->may ("access")
826
827Returns wether the given player is authorized to access resource "access"
828(e.g. "command_wizcast").
829
830=cut
831
832sub cf::object::player::may {
833 my ($self, $access) = @_;
834
835 $self->flag (cf::FLAG_WIZ) ||
836 (ref $cf::CFG{"may_$access"}
837 ? scalar grep $self->name eq $_, @{$cf::CFG{"may_$access"}}
838 : $cf::CFG{"may_$access"})
839}
818 840
819=cut 841=cut
820 842
821############################################################################# 843#############################################################################
822 844
824 846
825Functions that provide a safe environment to compile and execute 847Functions that provide a safe environment to compile and execute
826snippets of perl code without them endangering the safety of the server 848snippets of perl code without them endangering the safety of the server
827itself. Looping constructs, I/O operators and other built-in functionality 849itself. Looping constructs, I/O operators and other built-in functionality
828is not available in the safe scripting environment, and the number of 850is not available in the safe scripting environment, and the number of
829functions and methods that cna be called is greatly reduced. 851functions and methods that can be called is greatly reduced.
830 852
831=cut 853=cut
832 854
833our $safe = new Safe "safe"; 855our $safe = new Safe "safe";
834our $safe_hole = new Safe::Hole; 856our $safe_hole = new Safe::Hole;
1163 $TICK_WATCHER->at ($NEXT_TICK); 1185 $TICK_WATCHER->at ($NEXT_TICK);
1164 $TICK_WATCHER->start; 1186 $TICK_WATCHER->start;
1165 }, 1187 },
1166); 1188);
1167 1189
1168eval { IO::AIO::max_poll_time $TICK * 0.2 }; #d# remove eval after restart 1190IO::AIO::max_poll_time $TICK * 0.2;
1169 1191
1170Event->io (fd => IO::AIO::poll_fileno, 1192Event->io (fd => IO::AIO::poll_fileno,
1171 poll => 'r', 1193 poll => 'r',
1172 prio => 5, 1194 prio => 5,
1173 cb => \&IO::AIO::poll_cb); 1195 cb => \&IO::AIO::poll_cb);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines