… | |
… | |
271 | |
271 | |
272 | Wait until the given lock is available and then acquires it and returns |
272 | Wait until the given lock is available and then acquires it and returns |
273 | a Coro::guard object. If the guard object gets destroyed (goes out of scope, |
273 | a Coro::guard object. If the guard object gets destroyed (goes out of scope, |
274 | for example when the coroutine gets canceled), the lock is automatically |
274 | for example when the coroutine gets canceled), the lock is automatically |
275 | returned. |
275 | returned. |
|
|
276 | |
|
|
277 | Locks are *not* recursive, locking from the same coro twice results in a |
|
|
278 | deadlocked coro. |
276 | |
279 | |
277 | Lock names should begin with a unique identifier (for example, cf::map::find |
280 | Lock names should begin with a unique identifier (for example, cf::map::find |
278 | uses map_find and cf::map::load uses map_load). |
281 | uses map_find and cf::map::load uses map_load). |
279 | |
282 | |
280 | =item $locked = cf::lock_active $string |
283 | =item $locked = cf::lock_active $string |
… | |
… | |
2833 | # the server's init and main functions |
2836 | # the server's init and main functions |
2834 | |
2837 | |
2835 | sub load_facedata($) { |
2838 | sub load_facedata($) { |
2836 | my ($path) = @_; |
2839 | my ($path) = @_; |
2837 | |
2840 | |
|
|
2841 | # HACK to clear player env face cache, we need some signal framework |
|
|
2842 | # for this (global event?) |
|
|
2843 | %ext::player_env::MUSIC_FACE_CACHE = (); |
|
|
2844 | |
2838 | my $enc = JSON::XS->new->utf8->canonical->relaxed; |
2845 | my $enc = JSON::XS->new->utf8->canonical->relaxed; |
2839 | |
2846 | |
2840 | warn "loading facedata from $path\n"; |
2847 | warn "loading facedata from $path\n"; |
2841 | |
2848 | |
2842 | my $facedata; |
2849 | my $facedata; |
… | |
… | |
2953 | $ns->fx_want ($k, $v); |
2960 | $ns->fx_want ($k, $v); |
2954 | } |
2961 | } |
2955 | }; |
2962 | }; |
2956 | |
2963 | |
2957 | sub reload_regions { |
2964 | sub reload_regions { |
|
|
2965 | # HACK to clear player env face cache, we need some signal framework |
|
|
2966 | # for this (global event?) |
|
|
2967 | %ext::player_env::MUSIC_FACE_CACHE = (); |
|
|
2968 | |
2958 | load_resource_file "$MAPDIR/regions" |
2969 | load_resource_file "$MAPDIR/regions" |
2959 | or die "unable to load regions file\n"; |
2970 | or die "unable to load regions file\n"; |
2960 | |
2971 | |
2961 | for (cf::region::list) { |
2972 | for (cf::region::list) { |
2962 | $_->{match} = qr/$_->{match}/ |
2973 | $_->{match} = qr/$_->{match}/ |