diff --git a/src/client.cpp b/src/client.cpp index 5b4eb7d10..d48231883 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -577,7 +577,7 @@ void Client::step(float dtime) { if(sendlist.size() == 255 || i == deleted_blocks.end()) { - if(sendlist.size() == 0) + if(sendlist.empty()) break; /* [0] u16 command @@ -813,7 +813,7 @@ void Client::step(float dtime) } } // Sync to server - if(removed_server_ids.size() != 0) + if(!removed_server_ids.empty()) { std::ostringstream os(std::ios_base::binary); writeU16(os, TOSERVER_REMOVED_SOUNDS); diff --git a/src/clientiface.cpp b/src/clientiface.cpp index cd2e2d4d9..1383d0b84 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -603,7 +603,7 @@ void ClientInterface::UpdatePlayerList() m_clients_names.clear(); - if(clients.size() != 0) + if(!clients.empty()) infostream<<"Players:"<::iterator i = clients.begin(); diff --git a/src/connection.cpp b/src/connection.cpp index 64ef9a50e..468382473 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -1316,7 +1316,7 @@ bool ConnectionSendThread::packetsQueued() { std::list peerIds = m_connection->getPeerIDs(); - if ((this->m_outgoing_queue.size() > 0) && (peerIds.size() > 0)) + if ((!this->m_outgoing_queue.empty()) && (!peerIds.empty())) return true; for(std::list::iterator j = peerIds.begin(); diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 8471b7e81..671ddd4b1 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1468,7 +1468,7 @@ void GenericCAO::updateAnimation() void GenericCAO::updateBonePosition() { - if(!m_bone_position.size() || m_animated_meshnode == NULL) + if(m_bone_position.empty() || m_animated_meshnode == NULL) return; m_animated_meshnode->setJointMode(irr::scene::EJUOR_CONTROL); // To write positions to the mesh on render diff --git a/src/environment.cpp b/src/environment.cpp index d7c8acee8..ee4488476 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1669,7 +1669,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) if(block==NULL) return; // Ignore if no stored objects (to not set changed flag) - if(block->m_static_objects.m_stored.size() == 0) + if(block->m_static_objects.m_stored.empty()) return; verbosestream<<"ServerEnvironment::activateObjects(): " <<"activating objects of block "<getPos()) diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h index db8aa9e19..b14ca56e5 100644 --- a/src/mainmenumanager.h +++ b/src/mainmenumanager.h @@ -56,7 +56,7 @@ public: assert(*i != menu); } - if(m_stack.size() != 0) + if(!m_stack.empty()) m_stack.back()->setVisible(false); m_stack.push_back(menu); } @@ -84,14 +84,14 @@ public: assert(*i == menu); m_stack.erase(i);*/ - if(m_stack.size() != 0) + if(!m_stack.empty()) m_stack.back()->setVisible(true); } // Returns true to prevent further processing virtual bool preprocessEvent(const SEvent& event) { - if(m_stack.size() != 0) + if(!m_stack.empty()) return m_stack.back()->preprocessEvent(event); else return false; diff --git a/src/map.cpp b/src/map.cpp index 4b0d2e2d8..009bc3d72 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -276,7 +276,7 @@ void Map::unspreadLight(enum LightBank bank, v3s16(-1,0,0), // left }; - if(from_nodes.size() == 0) + if(from_nodes.empty()) return; u32 blockchangecount = 0; @@ -418,7 +418,7 @@ void Map::unspreadLight(enum LightBank bank, <<" for "< 0) + if(!unlighted_nodes.empty()) unspreadLight(bank, unlighted_nodes, light_sources, modified_blocks); } @@ -455,7 +455,7 @@ void Map::spreadLight(enum LightBank bank, v3s16(-1,0,0), // left }; - if(from_nodes.size() == 0) + if(from_nodes.empty()) return; u32 blockchangecount = 0; @@ -575,7 +575,7 @@ void Map::spreadLight(enum LightBank bank, <<" for "< 0) + if(!lighted_nodes.empty()) spreadLight(bank, lighted_nodes, modified_blocks); } diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp index 20b9fbda6..bc9d1681a 100644 --- a/src/mg_decoration.cpp +++ b/src/mg_decoration.cpp @@ -136,7 +136,7 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) if (mg->biomemap) { std::set::iterator iter; - if (biomes.size()) { + if (!biomes.empty()) { iter = biomes.find(mg->biomemap[mapindex]); if (iter == biomes.end()) continue; diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 112373b1e..27192a2f7 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -1414,7 +1414,7 @@ int NodeResolver::resolveNodes() for (it = idset.begin(); it != idset.end(); ++it) output->push_back(*it); - if (idset.size() == 0) { + if (idset.empty()) { num_failed++; errorstream << "NodeResolver::resolveNodes(): Failed to " "resolve '" << name << "'" << std::endl; diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index 0631d974a..b3e810b42 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -83,7 +83,7 @@ void NodeMetadataList::serialize(std::ostream &os) const Version 0 is a placeholder for "nothing to see here; go away." */ - if(m_data.size() == 0){ + if(!m_data.empty()){ writeU8(os, 0); // version return; } diff --git a/src/nodetimer.cpp b/src/nodetimer.cpp index d4971c873..790b46076 100644 --- a/src/nodetimer.cpp +++ b/src/nodetimer.cpp @@ -47,7 +47,7 @@ void NodeTimerList::serialize(std::ostream &os, u8 map_format_version) const { if(map_format_version == 24){ // Version 0 is a placeholder for "nothing to see here; go away." - if(m_data.size() == 0){ + if(m_data.empty()){ writeU8(os, 0); // version return; } diff --git a/src/server.cpp b/src/server.cpp index 7c5ee7f42..d56c34c65 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -664,7 +664,7 @@ void Server::AsyncRunStep(bool initial_step) /* Set the modified blocks unsent for all the clients */ - if(modified_blocks.size() > 0) + if(!modified_blocks.empty()) { SetBlocksNotSent(modified_blocks); } @@ -745,7 +745,7 @@ void Server::AsyncRunStep(bool initial_step) client->m_known_objects, added_objects); // Ignore if nothing happened - if(removed_objects.size() == 0 && added_objects.size() == 0) + if(removed_objects.empty() && added_objects.empty()) { //infostream<<"active objects: none changed"< 0) + if(!far_players.empty()) { // Convert list format to that wanted by SetBlocksNotSent std::map modified_blocks2; @@ -2675,7 +2675,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) continue; ServerPlayingSound &psound = i->second; psound.clients.erase(peer_id); - if(psound.clients.size() == 0) + if(psound.clients.empty()) m_playing_sounds.erase(i++); } } @@ -3628,7 +3628,7 @@ s32 Server::playSound(const SimpleSoundSpec &spec, dst_clients.push_back(*i); } } - if(dst_clients.size() == 0) + if(dst_clients.empty()) return -1; // Create the sound @@ -4322,7 +4322,7 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason) { ServerPlayingSound &psound = i->second; psound.clients.erase(peer_id); - if(psound.clients.size() == 0) + if(psound.clients.empty()) m_playing_sounds.erase(i++); else i++; diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp index d27526b55..b2b424a19 100644 --- a/src/sound_openal.cpp +++ b/src/sound_openal.cpp @@ -434,7 +434,7 @@ public: } } } - if(del_list.size() != 0) + if(!del_list.empty()) verbosestream<<"OpenALSoundManager::maintain(): deleting " <::iterator i = del_list.begin(); diff --git a/src/voxel.cpp b/src/voxel.cpp index e6d4bdcd2..335ab307c 100644 --- a/src/voxel.cpp +++ b/src/voxel.cpp @@ -420,7 +420,7 @@ void VoxelManipulator::unspreadLight(enum LightBank bank, std::map & from_nodes, std::set & light_sources, INodeDefManager *nodemgr) { - if(from_nodes.size() == 0) + if(from_nodes.empty()) return; for(std::map::iterator j = from_nodes.begin(); @@ -646,7 +646,7 @@ void VoxelManipulator::spreadLight(enum LightBank bank, v3s16(-1,0,0), // left }; - if(from_nodes.size() == 0) + if(from_nodes.empty()) return; std::set lighted_nodes; @@ -719,7 +719,7 @@ void VoxelManipulator::spreadLight(enum LightBank bank, <<" for "< 0) + if(!lighted_nodes.empty()) spreadLight(bank, lighted_nodes, nodemgr); } #endif