… | |
… | |
516 | my ($self) = @_; |
516 | my ($self) = @_; |
517 | |
517 | |
518 | &cf::map::load_map_header ($self->save_path) |
518 | &cf::map::load_map_header ($self->save_path) |
519 | } |
519 | } |
520 | |
520 | |
|
|
521 | sub unlink_save { |
|
|
522 | my ($self) = @_; |
|
|
523 | |
|
|
524 | utf8::encode (my $save = $self->save_path); |
|
|
525 | IO::AIO::aioreq_pri 4; IO::AIO::aio_unlink $save; |
|
|
526 | IO::AIO::aioreq_pri 4; IO::AIO::aio_unlink "$save.pst"; |
|
|
527 | } |
|
|
528 | |
521 | package cf; |
529 | package cf; |
522 | |
530 | |
523 | ############################################################################# |
531 | ############################################################################# |
524 | |
532 | |
525 | =head2 ATTACHABLE OBJECTS |
533 | =head2 ATTACHABLE OBJECTS |
… | |
… | |
1401 | |
1409 | |
1402 | if ($self->{path}->is_style_map) { |
1410 | if ($self->{path}->is_style_map) { |
1403 | $self->{deny_save} = 1; |
1411 | $self->{deny_save} = 1; |
1404 | $self->{deny_reset} = 1; |
1412 | $self->{deny_reset} = 1; |
1405 | } else { |
1413 | } else { |
|
|
1414 | $self->decay_objects; |
1406 | $self->fix_auto_apply; |
1415 | $self->fix_auto_apply; |
1407 | $self->decay_objects; |
|
|
1408 | $self->update_buttons; |
1416 | $self->update_buttons; |
1409 | $self->set_darkness_map; |
1417 | $self->set_darkness_map; |
1410 | $self->difficulty ($self->estimate_difficulty) |
1418 | $self->difficulty ($self->estimate_difficulty) |
1411 | unless $self->difficulty; |
1419 | unless $self->difficulty; |
1412 | $self->activate; |
1420 | $self->activate; |
… | |
… | |
1548 | my ($self) = @_; |
1556 | my ($self) = @_; |
1549 | |
1557 | |
1550 | $self->reset_at <= $cf::RUNTIME |
1558 | $self->reset_at <= $cf::RUNTIME |
1551 | } |
1559 | } |
1552 | |
1560 | |
1553 | sub unlink_save { |
|
|
1554 | my ($self) = @_; |
|
|
1555 | |
|
|
1556 | utf8::encode (my $save = $self->{path}->save_path); |
|
|
1557 | aioreq_pri 3; IO::AIO::aio_unlink $save; |
|
|
1558 | aioreq_pri 3; IO::AIO::aio_unlink "$save.pst"; |
|
|
1559 | } |
|
|
1560 | |
|
|
1561 | sub rename { |
1561 | sub rename { |
1562 | my ($self, $new_path) = @_; |
1562 | my ($self, $new_path) = @_; |
1563 | |
1563 | |
1564 | $self->unlink_save; |
1564 | $self->{path}->unlink_save; |
1565 | |
1565 | |
1566 | delete $cf::MAP{$self->path}; |
1566 | delete $cf::MAP{$self->path}; |
1567 | $self->{path} = new cf::path $new_path; |
1567 | $self->{path} = new cf::path $new_path; |
1568 | $self->path ($self->{path}->as_string); |
1568 | $self->path ($self->{path}->as_string); |
1569 | $cf::MAP{$self->path} = $self; |
1569 | $cf::MAP{$self->path} = $self; |
… | |
… | |
1583 | |
1583 | |
1584 | delete $cf::MAP{$self->path}; |
1584 | delete $cf::MAP{$self->path}; |
1585 | |
1585 | |
1586 | $_->clear_links_to ($self) for values %cf::MAP; |
1586 | $_->clear_links_to ($self) for values %cf::MAP; |
1587 | |
1587 | |
1588 | $self->unlink_save; |
1588 | $self->{path}->unlink_save; |
1589 | $self->destroy; |
1589 | $self->destroy; |
1590 | } |
1590 | } |
1591 | |
1591 | |
1592 | my $nuke_counter = "aaaa"; |
1592 | my $nuke_counter = "aaaa"; |
1593 | |
1593 | |