… | |
… | |
2384 | } |
2384 | } |
2385 | |
2385 | |
2386 | 1 |
2386 | 1 |
2387 | } |
2387 | } |
2388 | |
2388 | |
|
|
2389 | our $archetypes_loaded; |
|
|
2390 | |
|
|
2391 | sub load_archetypes { |
|
|
2392 | return 1 if $archetypes_loaded++; # current can only load them once |
|
|
2393 | load_archetype_file sprintf "%s/archetypes", cf::datadir |
|
|
2394 | } |
|
|
2395 | |
|
|
2396 | sub load_treasures { |
|
|
2397 | load_treasure_file sprintf "%s/treasures", cf::datadir |
|
|
2398 | } |
|
|
2399 | |
2389 | sub reload_resources { |
2400 | sub reload_resources { |
2390 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2401 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2391 | or die "unable to load regions file\n";#d# |
2402 | or die "unable to load regions file\n"; |
2392 | load_facedata |
2403 | load_facedata |
2393 | or die "unable to load facedata\n";#d# |
2404 | or die "unable to load facedata\n"; |
|
|
2405 | load_archetypes |
|
|
2406 | or die "unable to load archetypes\n"; |
|
|
2407 | load_treasures |
|
|
2408 | or die "unable to load treasurelists\n"; |
2394 | } |
2409 | } |
2395 | |
2410 | |
2396 | sub init { |
2411 | sub init { |
2397 | reload_resources; |
2412 | reload_resources; |
2398 | } |
2413 | } |
… | |
… | |
2647 | our @WAIT_FOR_TICK; |
2662 | our @WAIT_FOR_TICK; |
2648 | our @WAIT_FOR_TICK_BEGIN; |
2663 | our @WAIT_FOR_TICK_BEGIN; |
2649 | |
2664 | |
2650 | sub wait_for_tick { |
2665 | sub wait_for_tick { |
2651 | return unless $TICK_WATCHER->is_active; |
2666 | return unless $TICK_WATCHER->is_active; |
|
|
2667 | return if $Coro::current == $Coro::main; |
|
|
2668 | |
2652 | my $signal = new Coro::Signal; |
2669 | my $signal = new Coro::Signal; |
2653 | push @WAIT_FOR_TICK, $signal; |
2670 | push @WAIT_FOR_TICK, $signal; |
2654 | $signal->wait; |
2671 | $signal->wait; |
2655 | } |
2672 | } |
2656 | |
2673 | |
2657 | sub wait_for_tick_begin { |
2674 | sub wait_for_tick_begin { |
2658 | return unless $TICK_WATCHER->is_active; |
2675 | return unless $TICK_WATCHER->is_active; |
|
|
2676 | return if $Coro::current == $Coro::main; |
|
|
2677 | |
2659 | my $signal = new Coro::Signal; |
2678 | my $signal = new Coro::Signal; |
2660 | push @WAIT_FOR_TICK_BEGIN, $signal; |
2679 | push @WAIT_FOR_TICK_BEGIN, $signal; |
2661 | $signal->wait; |
2680 | $signal->wait; |
2662 | } |
2681 | } |
2663 | |
2682 | |