… | |
… | |
2242 | } |
2242 | } |
2243 | |
2243 | |
2244 | ############################################################################# |
2244 | ############################################################################# |
2245 | # the server's init and main functions |
2245 | # the server's init and main functions |
2246 | |
2246 | |
2247 | sub load_resources { |
2247 | sub init_resources { |
2248 | load_regions sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2248 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2249 | or die "unable to load regions file\n";#d# |
2249 | or die "unable to load regions file\n";#d# |
2250 | } |
2250 | } |
2251 | |
2251 | |
2252 | sub cfg_load { |
2252 | sub cfg_load { |
2253 | open my $fh, "<:utf8", cf::confdir . "/config" |
2253 | open my $fh, "<:utf8", cf::confdir . "/config" |
… | |
… | |
2269 | warn $@ if $@; |
2269 | warn $@ if $@; |
2270 | } |
2270 | } |
2271 | } |
2271 | } |
2272 | |
2272 | |
2273 | sub init { |
2273 | sub init { |
2274 | load_resources; |
2274 | init_resources; |
2275 | } |
2275 | } |
2276 | |
2276 | |
2277 | sub main { |
2277 | sub main { |
2278 | # we must not ever block the main coroutine |
2278 | # we must not ever block the main coroutine |
2279 | local $Coro::idle = sub { |
2279 | local $Coro::idle = sub { |
… | |
… | |
2453 | _global_reattach; |
2453 | _global_reattach; |
2454 | warn "reattaching attachments to maps"; |
2454 | warn "reattaching attachments to maps"; |
2455 | reattach $_ for values %MAP; |
2455 | reattach $_ for values %MAP; |
2456 | |
2456 | |
2457 | warn "loading reloadable resources"; |
2457 | warn "loading reloadable resources"; |
2458 | load_resources; |
2458 | init_resources; |
2459 | |
2459 | |
2460 | warn "leaving sync_job"; |
2460 | warn "leaving sync_job"; |
2461 | |
2461 | |
2462 | 1 |
2462 | 1 |
2463 | } or do { |
2463 | } or do { |