ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.529 by root, Wed Apr 28 11:28:22 2010 UTC vs.
Revision 1.530 by root, Wed Apr 28 21:05:33 2010 UTC

106our $RANDOMDIR = "$LOCALDIR/random"; 106our $RANDOMDIR = "$LOCALDIR/random";
107our $BDBDIR = "$LOCALDIR/db"; 107our $BDBDIR = "$LOCALDIR/db";
108our $PIDFILE = "$LOCALDIR/pid"; 108our $PIDFILE = "$LOCALDIR/pid";
109our $RUNTIMEFILE = "$LOCALDIR/runtime"; 109our $RUNTIMEFILE = "$LOCALDIR/runtime";
110 110
111our %RESOURCE; 111our %RESOURCE; # unused
112 112
113our $OUTPUT_RATE_MIN = 3000; 113our $OUTPUT_RATE_MIN = 3000;
114our $OUTPUT_RATE_MAX = 1000000; 114our $OUTPUT_RATE_MAX = 1000000;
115 115
116our $MAX_LINKS = 32; # how many chained exits to follow 116our $MAX_LINKS = 32; # how many chained exits to follow
3428 my $idx = (cf::face::find $name) || cf::face::alloc $name; 3428 my $idx = (cf::face::find $name) || cf::face::alloc $name;
3429 3429
3430 cf::face::set_data $idx, 0, $info->{data}, $info->{hash}; 3430 cf::face::set_data $idx, 0, $info->{data}, $info->{hash};
3431 cf::face::set_type $idx, $info->{type}; 3431 cf::face::set_type $idx, $info->{type};
3432 } else { 3432 } else {
3433 $RESOURCE{$name} = $info; 3433 $RESOURCE{$name} = $info; # unused
3434 } 3434 }
3435 3435
3436 cf::cede_to_tick; 3436 cf::cede_to_tick;
3437 } 3437 }
3438 } 3438 }
3439 3439
3440 cf::global->invoke (EVENT_GLOBAL_RESOURCE_UPDATE); 3440 cf::global->invoke (EVENT_GLOBAL_RESOURCE_UPDATE);
3441 3441
3442 1 3442 1
3443} 3443}
3444
3445cf::global->attach (on_resource_update => sub {
3446 if (my $soundconf = $RESOURCE{"res/sound.conf"}) {
3447 $soundconf = JSON::XS->new->utf8->relaxed->decode ($soundconf->{data});
3448
3449 for (0 .. SOUND_CAST_SPELL_0 - 1) {
3450 my $sound = $soundconf->{compat}[$_]
3451 or next;
3452
3453 my $face = cf::face::find "sound/$sound->[1]";
3454 cf::sound::set $sound->[0] => $face;
3455 cf::sound::old_sound_index $_, $face; # gcfclient-compat
3456 }
3457
3458 while (my ($k, $v) = each %{$soundconf->{event}}) {
3459 my $face = cf::face::find "sound/$v";
3460 cf::sound::set $k => $face;
3461 }
3462 }
3463});
3464 3444
3465register_exticmd fx_want => sub { 3445register_exticmd fx_want => sub {
3466 my ($ns, $want) = @_; 3446 my ($ns, $want) = @_;
3467 3447
3468 while (my ($k, $v) = each %$want) { 3448 while (my ($k, $v) = each %$want) {
3507sub reload_treasures { 3487sub reload_treasures {
3508 load_resource_file "$DATADIR/treasures" 3488 load_resource_file "$DATADIR/treasures"
3509 or die "unable to load treasurelists\n"; 3489 or die "unable to load treasurelists\n";
3510} 3490}
3511 3491
3492sub reload_sound {
3493 0 < Coro::AIO::aio_load "$DATADIR/sound", my $data
3494 or die "$DATADIR/sound $!";
3495
3496 my $soundconf = JSON::XS->new->utf8->relaxed->decode ($data);
3497
3498 for (0 .. SOUND_CAST_SPELL_0 - 1) {
3499 my $sound = $soundconf->{compat}[$_]
3500 or next;
3501
3502 my $face = cf::face::find "sound/$sound->[1]";
3503 cf::sound::set $sound->[0] => $face;
3504 cf::sound::old_sound_index $_, $face; # gcfclient-compat
3505 }
3506
3507 while (my ($k, $v) = each %{$soundconf->{event}}) {
3508 my $face = cf::face::find "sound/$v";
3509 cf::sound::set $k => $face;
3510 }
3511}
3512
3512sub reload_resources { 3513sub reload_resources {
3513 warn "reloading resource files...\n"; 3514 warn "reloading resource files...\n";
3514 3515
3515 reload_facedata; 3516 reload_facedata;
3517 reload_sound;
3516 reload_archetypes; 3518 reload_archetypes;
3517 reload_regions; 3519 reload_regions;
3518 reload_treasures; 3520 reload_treasures;
3519 3521
3520 warn "finished reloading resource files\n"; 3522 warn "finished reloading resource files\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines