Skip to content
Permalink
Browse files

random const's

  • Loading branch information...
rtri
rtri committed Oct 6, 2019
1 parent 1c35bd0 commit 6128051f10d4f9454cf56fe7c6e25dea718773fe
@@ -642,12 +642,12 @@ namespace GL {
void Update(const IndexArrayType* i, size_t ni, size_t pos) { AssertSizeI( ni, pos); std::memcpy(&indcsMap[pos], i, ni * sizeof( IndexArrayType)); }

bool SafeUpdate(const VertexArrayType& e, size_t pos) { return SafeUpdate(&e, 1, pos); }
bool SafeUpdate(const IndexArrayType i, size_t pos) { return SafeUpdate(&i, 1, pos); }
bool SafeUpdate(const VertexArrayType* e, size_t ne, size_t pos) {
if (elemsMap == nullptr || !CheckSizeE(ne, pos))
return false;
return (Update(e, ne, pos), true);
}
bool SafeUpdate(const IndexArrayType i, size_t pos) { return SafeUpdate(&i, 1, pos); }
bool SafeUpdate(const IndexArrayType* i, size_t ni, size_t pos) {
if (indcsMap == nullptr || !CheckSizeI(ni, pos))
return false;
@@ -185,10 +185,13 @@ void CGroundBlockingObjectMap::CloseBlockingYard(CSolidObject* object)
}


inline bool CGroundBlockingObjectMap::CheckYard(CSolidObject* yardUnit, const YardMapStatus& mask) const
bool CGroundBlockingObjectMap::CheckYard(const CSolidObject* yardUnit, const YardMapStatus& mask) const
{
for (int z = yardUnit->mapPos.y; z < yardUnit->mapPos.y + yardUnit->zsize; ++z) {
for (int x = yardUnit->mapPos.x; x < yardUnit->mapPos.x + yardUnit->xsize; ++x) {
const int2 mins = yardUnit->mapPos;
const int2 maxs = mins + int2(yardUnit->xsize, yardUnit->zsize);

for (int z = mins.y; z < maxs.y; ++z) {
for (int x = mins.x; x < maxs.x; ++x) {
if ((yardUnit->GetGroundBlockingMaskAtPos(float3(x * SQUARE_SIZE, 0.0f, z * SQUARE_SIZE)) & mask) == 0)
continue;

@@ -201,17 +204,6 @@ inline bool CGroundBlockingObjectMap::CheckYard(CSolidObject* yardUnit, const Ya
}


bool CGroundBlockingObjectMap::CanOpenYard(CSolidObject* yardUnit) const
{
return CheckYard(yardUnit, YARDMAP_YARDINV);
}

bool CGroundBlockingObjectMap::CanCloseYard(CSolidObject* yardUnit) const
{
return CheckYard(yardUnit, YARDMAP_YARD);
}


unsigned int CGroundBlockingObjectMap::CalcChecksum() const
{
unsigned int checksum = 666;
@@ -127,8 +127,8 @@ class CGroundBlockingObjectMap

void OpenBlockingYard(CSolidObject* object);
void CloseBlockingYard(CSolidObject* object);
bool CanOpenYard(CSolidObject* object) const;
bool CanCloseYard(CSolidObject* object) const;
bool CanOpenYard(const CSolidObject* object) const { return CheckYard(object, YARDMAP_YARDINV); }
bool CanCloseYard(const CSolidObject* object) const { return CheckYard(object, YARDMAP_YARD); }


// these retrieve either the first object in
@@ -171,7 +171,7 @@ class CGroundBlockingObjectMap
}

private:
bool CheckYard(CSolidObject* yardUnit, const YardMapStatus& mask) const;
bool CheckYard(const CSolidObject* yardUnit, const YardMapStatus& mask) const;

const ArrCell& GetArrCell(unsigned int mapSquare) const { return arrCells[mapSquare] ; }
ArrCell& GetArrCell(unsigned int mapSquare) { return arrCells[mapSquare] ; }

0 comments on commit 6128051

Please sign in to comment.
You can’t perform that action at this time.