Lines Matching defs:cbp
262 struct combostr *cbp = sortframes[color];
263 if (cbp == NULL)
266 if (four_in_a_row(color, cbp->c_vertex, cbp->c_dir))
275 ecbp = cbp;
277 sp = &board[cbp->c_vertex];
278 cp = &sp->s_fval[color][r = cbp->c_dir];
297 makecombo2(cbp, sp, 0, cb.s);
328 makecombo2(cbp, sp, off, cb.s);
341 board[cbp->c_vertex].s_flags |= MFLAG << r;
342 } while ((cbp = cbp->c_next) != ecbp);
366 cbp = ep->e_combo;
367 if (cbp->c_combo.s <= sp->s_combo[color].s) {
368 if (cbp->c_combo.s != sp->s_combo[color].s) {
369 sp->s_combo[color].s = cbp->c_combo.s;
370 sp->s_level[color] = cbp->c_nframes;
371 } else if (cbp->c_nframes < sp->s_level[color])
372 sp->s_level[color] = cbp->c_nframes;
381 cbp = ep->e_combo;
382 if (cbp->c_combo.s <= sp->s_combo[color].s) {
383 if (cbp->c_combo.s != sp->s_combo[color].s) {
384 sp->s_combo[color].s = cbp->c_combo.s;
385 sp->s_level[color] = cbp->c_nframes;
386 } else if (cbp->c_nframes < sp->s_level[color])
387 sp->s_level[color] = cbp->c_nframes;
397 if ((cbp = sortcombos) != NULL) {
401 ecbp = cbp;
403 ncbp = cbp->c_next;
404 free(cbp);
406 } while ((cbp = ncbp) != ecbp);
566 struct combostr *cbp, *ecbp;
580 cbp = ep->e_combo;
581 if (cbp->c_combo.s <= sp->s_combo[c].s) {
582 if (cbp->c_combo.s != sp->s_combo[c].s) {
583 sp->s_combo[c].s = cbp->c_combo.s;
584 sp->s_level[c] = cbp->c_nframes;
585 } else if (cbp->c_nframes < sp->s_level[c])
586 sp->s_level[c] = cbp->c_nframes;
597 cbp = ecbp = sortframes[curcolor];
599 fsp = &board[cbp->c_vertex];
600 r = cbp->c_dir;
623 makecombo(cbp, fsp, 0, cb.s);
635 makecombo(cbp, sp, off, fcb.s);
637 } while ((cbp = cbp->c_next) != ecbp);
642 cbp = *--cbpp;
643 if (cbp == NULL)
648 sortcombos = cbp;
652 pcbp->c_next = cbp;
653 ecbp->c_prev = cbp->c_prev;
654 cbp->c_prev->c_next = ecbp;
655 cbp->c_prev = pcbp;
667 struct combostr *cbp;
681 cbp = ep->e_combo;
682 verts = checkframes(cbp, ocbp, osp, cv, &ovi);
704 if (nep->e_combo == cbp)
706 if (nep->e_combo->c_nframes < cbp->c_nframes)
716 int c = cbp->c_combo.cv_force + ocb.cv_force - verts - 3;
727 (cbp->c_nframes + 1) * sizeof(struct combostr *));
731 if (sortcombo(scbpp, (void *)(cbp + 1), ocbp)) {
739 ncbp->c_link[0] = cbp;
744 ncbp->c_nframes = cbp->c_nframes + 1;
810 struct combostr *cbp, **cbpp;
839 for (cbp = ocbp; cbp->c_link[1] != NULL; cbp = cbp->c_link[0]) {
841 ep->e_combo = cbp;
842 *--cbpp = cbp->c_link[1];
843 ep->e_off = cbp->c_voff[1];
844 ep->e_frameindex = cbp->c_frameindex;
845 ep->e_fval.s = cbp->c_linkv[1].s;
846 ep->e_framecnt = cbp->c_framecnt[1];
847 ep->e_emask = cbp->c_emask[1];
849 cbp = ep->e_combo;
851 ep->e_combo = cbp;
852 *--cbpp = cbp->c_link[0];
853 ep->e_off = cbp->c_voff[0];
855 ep->e_fval.s = cbp->c_linkv[0].s;
856 ep->e_framecnt = cbp->c_framecnt[0];
857 ep->e_emask = cbp->c_emask[0];
862 cbp = ep->e_combo;
864 nep->e_framecnt = cbp->c_framecnt[0];
865 nep->e_emask = cbp->c_emask[0];
867 if ((cbp->c_flags & C_LOOP) != 0) {
873 nep = &einfo[cbp->c_dir];
875 nep->e_emask &= ~(1 << cbp->c_voff[0]);
890 cbp = ep->e_combo;
891 if ((cbp->c_flags & C_LOOP) == 0)
898 nep = &einfo[cbp->c_dir];
900 nep->e_emask = 1 << cbp->c_voff[0];
917 cbp = *cbpp;
918 sp = &board[cbp->c_vertex];
919 d = dd[cbp->c_dir];
959 * This is called only if 'cbp' is a <1,x> combo.
964 updatecombo(struct combostr *cbp, player_color color)
971 cb.cv_force = cbp->c_combo.cv_force;
972 u_char nframes = cbp->c_nframes;
977 for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) {
978 flags = cbp->c_flags;
979 cb.cv_win = cbp->c_combo.cv_win;
982 struct spotstr *sp = &board[cbp->c_vertex];
1018 spot_index s = cbp->c_vertex;
1020 int d = dd[cbp->c_dir];
1045 board[cbp->c_vertex].s_flags |= FFLAG << cbp->c_dir;
1052 appendcombo(struct combostr *cbp)
1059 sortcombos = cbp;
1060 cbp->c_next = cbp;
1061 cbp->c_prev = cbp;
1065 cbp->c_next = ncbp;
1066 cbp->c_prev = pcbp;
1067 ncbp->c_prev = cbp;
1068 pcbp->c_next = cbp;
1073 * in 'cbp' and forms a linked chain of frames (i.e., a tree; no loops).
1074 * Return positive if combining frame 'fcbp' to the frames in 'cbp'
1077 * Return -1 if 'fcbp' should not be combined with 'cbp'.
1081 checkframes(struct combostr *cbp, struct combostr *fcbp, struct spotstr *osp,
1095 u_char myindex = cbp->c_nframes;
1104 for (; (tcbp = cbp->c_link[1]) != NULL;
1105 lcbp = cbp, cbp = cbp->c_link[0]) {
1112 flags = cbp->c_flags;
1133 if (fcnt == 0 || cbp->c_framecnt[1] == 0)
1158 if (cbp == fcbp)
1161 /* check for intersection of 'cbp' with 'fcbp' */
1162 mask = str[cbp - frames];
1169 if (cbp->c_dir == fcbp->c_dir && (mask & (0x10 << n)) != 0)
1176 cbp - frames];
1189 (s == cbp->c_vertex ||
1190 s == cbp->c_vertex + 5 * dd[cbp->c_dir]))
1198 ovi->o_off = (s - cbp->c_vertex) / dd[cbp->c_dir];
1217 struct combostr *cbp, *ecbp;
1256 cbp = hashcombos[inx = (frame_index)(*scbpp - frames)];
1257 if (cbp == NULL) {
1267 ecbp = cbp;
1269 cbpp = (void *)(cbp + 1);
1292 printcombo(cbp, buf, sizeof(buf));
1308 } while ((cbp = cbp->c_next) != ecbp);
1313 ecbp = cbp->c_prev;
1315 fcbp->c_next = cbp;
1317 cbp->c_prev = fcbp;
1329 printcombo(struct combostr *cbp, char *buf, size_t max)
1335 cbp->c_combo.s, cbp->c_nframes);
1338 for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) {
1340 stoc(tcbp->c_vertex), pdir[tcbp->c_dir], cbp->c_flags);
1344 stoc(cbp->c_vertex), pdir[cbp->c_dir]);
1351 struct combostr *cbp, **cbpp;
1375 for (cbp = ocbp; cbp->c_link[1] != NULL; cbp = cbp->c_link[0]) {
1377 ep->e_combo = cbp;
1378 *--cbpp = cbp->c_link[1];
1379 ep->e_off = cbp->c_voff[1];
1380 ep->e_frameindex = cbp->c_frameindex;
1381 ep->e_fval.s = cbp->c_linkv[1].s;
1382 ep->e_framecnt = cbp->c_framecnt[1];
1383 ep->e_emask = cbp->c_emask[1];
1385 cbp = ep->e_combo;
1387 ep->e_combo = cbp;
1388 *--cbpp = cbp->c_link[0];
1389 ep->e_off = cbp->c_voff[0];
1391 ep->e_fval.s = cbp->c_linkv[0].s;
1392 ep->e_framecnt = cbp->c_framecnt[0];
1393 ep->e_emask = cbp->c_emask[0];
1398 cbp = ep->e_combo;
1400 nep->e_framecnt = cbp->c_framecnt[0];
1401 nep->e_emask = cbp->c_emask[0];
1403 if ((cbp->c_flags & C_LOOP) != 0) {
1409 nep = &einfo[cbp->c_dir];
1411 nep->e_emask &= ~(1 << cbp->c_voff[0]);
1426 cbp = ep->e_combo;
1427 if ((cbp->c_flags & C_LOOP) == 0)
1434 nep = &einfo[cbp->c_dir];
1436 nep->e_emask = 1 << cbp->c_voff[0];
1451 cbp = *cbpp;
1452 sp = &board[cbp->c_vertex];
1453 d = dd[cbp->c_dir];
1454 cmask = CFLAG << cbp->c_dir;
1455 omask = (IFLAG | CFLAG) << cbp->c_dir;
1464 clearcombo(struct combostr *cbp, int open)
1468 for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) {
1469 clearcombo(tcbp, cbp->c_flags & C_OPEN_1);
1470 open = cbp->c_flags & C_OPEN_0;
1473 struct spotstr *sp = &board[cbp->c_vertex];
1474 int d = dd[cbp->c_dir];
1475 int mask = ~((IFLAG | CFLAG) << cbp->c_dir);