Skip to content

Commit

Permalink
random const's
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Oct 6, 2019
1 parent 1c35bd0 commit 6128051
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion rts/Rendering/GL/RenderDataBuffer.hpp
Expand Up @@ -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;
Expand Down
20 changes: 6 additions & 14 deletions rts/Sim/Misc/GroundBlockingObjectMap.cpp
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions rts/Sim/Misc/GroundBlockingObjectMap.h
Expand Up @@ -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
Expand Down Expand Up @@ -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] ; }
Expand Down

0 comments on commit 6128051

Please sign in to comment.