… | |
… | |
1133 | my $path = path $pl; |
1133 | my $path = path $pl; |
1134 | my $guard = cf::lock_acquire "user_save:$path"; |
1134 | my $guard = cf::lock_acquire "user_save:$path"; |
1135 | |
1135 | |
1136 | return if $pl->{deny_save}; |
1136 | return if $pl->{deny_save}; |
1137 | |
1137 | |
1138 | IO::AIO::aio_mkdir playerdir $pl, 0770; |
1138 | Coro::AIO::aio_mkdir playerdir $pl, 0770; |
1139 | $pl->{last_save} = $cf::RUNTIME; |
1139 | $pl->{last_save} = $cf::RUNTIME; |
1140 | |
1140 | |
1141 | Coro::cede; |
|
|
1142 | $pl->save_pl ($path); |
1141 | $pl->save_pl ($path); |
1143 | Coro::cede; |
1142 | Coro::cede; |
1144 | } |
1143 | } |
1145 | |
1144 | |
1146 | sub new($) { |
1145 | sub new($) { |
… | |
… | |
1167 | $pl->invoke (cf::EVENT_PLAYER_QUIT); |
1166 | $pl->invoke (cf::EVENT_PLAYER_QUIT); |
1168 | $pl->ns->destroy if $pl->ns; |
1167 | $pl->ns->destroy if $pl->ns; |
1169 | |
1168 | |
1170 | my $path = playerdir $pl; |
1169 | my $path = playerdir $pl; |
1171 | my $temp = "$path~$cf::RUNTIME~deleting~"; |
1170 | my $temp = "$path~$cf::RUNTIME~deleting~"; |
1172 | IO::AIO::aio_rename $path, $temp, sub { |
1171 | Coro::AIO::aio_rename $path, $temp; |
1173 | delete $cf::PLAYER{$pl->ob->name}; |
1172 | delete $cf::PLAYER{$pl->ob->name}; |
1174 | $pl->destroy; |
1173 | $pl->destroy; |
1175 | |
|
|
1176 | IO::AIO::aio_rmtree $temp; |
1174 | IO::AIO::aio_rmtree $temp; |
1177 | }; |
|
|
1178 | } |
1175 | } |
1179 | |
1176 | |
1180 | =item $player->ext_reply ($msgid, $msgtype, %msg) |
1177 | =item $player->ext_reply ($msgid, $msgtype, %msg) |
1181 | |
1178 | |
1182 | Sends an ext reply to the player. |
1179 | Sends an ext reply to the player. |
… | |
… | |
1681 | $map = $map->customise_for ($self) if $map; |
1678 | $map = $map->customise_for ($self) if $map; |
1682 | |
1679 | |
1683 | # warn "entering ", $map->path, " at ($x, $y)\n" |
1680 | # warn "entering ", $map->path, " at ($x, $y)\n" |
1684 | # if $map; |
1681 | # if $map; |
1685 | |
1682 | |
|
|
1683 | $map or $map->cluck ("oy");#d# |
1686 | $map or $self->message ("The exit is closed", cf::NDI_UNIQUE | cf::NDI_RED); |
1684 | $map or $self->message ("The exit to '" . ($path->visible_name) . "' is closed", cf::NDI_UNIQUE | cf::NDI_RED); |
1687 | |
1685 | |
1688 | $self->leave_link ($map, $x, $y); |
1686 | $self->leave_link ($map, $x, $y); |
1689 | })->prio (1); |
1687 | })->prio (1); |
1690 | } |
1688 | } |
1691 | |
1689 | |
… | |
… | |
2099 | $cf::map::MAX_RESET = $CFG{map_max_reset} if exists $CFG{map_max_reset}; |
2097 | $cf::map::MAX_RESET = $CFG{map_max_reset} if exists $CFG{map_max_reset}; |
2100 | $cf::map::DEFAULT_RESET = $CFG{map_default_reset} if exists $CFG{map_default_reset}; |
2098 | $cf::map::DEFAULT_RESET = $CFG{map_default_reset} if exists $CFG{map_default_reset}; |
2101 | |
2099 | |
2102 | if (exists $CFG{mlockall}) { |
2100 | if (exists $CFG{mlockall}) { |
2103 | eval { |
2101 | eval { |
2104 | $CFG{mlockall} ? &mlockall : &munlockall |
2102 | $CFG{mlockall} ? eval "mlockall()" : eval "munlockall()" |
2105 | and die "WARNING: m(un)lockall failed: $!\n"; |
2103 | and die "WARNING: m(un)lockall failed: $!\n"; |
2106 | }; |
2104 | }; |
2107 | warn $@ if $@; |
2105 | warn $@ if $@; |
2108 | } |
2106 | } |
2109 | } |
2107 | } |