aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2018-05-18 11:10:53 +0200
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit263400b3d89c9499cb4be706461760bb5ccd9f5d (patch)
tree988ed07b693f5710d2b1647137b366f76631f839 /src
parent695d02e6bda939f7b00af402273b39a8fd75a203 (diff)
downloadminetest-263400b3d89c9499cb4be706461760bb5ccd9f5d.tar.gz
minetest-263400b3d89c9499cb4be706461760bb5ccd9f5d.tar.bz2
minetest-263400b3d89c9499cb4be706461760bb5ccd9f5d.zip
C++03 oldify in various source files
Diffstat (limited to 'src')
-rw-r--r--src/content_cao.cpp8
-rw-r--r--src/localplayer.cpp14
-rw-r--r--src/mapnode.cpp6
-rw-r--r--src/server.cpp6
-rw-r--r--src/serverenvironment.cpp26
-rw-r--r--src/sound_openal.cpp4
6 files changed, 38 insertions, 26 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index 994ff5bb5..7f1293ac3 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -837,8 +837,8 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr,
};
if (m_is_player) {
// Move minimal Y position to 0 (feet position)
- for (video::S3DVertex &vertex : vertices)
- vertex.Pos.Y += dy;
+ for (size_t i = 0; i < 4; i++)
+ vertices[i].Pos.Y += dy;
}
u16 indices[] = {0,1,2,2,3,0};
buf->append(vertices, 4, indices, 6);
@@ -861,8 +861,8 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr,
};
if (m_is_player) {
// Move minimal Y position to 0 (feet position)
- for (video::S3DVertex &vertex : vertices)
- vertex.Pos.Y += dy;
+ for (size_t i = 0; i < 4; i++)
+ vertices[i].Pos.Y += dy;
}
u16 indices[] = {0,1,2,2,3,0};
buf->append(vertices, 4, indices, 6);
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index ea2da15da..05195c91f 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -362,20 +362,22 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
// Force update each ClientEnvironment::step()
bool is_first = collision_info->empty();
- for (const auto &colinfo : result.collisions) {
- collision_info->push_back(colinfo);
+ for (std::vector<CollisionInfo>::const_iterator
+ colinfo = result.collisions.begin();
+ colinfo != result.collisions.end(); ++colinfo) {
+ collision_info->push_back(*colinfo);
- if (colinfo.type != COLLISION_NODE ||
- colinfo.new_speed.Y != 0 ||
+ if (colinfo->type != COLLISION_NODE ||
+ colinfo->new_speed.Y != 0 ||
(could_sneak && m_sneak_node_exists))
continue;
- diff = intToFloat(colinfo.node_p, BS) - position;
+ diff = intToFloat(colinfo->node_p, BS) - position;
// Find nearest colliding node
f32 len = diff.getLength();
if (is_first || len < distance) {
- m_standing_node = colinfo.node_p;
+ m_standing_node = colinfo->node_p;
distance = len;
}
}
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index ff5ad5557..aaea3831e 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -249,7 +249,11 @@ void transformNodeBox(const MapNode &n, const NodeBox &nodebox,
int facedir = n.getFaceDir(nodemgr);
u8 axisdir = facedir>>2;
facedir&=0x03;
- for (aabb3f box : fixed) {
+ for (std::vector<aabb3f>::const_iterator
+ i = fixed.begin();
+ i != fixed.end(); ++i) {
+ aabb3f box = *i;
+
if (nodebox.type == NODEBOX_LEVELED)
box.MaxEdge.Y = (-0.5f + n.getLevel(nodemgr) / 64.0f) * BS;
diff --git a/src/server.cpp b/src/server.cpp
index 363065995..71a349b08 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1660,8 +1660,10 @@ void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
Send(&pkt);
} else {
- for (u16 id : m_clients.getClientIDs())
- SendChatMessage(id, message);
+ std::vector<u16> clients = m_clients.getClientIDs();
+ for (std::vector<u16>::iterator it = clients.begin();
+ it != clients.end(); ++it)
+ SendChatMessage(*it, message);
}
}
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp
index da4aaf006..8c3c34854 100644
--- a/src/serverenvironment.cpp
+++ b/src/serverenvironment.cpp
@@ -265,7 +265,7 @@ void LBMManager::applyLBMs(ServerEnvironment *env, MapBlock *block, u32 stamp)
for (; it != m_lbm_lookup.end(); ++it) {
// Cache previous version to speedup lookup which has a very high performance
// penalty on each call
- content_t previous_c{};
+ content_t previous_c = CONTENT_IGNORE;
std::vector<LoadingBlockModifierDef *> *lbm_list = NULL;
for (pos.X = 0; pos.X < MAP_BLOCKSIZE; pos.X++)
@@ -1026,9 +1026,10 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
infostream << "ServerEnvironment::clearObjects(): "
<< "Removing all active objects" << std::endl;
std::vector<u16> objects_to_remove;
- for (auto &it : m_active_objects) {
- u16 id = it.first;
- ServerActiveObject* obj = it.second;
+ for (ActiveObjectMap::iterator it = m_active_objects.begin();
+ it != m_active_objects.end(); ++it) {
+ u16 id = it->first;
+ ServerActiveObject* obj = it->second;
if (obj->getType() == ACTIVEOBJECT_TYPE_PLAYER)
continue;
@@ -1054,8 +1055,9 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
}
// Remove references from m_active_objects
- for (u16 i : objects_to_remove) {
- m_active_objects.erase(i);
+ for (std::vector<u16>::iterator it = objects_to_remove.begin();
+ it != objects_to_remove.end(); ++it) {
+ m_active_objects.erase(*it);
}
// Get list of loaded blocks
@@ -1822,8 +1824,9 @@ void ServerEnvironment::removeRemovedObjects()
objects_to_remove.push_back(id);
}
// Remove references from m_active_objects
- for (u16 i : objects_to_remove) {
- m_active_objects.erase(i);
+ for (std::vector<u16>::iterator it = objects_to_remove.begin();
+ it != objects_to_remove.end(); ++it) {
+ m_active_objects.erase(*it);
}
}
@@ -2093,8 +2096,9 @@ void ServerEnvironment::deactivateFarObjects(bool _force_delete)
}
// Remove references from m_active_objects
- for (u16 i : objects_to_remove) {
- m_active_objects.erase(i);
+ for (std::vector<u16>::iterator it = objects_to_remove.begin();
+ it != objects_to_remove.end(); ++it) {
+ m_active_objects.erase(*it);
}
}
@@ -2128,7 +2132,7 @@ bool ServerEnvironment::saveStaticToBlock(
ServerActiveObject *obj, const StaticObject &s_obj,
u32 mod_reason)
{
- MapBlock *block = nullptr;
+ MapBlock *block = NULL;
try {
block = m_map->emergeBlock(blockpos);
} catch (InvalidPositionException &e) {
diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp
index 1bad04b9c..e56de3178 100644
--- a/src/sound_openal.cpp
+++ b/src/sound_openal.cpp
@@ -408,7 +408,7 @@ public:
alSource3f(sound->source_id, AL_POSITION, 0, 0, 0);
alSource3f(sound->source_id, AL_VELOCITY, 0, 0, 0);
alSourcei(sound->source_id, AL_LOOPING, loop ? AL_TRUE : AL_FALSE);
- volume = std::fmax(0.0f, volume);
+ volume = MYMAX(0.0f, volume);
alSourcef(sound->source_id, AL_GAIN, volume);
alSourcePlay(sound->source_id);
warn_if_error(alGetError(), "createPlayingSound");
@@ -436,7 +436,7 @@ public:
alSourcei(sound->source_id, AL_LOOPING, loop ? AL_TRUE : AL_FALSE);
// Multiply by 3 to compensate for reducing AL_REFERENCE_DISTANCE from
// the previous value of 30 to the new value of 10
- volume = std::fmax(0.0f, volume * 3.0f);
+ volume = MYMAX(0.0f, volume * 3.0f);
alSourcef(sound->source_id, AL_GAIN, volume);
alSourcePlay(sound->source_id);
warn_if_error(alGetError(), "createPlayingSoundAt");