2 class SCR_ResourceContainerStorageQueue<Class ResourceActorType> : Managed
4 protected int m_iOffsetPosition;
5 protected int m_iContainerCount;
6 private array<SCR_ResourceContainer> m_aContainers;
9 int GetContainerCount()
11 return m_iContainerCount;
15 int GetOffsetPosition()
17 return m_iOffsetPosition;
21 protected int GetUpperOffsetPosition()
23 return m_iOffsetPosition + m_iContainerCount;
29 return m_aContainers[m_iOffsetPosition +
index];
35 if (m_aContainers.IsIndexValid(
index))
36 return m_aContainers[
index];
44 return m_iContainerCount == 0;
48 bool ShouldContainerChangeCauseUpdate()
59 return InsertContainerAt(container, ComputePosition(container, actor));
64 void UnregisterFirstContainer()
66 if (!m_iContainerCount)
69 m_aContainers.RemoveOrdered(m_iOffsetPosition);
75 void UnregisterContainerAt(
int position)
77 if (!m_iContainerCount)
80 m_aContainers.RemoveOrdered(m_iOffsetPosition +
position);
93 if (
index == SCR_ResourceContainerQueue.INVALID_CONTAINER_INDEX)
94 return SCR_ResourceContainerQueue.INVALID_CONTAINER_INDEX;
98 m_aContainers.InsertAt(container,
position);
107 if (
index == SCR_ResourceContainerQueue.INVALID_CONTAINER_INDEX)
108 return SCR_ResourceContainerQueue.INVALID_CONTAINER_INDEX;
112 m_aContainers.InsertAt(container,
position);
118 void SetOffsetPosition(
int offset)
120 m_iOffsetPosition = offset;
124 void IncrementOffset(
int increment)
126 m_iOffsetPosition += increment;
130 void DecrementOffset(
int decrement)
132 m_iOffsetPosition -= decrement;
136 void Initialize(array<SCR_ResourceContainer> containers)
139 m_aContainers = containers;
143 void Reset(
int offsetPosition = 0)
145 m_iOffsetPosition = offsetPosition;
146 m_iContainerCount = 0;
152 string content =
string.Format(
"Storage Container Queue of [ %1 ] has: %2 containers", ToString(), m_iContainerCount);
154 for (
int i = 0; i < m_iContainerCount; i++)
156 content +=
string.Format(
"\n\tContainer %1", GetContainerRelativeAt(i).m_sDebugName);
161 Print(
string.ToString(content,
false,
false,
false));
165 void SCR_ResourceContainerStorage()
167 m_iOffsetPosition = 0;