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.37 by root, Thu Aug 24 14:05:22 2006 UTC vs.
Revision 1.38 by root, Thu Aug 24 17:29:30 2006 UTC

13 13
14use strict; 14use strict;
15 15
16our %COMMAND; 16our %COMMAND;
17our @EVENT; 17our @EVENT;
18our @PLUGIN_EVENT;
18our %PROP_TYPE; 19our %PROP_TYPE;
19our %PROP_IDX; 20our %PROP_IDX;
20our $LIBDIR = maps_directory "perl"; 21our $LIBDIR = maps_directory "perl";
21 22
22our $TICK = MAX_TIME * 1e-6; 23our $TICK = MAX_TIME * 1e-6;
23our $TICK_WATCHER; 24our $TICK_WATCHER;
24our $NEXT_TICK; 25our $NEXT_TICK;
25 26
26BEGIN { 27BEGIN {
27 @EVENT = map lc, @EVENT; 28 @PLUGIN_EVENT = map lc, @PLUGIN_EVENT;
28 29
29 *CORE::GLOBAL::warn = sub { 30 *CORE::GLOBAL::warn = sub {
30 my $msg = join "", @_; 31 my $msg = join "", @_;
31 $msg .= "\n" 32 $msg .= "\n"
32 unless $msg =~ /\n$/; 33 unless $msg =~ /\n$/;
141} 142}
142 143
143sub register { 144sub register {
144 my ($base, $pkg) = @_; 145 my ($base, $pkg) = @_;
145 146
146 for my $idx (0 .. $#EVENT) { 147 for my $idx (0 .. $#PLUGIN_EVENT) {
147 if (my $ref = $pkg->can ("on_$EVENT[$idx]")) { 148 if (my $ref = $pkg->can ("on_$PLUGIN_EVENT[$idx]")) {
148 #warn "registering $EVENT[$idx] hook to '$pkg'\n"; 149 #warn "registering $PLUGIN_EVENT[$idx] hook to '$pkg'\n";
149 $hook[$idx]{$base} = $ref; 150 $hook[$idx]{$base} = $ref;
150 } 151 }
151 } 152 }
152} 153}
153 154
187 my ($pkg) = @_; 188 my ($pkg) = @_;
188 189
189 warn "removing extension $pkg\n"; 190 warn "removing extension $pkg\n";
190 191
191 # remove hooks 192 # remove hooks
192 for my $idx (0 .. $#EVENT) { 193 for my $idx (0 .. $#PLUGIN_EVENT) {
193 delete $hook[$idx]{$pkg}; 194 delete $hook[$idx]{$pkg};
194 } 195 }
195 196
196 # remove commands 197 # remove commands
197 for my $name (keys %command) { 198 for my $name (keys %command) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines