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.148 by root, Mon Jan 8 12:39:16 2007 UTC vs.
Revision 1.153 by root, Mon Jan 8 23:36:16 2007 UTC

1119 return $cf::PLAYER{$_[0]} || do { 1119 return $cf::PLAYER{$_[0]} || do {
1120 my $login = $_[0]; 1120 my $login = $_[0];
1121 1121
1122 my $guard = cf::lock_acquire "user_find:$login"; 1122 my $guard = cf::lock_acquire "user_find:$login";
1123 1123
1124 $cf::PLAYER{$login} ||= (load_pl path $login or return); 1124 $cf::PLAYER{$_[0]} || do {
1125 my $pl = load_pl path $login
1126 or return;
1127 $cf::PLAYER{$login} = $pl
1128 }
1125 }; 1129 }
1126} 1130}
1127 1131
1128sub save($) { 1132sub save($) {
1129 my ($pl) = @_; 1133 my ($pl) = @_;
1130 1134
1166 $pl->invoke (cf::EVENT_PLAYER_QUIT); 1170 $pl->invoke (cf::EVENT_PLAYER_QUIT);
1167 $pl->ns->destroy if $pl->ns; 1171 $pl->ns->destroy if $pl->ns;
1168 1172
1169 my $path = playerdir $pl; 1173 my $path = playerdir $pl;
1170 my $temp = "$path~$cf::RUNTIME~deleting~"; 1174 my $temp = "$path~$cf::RUNTIME~deleting~";
1171 IO::AIO::aio_rename $path, $temp, sub { 1175 Coro::AIO::aio_rename $path, $temp;
1172 delete $cf::PLAYER{$pl->ob->name}; 1176 delete $cf::PLAYER{$pl->ob->name};
1173 $pl->destroy; 1177 $pl->destroy;
1174
1175 IO::AIO::aio_rmtree $temp; 1178 IO::AIO::aio_rmtree $temp;
1176 };
1177} 1179}
1178 1180
1179=item $player->ext_reply ($msgid, $msgtype, %msg) 1181=item $player->ext_reply ($msgid, $msgtype, %msg)
1180 1182
1181Sends an ext reply to the player. 1183Sends an ext reply to the player.
1669=cut 1671=cut
1670 1672
1671sub cf::object::player::goto { 1673sub cf::object::player::goto {
1672 my ($self, $path, $x, $y) = @_; 1674 my ($self, $path, $x, $y) = @_;
1673 1675
1676 $path = new cf::path $path;
1677 $path ne "/" or Carp::cluck ("oy");#d#
1678
1674 $self->enter_link; 1679 $self->enter_link;
1675 1680
1676 (async { 1681 (async {
1677 $path = new cf::path $path;
1678
1679 my $map = cf::map::find $path->as_string; 1682 my $map = cf::map::find $path->as_string;
1680 $map = $map->customise_for ($self) if $map; 1683 $map = $map->customise_for ($self) if $map;
1681 1684
1682# warn "entering ", $map->path, " at ($x, $y)\n" 1685# warn "entering ", $map->path, " at ($x, $y)\n"
1683# if $map; 1686# if $map;
1684 1687
1685 $map or $self->message ("The exit is closed", cf::NDI_UNIQUE | cf::NDI_RED); 1688 $map or $self->message ("The exit to '" . ($path->visible_name) . "' is closed", cf::NDI_UNIQUE | cf::NDI_RED);
1686 1689
1687 $self->leave_link ($map, $x, $y); 1690 $self->leave_link ($map, $x, $y);
1688 })->prio (1); 1691 })->prio (1);
1689} 1692}
1690 1693

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines