… | |
… | |
11 | |
11 | |
12 | our $SCHEDULER = cf::coro { |
12 | our $SCHEDULER = cf::coro { |
13 | while () { |
13 | while () { |
14 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
14 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
15 | |
15 | |
|
|
16 | # this weird form of iteration over values is used because |
|
|
17 | # the hash changes underneath us frequently, and for |
|
|
18 | # keeps a direct reference to the value without (in 5.8 perls) |
|
|
19 | # keeping a reference, so this is prone to crashes or worse. |
16 | my @maps = keys %cf::MAP; |
20 | my @maps = keys %cf::MAP; |
17 | for (@maps) { |
21 | for (@maps) { |
18 | my $map = $cf::MAP{$_} |
22 | my $map = $cf::MAP{$_} |
19 | or next; |
23 | or next; |
20 | $map->valid or next; |
24 | $map->valid or next; |
|
|
25 | |
21 | eval { |
26 | eval { |
22 | # not yet, because maps might become visible to players nearby |
27 | # not yet, because maps might become visible to players nearby |
23 | # we need to remove the map from %cf::MAP and all tiled map links |
28 | # we need to remove the map from %cf::MAP and all tiled map links |
24 | # if ($last_access + $DEACTIVATE_TIMEOUT <= $cf::RUNTIME) { |
29 | # if ($last_access + $DEACTIVATE_TIMEOUT <= $cf::RUNTIME) { |
25 | # $map->deactivate; |
30 | # $map->deactivate; |