ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.137 by root, Sat Jul 28 00:45:28 2007 UTC vs.
Revision 1.155 by root, Fri Aug 17 21:18:01 2007 UTC

21 21
22 my $self = $class->SUPER::new (%arg, 22 my $self = $class->SUPER::new (%arg,
23 setup_req => { 23 setup_req => {
24 extmap => 1, 24 extmap => 1,
25 excmd => 1, 25 excmd => 1,
26 ywidget => 1,#d# 26 xwidget1 => 1,#d#
27 %{$arg{setup_req} || {}}, 27 %{$arg{setup_req} || {}},
28 }, 28 },
29 ); 29 );
30 30
31 $self->{map_widget}->clr_commands; 31 $self->{map_widget}->clr_commands;
48 sort { (length $a) <=> (length $b) } 48 sort { (length $a) <=> (length $b) }
49 @args 49 @args
50 } sort { $a->{par} <=> $b->{par} } 50 } sort { $a->{par} <=> $b->{par} }
51 CFPlus::Pod::find command => "*"; 51 CFPlus::Pod::find command => "*";
52 52
53 $self->connect_ext (music => sub { 53 $self->connect_ext (ambient_music => sub {
54 my ($ev) = @_; 54 my ($songs) = @_;
55 55 &::audio_music_set_ambient ($songs);
56 &::audio_music_set ($self->{songs} = $ev->{play})
57 if $ev->{play};
58 }); 56 });
59 57
60 $self->connect_ext (capabilities => sub { 58 $self->connect_ext (capabilities => sub {
61 my (%cap) = @_; 59 my (%cap) = @_;
62 60
63 #$self->send ("setup sound 0"); # we use a different protocol 61 #$self->send ("setup sound 0"); # we use a different protocol
64 62 $self->update_fx_want;
65 $self->send_exti_msg (fx_want => {
66 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC
67 5 => !!$::CFG->{audio_enable}, # FT_SOUND
68 });
69 63
70 if (my $ts = $cap{tileset}) { 64 if (my $ts = $cap{tileset}) {
71 if (my ($default) = grep $_->[2] & 1, @$ts) { 65 if (my ($default) = grep $_->[2] & 1, @$ts) {
72 $self->{tileset} = $default; 66 $self->{tileset} = $default;
73 $self->{tilesize} = $default->[3]; 67 $self->{tilesize} = $default->[3];
110 # widgetset create 104 # widgetset create
111 $self->connect_ext (ws_c => sub { 105 $self->connect_ext (ws_c => sub {
112 my ($ws, $id, $class, $args) = @_; 106 my ($ws, $id, $class, $args) = @_;
113 107
114 for my $ev (grep /^on_/, keys %$args) { 108 for my $ev (grep /^on_/, keys %$args) {
109 my $rid = $args->{$ev};
115 $args->{$ev} = sub { 110 $args->{$ev} = sub {
116 my $id = shift->{s_id}; 111 my $id = shift->{s_id};
117 $self->send_exti_msg (w_e => $id, $ev, \@_); 112 $self->send_exti_msg (w_e => $id, $rid, @_);
118 113
119 1 114 1
120 }; 115 };
121 } 116 }
122 117
123 if (my $widget = eval { 118 $self->widget_associate (
119 $ws, $id => scalar eval {
124 local $SIG{__DIE__}; 120 local $SIG{__DIE__};
125 "CFPlus::UI::$class"->new ( 121 "CFPlus::UI::$class"->new (%$args)
126 %$args,
127 s_ws => $ws,
128 s_id => $id,
129 )
130 } 122 }
131 ) {
132 $self->{widget}{$id}
133 = $self->{widgetset}{$ws}{w}{$id}
134 = $widget;
135
136 $widget->connect (on_destroy => sub {
137 my ($widget) = @_;
138
139 delete $self->{widget}{$widget->{s_id}};
140 delete $self->{widgetset}{$widget->{s_ws}}{$widget->{s_id}};
141 });
142 } else {
143 warn "server failed creating client-side widget " . (CFPlus::to_json $class) . ": $@\n"; 123 ) or warn "server failed creating client-side widget " . (CFPlus::to_json $class) . ": $@\n";
144 $self->send_exti_msg (w_e => $id, "destroy"); 124 });
125
126 # widgetset associate
127 $self->connect_ext (ws_a => sub {
128 my (%ass) = @_;
129
130 # everything that has a name, wether conceivably useful or not
131 my %wkw = (
132 root => $CFPlus::UI::ROOT,
133 tooltip => $CFPlus::UI::TOOLTIP,
134
135 mapwidget => $::MAPWIDGET,
136 buttonbar => $::BUTTONBAR,
137 metaserver => $::METASERVER,
138 buttonbar => $::BUTTONBAR,
139 login_button => $::LOGIN_BUTTON,
140 quit_dialog => $::QUIT_DIALOG,
141 host_entry => $::HOST_ENTRY,
142 metaserver => $::METASERVER,
143 server_info => $::SERVER_INFO,
144
145 setup_dialog => $::SETUP_DIALOG,
146 setup_notebook => $::SETUP_NOTEBOOK,
147 setup_server => $::SETUP_SERVER,
148 setup_keyboard => $::SETUP_KEYBOARD,
149
150 pl_notebook => $::PL_NOTEBOOK,
151 pl_window => $::PL_WINDOW,
152 inventory_page => $::INVENTORY_PAGE,
153 stats_page => $::STATS_PAGE,
154 skill_page => $::SKILL_PAGE,
155 spell_page => $::SPELL_PAGE,
156 spell_list => $::SPELL_LIST,
157
158 floorbox => $::FLOORBOX,
159 help_window => $::HELP_WINDOW,
160 message_window => $::MESSAGE_WINDOW,
161 statusbox => $::SDTATUSBOX,
162
163 inv => $::INV,
164 invr => $::INVR,
165 invr_hb => $::INVR_HB,
166
167 );
168
169 while (my ($id, $name) = each %ass) {
170 $self->widget_associate (undef, $id => $wkw{$name})
171 or warn "server failed to associate non-existent well-known widget $name\n";
145 } 172 }
146 }); 173 });
147 174
148 # widget call 175 # widget call
149 $self->connect_ext (w_c => sub { 176 $self->connect_ext (w_c => sub {
150 my ($id, $rid, $method, $args) = @_; 177 my ($id, $rid, $method, @args) = @_;
151 178
152 my $w = $self->{widget}{$id} 179 my $w = $self->{widget}{$id}
153 or return; 180 or return;
154 181
155 $args ||= [];
156
157 if ($rid) { 182 if ($rid) {
158 $self->send_exti_msg (w_r => $rid, [$w->$method (@$args)]); 183 $self->send_exti_msg (w_r => $rid, $w->$method (@args));
159 } else { 184 } else {
160 $w->$method (@$args); 185 $w->$method (@args);
161 } 186 }
162 }); 187 });
163 188
164 # widget set 189 # widget set
165 $self->connect_ext (w_s => sub { 190 $self->connect_ext (w_s => sub {
225 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; 250 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}";
226 251
227 $self 252 $self
228} 253}
229 254
255sub widget_associate {
256 my ($self, $ws, $id, $widget) = @_;
257
258 if ($widget) {
259 $widget->{s_id} = $id;
260 $self->{widget}{$id} = $widget;
261
262 if ($ws) {
263 $widget->{s_ws} = $ws;
264 $self->{widgetset}{$ws}{w}{$id} = $widget;
265 }
266
267 $widget->connect (on_destroy => sub {
268 my ($widget) = @_;
269
270 delete $self->{widget}{$widget->{s_id}};
271 delete $self->{widgetset}{$widget->{s_ws}}{$widget->{s_id}}
272 if exists $widget->{s_ws};
273 });
274
275 1
276 } else {
277 $self->send_exti_msg (w_e => $id, undef);
278
279 0
280 }
281}
282
283sub update_fx_want {
284 my ($self) = @_;
285
286 $self->send_exti_msg (fx_want => {
287 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC
288 5 => !!$::CFG->{audio_enable}, # FT_SOUND
289 });
290}
291
230sub logprint { 292sub logprint {
231 my ($self, @a) = @_; 293 my ($self, @a) = @_;
232 294
233 $self->{log_fh} ||= do { 295 CFPlus::DB::logprint "$Crossfire::VARDIR/log.$self->{host}" => (join "", @a), sub { };
234 my $path = "$Crossfire::VARDIR/log.$self->{host}";
235
236 open my $fh, ">>:utf8", $path
237 or die "Couldn't open logfile $path: $!";
238
239 $fh->autoflush (1);
240
241 $fh;
242 };
243
244 my ($sec, $min, $hour, $mday, $mon, $year) = localtime time;
245
246 my $ts = sprintf "%04d-%02d-%02d %02d:%02d:%02d",
247 $year + 1900, $mon + 1, $mday, $hour, $min, $sec;
248
249 print {$self->{log_fh}} "$ts ", @a, "\n";
250} 296}
251 297
252sub _stat_numdiff { 298sub _stat_numdiff {
253 my ($self, $name, $old, $new) = @_; 299 my ($self, $name, $old, $new) = @_;
254 300
519} 565}
520 566
521sub feed_map1a { 567sub feed_map1a {
522 my ($self, $data) = @_; 568 my ($self, $data) = @_;
523 569
524 $self->{map}->map1a_update ($data, $self->{setup}{extmap}); 570 my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap});
571 my $delay;
572
573 for my $tile (@$missing) {
574 next if $self->{delay}{$tile};
575
576 $delay = 1;
577
578 if (my $tex = $::CONN->{texture}[$tile]) {
579 $tex->upload;
580 } else {
581 $self->{delay}{$tile} = 1;
582
583 # we assume the face is in-flight and will eventually come
584 push @{$self->{face_cb}{$tile}}, sub {
585 delete $self->{delay}{$tile};
586 $_[0]->upload;
587 };
588 }
589 }
590
591 if ($delay) {
592 # delay the map drawing a tiny bit in the hope of getting the missing fetched
593 Event->timer (after => 0.03, cb => sub {
594 $_[0]->w->cancel;
595 $self->{map_widget}->update;
596 });
597 } else {
525 $self->{map_widget}->update; 598 $self->{map_widget}->update;
599 }
526} 600}
527 601
528sub magicmap { 602sub magicmap {
529 my ($self, $w, $h, $x, $y, $data) = @_; 603 my ($self, $w, $h, $x, $y, $data) = @_;
530 604
537 my $map_info = delete $self->{map_info} 611 my $map_info = delete $self->{map_info}
538 or return; 612 or return;
539 613
540 my ($hash, $x, $y, $w, $h) = @$map_info; 614 my ($hash, $x, $y, $w, $h) = @$map_info;
541 615
542 my $data = $self->{map}->get_rect ($x, $y, $w, $h); 616 my $data = Compress::LZF::compress $self->{map}->get_rect ($x, $y, $w, $h);
617 $self->{map_cache_new}{$hash} = \$data;
543 CFPlus::DB::put $self->{mapcache} => $hash => Compress::LZF::compress $data, sub { }; 618 CFPlus::DB::put $self->{mapcache} => $hash => $data, sub { };
544 #warn sprintf "SAVEmap[%s] length %d\n", $hash, length $data;#d#
545} 619}
546 620
547sub map_clear { 621sub map_clear {
548 my ($self) = @_; 622 my ($self) = @_;
549 623
562 do { 636 do {
563 $id = pop @{$self->{bg_fetch}} 637 $id = pop @{$self->{bg_fetch}}
564 or return; 638 or return;
565 } while $self->{texture}[$id]; 639 } while $self->{texture}[$id];
566 640
567 CFPlus::DB::get tilecache => $id, sub { 641 CFPlus::DB::exists tilecache => $id, sub {
568 my ($data) = @_; 642 my ($exists) = @_;
569 643
570 return unless $self->{map}; # stop when destroyed 644 return unless $self->{map}; # stop when destroyed
571 645
572 $self->set_texture ($id => $data) 646 if ($exists) {
573 if defined $data; 647 $self->have_tile ($id);
648 $self->{texture}[$id]->upload;
649 }
574 650
575 $self->bg_fetch; 651 $self->bg_fetch;
576 }; 652 };
577} 653}
578 654
579sub load_map($$$) { 655sub load_map($$$) {
580 my ($self, $hash, $x, $y) = @_; 656 my ($self, $hash, $x, $y) = @_;
581 657
582 my $gen = $self->{map_change_gen}; 658 my $gen = $self->{map_change_gen};
583 659
584 CFPlus::DB::get $self->{mapcache} => $hash, sub { 660 my $cb = sub {
585 return unless $gen == $self->{map_change_gen}; 661 return unless $gen == $self->{map_change_gen};
586 662
587 my ($data) = @_; 663 my ($data) = @_;
588 664
589 if (defined $data) { 665 if (defined $data) {
666 $self->{map_cache_new}{$hash} = \$data;
667
590 $data = Compress::LZF::decompress $data; 668 my $data = Compress::LZF::decompress $data;
591 #warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d#
592 669
593 my $inprogress = @{ $self->{bg_fetch} || [] }; 670 my $inprogress = @{ $self->{bg_fetch} || [] };
594 unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data); 671 unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data);
595 $self->bg_fetch unless $inprogress; 672 $self->bg_fetch unless $inprogress;
596 } 673 }
597 }; 674 };
675
676 if (my $rdata = $self->{map_cache_old}{$hash}) {
677 $cb->($$rdata);
678 } else {
679 CFPlus::DB::get $self->{mapcache} => $hash, $cb;
680 }
598} 681}
599 682
600# hardcode /world/world_xxx_xxx map names, the savings are enourmous, 683# hardcode /world/world_xxx_xxx map names, the savings are enourmous,
601# (server resource,s latency, bandwidth), so this hack is warranted. 684# (server resource,s latency, bandwidth), so this hack is warranted.
602# the right fix is to make real tiled maps with an overview file 685# the right fix is to make real tiled maps with an overview file
695 my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_; 778 my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_;
696 779
697 $self->flush_map; 780 $self->flush_map;
698 781
699 ++$self->{map_change_gen}; 782 ++$self->{map_change_gen};
783 $self->{map_cache_old} = delete $self->{map_cache_new};
700 784
701 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); 785 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy);
702 786
703 my $mapmapw = $self->{mapmap}->{w}; 787 my $mapmapw = $self->{mapmap}->{w};
704 my $mapmaph = $self->{mapmap}->{h}; 788 my $mapmaph = $self->{mapmap}->{h};
734 $self->{map}->set_tileid ($facenum => $id); 818 $self->{map}->set_tileid ($facenum => $id);
735 819
736 CFPlus::DB::get tilecache => $id, $cb; 820 CFPlus::DB::get tilecache => $id, $cb;
737 821
738 } elsif ($face->{type} & 1) { # with metadata 822 } elsif ($face->{type} & 1) { # with metadata
739 #::message ({ markup => "starting to download song #$face/$pri, check your output-rate setting if your connection gets laggy." });
740 CFPlus::DB::get "res-metadata" => $face->{name}, $cb; 823 CFPlus::DB::get res_meta => $face->{name}, $cb;
741 } 824 }
742} 825}
743 826
744sub face_update { 827sub face_update {
745 my ($self, $facenum, $face, $changed) = @_; 828 my ($self, $facenum, $face, $changed) = @_;
746 829
747 if ($face->{type} == 0) { # FT_FACE 830 if ($face->{type} == 0) { # FT_FACE
748 CFPlus::DB::put tilecache => $face->{id} => $face->{data}, sub { } 831 CFPlus::DB::put tilecache => $face->{id} => $face->{data}, sub { }
749 if $changed; 832 if $changed;
750 833
751 $self->set_texture ($face->{id} => delete $face->{data}); 834 $self->have_tile ($face->{id});
752 835
753 } elsif ($face->{type} & 1) { # split metadata 836 } elsif ($face->{type} & 1) { # split metadata
754 my $cb = sub { };
755
756 if ($face->{type} == 3) { # FT_MUSIC
757 $cb = sub {
758 $self->{music_meta}{$facenum} = $face;
759
760 ::message ({ markup => "downloaded song #$facenum" })
761 if $changed;
762
763 &::audio_music_set ($self->{songs});
764 };
765 }
766
767 if ($changed) { # new data 837 if ($changed) { # new data
768 my ($meta_json, $data) = unpack "(w/a*)*", delete $face->{data}; 838 my ($meta_json, $data) = unpack "(w/a*)*", delete $face->{data};
769 my $path = CFPlus::DB::path_of_res $face->{name};
770
771 CFPlus::DB::write_file $path, $data, sub {
772 CFPlus::DB::put "res-metadata" => $face->{name} => $meta_json, sub {
773 $face->{meta} = $self->{json_coder}->decode ($meta_json); 839 $face->{meta} = $self->{json_coder}->decode ($meta_json);
774 $face->{path} = $path;
775 840
776 $cb->(); 841 CFPlus::DB::put res_data => $face->{name} => $data, sub { };
777 }; 842 CFPlus::DB::put res_meta => $face->{name} => $meta_json, sub { };
778 };
779 } else { 843 } else {
780 $face->{meta} = $self->{json_coder}->decode (delete $face->{data}); 844 $face->{meta} = $self->{json_coder}->decode (delete $face->{data});
781 $cb->();
782 } 845 }
846
847 ::add_license ($face);
848
849 if ($face->{type} == 3) { # FT_MUSIC
850 $self->{music_meta}{$facenum} = $face;
851
852 ::message ({ markup => "downloaded song #$facenum" })
853 if $changed;
854
855 &::audio_music_push ($facenum);
856 } elsif ($face->{type} == 5) { # FT_SOUND
857 $self->{sound_meta}{$facenum} = $face;
858
859 ::message ({ markup => "downloaded sound #$facenum" })
860 if $changed;
861
862 &::audio_sound_push ($facenum);
863 }
864
783 } 865 }
784} 866}
785 867
786sub smooth_update { 868sub smooth_update {
787 my ($self, $facenum, $face) = @_; 869 my ($self, $facenum, $face) = @_;
788 870
789 $self->{map}->set_smooth ($facenum, $face->{smoothface}, $face->{smoothlevel}); 871 $self->{map}->set_smooth ($facenum, $face->{smoothface}, $face->{smoothlevel});
790} 872}
791 873
792sub set_texture { 874sub have_tile {
793 my ($self, $id, $data) = @_; 875 my ($self, $tile) = @_;
794 876
795 return unless $self->{map}; 877 return unless $self->{map};
796 878
797 $self->{texture}[$id] = my $tex = 879 my $tex = $self->{texture}[$tile] ||=
798 new_from_image CFPlus::Texture 880 new CFPlus::Texture
799 $data, minify => 1, mipmap => 1; 881 tile => $tile, minify => 1, mipmap => 1, delay => 1;
800 882
801 $self->{map}->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}});
802 $self->{map_widget}->update;
803
804 $_->() for @{(delete $self->{face_cb}{$id}) || []}; 883 $_->($tex) for @{(delete $self->{face_cb}{$tile}) || []};
805} 884}
806 885
807sub connect_face_update { 886sub connect_face_update {
808 my ($self, $id, $cb) = @_; 887 my ($self, $id, $cb) = @_;
809 888
815 @{$self->{face_cb}{$id}}; 894 @{$self->{face_cb}{$id}};
816 } 895 }
817} 896}
818 897
819sub sound_play { 898sub sound_play {
820 my ($self, $x, $y, $soundnum, $type) = @_; 899 my ($self, $type, $face, $dx, $dy, $vol) = @_;
821 warn "sound play <@_>\n";#d#
822 900
823 #$self->{sound_play}->($x, $y, $soundnum, $type); 901 &::audio_sound_play ($face, $dx, $dy, $vol)
902 unless $type & 1; # odd types are silent for future expansion
824} 903}
825 904
826my $LAST_QUERY; # server is stupid, stupid, stupid 905my $LAST_QUERY; # server is stupid, stupid, stupid
827 906
828sub query { 907sub query {
893 $self->{$type} = $text; 972 $self->{$type} = $text;
894 } else { 973 } else {
895 $self->logprint ("msg: ", $text); 974 $self->logprint ("msg: ", $text);
896 return if $color < 0; # negative color == ignore if not understood 975 return if $color < 0; # negative color == ignore if not understood
897 976
898 my $fg = $CF_COLOR[$color % @CF_COLOR]; 977 my $fg = $CF_COLOR[$color & NDI_COLOR_MASK] || [1, 0, 0];
899 978
900 ## try to create single paragraphs of multiple lines sent by the server 979 ## try to create single paragraphs of multiple lines sent by the server
901 # no longer neecssary with TRT servers 980 # no longer neecssary with TRT servers
902 #$text =~ s/(?<=\S)\n(?=\w)/ /g; 981 #$text =~ s/(?<=\S)\n(?=\w)/ /g;
903 982
904 ::message ({ fg => $fg, markup => $_, type => $type, extra => [@extra] }) 983 ::message ({
984 fg => $fg,
985 markup => $_,
986 type => $type,
987 extra => [@extra],
988 color_flags => $color
905 for split /\n/, $text; 989 }) for split /\n/, $text;
906 990
907 $self->{statusbox}->add ($text, 991 $self->{statusbox}->add ($text,
908 group => $text, 992 group => $text,
909 fg => $fg, 993 fg => $fg,
910 timeout => $color >= 2 ? 180 : 10, 994 timeout => $color >= 2 ? 180 : 10,
966 $self->{map_widget}->clr_commands; 1050 $self->{map_widget}->clr_commands;
967 1051
968 ::stop_game (); 1052 ::stop_game ();
969} 1053}
970 1054
971sub image_info {
972 my ($self, $numfaces) = @_;
973
974 $self->{num_faces} = $numfaces;
975 $self->{face_prefetch} = [1 .. $numfaces];
976 $self->face_prefetch;
977}
978
979sub face_prefetch {
980 my ($self) = @_;
981
982 return unless $::CFG->{face_prefetch};
983
984 if ($self->{num_faces}) {
985 return if @{ $self->{send_queue} || [] };
986 my $todo = @{ $self->{face_prefetch} }
987 or return;
988
989 my ($face) = splice @{ $self->{face_prefetch} }, + rand @{ $self->{face_prefetch} }, 1, ();
990
991 $self->send ("requestinfo image_sums $face $face");
992
993 $self->{statusbox}->add (CFPlus::asxml "prefetching $todo",
994 group => "prefetch", timeout => 3, fg => [1, 1, 0, 0.5]);
995 } elsif (!exists $self->{num_faces}) {
996 $self->send ("requestinfo image_info");
997
998 $self->{num_faces} = 0;
999
1000 $self->{statusbox}->add (CFPlus::asxml "starting to prefetch",
1001 group => "prefetch", timeout => 3, fg => [1, 1, 0, 0.5]);
1002 }
1003}
1004
1005sub update_floorbox { 1055sub update_floorbox {
1006 $CFPlus::UI::ROOT->on_refresh ($::FLOORBOX => sub { 1056 $CFPlus::UI::ROOT->on_refresh ($::FLOORBOX => sub {
1007 return unless $::CONN; 1057 return unless $::CONN;
1008 1058
1009 $::FLOORBOX->clear; 1059 $::FLOORBOX->clear;
1038 } 1088 }
1039 1089
1040 $::FLOORBOX->add_at (@add); 1090 $::FLOORBOX->add_at (@add);
1041 }); 1091 });
1042 1092
1043 $::WANT_REFRESH++; 1093 $::WANT_REFRESH->start;
1044} 1094}
1045 1095
1046sub set_opencont { 1096sub set_opencont {
1047 my ($conn, $tag, $name) = @_; 1097 my ($conn, $tag, $name) = @_;
1048 $conn->{open_container} = $tag; 1098 $conn->{open_container} = $tag;
1049 update_floorbox; 1099 update_floorbox;
1050 1100
1051 $::INV_RIGHT_HB->clear (); 1101 $::INVR_HB->clear ();
1052 $::INV_RIGHT_HB->add (new CFPlus::UI::Label align => 0, expand => 1, text => $name); 1102 $::INVR_HB->add (new CFPlus::UI::Label align => 0, expand => 1, text => $name);
1053 1103
1054 if ($tag != 0) { # Floor isn't closable, is it? 1104 if ($tag != 0) { # Floor isn't closable, is it?
1055 $::INV_RIGHT_HB->add (new CFPlus::UI::Button 1105 $::INVR_HB->add (new CFPlus::UI::Button
1056 text => "Close container", 1106 text => "Close container",
1057 tooltip => "Close the currently open container (if one is open)", 1107 tooltip => "Close the currently open container (if one is open)",
1058 on_activate => sub { 1108 on_activate => sub {
1059 $::CONN->send ("apply $tag") # $::CONN->{open_container}") 1109 $::CONN->send ("apply $tag") # $::CONN->{open_container}")
1060 if $tag != 0; 1110 if $tag != 0;
1061 #if $CONN->{open_container} != 0;
1062 0 1111 0
1063 }, 1112 },
1064 ); 1113 );
1065 } 1114 }
1066 1115

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines