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.49 by root, Sun Aug 27 17:59:26 2006 UTC vs.
Revision 1.50 by root, Mon Aug 28 07:07:42 2006 UTC

72 72
73@safe::cf::object::player::ISA = @cf::object::player::ISA = 'cf::object'; 73@safe::cf::object::player::ISA = @cf::object::player::ISA = 'cf::object';
74 74
75# we bless all objects into (empty) derived classes to force a method lookup 75# we bless all objects into (empty) derived classes to force a method lookup
76# within the Safe compartment. 76# within the Safe compartment.
77for my $pkg (qw(cf::object cf::object::player cf::player cf::map cf::party cf::region cf::arch)) { 77for my $pkg (qw(cf::object cf::object::player cf::player cf::map cf::party cf::region cf::arch cf::living)) {
78 no strict 'refs'; 78 no strict 'refs';
79 @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; 79 @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg;
80} 80}
81 81
82$Event::DIED = sub { 82$Event::DIED = sub {
262 $obj->{$name} = \%arg; 262 $obj->{$name} = \%arg;
263 } else { 263 } else {
264 warn "object uses attachment '$name' that is not available, postponing.\n"; 264 warn "object uses attachment '$name' that is not available, postponing.\n";
265 } 265 }
266 266
267 push @{$obj->{_attachment}}, $name; 267 $obj->{_attachment}{$name} = undef;
268 268
269 $res->{attachment} = $name; 269 $res->{attachment} = $name;
270 $res 270 $res
271} 271}
272 272
368 my ($obj) = @_; 368 my ($obj) = @_;
369 my $registry = $obj->registry; 369 my $registry = $obj->registry;
370 370
371 @$registry = (); 371 @$registry = ();
372 372
373 delete $obj->{_attachment} unless @{ $obj->{_attachment} || [] }; 373 delete $obj->{_attachment} unless scalar keys %{ $obj->{_attachment} || {} };
374 374
375 for my $name (@{ $obj->{_attachment} || [] }) { 375 for my $name (keys %{ $obj->{_attachment} || {} }) {
376 if (my $attach = $attachment{$name}) { 376 if (my $attach = $attachment{$name}) {
377 for (@$attach) { 377 for (@$attach) {
378 my ($klass, @attach) = @$_; 378 my ($klass, @attach) = @$_;
379 _attach @$registry, $klass, @attach; 379 _attach @$registry, $klass, @attach;
380 } 380 }
416 416
417 @{$dst->registry} = @{$src->registry}; 417 @{$dst->registry} = @{$src->registry};
418 418
419 %$dst = %$src; 419 %$dst = %$src;
420 420
421 $dst->{_attachment} = [@{ $src->{_attachment} }] 421 %{$dst->{_attachment}} = %{$src->{_attachment}}
422 if exists $src->{_attachment}; 422 if exists $src->{_attachment};
423 }, 423 },
424; 424;
425 425
426############################################################################# 426#############################################################################
687 687
688 $data->{version} <= 1 688 $data->{version} <= 1
689 or return; # too new 689 or return; # too new
690 690
691 $map->_set_obs ($data->{obs}); 691 $map->_set_obs ($data->{obs});
692 $map->invoke (EVENT_MAP_UPGRADE);
692}; 693};
693 694
694attach_to_maps prio => -10000, package => cf::mapsupport::; 695attach_to_maps prio => -10000, package => cf::mapsupport::;
695 696
696############################################################################# 697#############################################################################

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines