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.14 by root, Fri Mar 31 22:47:35 2006 UTC vs.
Revision 1.15 by root, Sun Jun 11 15:02:16 2006 UTC

65 65
66my %ext_pkg; 66my %ext_pkg;
67my @exts; 67my @exts;
68my @hook; 68my @hook;
69my %command; 69my %command;
70my %extcmd;
70 71
71sub inject_event { 72sub inject_event {
72 my $extension = shift; 73 my $extension = shift;
73 my $event_code = shift; 74 my $event_code = shift;
74 75
172 delete $command{$name}; 173 delete $command{$name};
173 delete $COMMAND{"$name\000"}; 174 delete $COMMAND{"$name\000"};
174 } 175 }
175 } 176 }
176 177
178 # remove extcmds
179 for my $name (keys %command) {
180 my @cb = grep $_->[2] ne $pkg, @{ $command{$name} };
181
182 if (@cb) {
183 $command{$name} = \@cb;
184 $COMMAND{"$name\000"} = List::Util::max map $_->[0], @cb;
185 } else {
186 delete $command{$name};
187 delete $COMMAND{"$name\000"};
188 }
189 }
190
191
177 Symbol::delete_package $pkg; 192 Symbol::delete_package $pkg;
178} 193}
179 194
180sub load_extensions { 195sub load_extensions {
181 my $LIBDIR = maps_directory "perl"; 196 my $LIBDIR = maps_directory "perl";
214 $who->message ("Intruder Alert!"); 229 $who->message ("Intruder Alert!");
215 } 230 }
216}; 231};
217 232
218############################################################################# 233#############################################################################
234# extcmd framework, basically convert ext <id> <pkg> arg1 args
235# into pkg::->on_extcmd_arg1 (...) while shortcutting a few
236
237sub on_extcmd {
238 my ($pl, $buf) = @_;
239
240 my ($id, $pkg, $name, $data) = split / /, $buf, 4;
241
242 if (my $method = "cf::ext::$pkg"->can ("on_extcmd_$name")) {
243 $method->($pl, $id, $buf);
244 }
245}
246
247#############################################################################
219# load/save/clean perl data associated with a map 248# load/save/clean perl data associated with a map
220 249
221*on_mapclean = sub { 250*on_mapclean = sub {
222 my ($map) = @_; 251 my ($map) = @_;
223 252

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines