Beispiel #1
0
PathQueueRecPtr MovePathManager::remove(MechWarriorPtr pilot)
{
    PathQueueRecPtr rec = pilot->getMovePathRequest();
    if(rec)
    {
        remove(rec);
        pilot->setMovePathRequest(nullptr);
        return(rec);
    }
    return(nullptr);
}
Beispiel #2
0
void MovePathManager::calcPath(void)
{
    if(queueFront)
    {
        //------------------------------
        // Grab the next in the queue...
        PathQueueRecPtr curQRec = queueFront;
        remove(queueFront);
        //--------------------------------------------------
        // If the mover is no longer around, don't bother...
        MechWarriorPtr pilot = curQRec->pilot;
        pilot->setMovePathRequest(nullptr);
        MoverPtr mover = pilot->getVehicle();
        if(!mover)
            return;
        /*int32_t err = */pilot->calcMovePath(curQRec->selectionIndex, curQRec->moveParams);
    }
}
Beispiel #3
0
void MovePathManager::request(MechWarriorPtr pilot, int32_t selectionIndex, uint32_t moveParams, int32_t source)
{
    //-----------------------------------------------------
    // If the pilot is already awaiting a calc, purge it...
    remove(pilot);
    if(!freeList)
        Fatal(0, " Too many pilots calcing paths ");
    //---------------------------------------------
    // Grab the first free move path rec in line...
    PathQueueRecPtr pathQRec = freeList;
    //-----------------------------------------
    // Cut the new record from the free list...
    freeList = freeList->next;
    if(freeList)
        freeList->prev = nullptr;
    //---------------------------------------------------
    // New record has no next. Already has no previous...
    pathQRec->num = source;
    pathQRec->pilot = pilot;
    pathQRec->selectionIndex = selectionIndex;
    pathQRec->moveParams = moveParams;
    if(queueEnd)
    {
        queueEnd->next = pathQRec;
        pathQRec->prev = queueEnd;
        pathQRec->next = nullptr;
        queueEnd = pathQRec;
    }
    else
    {
        pathQRec->prev = nullptr;
        pathQRec->next = nullptr;
        queueFront = queueEnd = pathQRec;
    }
    pilot->setMovePathRequest(pathQRec);
    numPaths++;
    sourceTally[source]++;
    if(numPaths > peakPaths)
        peakPaths = numPaths;
}