… | |
… | |
27 | |
27 | |
28 | { |
28 | { |
29 | |
29 | |
30 | my $data; # stores currently processed decoding/encoding packet |
30 | my $data; # stores currently processed decoding/encoding packet |
31 | |
31 | |
|
|
32 | sub _set_data($) { $data = shift } # for debugging or special apps only |
|
|
33 | |
32 | # primitive enc/decoders |
34 | # primitive enc/decoders |
33 | |
35 | |
34 | ############################################################################# |
36 | ############################################################################# |
35 | |
37 | |
36 | sub dec_U8 { |
38 | sub dec_U8 { |
… | |
… | |
186 | } elsif ($type == 34) { |
188 | } elsif ($type == 34) { |
187 | push @r, [score => dec_U8, dec_score1000]; |
189 | push @r, [score => dec_U8, dec_score1000]; |
188 | |
190 | |
189 | } elsif ($type == 29) { |
191 | } elsif ($type == 29) { |
190 | push @r, [type_29 => dec_ZSTRING]; |
192 | push @r, [type_29 => dec_ZSTRING]; |
191 | warn "TYPE 29 $r[-1][1]\007 PLEASE REPORT";#d# |
193 | warn "UNKNOWN TREE TYPE 29 $r[-1][1]\007 PLEASE REPORT";#d# |
192 | die; |
194 | die; |
193 | |
195 | |
194 | } elsif ($type == 28) { |
196 | } elsif ($type == 28) { |
195 | # move number, only in variations it seems. oh my. |
197 | # move number, only in variations it seems. oh my. |
196 | push @r, [movenum => dec_ZSTRING]; |
198 | push @r, [movenum => dec_ZSTRING]; |
|
|
199 | |
|
|
200 | } elsif ($type == 26) { |
|
|
201 | push @r, [type_26 => dec_U8]; # sets a flag (?) |
|
|
202 | warn "unknown tree node 26, PLEASE REPORT AND INCLUDE THE GAME\n"; |
197 | |
203 | |
198 | } elsif ($type == 25) { |
204 | } elsif ($type == 25) { |
199 | push @r, [result => dec_result]; |
205 | push @r, [result => dec_result]; |
200 | |
206 | |
201 | } elsif ($type == 23) { |
207 | } elsif ($type == 23) { |
… | |
… | |
255 | push @r, [rules => dec_rules]; |
261 | push @r, [rules => dec_rules]; |
256 | |
262 | |
257 | # OLD |
263 | # OLD |
258 | |
264 | |
259 | } else { |
265 | } else { |
|
|
266 | require KGS::Listener::Debug; # hack |
260 | print STDERR KGS::Listener::Debug::dumpval(\@r); |
267 | print STDERR KGS::Listener::Debug::dumpval(\@r); |
261 | open XTYPE, "|xtype"; print XTYPE $data; close XTYPE; |
268 | open XTYPE, "|xtype"; print XTYPE $data; close XTYPE; |
262 | die "unknown tree type $type, PLEASE REPORT and include the game you wanted to watch. thx."; |
269 | die "unknown tree type $type, PLEASE REPORT and include the game you wanted to watch. thx."; |
263 | |
270 | |
264 | } |
271 | } |
… | |
… | |
318 | enc_U8 $arg[1] == MARK_SMALL_W if $op == 22; |
325 | enc_U8 $arg[1] == MARK_SMALL_W if $op == 22; |
319 | enc_U8 $arg[2]; |
326 | enc_U8 $arg[2]; |
320 | enc_U8 $arg[3]; |
327 | enc_U8 $arg[3]; |
321 | |
328 | |
322 | enc_ZSTRING $arg[4] if $op == 18; |
329 | enc_ZSTRING $arg[4] if $op == 18; |
|
|
330 | |
|
|
331 | # unknown types |
|
|
332 | } elsif ($type eq "type_29") { |
|
|
333 | enc_U8 29; |
|
|
334 | enc_ZSTRING $arg[0]; |
|
|
335 | } elsif ($type eq "type_26") { |
|
|
336 | enc_U8 26; |
|
|
337 | enc_U8 $arg[0]; |
323 | |
338 | |
324 | } else { |
339 | } else { |
325 | warn "unable to encode tree node type $type\n"; |
340 | warn "unable to encode tree node type $type\n"; |
326 | } |
341 | } |
327 | } |
342 | } |