ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/player-env.ext
(Generate patch)

Comparing deliantra/server/ext/player-env.ext (file contents):
Revision 1.18 by root, Fri May 14 22:56:47 2010 UTC vs.
Revision 1.19 by root, Fri May 14 23:47:37 2010 UTC

2 2
3# this extension provides "environmental effects", 3# this extension provides "environmental effects",
4# meaning mostly background music and region messages right now. 4# meaning mostly background music and region messages right now.
5 5
6our %MUSIC_GROUP; 6our %MUSIC_GROUP;
7our %MUSIC_FACE_CACHE; # cleared by reload_facedata
7 8
8sub reload { 9sub reload {
9 cf::trace "loading music config from $DATADIR/music\n"; 10 cf::trace "loading music config from $DATADIR/music\n";
10 11
11 0 < Coro::AIO::aio_load "$DATADIR/music", my $data 12 0 < Coro::AIO::aio_load "$DATADIR/music", my $data
12 or die "$DATADIR/music $!"; 13 or die "$DATADIR/music $!";
13 14
14 my $conf = JSON::XS->new->utf8->relaxed->decode ($data); 15 my $conf = JSON::XS->new->utf8->relaxed->decode ($data);
15 %MUSIC_GROUP = %{ $conf->{group} }; 16 %MUSIC_GROUP = %{ $conf->{group} };
17 %MUSIC_FACE_CACHE = ();
16} 18}
17 19
18cf::post_init { 20cf::post_init {
19 $_[0] ? cf::async { reload } : reload 21 $_[0] ? cf::async { reload } : reload
20}; 22};
48 # sort by size, smallest first, because it'S the fastest to download... 50 # sort by size, smallest first, because it'S the fastest to download...
49 [ sort { (cf::face::get_data_size $a) <=> (cf::face::get_data_size $b) } @face ] 51 [ sort { (cf::face::get_data_size $a) <=> (cf::face::get_data_size $b) } @face ]
50} 52}
51 53
52our %MUSIC_QUEUE; 54our %MUSIC_QUEUE;
53our %MUSIC_FACE_CACHE; # cleared by reload_facedata
54 55
55our $MUSIC_SCHEDULER = cf::async_ext { 56our $MUSIC_SCHEDULER = cf::async_ext {
56 $Coro::current->{desc} = "music scheduler"; 57 $Coro::current->{desc} = "music scheduler";
57 58
58 while () { 59 while () {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines