… | |
… | |
1769 | my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM |
1769 | my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM |
1770 | |
1770 | |
1771 | # mit "rum" bekleckern, nicht |
1771 | # mit "rum" bekleckern, nicht |
1772 | $self->_create_random_map ( |
1772 | $self->_create_random_map ( |
1773 | $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle}, |
1773 | $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle}, |
1774 | $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, |
1774 | $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, $rmp->{miningstyle}, |
1775 | $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map}, |
1775 | $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map}, |
1776 | $rmp->{exit_on_final_map}, |
1776 | $rmp->{exit_on_final_map}, |
1777 | $rmp->{xsize}, $rmp->{ysize}, |
1777 | $rmp->{xsize}, $rmp->{ysize}, |
1778 | $rmp->{expand2x}, $rmp->{layoutoptions1}, $rmp->{layoutoptions2}, $rmp->{layoutoptions3}, |
1778 | $rmp->{expand2x}, $rmp->{layoutoptions1}, $rmp->{layoutoptions2}, $rmp->{layoutoptions3}, |
1779 | $rmp->{symmetry}, $rmp->{difficulty}, $rmp->{difficulty_given}, $rmp->{difficulty_increase}, |
1779 | $rmp->{symmetry}, $rmp->{difficulty}, $rmp->{difficulty_given}, $rmp->{difficulty_increase}, |
… | |
… | |
2093 | } |
2093 | } |
2094 | |
2094 | |
2095 | $self->post_load; |
2095 | $self->post_load; |
2096 | } |
2096 | } |
2097 | |
2097 | |
|
|
2098 | # customize the map for a given player, i.e. |
|
|
2099 | # return the _real_ map. used by e.g. per-player |
|
|
2100 | # maps to change the path to ~playername/mappath |
2098 | sub customise_for { |
2101 | sub customise_for { |
2099 | my ($self, $ob) = @_; |
2102 | my ($self, $ob) = @_; |
2100 | |
2103 | |
2101 | return find "~" . $ob->name . "/" . $self->{path} |
2104 | return find "~" . $ob->name . "/" . $self->{path} |
2102 | if $self->per_player; |
2105 | if $self->per_player; |
… | |
… | |
3573 | }; |
3576 | }; |
3574 | } |
3577 | } |
3575 | } |
3578 | } |
3576 | |
3579 | |
3577 | sub write_runtime_sync { |
3580 | sub write_runtime_sync { |
|
|
3581 | my $t0 = EV::time; |
|
|
3582 | |
3578 | # first touch the runtime file to show we are still running: |
3583 | # first touch the runtime file to show we are still running: |
3579 | # the fsync below can take a very very long time. |
3584 | # the fsync below can take a very very long time. |
3580 | |
3585 | |
3581 | IO::AIO::aio_utime $RUNTIMEFILE, undef, undef; |
3586 | IO::AIO::aio_utime $RUNTIMEFILE, undef, undef; |
3582 | |
3587 | |
… | |
… | |
3603 | or return; |
3608 | or return; |
3604 | |
3609 | |
3605 | aio_rename "$RUNTIMEFILE~", $RUNTIMEFILE |
3610 | aio_rename "$RUNTIMEFILE~", $RUNTIMEFILE |
3606 | and return; |
3611 | and return; |
3607 | |
3612 | |
3608 | warn "runtime file written.\n"; |
3613 | warn sprintf "runtime file written (%gs).\n", EV::time - $t0; |
3609 | |
3614 | |
3610 | 1 |
3615 | 1 |
3611 | } |
3616 | } |
3612 | |
3617 | |
3613 | our $uuid_lock; |
3618 | our $uuid_lock; |