void translateTo(Board::Coord c,float h = 0.0f) { static const float shifts[5] = { 1.0f,0.5f,0.0f,-0.5f,-1.0f }; glTranslatef(boardB+vLabelW+c.x()*caseD+shifts[c.y()]*caseD, boardB+hLabelH+c.y()*caseD, h); }
deque<Board::ConstStackHandle> Game::possibleDestinations(const Board::ConstStackHandle& ha) const { deque<Board::ConstStackHandle> r; if (ha->hasPieces()) { unsigned int h = ha->height(); Board::Coord s = ha.stackCoord(); Board::Coord d[6] = { Board::Coord(s.x()-h,s.y()), Board::Coord(s.x()+h,s.y()), Board::Coord(s.x() ,s.y()-h), Board::Coord(s.x() ,s.y()+h), Board::Coord(s.x()-h,s.y()-h), Board::Coord(s.x()+h,s.y()+h) }; for (unsigned int i=0;i<6;++i) { if (Board::isValid(d[i]) && board_.stackAt(d[i])->hasPieces()) { r.push_back(board_.stackAt(d[i])); } } } return r; }