… | |
… | |
54 | # delete $map->{active}; |
54 | # delete $map->{active}; |
55 | # } |
55 | # } |
56 | if ($map->should_reset) { |
56 | if ($map->should_reset) { |
57 | $map->reset; |
57 | $map->reset; |
58 | } elsif ($map->in_memory == cf::MAP_IN_MEMORY) { |
58 | } elsif ($map->in_memory == cf::MAP_IN_MEMORY) { |
59 | if ((cf::object::actives_size > $MAX_ACTIVES || $map->last_access + $SWAP_TIMEOUT <= $cf::RUNTIME) |
59 | my $max_idle = cf::object::actives_size > $MAX_ACTIVES ? 1 : $SWAP_TIMEOUT; |
60 | && !$map->players) { |
60 | if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) { |
61 | $map->swap_out; |
61 | $map->swap_out; |
62 | $cf::WAIT_FOR_TICK_ONE->wait; |
62 | $cf::WAIT_FOR_TICK_ONE->wait; |
63 | } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
63 | } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
64 | $map->save; |
64 | $map->save; |
65 | $cf::WAIT_FOR_TICK_ONE->wait; |
65 | $cf::WAIT_FOR_TICK_ONE->wait; |