Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- simulated function int SortByStatus(StateObjectReference A, StateObjectReference B)
- {
- local XComGameState_Unit UnitA, UnitB;
- local string StatusA, StatusB, TimeLabelA, TimeLabelB, TimeValueA, TimeValueB;
- local int RankA, RankB, iTimeValueA, iTimeValueB;
- local EMentalState CurrentMentalStateA, CurrentMentalStateB;
- UnitA = XComGameState_Unit(`XCOMHISTORY.GetGameStateForObjectID(A.ObjectID));
- UnitB = XComGameState_Unit(`XCOMHISTORY.GetGameStateForObjectID(B.ObjectID));
- //CANNOT USE THIS AS DOES NOT GATHER ENOUGH DATA EG: TIME
- //StatusA = class'UIUtilities_Strategy'.static.GetPersonnelStatus(UnitA);
- //StatusB = class'UIUtilities_Strategy'.static.GetPersonnelStatus(UnitB);
- //THIS GIVES US ALPHABETICAL STATUS, TIME LABEL (DAYS/HRS), VALUE AS AN INT IN HRS?
- UnitA.GetStatusStringsSeparate(StatusA, TimeLabelA, iTimeValueA);
- UnitB.GetStatusStringsSeparate(StatusB, TimeLabelB, iTimeValueB);
- //THIS GIVES THE ABOVE BUT ALSO INCLUDES CHL DATA (TIME VALUE HERE IS A USELESS STRING THAT DOESNT COMPARE CORRECTLY)
- class'UIUtilities_Strategy'.static.GetPersonnelStatusSeparate(UnitA, StatusA, TimeLabelA, TimeValueA, -1, false);
- class'UIUtilities_Strategy'.static.GetPersonnelStatusSeparate(UnitB, StatusB, TimeLabelB, TimeValueB, -1, false);
- //convert STRING time back into an INT for correct comparrisons
- //iTimeValueA = int(TimeValueA);
- //iTimeValueB = int(TimeValueB);
- //GIVES MENTAL STATE AS AN ENUM
- CurrentMentalStateA = UnitA.GetMentalState();
- CurrentMentalStateB = UnitB.GetMentalState();
- //SO AVAILIABLE SORT BY RANK STILL
- RankA = UnitA.GetRank();
- RankB = UnitB.GetRank();
- //sort by Shaken TO BOTTOM
- if (!UnitA.bIsShaken && UnitB.bIsShaken)
- {
- return m_bFlipSort ? -1 : 1;
- }
- else if (UnitA.bIsShaken && !UnitB.bIsShaken)
- {
- return m_bFlipSort ? 1 : -1;
- }
- //sort by status string Alphabetical, A is less than Z
- if( StatusA < StatusB )
- {
- return m_bFlipSort ? -1 : 1;
- }
- else if( StatusA > StatusB )
- {
- return m_bFlipSort ? 1 : -1;
- }
- //sort by mental Ready 2, Tired 1, Shaken 0
- if (CurrentMentalStateA > CurrentMentalStateB)
- {
- return m_bFlipSort ? -1 : 1;
- }
- else if (CurrentMentalStateA < CurrentMentalStateB)
- {
- return m_bFlipSort ? 1 : -1;
- }
- //sort by time ASCENDING
- if( iTimeValueA < iTimeValueB )
- {
- return m_bFlipSort ? -1 : 1;
- }
- else if( iTimeValueA > iTimeValueB )
- {
- return m_bFlipSort ? 1 : -1;
- }
- //sort by rank
- if (class'UISL_SSStatusAutoSort'.default.bSortStatusIncludesRank)
- {
- if( RankA > RankB )
- {
- return m_bFlipSort ? -1 : 1;
- }
- else if( RankA < RankB )
- {
- return m_bFlipSort ? 1 : -1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement