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.51 by root, Mon Aug 28 14:05:24 2006 UTC vs.
Revision 1.52 by root, Mon Aug 28 16:52:51 2006 UTC

174 174
175Attach handlers to all maps. 175Attach handlers to all maps.
176 176
177=item cf:register_attachment $name, ... 177=item cf:register_attachment $name, ...
178 178
179Register an attachment by name through which objects can refer to this
180attachment.
181
182=item cf:register_map_attachment $name, ...
183
184Register an attachment by name through which maps can refer to this
185attachment.
186
179=cut 187=cut
180 188
181# the following variables are defined in .xs and must not be re-created 189# the following variables are defined in .xs and must not be re-created
182our @CB_GLOBAL = (); # registry for all global events 190our @CB_GLOBAL = (); # registry for all global events
183our @CB_OBJECT = (); # all objects (should not be used except in emergency) 191our @CB_OBJECT = (); # all objects (should not be used except in emergency)
277} 285}
278 286
279sub cf::player::attach { 287sub cf::player::attach {
280 my ($obj, $name, %arg) = @_; 288 my ($obj, $name, %arg) = @_;
281 289
282 _attach_attachment KLASS_PLAYER, $obj, $name, %arg; 290 _attach_attachment $obj, $name, %arg;
283} 291}
284 292
285sub cf::map::attach { 293sub cf::map::attach {
286 my ($obj, $name, %arg) = @_; 294 my ($obj, $name, %arg) = @_;
287 295
288 _attach_attachment KLASS_MAP, $obj, $name, %arg; 296 _attach_attachment $obj, $name, %arg;
289} 297}
290 298
291sub attach_global { 299sub attach_global {
292 _attach @CB_GLOBAL, KLASS_GLOBAL, @_ 300 _attach @CB_GLOBAL, KLASS_GLOBAL, @_
293} 301}
313 321
314sub register_attachment { 322sub register_attachment {
315 my $name = shift; 323 my $name = shift;
316 324
317 $attachment{$name} = [[KLASS_OBJECT, @_]]; 325 $attachment{$name} = [[KLASS_OBJECT, @_]];
326}
327
328sub register_map_attachment {
329 my $name = shift;
330
331 $attachment{$name} = [[KLASS_MAP, @_]];
318} 332}
319 333
320our $override; 334our $override;
321our @invoke_results = (); # referenced from .xs code. TODO: play tricks with reify and mortals? 335our @invoke_results = (); # referenced from .xs code. TODO: play tricks with reify and mortals?
322 336

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines