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.48 by root, Sun Aug 27 15:24:22 2006 UTC vs.
Revision 1.49 by root, Sun Aug 27 17:59:26 2006 UTC

356 356
357 $data = from_json $data; 357 $data = from_json $data;
358 358
359 for (@$data) { 359 for (@$data) {
360 my ($name, $args) = @$_; 360 my ($name, $args) = @$_;
361
361 attach $obj, $name, %{$args || {} }; 362 $obj->attach ($name, %{$args || {} });
362 } 363 }
363} 364}
364 365
365# basically do the same as instantiate, without calling instantiate 366# basically do the same as instantiate, without calling instantiate
366sub reattach { 367sub reattach {
367 my ($obj) = @_; 368 my ($obj) = @_;
368 my $registry = $obj->registry; 369 my $registry = $obj->registry;
369 370
370 @$registry = (); 371 @$registry = ();
371 372
373 delete $obj->{_attachment} unless @{ $obj->{_attachment} || [] };
374
372 for my $name (@{ $obj->{_attachment} }) { 375 for my $name (@{ $obj->{_attachment} || [] }) {
373 if (my $attach = $attachment{$name}) { 376 if (my $attach = $attachment{$name}) {
374 for (@$attach) { 377 for (@$attach) {
375 my ($klass, @attach) = @$_; 378 my ($klass, @attach) = @$_;
376 _attach @$registry, $klass, @attach; 379 _attach @$registry, $klass, @attach;
377 } 380 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines