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.510 by root, Tue Apr 6 22:59:28 2010 UTC vs.
Revision 1.511 by root, Wed Apr 7 18:35:56 2010 UTC

1533 $cf::PLAYER{$login} = $pl 1533 $cf::PLAYER{$login} = $pl
1534 } 1534 }
1535 } 1535 }
1536} 1536}
1537 1537
1538cf::player->attach (
1539 on_load => sub {
1540 my ($pl, $path) = @_;
1541
1542 # restore slots saved in save, below
1543 my $slots = delete $pl->{_slots};
1544
1545 $pl->ob->current_weapon ($slots->[0]);
1546 $pl->combat_ob ($slots->[1]);
1547 $pl->ranged_ob ($slots->[2]);
1548 },
1549);
1550
1538sub save($) { 1551sub save($) {
1539 my ($pl) = @_; 1552 my ($pl) = @_;
1540 1553
1541 return if $pl->{deny_save}; 1554 return if $pl->{deny_save};
1542 1555
1547 1560
1548 aio_mkdir playerdir $pl, 0770; 1561 aio_mkdir playerdir $pl, 0770;
1549 $pl->{last_save} = $cf::RUNTIME; 1562 $pl->{last_save} = $cf::RUNTIME;
1550 1563
1551 cf::get_slot 0.01; 1564 cf::get_slot 0.01;
1565
1566 # save slots, to be restored later
1567 local $pl->{_slots} = [$pl->ob->current_weapon, $pl->combat_ob, $pl->ranged_ob];
1552 1568
1553 $pl->save_pl ($path); 1569 $pl->save_pl ($path);
1554 cf::cede_to_tick; 1570 cf::cede_to_tick;
1555} 1571}
1556 1572

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines