… | |
… | |
89 | |
89 | |
90 | if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) { |
90 | if ($map->last_access + $max_idle <= $cf::RUNTIME && !$map->players) { |
91 | $map->swap_out; |
91 | $map->swap_out; |
92 | } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
92 | } elsif ($map->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
93 | $map->save; |
93 | $map->save; |
94 | $map->{last_save} -= rand; # randomise map save times a bit |
94 | $map->{last_save} -= cf::rndm; # randomise map save times a bit |
95 | } |
95 | } |
96 | } |
96 | } |
97 | }; |
97 | }; |
98 | warn $@ if $@; |
98 | warn $@ if $@; |
99 | cf::cede_to_tick; |
99 | cf::cede_to_tick; |