… | |
… | |
2270 | }, |
2270 | }, |
2271 | ); |
2271 | ); |
2272 | } |
2272 | } |
2273 | |
2273 | |
2274 | ############################################################################# |
2274 | ############################################################################# |
2275 | # the server's main() |
2275 | # the server's init and main functions |
|
|
2276 | |
|
|
2277 | sub load_resources { |
|
|
2278 | load_regions sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
|
|
2279 | or die "unable to load regions file\n";#d# |
|
|
2280 | } |
2276 | |
2281 | |
2277 | sub cfg_load { |
2282 | sub cfg_load { |
2278 | open my $fh, "<:utf8", cf::confdir . "/config" |
2283 | open my $fh, "<:utf8", cf::confdir . "/config" |
2279 | or return; |
2284 | or return; |
2280 | |
2285 | |
… | |
… | |
2291 | $CFG{mlockall} ? eval "mlockall()" : eval "munlockall()" |
2296 | $CFG{mlockall} ? eval "mlockall()" : eval "munlockall()" |
2292 | and die "WARNING: m(un)lockall failed: $!\n"; |
2297 | and die "WARNING: m(un)lockall failed: $!\n"; |
2293 | }; |
2298 | }; |
2294 | warn $@ if $@; |
2299 | warn $@ if $@; |
2295 | } |
2300 | } |
|
|
2301 | } |
|
|
2302 | |
|
|
2303 | sub init { |
|
|
2304 | load_resources; |
2296 | } |
2305 | } |
2297 | |
2306 | |
2298 | sub main { |
2307 | sub main { |
2299 | # we must not ever block the main coroutine |
2308 | # we must not ever block the main coroutine |
2300 | local $Coro::idle = sub { |
2309 | local $Coro::idle = sub { |
… | |
… | |
2461 | warn "reattaching attachments to objects/players"; |
2470 | warn "reattaching attachments to objects/players"; |
2462 | _global_reattach; |
2471 | _global_reattach; |
2463 | warn "reattaching attachments to maps"; |
2472 | warn "reattaching attachments to maps"; |
2464 | reattach $_ for values %MAP; |
2473 | reattach $_ for values %MAP; |
2465 | |
2474 | |
|
|
2475 | warn "loading reloadable resources"; |
|
|
2476 | load_resources; |
|
|
2477 | |
2466 | warn "restarting server ticker"; |
2478 | warn "restarting server ticker"; |
2467 | |
2479 | |
2468 | $TICK_WATCHER->start; |
2480 | $TICK_WATCHER->start; |
2469 | }; |
2481 | }; |
2470 | |
2482 | |