示例#1
0
void YSgUtil::SetPositionInNode(SgNode* node, const StoneBoard& brd, 
                                  HexColor color)
{
    int height = brd.Height();
    SgVector<SgPoint> blist = YSgUtil::BitsetToSgVector(brd.GetBlack() 
                                       & brd.Const().GetCells(), height);
    SgVector<SgPoint> wlist = YSgUtil::BitsetToSgVector(brd.GetWhite()
                                       & brd.Const().GetCells(), height);
    SgVector<SgPoint> elist = YSgUtil::BitsetToSgVector(brd.GetEmpty()
                                       & brd.Const().GetCells(), height);
    SgPropPlayer* pprop = new SgPropPlayer(SG_PROP_PLAYER);
    SgPropAddStone* bprop = new SgPropAddStone(SG_PROP_ADD_BLACK);
    SgPropAddStone* wprop = new SgPropAddStone(SG_PROP_ADD_WHITE);
    SgPropAddStone* eprop = new SgPropAddStone(SG_PROP_ADD_EMPTY);
    pprop->SetValue(YSgUtil::HexColorToSgColor(color));    
    bprop->SetValue(blist);
    wprop->SetValue(wlist);
    eprop->SetValue(elist);
    node->Add(pprop);
    node->Add(bprop);
    node->Add(wprop);
    node->Add(eprop);
}
inline HexUctStoneData::HexUctStoneData(const StoneBoard& brd)
    : black(brd.GetBlack()),
      white(brd.GetWhite()),
      played(brd.GetPlayed())
{
}