mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor similar loop in s4 and s6 import
This commit is contained in:
parent
90718ca81c
commit
0aa6ceb2aa
|
@ -299,6 +299,17 @@ void Staff::SetPatrolArea(const CoordsXY& coords, bool value)
|
|||
PatrolInfo->Set(coords, value);
|
||||
}
|
||||
|
||||
void Staff::SetPatrolArea(const MapRange& range, bool value)
|
||||
{
|
||||
for (int32_t yy = range.GetTop(); yy <= range.GetBottom(); yy += COORDS_XY_STEP)
|
||||
{
|
||||
for (int32_t xx = range.GetLeft(); xx <= range.GetRight(); xx += COORDS_XY_STEP)
|
||||
{
|
||||
SetPatrolArea({ xx, yy }, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Staff::ClearPatrolArea()
|
||||
{
|
||||
delete PatrolInfo;
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
|
||||
void ClearPatrolArea();
|
||||
void SetPatrolArea(const CoordsXY& coords, bool value);
|
||||
void SetPatrolArea(const MapRange& range, bool value);
|
||||
bool HasPatrolArea() const;
|
||||
std::vector<TileCoordsXY> GetPatrolArea();
|
||||
void SetPatrolArea(const std::vector<TileCoordsXY>& area);
|
||||
|
|
|
@ -1361,13 +1361,8 @@ namespace RCT1
|
|||
x <<= 7;
|
||||
int32_t y = val & 0x3E0;
|
||||
y <<= 2;
|
||||
for (int32_t offsetY = 0; offsetY < 4 * COORDS_XY_STEP; offsetY += COORDS_XY_STEP)
|
||||
{
|
||||
for (int32_t offsetX = 0; offsetX < 4 * COORDS_XY_STEP; offsetX += COORDS_XY_STEP)
|
||||
{
|
||||
staffmember->SetPatrolArea({ x + offsetX, y + offsetY }, true);
|
||||
}
|
||||
}
|
||||
staffmember->SetPatrolArea(
|
||||
MapRange(x, y, x + (4 * COORDS_XY_STEP) - 1, y + (4 * COORDS_XY_STEP) - 1), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1516,13 +1516,8 @@ namespace RCT2
|
|||
x <<= 7;
|
||||
int32_t y = val & 0xFC0;
|
||||
y <<= 1;
|
||||
for (int32_t offsetY = 0; offsetY < 4 * COORDS_XY_STEP; offsetY += COORDS_XY_STEP)
|
||||
{
|
||||
for (int32_t offsetX = 0; offsetX < 4 * COORDS_XY_STEP; offsetX += COORDS_XY_STEP)
|
||||
{
|
||||
staffmember->SetPatrolArea({ x + offsetX, y + offsetY }, true);
|
||||
}
|
||||
}
|
||||
staffmember->SetPatrolArea(
|
||||
MapRange(x, y, x + (4 * COORDS_XY_STEP) - 1, y + (4 * COORDS_XY_STEP) - 1), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue