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.427 by root, Sat Apr 26 12:25:45 2008 UTC vs.
Revision 1.429 by root, Sat May 3 15:17:13 2008 UTC

2031 2031
2032 cf::lock_wait "map_data:$path";#d#remove 2032 cf::lock_wait "map_data:$path";#d#remove
2033 cf::lock_wait "map_find:$path"; 2033 cf::lock_wait "map_find:$path";
2034 2034
2035 $cf::MAP{$path} || do { 2035 $cf::MAP{$path} || do {
2036 my $guard1 = cf::lock_acquire "map_find:$path";
2037 my $guard2 = cf::lock_acquire "map_data:$path"; # just for the fun of it 2036 my $guard1 = cf::lock_acquire "map_data:$path"; # just for the fun of it
2037 my $guard2 = cf::lock_acquire "map_find:$path";
2038 2038
2039 my $map = new_from_path cf::map $path 2039 my $map = new_from_path cf::map $path
2040 or return; 2040 or return;
2041 2041
2042 $map->{last_save} = $cf::RUNTIME; 2042 $map->{last_save} = $cf::RUNTIME;
2045 or return; 2045 or return;
2046 2046
2047 if ($map->should_reset) {#d#TODO# disabled, crashy (locking issue?) 2047 if ($map->should_reset) {#d#TODO# disabled, crashy (locking issue?)
2048 # doing this can freeze the server in a sync job, obviously 2048 # doing this can freeze the server in a sync job, obviously
2049 #$cf::WAIT_FOR_TICK->wait; 2049 #$cf::WAIT_FOR_TICK->wait;
2050 undef $guard2;
2050 undef $guard1; 2051 undef $guard1;
2051 undef $guard2;
2052 $map->reset; 2052 $map->reset;
2053 return find $path; 2053 return find $path;
2054 } 2054 }
2055 2055
2056 $cf::MAP{$path} = $map 2056 $cf::MAP{$path} = $map
2459can be C<undef>. Does the right thing when the player is currently in a 2459can be C<undef>. Does the right thing when the player is currently in a
2460dialogue with the given NPC character. 2460dialogue with the given NPC character.
2461 2461
2462=cut 2462=cut
2463 2463
2464our $SAY_CHANNEL = {
2465 id => "say",
2466 title => "Map",
2467 reply => "say ",
2468 tooltip => "Things said to and replied from npcs near you and other players on the same map only.",
2469};
2470
2471our $CHAT_CHANNEL = {
2472 id => "chat",
2473 title => "Chat",
2474 reply => "chat ",
2475 tooltip => "Player chat and shouts, global to the server.",
2476};
2477
2464# rough implementation of a future "reply" method that works 2478# rough implementation of a future "reply" method that works
2465# with dialog boxes. 2479# with dialog boxes.
2466#TODO: the first argument must go, split into a $npc->reply_to ( method 2480#TODO: the first argument must go, split into a $npc->reply_to ( method
2467sub cf::object::player::reply($$$;$) { 2481sub cf::object::player::reply($$$;$) {
2468 my ($self, $npc, $msg, $flags) = @_; 2482 my ($self, $npc, $msg, $flags) = @_;
2479 my $dialog = $pl->{npc_dialog}; 2493 my $dialog = $pl->{npc_dialog};
2480 $dialog->{pl}->ext_msg ($dialog->{id}, update => msg => $dialog->{pl}->expand_cfpod ($msg)); 2494 $dialog->{pl}->ext_msg ($dialog->{id}, update => msg => $dialog->{pl}->expand_cfpod ($msg));
2481 2495
2482 } else { 2496 } else {
2483 $msg = $npc->name . " says: $msg" if $npc; 2497 $msg = $npc->name . " says: $msg" if $npc;
2484 $self->message ($msg, $flags); 2498 $self->send_msg ($SAY_CHANNEL => $msg, $flags);
2485 } 2499 }
2486 } 2500 }
2487} 2501}
2488 2502
2489=item $object->send_msg ($channel, $msg, $color, [extra...]) 2503=item $object->send_msg ($channel, $msg, $color, [extra...])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines