MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / splitXRegion

Method splitXRegion

source/base/StarWorldGeometry.cpp:194–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194StaticList<Vec2I, 2> WorldGeometry::splitXRegion(Vec2I const& xRegion) const {
195 if (m_size[0] == 0)
196 return {xRegion};
197
198 starAssert(xRegion[1] >= xRegion[0]);
199
200 // This does not work for ranges greater than m_size[0] wide!
201 starAssert(xRegion[1] - xRegion[0] <= (int)m_size[0]);
202
203 int x1 = xwrap(xRegion[0]);
204 int x2 = x1 + xRegion[1] - xRegion[0];
205
206 if (x2 > (int)m_size[0]) {
207 return {Vec2I(x1, m_size[0]), Vec2I(0.0f, x2 - m_size[0])};
208 } else {
209 return {{x1, x2}};
210 }
211}
212
213StaticList<Vec2F, 2> WorldGeometry::splitXRegion(Vec2F const& xRegion) const {
214 if (m_size[0] == 0)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected