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.13 by root, Tue Jul 31 02:01:18 2007 UTC vs.
Revision 1.14 by root, Thu Aug 30 08:34:40 2007 UTC

17 split /\s*,\s*/, $list 17 split /\s*,\s*/, $list
18 ] 18 ]
19} 19}
20 20
21our %MUSIC_QUEUE; 21our %MUSIC_QUEUE;
22our %MUSIC_FACE_CACHE; # cleared by reload_facedata
22 23
23our $MUSIC_SCHEDULER = cf::async_ext { 24our $MUSIC_SCHEDULER = cf::async_ext {
24 while () { 25 while () {
25 for (keys %MUSIC_QUEUE) { 26 for (keys %MUSIC_QUEUE) {
26 delete $MUSIC_QUEUE{$_}; 27 delete $MUSIC_QUEUE{$_};
31 $pl->ob->active or next; 32 $pl->ob->active or next;
32 my $ns = $pl->ns or next; 33 my $ns = $pl->ns or next;
33 $ns->extcmd or next; 34 $ns->extcmd or next;
34 my $map = $pl->ob->map or next; 35 my $map = $pl->ob->map or next;
35 36
36 my $faces; 37 my $faces = $MUSIC_FACE_CACHE{$map} ||= do {
38 # 1. map-specific music info
39 parse_facelist "music/", $map->{music}
40 or do {
41 # 2. fall back to region if no map-specific music
42 my $rgn = $pl->ob->region
43 or next;
37 44
38 # 1. update map-specific music info 45 my $par = $rgn;
39 unless (exists $map->{music_faces}) { 46 while () {
40 $map->{music_faces} = parse_facelist "music/", $map->{music}; 47 last if exists $par->{music};
41 } 48 $par = $par->parent
49 or last;
50 }
42 51
43 my $faces = $map->{music_faces}; 52 parse_facelist "music/", $par->{music}
44
45 # 2. fall back to region if no map-specific music
46 unless ($faces) {
47 my $rgn = $pl->ob->region
48 or next;
49
50 unless (exists $rgn->{music_faces}) {
51 my $par = $rgn;
52 while () {
53 last if exists $par->{music};
54 $par = $par->parent
55 or last;
56 } 53 }
57
58 $rgn->{music_faces} = parse_facelist "music/", $par->{music};
59 } 54 ;
60
61 $faces = $rgn->{music_faces};
62 } 55 };
63 56
64 $faces 57 $faces
65 or next; 58 or next;
66 59
67 my $facestr = join ",", @$faces; 60 my $facestr = join ",", @$faces;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines