ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/kgsueme/game.pl
(Generate patch)

Comparing kgsueme/kgsueme/game.pl (file contents):
Revision 1.21 by pcg, Sun Jun 1 06:40:15 2003 UTC vs.
Revision 1.104 by pcg, Sun May 30 07:24:06 2004 UTC

1use utf8;
2
3use Scalar::Util ();
4
5package game::goclock;
6
7# Lo and Behold! I admit it! The rounding stuff etc.. in goclock
8# is completely borked.
9
10use Time::HiRes ();
11
12use KGS::Constants;
13
14use Glib::Object::Subclass
15 Gtk2::Label;
16
17sub INIT_INSTANCE {
18 my $self = shift;
19
20 $self->signal_connect (destroy => sub { $_[0]->stop });
21
22 $self->{set} = sub { };
23 $self->{format} = sub { "???" };
24}
25
26sub configure {
27 my ($self, $timesys, $main, $interval, $count) = @_;
28
29 if ($timesys == TIMESYS_ABSOLUTE) {
30 $self->{set} = sub { $self->{time} = $_[0] };
31 $self->{format} = sub { util::format_time $_[0] };
32
33 } elsif ($timesys == TIMESYS_BYO_YOMI) {
34 my $low = $interval * $count;
35
36 $self->{set} = sub { $self->{time} = $_[0] };
37
38 $self->{format} = sub {
39 if ($_[0] > $low) {
40 util::format_time $_[0] - $low;
41 } else {
42 sprintf "%s (%d)",
43 util::format_time int (($_[0] - 1) % $interval + 1),
44 ($_[0] - 1) / $interval;
45 }
46 };
47
48 } elsif ($timesys == TIMESYS_CANADIAN) {
49 $self->{set} = sub { $self->{time} = $_[0]; $self->{moves} = $_[1] };
50
51 $self->{format} = sub {
52 if (!$self->{moves}) {
53 util::format_time $_[0] - $low;
54 } else {
55 my $time = int (($_[0] - 1) % $interval + 1);
56
57 sprintf "%s/%d =%d",
58 util::format_time $time,
59 $self->{moves},
60 $self->{moves} > 1
61 ? $time / $self->{moves}
62 : $interval;
63 }
64 };
65
66 } else {
67 # none, or unknown
68 $self->{set} = sub { };
69 $self->{format} = sub { "---" }
70 }
71}
72
73sub refresh {
74 my ($self, $timestamp) = @_;
75 my $timer = $self->{time} + $self->{start} - $timestamp;
76
77 # we round the timer value slightly... the protocol isn't exact anyways,
78 # and this gives smoother timers ;)
79 my $timer2 = int $timer + 0.4;
80
81 if ($timer2 <= 0) {
82 $timer2 = 0 if $timer2 < 0;
83 $self->set_text ("TIME OUT");
84 } else {
85 $self->set_text ($self->{format}->($timer2));
86 }
87
88 $timer - int $timer;
89}
90
91sub set_time {
92 my ($self, $time, $moves) = @_;
93
94 # we ignore requests to re-set the time of a running clock.
95 # this is the easiest way to ensure that commentary etc.
96 # doesn't re-set the clock. yes, this is frickle design,
97 # but I think the protocol is to blame here, which gives
98 # very little time information. (cgoban2 also has had quite
99 # a lot of small time update problems...)
100 unless ($self->{timeout}) {
101 $self->{set}->($time, $moves);
102 $self->refresh ($self->{start});
103 }
104}
105
106sub start {
107 my ($self, $when) = @_;
108
109 $self->stop;
110
111 $self->{start} = $when;
112
113 my $timeout; $timeout = sub {
114 my $next = $self->refresh (Time::HiRes::time) * 1000;
115 $next += 1000 if $next < 0;
116 $self->{timeout} = add Glib::Timeout $next, $timeout;
117 0;
118 };
119
120 $timeout->();
121}
122
123sub stop {
124 my ($self) = @_;
125
126 remove Glib::Source delete $self->{timeout} if $self->{timeout};
127}
128
129package game::userpanel;
130
131use Glib::Object::Subclass
132 Gtk2::HBox,
133 properties => [
134 Glib::ParamSpec->IV ("colour", "colour", "User Colour", 0, 1, 0, [qw(construct-only writable)]),
135 ];
136
137sub INIT_INSTANCE {
138 my ($self) = @_;
139
140 $self->add (my $vbox = new Gtk2::VBox);
141
142 $vbox->add ($self->{name} = new Gtk2::Label $self->{name});
143 $vbox->add ($self->{info} = new Gtk2::Label "");
144 $vbox->add ($self->{clock} = new game::goclock); Scalar::Util::weaken $self->{clock};
145
146 $vbox->add ($self->{imagebox} = new Gtk2::VBox);
147
148 $self;
149}
150
151sub configure {
152 my ($self, $app, $user, $rules) = @_;
153
154 if ($self->{name}->get_text ne $user->as_string) {
155 $self->{name}->set_text ($user->as_string);
156
157 $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children;
158 $self->{imagebox}->add (gtk::image_from_data undef);
159 $self->{imagebox}->show_all;
160
161 if ($user->has_pic) {
162 # the big picture...
163 $app->userpic ($user->{name}, sub {
164 return unless $self->{imagebox};
165
166 if ($_[0]) {
167 $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children;
168 $self->{imagebox}->add (gtk::image_from_data $_[0]);
169 $self->{imagebox}->show_all;
170 }
171 });
172 }
173 }
174
175 $self->{clock}->configure (@{$rules}{qw(timesys time interval count)});
176}
177
178sub set_captures {
179 my ($self, $captures) = @_;
180
181 $self->{info}->set_text ("$captures pris.");
182}
183
184sub set_timer {
185 my ($self, $when, $time, $moves) = @_;
186
187 $self->{clock}->stop unless $when;
188 $self->{clock}->set_time ($time, $moves);
189 $self->{clock}->start ($when) if $when;
190}
191
1package game; 192package game;
193
194use Scalar::Util qw(weaken);
2 195
3use KGS::Constants; 196use KGS::Constants;
4use KGS::Game::Board; 197use KGS::Game::Board;
5 198
199use Gtk2::GoBoard;
200use Gtk2::GoBoard::Constants;
201
202use base KGS::Game;
6use base KGS::Listener::Game; 203use base KGS::Listener::Game;
7use base KGS::Game;
8 204
9use base gtk::widget; 205use Glib::Object::Subclass
206 Gtk2::Window;
10 207
11use POSIX qw(ceil); 208use POSIX qw(ceil);
12 209
13sub new { 210sub new {
14 my $self = shift; 211 my ($self, %arg) = @_;
15 $self = $self->SUPER::new(@_); 212 $self = $self->Glib::Object::new;
213 $self->{$_} = delete $arg{$_} for keys %arg;
16 214
17 $self->listen($self->{conn});
18
19 $self->{window} = new Gtk2::Window 'toplevel';
20 my $title = $self->{channel} ? $self->owner->as_string." ".$self->opponent_string : "Game Window";
21 $self->{window}->set_title("KGS Game $title");
22 gtk::state $self->{window}, "game::window", undef, window_size => [600, 500]; 215 gtk::state $self, "game::window", undef, window_size => [600, 500];
23 216
24 $self->{window}->signal_connect(delete_event => sub { 217 $self->signal_connect (destroy => sub {
25 if ($self->{joined}) { 218 $self->unlisten;
219 delete $self->{app}{game}{$self->{channel}};
220 %{$_[0]} = ();
221 });#d#
222
223 $self->add (my $hpane = new Gtk2::HPaned);
224 gtk::state $hpane, "game::hpane", undef, position => 500;
225
226 # LEFT PANE
227
228 $hpane->pack1 (($self->{left} = new Gtk2::VBox), 1, 0);
229
230 $self->{boardbox} = new Gtk2::VBox;
231
232 $hpane->pack1((my $vbox = new Gtk2::VBox), 1, 1);
233
234 # board box (aspect/canvas)
235
236 #$self->{boardbox}->pack_start((my $frame = new Gtk2::Frame), 0, 1, 0);
237
238 # RIGHT PANE
239
240 $hpane->pack2 ((my $vbox = new Gtk2::VBox), 1, 1);
241 $hpane->set (position_set => 1);
242
243 $vbox->pack_start ((my $frame = new Gtk2::Frame), 0, 1, 0);
244
245 {
246 $frame->add (my $vbox = new Gtk2::VBox);
247 $vbox->add ($self->{title} = new Gtk2::Label $title);
248
249 $vbox->add (my $hbox = new Gtk2::HBox);
250
251 $hbox->pack_start (($self->{board_label} = new Gtk2::Label), 0, 1, 0);
252
253 $self->{moveadj} = new Gtk2::Adjustment 1, 1, 1, 1, 5, 0;
254
255 $hbox->pack_start ((my $scale = new Gtk2::HScale $self->{moveadj}), 1, 1, 0);
256 $scale->set_draw_value (0);
257 $scale->set_digits (0);
258
259 $self->{moveadj}->signal_connect (value_changed => sub {
260 $self->{showmove} = int $self->{moveadj}->get_value;
26 $self->part; 261 $self->update_board;
27 } else {
28 $self->event_part;
29 } 262 });
30 1; 263 }
264
265 $vbox->pack_start ((my $hbox = new Gtk2::HBox 1), 0, 1, 0);
266
267 $hbox->add ($self->{userpanel}[$_] = new game::userpanel colour => $_)
268 for COLOUR_WHITE, COLOUR_BLACK;
269
270 $vbox->pack_start ((my $buttonbox = new Gtk2::HButtonBox), 0, 1, 0);
271
272 $buttonbox->add ($self->{button_pass} =
273 Gtk2::Button->Glib::Object::new (label => "Pass", no_show_all => 1, visible => 0));
274 $self->{button_pass}->signal_connect (clicked => sub {
275 $self->{board_click}->(255, 255) if $self->{board_click};
31 }); 276 });
32 277 $buttonbox->add ($self->{button_undo} =
33 $self->{window}->add($self->{hpane} = new Gtk2::HPaned); 278 Gtk2::Button->Glib::Object::new (label => "Undo", no_show_all => 1, visible => 0));
34 gtk::state $self->{hpane}, "game::hpane", undef, position => 500; 279 $self->{button_undo}->signal_connect (clicked => sub {
35 280 $self->send (req_undo => channel => $self->{channel});
36 $self->{hpane}->pack1((my $vbox = new Gtk2::VBox), 1, 1); 281 });
37 282 $buttonbox->add ($self->{button_resign} =
38 $vbox->pack_start((my $frame = new Gtk2::Frame), 0, 1, 0); 283 Gtk2::Button->Glib::Object::new (label => "Resign", no_show_all => 1, visible => 0));
39 284 $self->{button_resign}->signal_connect (clicked => sub {
285 $self->send (resign_game => channel => $self->{channel}, player => $self->{colour});
286 });
40 { 287
41 # grrr... 288 $vbox->pack_start (($self->{chat} = new superchat), 1, 1, 0);
42 $frame->add(my $vbox = new Gtk2::VBox);
43 $vbox->add($self->{title} = new Gtk2::Label $title);
44 289
45 $self->{moveadj} = new Gtk2::Adjustment 1, 0, 1, 0.001, 0.05, 0; 290 $self->set_channel ($self->{channel});
46 291
47 $vbox->add(my $scale = new Gtk2::HScale $self->{moveadj}); 292 $self->show_all;
48 $scale->set_draw_value (0);
49 293
294 $self;
295}
296
297sub set_channel {
298 my ($self, $channel) = @_;
299
300 $self->{channel} = $channel;
301
302 if ($self->{channel} > 0) {
303 $self->listen ($self->{conn});
304
305 $self->{rules_inlay} = $self->{chat}->new_switchable_inlay ("Game Setup:", sub { $self->draw_setup (@_) }, 1);
306 $self->{users_inlay} = $self->{chat}->new_switchable_inlay ("Users:", sub { $self->draw_users (@_) }, 1);
307
308 $self->signal_connect (delete_event => sub { $self->part; 1 });
50 $self->{moveadj}->signal_connect (value_changed => sub { 309 $self->{chat}->signal_connect (command => sub {
51 return unless $self->{path}; 310 my ($chat, $cmd, $arg) = @_;
52 311 if ($cmd eq "rsave") {
53 my $move = int (@{$self->{path}} * $_[0]->get_value); 312 Storable::nstore { tree => $self->{tree}, curnode => $self->{curnode}, move => $self->{move} }, $arg;#d#
54 313 } else {
55 $self->{board_label}->set_text ("Move $move"); 314 $self->{app}->do_command ($chat, $cmd, $arg, userlist => $self->{userlist}, game => $self);
56 315 }
57 $self->{board} = new KGS::Game::Board $self->{size};
58 $self->{board}->interpret_path ([@{$self->{path}}[0 .. $move - 1]]);
59
60 $self->redraw ($self->repaint_board);
61
62 $self->{text}->set_text(KGS::Listener::Debug::dumpval([$self->{board}{time},$self->{board}{captures}]). $self->{board}{comment});
63 }); 316 });
64 } 317 }
65
66 $vbox->pack_start((my $aspect_frame = new Gtk2::AspectFrame "", 0.5, 0.5, 1, 0), 1, 1, 0);
67 $aspect_frame->set (border_width => 0, shadow_type => 'none', label_xalign => 0.5);
68 $self->{board_label} = $aspect_frame->get_label_widget;
69
70 $aspect_frame->add($self->{canvas} = new Gtk2::DrawingArea);
71 $self->{canvas}->double_buffered (0) if $::config->{conserve_memory};
72
73 $self->{canvas}->signal_connect(configure_event => \&configure_event, $self);
74 $self->{canvas}->signal_connect(expose_event => \&expose_event, $self);
75
76 $self->{hpane}->pack2(($self->{vpane} = new Gtk2::VPaned), 0, 0);
77 $self->{hpane}->set(position_set => 1);
78 gtk::state $self->{vpane}, "game::vpane", $self->{name}, position => 80;
79
80 $self->{vpane}->add(my $sw = new Gtk2::ScrolledWindow);
81 $sw->set_policy("automatic", "always");
82
83 $sw->add(($self->{userlist} = new userlist)->widget);
84
85 $self->{vpane}->add(my $vbox = new Gtk2::VBox);
86
87 $vbox->pack_start((my $sw = new Gtk2::ScrolledWindow), 1, 1, 0);
88 $sw->set_policy("never", "always");
89
90 $sw->add(($self->{text} = new gtk::text)->widget);
91
92 $vbox->pack_start(($self->{entry} = new Gtk2::Entry), 0, 1, 0);
93 $self->{entry}->signal_connect(activate => sub {
94 my $text = $self->{entry}->get_text;
95 $self->say($text) if $text =~ /\S/;
96 $self->{entry}->set_text("");
97 });
98
99 $self;
100} 318}
101 319
102sub event_update_users { 320sub event_update_users {
103 my ($self, $add, $update, $remove) = @_; 321 my ($self, $add, $update, $remove) = @_;
104 322
105 $self->{userlist}->update ($add, $update, $remove); 323# $self->{userlist}->update ($add, $update, $remove);
324
325 $self->{challenge}{$_->{name}} && (delete $self->{challenge}{$_->{name}})->{inlay}->destroy
326 for @$remove;
327
328 $self->{users_inlay}->refresh;
329
330 my %important;
331 $important{$self->{black}{name}}++;
332 $important{$self->{white}{name}}++;
333 $important{$self->{owner}{name}}++;
334
335 if (my @users = grep $important{$_->{name}}, @$add) {
336 $self->{chat}->append_text ("\n<header>Joins:</header>");
337 $self->{chat}->append_text (" <user>" . $_->as_string . "</user>") for @users;
338 }
339 if (my @users = grep $important{$_->{name}}, @$remove) {
340 $self->{chat}->append_text ("\n<header>Parts:</header>");
341 $self->{chat}->append_text (" <user>" . $_->as_string . "</user>") for @users;
342 }
106} 343}
107 344
108sub join { 345sub join {
109 my ($self) = @_; 346 my ($self) = @_;
110 return if $self->{joined}; 347 return if $self->{joined};
111 348
112 $self->SUPER::join; 349 $self->SUPER::join;
113
114 $self->{window}->show_all;
115} 350}
116 351
117sub part { 352sub update_cursor {
118 my ($self) = @_; 353 my ($self) = @_;
119 return unless $self->{joined};
120 $self->SUPER::part;
121 354
122 $self->{window}->hide; 355 my $running = $self->{showmove} == @{$self->{path}} && $self->is_active;
123}
124 356
125sub configure_event {
126 my ($widget, $event, $self) = @_;
127 delete $self->{stack};
128 delete $self->{pixbuf};
129 delete $self->{board_shown}; 357 delete $self->{board_click};
130 delete $self->{background};
131 $self->repaint_board;
132 0;
133}
134 358
135sub expose_event { 359 if ($self->{teacher} eq $self->{app}{conn}) {
136 my ($widget, $event, $self) = @_; 360 #TODO# # teaching mode not implemented
361 $self->{button_pass}->set (label => "Pass", sensitive => 1, visible => 1);
362 $self->{button_undo}->hide;
363 $self->{button_resign}->hide;
364 $self->{board}->set (cursor => undef);
137 365
138 $self->{pixbuf} or return; 366 } elsif ($running && $self->{colour} != COLOUR_NONE) {
367 # during game
368 $self->{button_undo}->show;
369 $self->{button_resign}->show;
139 370
140 my $area = $event->area; 371 if ($self->{cur_board}{score}) {
141 372 # during scoring
142 $self->redraw ($area); 373 $self->{button_pass}->set (label => "Done", sensitive => 1, visible => 1);
143 374 $self->{board}->set (cursor => sub {
144 0;
145}
146
147# something Gtk2 fixed
148sub INTERP_NEAREST (){ 'nearest' }
149sub INTERP_TILES (){ 'tiles' }
150sub INTERP_BILINEAR (){ 'bilinear' }
151sub INTERP_HYPER (){ 'hyper' }
152
153sub new_pixbuf {
154 my ($w, $h, $alpha, $fill) = @_;
155
156 my $pixbuf = new Gtk2::Gdk::Pixbuf 'rgb', $alpha, 8, $w, $h;
157 $pixbuf->fill ($fill) if defined $fill;
158
159 $pixbuf;
160}
161
162sub scale_pixbuf {
163 my ($src, $w, $h, $mode) = @_;
164
165 my $dst = new_pixbuf $w, $h, 1;
166
167 $src->scale(
168 $dst, 0, 0, $w, $h, 0, 0,
169 $w / $src->get_width, $h / $src->get_height,
170 $mode,
171 );
172
173 $dst;
174}
175
176# create a stack of stones
177sub create_stack {
178 my ($self, $mark, $size, $rand) = @_;
179
180 my $shadow = $size * 0.05;
181
182 my $c = \$self->{stack}{$mark};
183 unless ($$c) {
184 for my $stone ($mark & (MARK_W | MARK_GRAY_W) ? @::white_img : @::black_img) {
185 my $base = new_pixbuf $size + $shadow, $size + $shadow, 1, 0x00000000;
186
187 # zeroeth the shadow
188 if ($mark & (MARK_B | MARK_W)) { 375 $_[0] & (MARK_B | MARK_W)
189 $::shadow_img->composite ( 376 ? $_[0] ^ MARK_GRAYED
190 $base, $shadow, $shadow, $size, $size, $shadow - 0.5, $shadow - 0.5, 377 : $_[0];
191 $size / $stone->get_width, $size / $stone->get_height,
192 $::config->{speed} ? INTERP_NEAREST : INTERP_BILINEAR, 192
193 );
194 } 378 });
195 379 $self->{board_click} = sub {
196 # first the big stones (handicap stones different for effect) 380 if ($_[0] == 255) {
197 for ([MARK_B, $mark & MARK_MOVE ? 255 : 192], 381 $self->{button_pass}->sensitive (0);
198 [MARK_W, $mark & MARK_MOVE ? 255 : 192], 382 $self->done;
199 [MARK_GRAY_B, 128], 383 } else {
200 [MARK_GRAY_W, 128]) { 384 $self->send (mark_dead =>
201 my ($mask, $alpha) = @$_; 385 channel => $self->{channel},
202 if ($mark & $mask) { 386 x => $_[0],
203 $stone->composite ( 387 y => $_[1],
204 $base, 0, 0, $size, $size, 0, 0, 388 dead => !($self->{cur_board}{board}[$_[0]][$_[1]] & MARK_GRAYED),
205 $size / $stone->get_width, $size / $stone->get_height,
206 $::config->{speed} ? INTERP_NEAREST : INTERP_BILINEAR, $alpha
207 ); 389 );
208 } 390 }
209 } 391 };
210 392
211 # then the small stones 393 } elsif (1 - $self->{colour} == $self->{cur_board}{last}) {
212 for ([MARK_SMALL_B, $::black_img[$rand % @::black_img]], 394 # normal move
213 [MARK_SMALL_W, $::white_img[$rand % @::white_img]]) { 395 $self->{button_pass}->set (label => "Pass", sensitive => 1, visible => 1);
214 my ($mask, $img) = @$_; 396 $self->{board}->set (cursor => sub {
215 if ($mark & $mask) { 397 # if is_valid_move oder so#TODO#
216 $img->composite ( 398 $_[0] & (MARK_B | MARK_W)
217 $base, (ceil ($size / 4)) x2, (ceil ($size / 2)) x2, (ceil ($size / 4)) x2,
218 $size / $img->get_width / 2, $size / $img->get_height / 2,
219 $::config->{speed} ? INTERP_NEAREST : INTERP_BILINEAR, 224
220 ); 399 ? $_[0]
400 : $_[0] | MARK_GRAYED | ($self->{colour} == COLOUR_WHITE ? MARK_W : MARK_B);
221 } 401 });
402 $self->{board_click} = sub {
403 $self->send (game_move => channel => $self->{channel}, x => $_[0], y => $_[1]);
404 $self->{board}->set (cursor => undef);
405 delete $self->{board_click};
406 $self->{button_pass}->sensitive (0);
222 } 407 };
223
224 # and lastly any markers
225 my $dark_bg = ! ! ($mark & (MARK_B | MARK_GRAY_B));
226
227 for ([MARK_CIRCLE, $::circle_img[$dark_bg]],
228 [MARK_TRIANGLE, $::triangle_img[$dark_bg]],
229 [MARK_SQUARE, $::square_img[$dark_bg]]) {
230 my ($mask, $img) = @$_;
231 if ($mark & $mask) {
232 $img->composite (
233 $base, 0, 0, $size, $size, -0.5, -0.5,
234 $size / $img->get_width, $size / $img->get_height,
235 $::config->{speed} ? INTERP_NEAREST : INTERP_BILINEAR, 255
236 );
237 }
238 }
239
240 push @$$c, $base;
241 }
242 }
243
244 $$c->[$rand % @$$c];
245}
246
247sub pixbuf_text {
248 my ($pixbuf, $colour, $x, $y, $height, $text) = @_;
249
250 my @c = grep $_,
251 map $::font[$colour][$::fontmap{$_}],
252 split //, $text;
253
254 if (@c) {
255 my $spacing = $height * 0.1;
256 my $s = $height / List::Util::max map $_->get_height, @c;
257 my $W = List::Util::sum map $_->get_width, @c;
258
259 $x -= ($W * $s + $spacing * (@c - 1)) * 0.5;
260 $y -= $height * 0.5;
261
262 for (@c) {
263 my $w = $_->get_width * $s;
264 # +2 == don't fight the rounding
265 $_->composite ($pixbuf,
266 $x, $y, $w+2, $height+2, $x, $y, $s, $s,
267 $::config->{speed} ? INTERP_NEAREST : INTERP_BILINEAR, 255);
268
269 $x += $w + $spacing;
270 }
271 }
272}
273
274sub pixbuf_rect {
275 my ($pb, $colour, $x1, $y1, $x2, $y2, $alpha) = @_;
276 # we fake lines by... a horrible method :/
277 my $colour_pb = new_pixbuf 1, 1, 0, $colour;
278 $colour_pb->composite ($pb, $x1, $y1, $x2 - $x1 + 1, $y2 - $y1 + 1, $x1, $y1, $x2 + 1, $y2 + 1,
279 INTERP_NEAREST, $alpha);
280}
281
282sub repaint_board {
283 my ($self) = @_;
284 my $canvas = $self->{canvas};
285 my $expose_area = undef;
286
287 return $expose_area unless $self->{board};
288
289 my ($w, $h) = ($canvas->allocation->values)[2,3];
290
291 die "FATAL: board aspect ratio != 1" unless $w == $h;
292
293 my $s = $w;
294
295 return unless $s >= 200;
296
297 my $size = $self->{size};
298
299 # we leave enough space for the shadows.. I like smaller stones, and we
300 # do no need to do the nifty recursive screen updates that goban2 does
301 my $border = int ($s / ($size + 3) * 0.5);
302 my $s2 = $s - $border * 2;
303 my $edge = int ($s2 / ($size + 1) * 0.96) - ($::config->{randomize} ? 3 : 0);
304 my $ofs = int ($edge / 2);
305
306 my @k = map int ($s2 * $_ / ($size+1) + $border + 0.5), 0 .. $size;
307
308 my $pixbuf;
309
310 my $oldboard;
311
312 if ($self->{background}) {
313 if ($oldboard = $self->{board_shown}) {
314 $pixbuf = $self->{pixbuf};
315 } else { 408 } else {
316 $pixbuf = $self->{background}->copy; 409 $self->{button_pass}->set (label => "Pass", sensitive => 0, visible => 1);
317 $expose_area = new Gtk2::Gdk::Rectangle 0, 0, $s, $s;
318 } 410 }
319 } else { 411 } else {
320 $expose_area = new Gtk2::Gdk::Rectangle 0, 0, $s, $s; 412 $self->{button_undo}->hide;
413 $self->{button_resign}->hide;
414 $self->{button_pass}->hide;
415 $self->{board}->set (cursor => undef);
416 #TODO# # implement coordinate-grabbing
417 }
418}
321 419
322 my ($bw, $bh) = ($::board_img->get_width, $::board_img->get_height); 420sub update_timers {
421 my ($self, $timers) = @_;
323 422
324 if ($s < $bw && $s < $bh) { 423 my $running = $self->{showmove} == @{$self->{path}} && !$self->{teacher};
325 $pixbuf = new_pixbuf $s, $s, 0; 424
326 $::board_img->copy_area (0, 0, $s, $s, $pixbuf, 0, 0); 425 for my $colour (COLOUR_BLACK, COLOUR_WHITE) {
426 my $t = $timers->[$colour];
427 $self->{userpanel}[$colour]->set_timer (
428 $running && $self->{lastmove_colour} == 1 - $colour && $t->[0],
429 $t->[1], $t->[2]);
430 }
431}
432
433sub update_board {
434 my ($self) = @_;
435 return unless $self->{path};
436
437 $self->{board_label}->set_text ("Move " . ($self->{showmove} - 1));
438
439 $self->{cur_board} = new KGS::Game::Board $self->{size};
440 $self->{cur_board}->interpret_path ([@{$self->{path}}[0 .. $self->{showmove} - 1]]);
441
442 $self->{userpanel}[$_]->set_captures ($self->{cur_board}{captures}[$_])
443 for COLOUR_WHITE, COLOUR_BLACK;
444
445 if ($self->{showmove} == @{$self->{path}}) {
446 $self->{timers} = [
447 [$self->{lastmove_time}, @{$self->{cur_board}{timer}[0]}],
448 [$self->{lastmove_time}, @{$self->{cur_board}{timer}[1]}],
449 ];
450 $self->update_timers ($self->{timers});
327 } else { 451 } else {
328 $pixbuf = scale_pixbuf $::board_img, $s, $s, $::config->{speed} ? INTERP_NEAREST : INTERP_TILES; 452 $self->update_timers ([
453 [0, @{$self->{cur_board}{timer}[0]}],
454 [0, @{$self->{cur_board}{timer}[1]}],
329 } 455 ]);
330
331 my $linew = int ($s / 25 / $size);
332
333 # ornamental border... we have time to waste :/
334 pixbuf_rect $pixbuf, 0xffcc7700, 0, 0, $s-1, $linew, 255;
335 pixbuf_rect $pixbuf, 0xffcc7700, 0, 0, $linew, $s-1, 255;
336 pixbuf_rect $pixbuf,0xffcc7700, $s-$linew-1, 0, $s-1, $s-1, 255;
337 pixbuf_rect $pixbuf,0xffcc7700, 0, $s-$linew-1, $s-1, $s-1, 255;
338
339 for my $i (1 .. $size) {
340 pixbuf_rect $pixbuf, 0x44111100, $k[$i] - $linew, $k[1] - $linew, $k[$i] + $linew, $k[$size] + $linew, 192;
341 pixbuf_rect $pixbuf, 0x44111100, $k[1] - $linew, $k[$i] - $linew, $k[$size] + $linew, $k[$i] + $linew, 192;
342
343 # 38 max, but we allow a bit more
344 my $label = (qw(- A B C D E F G H J K L M N O P Q R S T U V W X Y Z
345 AA BB CC DD EE FF GG HH JJ KK LL MM NN OO PP QQ RR SS TT UU VV WW XX YY ZZ))[$i];
346
347 pixbuf_text $pixbuf, 0, $k[$i], $border, $ofs, $label;
348 pixbuf_text $pixbuf, 0, $k[$i], $s2 + $border, $ofs, $label;
349 pixbuf_text $pixbuf, 0, $border, $k[$i], $ofs, $size - $i + 1;
350 pixbuf_text $pixbuf, 0, $s2 + $border, $k[$i], $ofs, $size - $i + 1;
351
352 $a++;
353 $a++ if $a eq "I"; # not correct, instead of AA AB, we should get HH JJ KK...
354 }
355
356 unless ($::config->{conserve_memory} > 1) {
357 $self->{background} = $pixbuf;
358 $pixbuf = $pixbuf->copy;
359 }
360 } 456 }
361 457
362 $self->{pixbuf} = $pixbuf; 458 $self->{board}->set_board ($self->{cur_board});
363 459
364 # hoshi-points(!)#d# 460 $self->update_cursor;
365 # caching of empty board gfx(!)#d#
366
367 for my $x (1 .. $size) {
368 for my $y (1 .. $size) {
369 my $rand = ($x ^ $y ^ 0x5555);
370
371 my ($dx, $dy) = ($k[$x] - $ofs, $k[$y] - $ofs);
372
373 if ($::config->{randomize}) {
374 $dx += ($rand % 7) - 3;
375 $dy += ($rand / 3 % 7) - 3;
376 }
377
378 my $shadow = $edge * 0.05;
379 my $area = [$dx, $dy, $edge + $shadow, $edge + $shadow];
380
381 my $mark = $self->{board}{board}[$x-1][$y-1];
382 my $old = $oldboard ? $oldboard->{board}[$x-1][$y-1] : 0;
383
384 if ($oldboard) {
385 next if $old == $mark; # no change
386
387 $self->{background}->copy_area (@$area, $pixbuf, $dx, $dy);
388 $expose_area = $expose_area
389 ? $expose_area->union (new Gtk2::Gdk::Rectangle @$area)
390 : new Gtk2::Gdk::Rectangle @$area;
391 }
392
393 if ($mark) {
394 my $pb = $self->create_stack($mark, $edge, $rand);
395
396 $pb->composite ($pixbuf, @$area,
397 $dx, $dy, 1, 1, $::config->{speed} ? INTERP_NEAREST : INTERP_NEAREST, 255);
398
399 # labels are handled here because they are quite rare
400 if ($mark & MARK_LABEL) {
401 my $white = $mark & (MARK_W | MARK_GRAY_W) ? 0 : 1;
402
403 if ($white) {
404 pixbuf_text $pixbuf, 0,
405 $k[$x] + $ofs * 0.1, $k[$y] + $ofs * 0.1, $ofs * 0.7,
406 $self->{board}{label}[$x-1][$y-1];
407 }
408 pixbuf_text $pixbuf, $white,
409 $k[$x], $k[$y], $ofs * 0.7,
410 $self->{board}{label}[$x-1][$y-1];
411 }
412
413 # old pixmap&mask-way. that was fast ;(
414 #my ($pm, $bm) = $self->create_stack($gc, $mark, $edge, $x * 17 + $y * 11 );
415
416 #$gc->set_clip_mask ($bm);
417 #$gc->set_clip_origin ($dx, $dy);
418 #$pixmap->draw_pixmap ($gc, $pm, 0, 0, $dx, $dy, $edge, $edge);
419 }
420 }
421 }
422
423 $self->{board_shown} = Storable::dclone $self->{board};
424 #d# save
425 #Storable::nstore { board => $self->{board}, size => $self->{size}, path => $self->{path}}, "testboard.storable";
426
427 $expose_area;
428}
429
430sub redraw {
431 my ($self, $area) = @_;
432
433 if ($area && $self->{pixbuf}) {
434 my ($x, $y, $w, $h) = $area->values;
435
436 $self->{canvas}->window->draw_pixbuf ($self->{canvas}->style->white_gc, $self->{pixbuf},
437 $x, $y, $x, $y, $w, $h,
438 "normal", 0, 0);
439 $self->{canvas}->window->draw_rectangle ($self->{canvas}->style->black_gc, 0,
440 $x - 1, $y - 1, $w + 2, $h + 2) if $::DEBUG_EXPOSE;
441 }
442} 461}
443 462
444sub event_update_tree { 463sub event_update_tree {
445 my ($self) = @_; 464 my ($self) = @_;
446 465
447 $self->{path} = $self->get_path; 466 $self->{path} = $self->get_path;
448 $self->{moveadj}->value_changed if $self->{moveadj}; 467
468 if ($self->{moveadj}) {
469 my $upper = $self->{moveadj}->upper;
470 my $pos = $self->{moveadj}->get_value;
471 my $move = scalar @{$self->{path}};
472
473 $self->{moveadj}->upper ($move);
474
475 $self->{moveadj}->changed;
476 if ($pos == $upper) {
477 $self->{moveadj}->value ($move);
478 $self->{moveadj}->value_changed;
479 }
480 }
481}
482
483sub event_update_comments {
484 my ($self, $node, $comment, $newnode) = @_;
485 $self->SUPER::event_update_comments($node, $comment, $newnode);
486
487 my $text;
488
489 $text .= "\n<header>Move <move>$node->{move}</move>, Node <node>$node->{id}</node></header>"
490 if $newnode;
491
492 for (split /\n/, $comment) {
493 $text .= "\n";
494 if (s/^([0-9a-zA-Z]+ \[[0-9dkp\?\-]+\])://) {
495 $text .= "<user>" . (util::toxml $1) . "</user>:";
496 }
497
498 # coords only for 19x19 so far
499 $_ = util::toxml $_;
500 s{
501 (
502 \b
503 (?:[bw])?
504 [, ]{0,2}
505 [a-hj-t] # valid for upto 19x19
506 \s?
507 [1-9]?[0-9]
508 \b
509 )
510 }{
511 "<coord>$1</coord>";
512 }sgexi;
513
514 $text .= $_;
515 }
516
517 $self->{chat}->append_text ($text);
518}
519
520sub event_join {
521 my ($self) = @_;
522
523 $self->SUPER::event_join (@_);
524 $self->init_tree;
525 $self->event_update_game;
449} 526}
450 527
451sub event_part { 528sub event_part {
452 my ($self) = @_; 529 my ($self) = @_;
530
453 $self->SUPER::event_part; 531 $self->SUPER::event_part;
454 delete $appwin::gamelist->{game}{$self->{channel}};
455 $self->destroy; 532 $self->destroy;
456} 533}
457 534
458sub event_move { 535sub event_move {
459 my ($self, $pass) = @_; 536 my ($self, $pass) = @_;
460 sound::play 1, $pass ? "pass" : "move"; 537 sound::play 1, $pass ? "pass" : "move";
538
539 if ($self->{undo_inlay}) {
540 (delete $self->{undo_inlay})->clear;
541 }
542}
543
544sub event_update_game {
545 my ($self) = @_;
546
547 $self->SUPER::event_update_game;
548
549 return unless $self->{joined};
550
551 $self->{colour} = $self->player_colour ($self->{conn}{name});
552
553 my $title = defined $self->{channel}
554 ? $self->owner->as_string . " " . $self->opponent_string
555 : "Game Window";
556 $self->set_title ("KGS Game $title");
557 $self->{title}->set_text ($title);
558
559 $self->{user}[COLOUR_BLACK] = $self->{black};
560 $self->{user}[COLOUR_WHITE] = $self->{white};
561
562 # show board
563 if ($self->is_inprogress) {
564 if (!$self->{boardbox}->parent) {
565 $self->{boardbox}->add ($self->{board} = new Gtk2::GoBoard size => $self->{size});
566 $self->{left}->add ($self->{boardbox});
567 $self->{board}->signal_connect (button_release => sub {
568 if ($_[1] == 1) {
569 $self->{board_click}->($_[2], $_[3]) if $self->{board_click};
570 }
571 });
572 }
573 if (my $ch = delete $self->{challenge}) {
574 $_->{inlay}->destroy for values %$ch;
575 }
576 $self->update_cursor;
577 }
578
579 $self->{left}->show_all;
580
581 $self->{rules_inlay}->refresh;
582
583}
584
585sub draw_setup {
586 my ($self, $inlay) = @_;
587
588 return unless $self->{joined};
589
590 my $rules = $self->{rules};
591
592 my $text = "";
593
594 $text .= "\nTeacher: <user>" . (util::toxml $self->{teacher}) . "</user>"
595 if $self->{teacher};
596
597 $text .= "\nOwner: <user>" . (util::toxml $self->{owner}->as_string) . "</user>"
598 if $self->{owner}->is_valid;
599
600 if ($self->is_inprogress) {
601 $text .= "\nPlayers: <user>" . (util::toxml $self->{white}->as_string) . "</user>"
602 . " vs. <user>" . (util::toxml $self->{black}->as_string) . "</user>";
603 }
604 $text .= "\nType: " . util::toxml $gametype{$self->type};
605
606 $text .= "\nRuleset: " . $ruleset{$rules->{ruleset}};
607
608 $text .= "\nTime: ";
609
610 if ($rules->{timesys} == TIMESYS_NONE) {
611 $text .= "UNLIMITED";
612 } elsif ($rules->{timesys} == TIMESYS_ABSOLUTE) {
613 $text .= util::format_time $rules->{time};
614 $text .= " ABS";
615 } elsif ($rules->{timesys} == TIMESYS_BYO_YOMI) {
616 $text .= util::format_time $rules->{time};
617 $text .= sprintf " + %s (%d) BY", util::format_time $rules->{interval}, $rules->{count};
618 } elsif ($rules->{timesys} == TIMESYS_CANADIAN) {
619 $text .= util::format_time $rules->{time};
620 $text .= sprintf " + %s/%d CAN", util::format_time $rules->{interval}, $rules->{count};
621 }
622
623 $text .= "\nFlags:";
624 $text .= " private" if $self->is_private;
625 $text .= " started" if $self->is_inprogress;
626 $text .= " adjourned" if $self->is_adjourned;
627 $text .= " scored" if $self->is_scored;
628 $text .= " saved" if $self->is_saved;
629
630 if ($self->is_inprogress) {
631 $text .= "\nHandicap: " . $self->{handicap};
632 $text .= "\nKomi: " . $self->{komi};
633 $text .= "\nSize: " . $self->size_string;
634 }
635
636 if ($self->is_scored) {
637 $text .= "\nResult: " . $self->score_string;
638 }
639
640 $inlay->append_text ("<infoblock>$text</infoblock>");
641
642}
643
644sub event_update_rules {
645 my ($self, $rules) = @_;
646
647 $self->{rules} = $rules;
648
649 if ($self->{user}) {
650 $self->{userpanel}[$_]->configure ($self->{app}, $self->{user}[$_], $rules)
651 for COLOUR_BLACK, COLOUR_WHITE;
652 }
653
654 sound::play 3, "gamestart";
655
656 $self->{rules_inlay}->refresh;
657}
658
659sub event_resign_game {
660 my ($self, $player) = @_;
661
662 sound::play 3, "resign";
663 $self->{chat}->append_text ("\n<infoblock><header>Resign</header>"
664 . "\n<user>"
665 . (util::toxml $self->{user}[$msg->{player}]->as_string)
666 . "</user> resigned.</infoblock>");
667}
668
669sub event_out_of_time {
670 my ($self, $player) = @_;
671
672 sound::play 3, "timewin";
673 $self->{chat}->append_text ("\n<infoblock><header>Out of Time</header>"
674 . "\n<user>"
675 . (util::toxml $self->{user}[$msg->{player}]->as_string)
676 . "</user> ran out of time and lost.</infoblock>");
677}
678
679sub event_done {
680 my ($self) = @_;
681
682 if ($self->{done}[1 - $self->{colour}] && !$self->{done}[$self->{colour}]) {
683 $self->{chat}->append_text ("\n<infoblock><header>Done</header>"
684 . "\nYour opponent pressed done.");
685 }
686}
687
688sub inject_final_result {
689 my ($self, $msg) = @_;
690
691 $self->{chat}->append_text ("<infoblock>\n<header>Game Over</header>"
692 . "\nWhite Score " . (util::toxml $msg->{whitescore}->as_string)
693 . "\nBlack Score " . (util::toxml $msg->{blackscore}->as_string)
694 . "</infoblock>"
695 );
696}
697
698sub inject_set_gametime {
699 my ($self, $msg) = @_;
700
701 $self->{timers} = [
702 [$msg->{NOW}, $msg->{black_time}, $msg->{black_moves}],
703 [$msg->{NOW}, $msg->{white_time}, $msg->{white_moves}],
704 ];
705
706 print "SGT\n";#d#
707 $self->update_timers ($self->{timers})
708 if $self->{showmove} == @{$self->{path}};
709}
710
711sub inject_req_undo {
712 my ($self, $msg) = @_;
713
714 my $inlay = $self->{undo_inlay} ||= $self->{chat}->new_inlay;
715 return if $inlay->{ignore};
716
717 sound::play 3, "warning" unless $inlay->{count};
718 $inlay->{count}++;
719
720 $inlay->clear;
721 $inlay->append_text ("\n<undo>Undo requested ($inlay->{count} times)</undo>\n");
722 $inlay->append_button ("Grant", sub {
723 $inlay->clear;
724 $self->send (grant_undo => channel => $self->{channel});
725 });
726 $inlay->append_button ("Ignore", sub {
727 $inlay->clear;
728 $inlay->{ignore} = 1;
729 # but leave inlay, so further undo requests get counted
730 });
731
732 $self->{chat}->set_end;
733}
734
735sub inject_new_game {
736 my ($self, $msg) = @_;
737
738 $self->{chat}->append_text ("\n<header>ACK from server ($msg->{cid} == $self->{cid})</header>");
739 delete $self->{cid};
740}
741
742sub draw_challenge {
743 my ($self, $id) = @_;
744
745 my $info = $self->{challenge}{$id};
746 my $inlay = $info->{inlay};
747 my $rules = $info->{rules};
748
749 my $as_black = $info->{black}{name} eq $self->{conn}{name} ? 1 : 0;;
750 my $opponent = $as_black ? $info->{white} : $info->{black};
751
752 my ($size, $time, $interval, $count);
753
754 if (!$self->{channel}) {
755 $inlay->append_text ("\nNotes: ");
756 $inlay->append_entry (\$info->{notes}, 20, "");
757 $inlay->append_text ("\nGlobal Offer: ");
758 $inlay->append_optionmenu (\$info->{flags},
759 0 => "No",
760 2 => "Yes",
761 );
762 } else {
763 $inlay->append_text ("\nNotes: " . util::toxml $info->{notes});
764 }
765
766 $inlay->append_text ("\nType: ");
767 $inlay->append_optionmenu (
768 \$info->{gametype},
769 GAMETYPE_DEMONSTRATION , "Demonstration",
770 GAMETYPE_DEMONSTRATION | GAMETYPE_PRIVATE, "Demonstration (P)",
771 GAMETYPE_TEACHING , "Teaching",
772 GAMETYPE_TEACHING | GAMETYPE_PRIVATE, "Teaching (P)",
773 GAMETYPE_SIMUL , "Simul (not yet!)",
774 GAMETYPE_FREE , "Free",
775 GAMETYPE_RATED , "Rated",
776 sub {
777 $size->set_history (2) if $_[0] eq GAMETYPE_RATED;
778 },
779 );
780
781 if ($self->{channel}) {
782 $inlay->append_text ("\nMy Colour: ");
783 $inlay->append_optionmenu (
784 \$as_black,
785 0 => "White",
786 1 => "Black",
787 sub {
788 if ($info->{$_[0] ? "black" : "white"}{name} ne $self->{conn}{name}) {
789 ($info->{black}, $info->{white}) = ($info->{white}, $info->{black});
790 }
791 }
792 );
793 }
794
795 $inlay->append_text ("\nRuleset: ");
796 $inlay->append_optionmenu (
797 \$info->{rules}{ruleset},
798 RULESET_JAPANESE , "Japanese",
799 RULESET_CHINESE , "Chinese",
800 RULESET_AGA , "AGA",
801 RULESET_NEW_ZEALAND, "New Zealand",
802 );
803
804 $inlay->append_text ("\nSize: ");
805 $size = $inlay->append_optionmenu (
806 \$info->{rules}{size}, 9 => 9, 13 => 13, 19 => 19, map +($_, $_), 2..38
807 );
808
809 if ($self->{channel}) {
810 $inlay->append_text ("\nHandicap: ");
811 $inlay->append_optionmenu (\$info->{rules}{handicap}, map +($_, $_), 0..9);
812
813 $inlay->append_text ("\nKomi: ");
814 $inlay->append_entry (\$info->{rules}{komi}, 5);
815 }
816
817 $inlay->append_text ("\nTimesys: ");
818 $inlay->append_optionmenu (
819 \$info->{rules}{timesys},
820 &TIMESYS_NONE => "None",
821 &TIMESYS_ABSOLUTE => "Absolute",
822 &TIMESYS_BYO_YOMI => "Byo Yomi",
823 &TIMESYS_CANADIAN => "Canadian",
824 sub {
825 my ($new) = @_;
826
827 if ($new eq TIMESYS_NONE) {
828 $time->hide;
829 $interval->hide;
830 $count->hide;
831 } else {
832 $time->show;
833 $time->set_text ($self->{app}{defaults}{time});
834 if ($new eq TIMESYS_ABSOLUTE) {
835 $interval->hide;
836 $count->hide;
837 } else {
838 $interval->show;
839 $count->show;
840 if ($new eq TIMESYS_BYO_YOMI) {
841 $interval->set_text ($self->{app}{defaults}{byo_time});
842 $count->set_text ($self->{app}{defaults}{byo_period});
843 } elsif ($new eq TIMESYS_CANADIAN) {
844 $interval->set_text ($self->{app}{defaults}{can_time});
845 $count->set_text ($self->{app}{defaults}{can_period});
846 }
847 }
848 }
849 }
850 );
851
852 $inlay->append_text ("\nMain Time: ");
853 $time = $inlay->append_entry (\$info->{rules}{time}, 5);
854 $inlay->append_text ("\nInterval: ");
855 $interval = $inlay->append_entry (\$info->{rules}{interval}, 3);
856 $inlay->append_text ("\nPeriods/Stones: ");
857 $count = $inlay->append_entry (\$info->{rules}{count}, 2);
858
859 $inlay->append_text ("\n");
860
861 if (!$self->{channel}) {
862 $inlay->append_button ("Create Challenge", sub {
863 $inlay->clear;
864 $self->{cid} = $self->{conn}->alloc_clientid;
865 $self->send (new_game =>
866 channel => delete $self->{roomid},
867 gametype => $info->{gametype},
868 cid => $self->{cid},
869 flags => $info->{flags},
870 rules => $info->{rules},
871 notes => $info->{notes},
872 );
873 });
874 } else {
875 $inlay->append_button ("OK", sub {
876 $inlay->clear;
877 $self->send (challenge =>
878 channel => $self->{channel},
879 black => $info->{black},
880 white => $info->{white},
881 gametype => $info->{gametype},
882 cid => $info->{cid},
883 rules => $info->{rules},
884 );
885 });
886 if (exists $self->{challenge}{""}) {
887 $inlay->append_button ("Reject", sub {
888 $inlay->clear;
889 $self->send (reject_challenge =>
890 channel => $self->{channel},
891 name => $opponent->{name},
892 gametype => $info->{gametype},
893 cid => $info->{cid},
894 rules => $info->{rules},
895 );
896 });
897 }
898 }
899}
900
901sub draw_users {
902 my ($self, $inlay) = @_;
903
904 for (sort keys %{$self->{users}}) {
905 $inlay->append_text (" <user>" . $self->{users}{$_}->as_string . "</user>");
906 }
907}
908
909sub event_challenge {
910 my ($self, $info) = @_;
911
912 my $as_black = $info->{black}->{name} eq $self->{conn}{name};
913 my $opponent = $as_black ? $info->{white} : $info->{black};
914
915 my $id = $opponent->{name};
916
917 $self->{challenge}{$id} = $info;
918 $self->{challenge}{$id}{inlay} = $self->{chat}->new_switchable_inlay (
919 exists $self->{challenge}{""}
920 ? "Challenge from $opponent->{name}"
921 : "Challenge to $opponent->{name}",
922 sub {
923 $self->{challenge}{$id}{inlay} = $_[0];
924 $self->draw_challenge ($id);
925 },
926 !exists $self->{challenge}{""} # only open when not offerer
927 );
461} 928}
462 929
4631; 9301;
464 931

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines