};
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);
};
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);
// 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;
}
}
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;
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);
}
}
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++)
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;
}
// 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
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);
}
}
}
// 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);
}
}
ServerActiveObject *obj, const StaticObject &s_obj,
u32 mod_reason)
{
- MapBlock *block = nullptr;
+ MapBlock *block = NULL;
try {
block = m_map->emergeBlock(blockpos);
} catch (InvalidPositionException &e) {
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");
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");