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.507 by root, Sat Mar 20 02:24:38 2010 UTC vs.
Revision 1.511 by root, Wed Apr 7 18:35:56 2010 UTC

1310} 1310}
1311 1311
1312use File::Glob (); 1312use File::Glob ();
1313 1313
1314cf::player->attach ( 1314cf::player->attach (
1315 on_command => sub { 1315 on_unknown_command => sub {
1316 my ($pl, $name, $params) = @_; 1316 my ($pl, $name, $params) = @_;
1317 1317
1318 my $cb = $COMMAND{$name} 1318 my $cb = $COMMAND{$name}
1319 or return; 1319 or return;
1320 1320
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
1769 my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM 1785 my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM
1770 1786
1771 # mit "rum" bekleckern, nicht 1787 # mit "rum" bekleckern, nicht
1772 $self->_create_random_map ( 1788 $self->_create_random_map (
1773 $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle}, 1789 $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle},
1774 $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, 1790 $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, $rmp->{miningstyle},
1775 $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map}, 1791 $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map},
1776 $rmp->{exit_on_final_map}, 1792 $rmp->{exit_on_final_map},
1777 $rmp->{xsize}, $rmp->{ysize}, 1793 $rmp->{xsize}, $rmp->{ysize},
1778 $rmp->{expand2x}, $rmp->{layoutoptions1}, $rmp->{layoutoptions2}, $rmp->{layoutoptions3}, 1794 $rmp->{expand2x}, $rmp->{layoutoptions1}, $rmp->{layoutoptions2}, $rmp->{layoutoptions3},
1779 $rmp->{symmetry}, $rmp->{difficulty}, $rmp->{difficulty_given}, $rmp->{difficulty_increase}, 1795 $rmp->{symmetry}, $rmp->{difficulty}, $rmp->{difficulty_given}, $rmp->{difficulty_increase},
3134 3150
3135 $coro 3151 $coro
3136} 3152}
3137 3153
3138cf::client->attach ( 3154cf::client->attach (
3139 on_destroy => sub { 3155 on_client_destroy => sub {
3140 my ($ns) = @_; 3156 my ($ns) = @_;
3141 3157
3142 $_->cancel for values %{ (delete $ns->{_coro}) || {} }; 3158 $_->cancel for values %{ (delete $ns->{_coro}) || {} };
3143 }, 3159 },
3144); 3160);
3541 reload_config; 3557 reload_config;
3542 db_init; 3558 db_init;
3543 3559
3544 cf::init_uuid; 3560 cf::init_uuid;
3545 cf::init_signals; 3561 cf::init_signals;
3546 cf::init_commands;
3547 cf::init_skills; 3562 cf::init_skills;
3548 3563
3549 cf::init_beforeplay; 3564 cf::init_beforeplay;
3550 3565
3551 atomic; 3566 atomic;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines