… | |
… | |
80 | |
80 | |
81 | # we bless all objects into (empty) derived classes to force a method lookup |
81 | # we bless all objects into (empty) derived classes to force a method lookup |
82 | # within the Safe compartment. |
82 | # within the Safe compartment. |
83 | for my $pkg (qw( |
83 | for my $pkg (qw( |
84 | cf::object cf::object::player |
84 | cf::object cf::object::player |
85 | cf::client_socket cf::player |
85 | cf::client cf::player |
86 | cf::arch cf::living |
86 | cf::arch cf::living |
87 | cf::map cf::party cf::region |
87 | cf::map cf::party cf::region |
88 | )) { |
88 | )) { |
89 | no strict 'refs'; |
89 | no strict 'refs'; |
90 | @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; |
90 | @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; |
… | |
… | |
864 | |
864 | |
865 | =pod |
865 | =pod |
866 | |
866 | |
867 | The following fucntions and emthods are available within a safe environment: |
867 | The following fucntions and emthods are available within a safe environment: |
868 | |
868 | |
869 | cf::object contr pay_amount pay_player |
869 | cf::object contr pay_amount pay_player map |
870 | cf::object::player player |
870 | cf::object::player player |
871 | cf::player peaceful |
871 | cf::player peaceful |
|
|
872 | cf::map trigger |
872 | |
873 | |
873 | =cut |
874 | =cut |
874 | |
875 | |
875 | for ( |
876 | for ( |
876 | ["cf::object" => qw(contr pay_amount pay_player)], |
877 | ["cf::object" => qw(contr pay_amount pay_player map)], |
877 | ["cf::object::player" => qw(player)], |
878 | ["cf::object::player" => qw(player)], |
878 | ["cf::player" => qw(peaceful)], |
879 | ["cf::player" => qw(peaceful)], |
|
|
880 | ["cf::map" => qw(trigger)], |
879 | ) { |
881 | ) { |
880 | no strict 'refs'; |
882 | no strict 'refs'; |
881 | my ($pkg, @funs) = @$_; |
883 | my ($pkg, @funs) = @$_; |
882 | *{"safe::$pkg\::$_"} = $safe_hole->wrap (\&{"$pkg\::$_"}) |
884 | *{"safe::$pkg\::$_"} = $safe_hole->wrap (\&{"$pkg\::$_"}) |
883 | for @funs; |
885 | for @funs; |
… | |
… | |
1171 | }; |
1173 | }; |
1172 | |
1174 | |
1173 | unshift @INC, $LIBDIR; |
1175 | unshift @INC, $LIBDIR; |
1174 | |
1176 | |
1175 | $TICK_WATCHER = Event->timer ( |
1177 | $TICK_WATCHER = Event->timer ( |
1176 | prio => 1, |
1178 | prio => 0, |
1177 | async => 1, |
|
|
1178 | at => $NEXT_TICK || 1, |
1179 | at => $NEXT_TICK || 1, |
1179 | data => WF_AUTOCANCEL, |
1180 | data => WF_AUTOCANCEL, |
1180 | cb => sub { |
1181 | cb => sub { |
1181 | cf::server_tick; # one server iteration |
1182 | cf::server_tick; # one server iteration |
1182 | |
1183 | |