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

Comparing deliantra/server/ext/item-worldmap.ext (file contents):
Revision 1.3 by root, Sun Jul 22 14:17:58 2007 UTC vs.
Revision 1.4 by root, Sun Jul 22 17:10:06 2007 UTC

1#! perl # depends=widget 1#! perl # depends=widget
2#! perl 2
3# this module implements a rather fancy worldmap
4
5our $WORLDMAP_UPDATE_INTERVAL = $cfg::CFG{worldmap_update_interval} || 10;
6
7cf::async_ext {
8 my $schedule_interval = Coro::Event->timer (after => 1);
9
10 while () {
11 $schedule_interval->interval ($WORLDMAP_UPDATE_INTERVAL);
12 $schedule_interval->next;
13 }
14};
3 15
4sub create_widgets { 16sub create_widgets {
5 my ($ns) = @_; 17 my ($ns) = @_;
6 18
7 my $info = { }; 19 my $info = { };
29 $canvas->add_fixed ($ws->new (Label => text => "lb1"), abs => 10, 10, rel => 1, 1); 41 $canvas->add_fixed ($ws->new (Label => text => "lb1"), abs => 10, 10, rel => 1, 1);
30 42
31 $info 43 $info
32} 44}
33 45
34# this module implements a rather fancy worldmap 46sub update_worldmap {
47 my ($ns) = @_;
48
49 my $ws = $ns->{ws_worldmap} or return;
50}
35 51
36cf::object::attachment item_worldmap => 52cf::object::attachment item_worldmap =>
37 on_apply => sub { 53 on_apply => sub {
38 my ($self, $who) = @_; 54 my ($self, $who) = @_;
39 55
40 my $ns = $who->contr->ns; 56 my $ns = $who->contr->ns;
41 57
42 if ($ns->{can_widget}) { 58 if ($ns->{can_widget}) {
43 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns; 59 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
44 $ws->{toplevel}->show; 60 $ws->{toplevel}->toggle_visibility;
61 $ws->{toplevel}->get (visible => sub {
62 update_worldmap $ns;
63 });
45 } else { 64 } else {
46 $ns->send_msg ("log", "Your client doesn't support the (required) widget extension. Try CFPlus at http://crossfire.schmorp.de/.", cf::NDI_RED); 65 $ns->send_msg ("log", "Your client doesn't support the (required) widget extension. Try CFPlus at http://crossfire.schmorp.de/.", cf::NDI_RED);
47 } 66 }
48 67
49 cf::override 1; 68 cf::override 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines