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.135 by root, Thu Jan 4 20:29:46 2007 UTC vs.
Revision 1.137 by root, Fri Jan 5 10:23:05 2007 UTC

1296} 1296}
1297 1297
1298sub save { 1298sub save {
1299 my ($self) = @_; 1299 my ($self) = @_;
1300 1300
1301 my $lock = cf::lock_acquire "map_data:" . $self->path;
1302
1301 $self->{last_save} = $cf::RUNTIME; 1303 $self->{last_save} = $cf::RUNTIME;
1302 1304
1303 return unless $self->dirty; 1305 return unless $self->dirty;
1304 1306
1305 my $save = $self->{path}->save_path; utf8::encode $save; 1307 my $save = $self->{path}->save_path; utf8::encode $save;
1323 my ($self) = @_; 1325 my ($self) = @_;
1324 1326
1325 # save first because save cedes 1327 # save first because save cedes
1326 $self->save; 1328 $self->save;
1327 1329
1330 my $lock = cf::lock_acquire "map_data:" . $self->path;
1331
1328 return if $self->players; 1332 return if $self->players;
1329 return if $self->in_memory != cf::MAP_IN_MEMORY; 1333 return if $self->in_memory != cf::MAP_IN_MEMORY;
1330 return if $self->{deny_save}; 1334 return if $self->{deny_save};
1331 1335
1332 $self->clear; 1336 $self->clear;
1373 $self->save; 1377 $self->save;
1374} 1378}
1375 1379
1376sub reset { 1380sub reset {
1377 my ($self) = @_; 1381 my ($self) = @_;
1382
1383 my $lock = cf::lock_acquire "map_data:" . $self->path;
1378 1384
1379 return if $self->players; 1385 return if $self->players;
1380 return if $self->{path}{user_rel};#d# 1386 return if $self->{path}{user_rel};#d#
1381 1387
1382 warn "resetting map ", $self->path;#d# 1388 warn "resetting map ", $self->path;#d#
1559 }; 1565 };
1560 } 1566 }
1561 }, 1567 },
1562); 1568);
1563 1569
1564=item $player_object->goto_map ($path, $x, $y) 1570=item $player_object->goto ($path, $x, $y)
1565 1571
1566=cut 1572=cut
1567 1573
1568sub cf::object::player::goto_map { 1574sub cf::object::player::goto {
1569 my ($self, $path, $x, $y) = @_; 1575 my ($self, $path, $x, $y) = @_;
1570 1576
1571 $self->enter_link; 1577 $self->enter_link;
1572 1578
1573 (cf::async { 1579 (cf::async {
1647 unless (eval { 1653 unless (eval {
1648 prepare_random_map $exit 1654 prepare_random_map $exit
1649 if $exit->slaying eq "/!"; 1655 if $exit->slaying eq "/!";
1650 1656
1651 my $path = new cf::path $exit->slaying, $exit->map && $exit->map->path; 1657 my $path = new cf::path $exit->slaying, $exit->map && $exit->map->path;
1652 $self->goto_map ($path, $exit->stats->hp, $exit->stats->sp); 1658 $self->goto ($path, $exit->stats->hp, $exit->stats->sp);
1653 1659
1654 1; 1660 1;
1655 }) { 1661 }) {
1656 $self->message ("Something went wrong deep within the crossfire server. " 1662 $self->message ("Something went wrong deep within the crossfire server. "
1657 . "I'll try to bring you back to the map you were before. " 1663 . "I'll try to bring you back to the map you were before. "

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines