Tehtsuo / Combot

5 stars 2 forks source link

obj_TargetList - AddTargetException #79

Open rjinski opened 11 years ago

rjinski commented 11 years ago

Could the ideal behind AddTargetException be extended to include an AddQueryException ?

I was thinking of adding a state between GetQueryString and PopulateList that if a QueryExpection exists it would remove it from the Buffer before populating?

rjinski commented 11 years ago

I added this from in my sandbox, currently untested:

method AddQueryException(string QueryString) { variable int QueryID variable index:entity index_remove variable iterator ite_remove

    QueryID:Set[${LavishScript.CreateQuery["${QueryString.Escape}"]}]
    QueryExceptionList:Insert[${QueryID}]
    TargetList:RemoveByQuery[${QueryID}]
    LockedTargetList:RemoveByQuery[${QueryID}]

    EVE:QueryEntities[index_remove, "${QueryString.Escape}"]
    index_remove:GetIterator[ite_remove]
    if ${ite_remove:First(exists)}
    {
        do
        {
            if ${ite_remove.Value.LockedTarget}
            {
                ite_remove.Value:UnlockTarget
            }
        }
        while ${ite_remove:Next(exists)}
    }
}

method ClearQueryExceptions() { variable iterator ite_exceptions QueryExceptionList:GetIterator[ite_exceptions] if ${ite_exceptions:First(exists)} { do { LavishScript:FreeQuery[${ite_exceptions.Value}] } while ${ite_exceptions:Next(exists)} } QueryExceptionList:Clear }

member:bool PopulateList() { Profiling:StartTrack["TargetList_PopulateList"] variable iterator ExceptionIterator QueryExceptionList:GetIterator[ExceptionIterator] if ${ExceptionIterator:First(exists)} { do { This.TargetListBuffer:RemoveByQuery[${ExceptionIterator.Value}] This.TargetListBufferOOR:RemoveByQuery[${ExceptionIterator.Value}] This.LockedTargetListBuffer:RemoveByQuery[${ExceptionIterator.Value}] This.LockedTargetListBufferOOR:RemoveByQuery[${ExceptionIterator.Value}] This.TargetLockPriorityBuffer:RemoveByQuery[${ExceptionIterator.Value}] } while ${ExceptionIterator:Next(exists)} } ......................... etc