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.255 by root, Thu Apr 19 16:23:47 2007 UTC vs.
Revision 1.256 by root, Sat Apr 21 16:56:32 2007 UTC

1490 my ($self) = @_; 1490 my ($self) = @_;
1491 1491
1492 local $self->{deny_reset} = 1; # loading can take a long time 1492 local $self->{deny_reset} = 1; # loading can take a long time
1493 1493
1494 my $path = $self->{path}; 1494 my $path = $self->{path};
1495
1496 {
1495 my $guard = cf::lock_acquire "map_load:$path"; 1497 my $guard = cf::lock_acquire "map_load:$path";
1496 1498
1497 return if $self->in_memory != cf::MAP_SWAPPED; 1499 return if $self->in_memory != cf::MAP_SWAPPED;
1498 1500
1499 $self->in_memory (cf::MAP_LOADING); 1501 $self->in_memory (cf::MAP_LOADING);
1500 1502
1501 $self->alloc; 1503 $self->alloc;
1502 1504
1503 $self->pre_load; 1505 $self->pre_load;
1504 Coro::cede;
1505
1506 $self->_load_objects ($self->{load_path}, 1)
1507 or return;
1508
1509 $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1)
1510 if delete $self->{load_original};
1511
1512 if (my $uniq = $self->uniq_path) {
1513 utf8::encode $uniq;
1514 if (aio_open $uniq, O_RDONLY, 0) {
1515 $self->clear_unique_items;
1516 $self->_load_objects ($uniq, 0);
1517 }
1518 }
1519
1520 Coro::cede;
1521 # now do the right thing for maps
1522 $self->link_multipart_objects;
1523 Coro::cede;
1524
1525 unless ($self->{deny_activate}) {
1526 $self->decay_objects;
1527 $self->fix_auto_apply;
1528 $self->update_buttons;
1529 Coro::cede; 1506 Coro::cede;
1530 $self->set_darkness_map; 1507
1508 $self->_load_objects ($self->{load_path}, 1)
1509 or return;
1510
1511 $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1)
1512 if delete $self->{load_original};
1513
1514 if (my $uniq = $self->uniq_path) {
1515 utf8::encode $uniq;
1516 if (aio_open $uniq, O_RDONLY, 0) {
1517 $self->clear_unique_items;
1518 $self->_load_objects ($uniq, 0);
1519 }
1520 }
1521
1522 Coro::cede;
1523 # now do the right thing for maps
1524 $self->link_multipart_objects;
1531 $self->difficulty ($self->estimate_difficulty) 1525 $self->difficulty ($self->estimate_difficulty)
1532 unless $self->difficulty; 1526 unless $self->difficulty;
1533 Coro::cede; 1527 Coro::cede;
1528
1529 unless ($self->{deny_activate}) {
1530 $self->decay_objects;
1531 $self->fix_auto_apply;
1532 $self->update_buttons;
1533 Coro::cede;
1534 $self->set_darkness_map;
1535 Coro::cede;
1534 $self->activate; 1536 $self->activate;
1535 Coro::cede; 1537 }
1538
1539 $self->in_memory (cf::MAP_IN_MEMORY);
1540
1541 undef $guard;
1536 } 1542 }
1537 1543
1538 $self->post_load; 1544 $self->post_load;
1539 Coro::cede;
1540
1541 $self->in_memory (cf::MAP_IN_MEMORY);
1542} 1545}
1543 1546
1544sub customise_for { 1547sub customise_for {
1545 my ($self, $ob) = @_; 1548 my ($self, $ob) = @_;
1546 1549

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines