30 auto insertResult =
Phases.emplace(phaseId,
flags,
nullptr);
33 insertResult.first->AreaConditions = areaConditions;
35 return insertResult.second;
45 return {
Phases.erase(itr),
true };
46 return { itr,
false };
48 return {
Phases.end(),
false };
54 insertResult.first->second.References += references;
55 return insertResult.second;
63 if (!--itr->second.References)
65 return { itr,
false };
73 insertResult.first->second.References += references;
74 return insertResult.second;
82 if (!--itr->second.References)
84 return { itr,
false };
126 [&ownerGuid, &otherPersonalGuid, excludePhasesWithFlag](
PhaseRef const& myPhase,
PhaseRef const& )
128 return !myPhase.Flags.HasFlag(excludePhasesWithFlag) && (!myPhase.Flags.HasFlag(PhaseFlags::Personal) || ownerGuid == otherPersonalGuid);
132 auto checkInversePhaseShift = [excludePhasesWithFlag](
PhaseShift const& phaseShift,
PhaseShift const& excludedPhaseShift)
142 auto itr2 = std::find(excludedPhaseShift.Phases.begin(), excludedPhaseShift.Phases.end(), phase);
143 if (itr2 != excludedPhaseShift.Phases.end() && !itr2->Flags.HasFlag(excludePhasesWithFlag))
150 return checkInversePhaseShift(*
this, other);
152 return checkInversePhaseShift(other, *
this);
157 itr->References += references;
186 Flags &= ~unphasedFlag;
188 Flags |= unphasedFlag;
200 if (phaseRef.IsPersonal())
constexpr bool HasFlag(T flag) const
PhaseShift & operator=(PhaseShift const &right)
EnumFlag< PhaseShiftFlags > Flags
PhaseContainer const & GetPhases() const
void ModifyPhasesReferences(PhaseContainer::iterator itr, int32 references)
int32 NonCosmeticReferences
EraseResult< VisibleMapIdContainer > RemoveVisibleMapId(uint32 visibleMapId)
bool HasPersonalPhase() const
void UpdateUnphasedFlag()
EraseResult< PhaseContainer > RemovePhase(uint32 phaseId)
UiMapPhaseIdContainer UiMapPhaseIds
bool AddVisibleMapId(uint32 visibleMapId, TerrainSwapInfo const *visibleMapInfo, int32 references=1)
EraseResult< UiMapPhaseIdContainer > RemoveUiMapPhaseId(uint32 uiMapPhaseId)
void UpdatePersonalGuid()
bool AddUiMapPhaseId(uint32 uiMapPhaseId, int32 references=1)
bool AddPhase(uint32 phaseId, PhaseFlags flags, std::vector< Condition > const *areaConditions, int32 references=1)
VisibleMapIdContainer VisibleMapIds
bool CanSee(PhaseShift const &other) const
bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
EnumFlag< PhaseFlags > Flags