public ESearchStatus CycleOnce() { ESearchStatus Result = CurrentSearch.CycleOnce(); if (Result == ESearchStatus.TargetNotFound) { } else if (Result == ESearchStatus.TargetFound) { //if the search was for an item type then the final node in the path will //represent a giver trigger. Consequently, it's worth passing the pointer //to the trigger in the extra info field of the message. (The pointer //will just be NULL if no trigger) //void* pTrigger = //m_NavGraph.GetNode(m_pCurrentSearch->GetPathToTarget().back()).ExtraInfo(); //Dispatcher->DispatchMsg(SEND_MSG_IMMEDIATELY, // SENDER_ID_IRRELEVANT, // m_pOwner->ID(), // Msg_PathReady, // pTrigger); } return(Result); }
// every time this is called the total amount of search cycles // available will be shared out equally between all the active // path requests. if a search completes sucessfully or fails // the method will notify the relevant bot public void UpdateSearches() { int NumCyclesRemaining = NumSearchCyclesPerUpdate; int CurSearchIndex = 0; while (NumCyclesRemaining-- > 0 && SearchRequests.Any()) { ESearchStatus Result = (SearchRequests[CurSearchIndex]).CycleOnce(); if (Result == ESearchStatus.TargetFound) { OnTargetFound(); SearchRequests.RemoveAt(CurSearchIndex); } else if (Result == ESearchStatus.TargetNotFound) { OnTargetNotFound(); SearchRequests.RemoveAt(CurSearchIndex); } else { // go to next path CurSearchIndex++; } // if we are at the end, reset to beginning. if (CurSearchIndex >= SearchRequests.Count()) { CurSearchIndex = 0; } } }
public ESearchStatus CycleOnce() { ESearchStatus Result = Search.CycleOnce(); if (Result == ESearchStatus.TargetFound) { PathToTarget.AddRange(Search.GetPathAsPathEdges()); } return(Result); }