… | |
… | |
9 | use Event; |
9 | use Event; |
10 | use Opcode; |
10 | use Opcode; |
11 | use Safe; |
11 | use Safe; |
12 | use Safe::Hole; |
12 | use Safe::Hole; |
13 | |
13 | |
14 | use Coro 3.52 (); |
14 | use Coro 3.61 (); |
15 | use Coro::State; |
15 | use Coro::State; |
16 | use Coro::Event; |
16 | use Coro::Event; |
17 | use Coro::Timer; |
17 | use Coro::Timer; |
18 | use Coro::Signal; |
18 | use Coro::Signal; |
19 | use Coro::Semaphore; |
19 | use Coro::Semaphore; |
… | |
… | |
2384 | } |
2384 | } |
2385 | |
2385 | |
2386 | 1 |
2386 | 1 |
2387 | } |
2387 | } |
2388 | |
2388 | |
|
|
2389 | sub load_archetypes { |
|
|
2390 | load_archetype_file sprintf "%s/archetypes", cf::datadir; # remove when stable |
|
|
2391 | load_archetype_file sprintf "%s/archetypes", cf::datadir |
|
|
2392 | } |
|
|
2393 | |
|
|
2394 | sub load_treasures { |
|
|
2395 | load_treasure_file sprintf "%s/treasures", cf::datadir |
|
|
2396 | } |
|
|
2397 | |
2389 | sub reload_resources { |
2398 | sub reload_resources { |
2390 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2399 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2391 | or die "unable to load regions file\n";#d# |
2400 | or die "unable to load regions file\n"; |
2392 | load_facedata |
2401 | load_facedata |
2393 | or die "unable to load facedata\n";#d# |
2402 | or die "unable to load facedata\n"; |
|
|
2403 | load_archetypes |
|
|
2404 | or die "unable to load archetypes\n"; |
|
|
2405 | load_treasures |
|
|
2406 | or die "unable to load treasurelists\n"; |
2394 | } |
2407 | } |
2395 | |
2408 | |
2396 | sub init { |
2409 | sub init { |
2397 | reload_resources; |
2410 | reload_resources; |
2398 | } |
2411 | } |
… | |
… | |
2646 | |
2659 | |
2647 | our @WAIT_FOR_TICK; |
2660 | our @WAIT_FOR_TICK; |
2648 | our @WAIT_FOR_TICK_BEGIN; |
2661 | our @WAIT_FOR_TICK_BEGIN; |
2649 | |
2662 | |
2650 | sub wait_for_tick { |
2663 | sub wait_for_tick { |
|
|
2664 | return unless $TICK_WATCHER->is_active; |
|
|
2665 | return if $Coro::current == $Coro::main; |
|
|
2666 | |
2651 | my $signal = new Coro::Signal; |
2667 | my $signal = new Coro::Signal; |
2652 | push @WAIT_FOR_TICK, $signal; |
2668 | push @WAIT_FOR_TICK, $signal; |
2653 | $signal->wait; |
2669 | $signal->wait; |
2654 | } |
2670 | } |
2655 | |
2671 | |
2656 | sub wait_for_tick_begin { |
2672 | sub wait_for_tick_begin { |
|
|
2673 | return unless $TICK_WATCHER->is_active; |
|
|
2674 | return if $Coro::current == $Coro::main; |
|
|
2675 | |
2657 | my $signal = new Coro::Signal; |
2676 | my $signal = new Coro::Signal; |
2658 | push @WAIT_FOR_TICK_BEGIN, $signal; |
2677 | push @WAIT_FOR_TICK_BEGIN, $signal; |
2659 | $signal->wait; |
2678 | $signal->wait; |
2660 | } |
2679 | } |
2661 | |
2680 | |