mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Modernize source code: last part (#6285)
* Modernize source code: last par * Use empty when needed * Use emplace_back instead of push_back when needed * For range-based loops * Initializers fixes * constructors, destructors default * c++ C stl includes
This commit is contained in:
parent
50669cd282
commit
1c1c97cbd1
72 changed files with 446 additions and 584 deletions
|
@ -68,9 +68,8 @@ void AreaStore::serialize(std::ostream &os) const
|
|||
|
||||
// TODO: Compression?
|
||||
writeU16(os, areas_map.size());
|
||||
for (AreaMap::const_iterator it = areas_map.begin();
|
||||
it != areas_map.end(); ++it) {
|
||||
const Area &a = it->second;
|
||||
for (const auto &it : areas_map) {
|
||||
const Area &a = it.second;
|
||||
writeV3S16(os, a.minedge);
|
||||
writeV3S16(os, a.maxedge);
|
||||
writeU16(os, a.data.size());
|
||||
|
@ -193,10 +192,9 @@ bool VectorAreaStore::removeArea(u32 id)
|
|||
|
||||
void VectorAreaStore::getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos)
|
||||
{
|
||||
for (size_t i = 0; i < m_areas.size(); ++i) {
|
||||
Area *b = m_areas[i];
|
||||
if (AST_CONTAINS_PT(b, pos)) {
|
||||
result->push_back(b);
|
||||
for (Area *area : m_areas) {
|
||||
if (AST_CONTAINS_PT(area, pos)) {
|
||||
result->push_back(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,11 +202,10 @@ void VectorAreaStore::getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos)
|
|||
void VectorAreaStore::getAreasInArea(std::vector<Area *> *result,
|
||||
v3s16 minedge, v3s16 maxedge, bool accept_overlap)
|
||||
{
|
||||
for (size_t i = 0; i < m_areas.size(); ++i) {
|
||||
Area *b = m_areas[i];
|
||||
if (accept_overlap ? AST_AREAS_OVERLAP(minedge, maxedge, b) :
|
||||
AST_CONTAINS_AREA(minedge, maxedge, b)) {
|
||||
result->push_back(b);
|
||||
for (Area *area : m_areas) {
|
||||
if (accept_overlap ? AST_AREAS_OVERLAP(minedge, maxedge, area) :
|
||||
AST_CONTAINS_AREA(minedge, maxedge, area)) {
|
||||
result->push_back(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue