コード例 #1
0
bool KBlocksAIPlannerExtend::getPath(int index, AIPlanner_PieceInfo_Sequence *pseq)
{
    if ((mPathList == 0) || (index >= (int)mPathList->size())) {
        return false;
    }

    PathNode *node  = (*mPathList)[index];
    while (node != 0) {
        KBlocksPiece piece = node->getContent();
        pseq->push_back(piece);
        node = node->getParent();
    }

    return true;
}
コード例 #2
0
bool KBlocksAIPlannerExtend::getNextPieceState(int index, KBlocksPiece *piece)
{
    if (index >= (int)mPathList->size()) {
        return false;
    }
    PathNode *node = (*mPathList)[index];
    PathNode *last = 0;
    while (node != 0) {
        last = node;
        node = node->getParent();
    }
    if (last == 0) {
        return false;
    }
    *piece = last->getContent();
    return true;
}