summaryrefslogtreecommitdiff
path: root/src/minimap.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-18 18:18:25 +0200
committerGitHub <noreply@github.com>2017-08-18 18:18:25 +0200
commitc42753338924bb29c61081c9f269772f89bcd808 (patch)
tree3ccbf49ad802c57a1288ea978268315b68d8e65f /src/minimap.cpp
parentfb196be8cf8606cfab144e2fe62d9c9d1f50932f (diff)
downloadminetest-c42753338924bb29c61081c9f269772f89bcd808.tar.gz
minetest-c42753338924bb29c61081c9f269772f89bcd808.tar.bz2
minetest-c42753338924bb29c61081c9f269772f89bcd808.zip
Modernize various files (src/m*) (#6267)
* Modernize various files (src/m*) * range-based for loops * code style * C++ headers instead of C headers * Default operators * empty function Thanks to clang-tidy
Diffstat (limited to 'src/minimap.cpp')
-rw-r--r--src/minimap.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/minimap.cpp b/src/minimap.cpp
index dab5f3aa5..f35330963 100644
--- a/src/minimap.cpp
+++ b/src/minimap.cpp
@@ -46,10 +46,7 @@ bool MinimapUpdateThread::pushBlockUpdate(v3s16 pos, MinimapMapblock *data)
// Find if block is already in queue.
// If it is, update the data and quit.
- for (std::deque<QueuedMinimapUpdate>::iterator
- it = m_update_queue.begin();
- it != m_update_queue.end(); ++it) {
- QueuedMinimapUpdate &q = *it;
+ for (QueuedMinimapUpdate &q : m_update_queue) {
if (q.pos == pos) {
delete q.data;
q.data = data;
@@ -277,9 +274,9 @@ MinimapShape Minimap::getMinimapShape()
{
if (data->minimap_shape_round) {
return MINIMAP_SHAPE_ROUND;
- } else {
- return MINIMAP_SHAPE_SQUARE;
}
+
+ return MINIMAP_SHAPE_SQUARE;
}
void Minimap::setMinimapMode(MinimapMode mode)
@@ -434,9 +431,9 @@ v3f Minimap::getYawVec()
cos(m_angle * core::DEGTORAD),
sin(m_angle * core::DEGTORAD),
1.0);
- } else {
- return v3f(1.0, 0.0, 1.0);
}
+
+ return v3f(1.0, 0.0, 1.0);
}
scene::SMeshBuffer *Minimap::getMinimapMeshBuffer()
@@ -568,9 +565,8 @@ void Minimap::updateActiveMarkers()
m_active_markers.clear();
- for (std::list<Nametag *>::const_iterator i = nametags.begin();
- i != nametags.end(); ++i) {
- v3s16 pos = floatToInt((*i)->parent_node->getPosition() +
+ for (Nametag *nametag : nametags) {
+ v3s16 pos = floatToInt(nametag->parent_node->getPosition() +
intToFloat(client->getCamera()->getOffset(), BS), BS);
pos -= data->pos - v3s16(data->map_size / 2,
data->scan_height / 2,
@@ -586,8 +582,9 @@ void Minimap::updateActiveMarkers()
if (!mask_col.getAlpha()) {
continue;
}
- m_active_markers.push_back(v2f(((float)pos.X / (float)MINIMAP_MAX_SX) - 0.5,
- (1.0 - (float)pos.Z / (float)MINIMAP_MAX_SY) - 0.5));
+
+ m_active_markers.emplace_back(((float)pos.X / (float)MINIMAP_MAX_SX) - 0.5,
+ (1.0 - (float)pos.Z / (float)MINIMAP_MAX_SY) - 0.5);
}
}