summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton <vob999@bk.ru>2014-12-12 19:55:40 +0500
committerShadowNinja <shadowninja@minetest.net>2014-12-12 15:16:24 -0500
commit10e0cf8b2c27917a3fd45e73a5d835af4313db3b (patch)
tree906faf9a2e5185b1eb63060af007e070fe0097d0 /src
parent83830e8682de23840675a35daa386fa2820fbb7d (diff)
downloadminetest-10e0cf8b2c27917a3fd45e73a5d835af4313db3b.tar.gz
minetest-10e0cf8b2c27917a3fd45e73a5d835af4313db3b.tar.bz2
minetest-10e0cf8b2c27917a3fd45e73a5d835af4313db3b.zip
Use std::string::empty() instead of size() where applicable
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/clientiface.cpp2
-rw-r--r--src/connection.cpp2
-rw-r--r--src/content_cao.cpp2
-rw-r--r--src/environment.cpp2
-rw-r--r--src/mainmenumanager.h6
-rw-r--r--src/map.cpp8
-rw-r--r--src/mg_decoration.cpp2
-rw-r--r--src/nodedef.cpp2
-rw-r--r--src/nodemetadata.cpp2
-rw-r--r--src/nodetimer.cpp2
-rw-r--r--src/server.cpp12
-rw-r--r--src/sound_openal.cpp2
-rw-r--r--src/voxel.cpp6
14 files changed, 27 insertions, 27 deletions
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:"<<std::endl;
for(std::list<u16>::iterator
i = clients.begin();
diff --git a/src/connection.cpp b/src/connection.cpp
index 64ef9a50e..cf5be7ed6 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -1316,7 +1316,7 @@ bool ConnectionSendThread::packetsQueued()
{
std::list<u16> peerIds = m_connection->getPeerIDs();
- if ((this->m_outgoing_queue.size() > 0) && (peerIds.size() > 0))
+ if (!m_outgoing_queue.empty() && !peerIds.empty())
return true;
for(std::list<u16>::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 "<<PP(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 "<<from_nodes.size()<<" nodes"
<<std::endl;*/
- if(unlighted_nodes.size() > 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 "<<from_nodes.size()<<" nodes"
<<std::endl;*/
- if(lighted_nodes.size() > 0)
+ if(!lighted_nodes.empty())
spreadLight(bank, lighted_nodes, modified_blocks);
}
diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp
index 14368c091..761b231ed 100644
--- a/src/mg_decoration.cpp
+++ b/src/mg_decoration.cpp
@@ -155,7 +155,7 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
if (mg->biomemap) {
std::set<u8>::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 1795b199c..b046957e6 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..b8c7d3d9c 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"<<std::endl;
continue;
@@ -1051,7 +1051,7 @@ void Server::AsyncRunStep(bool initial_step)
/*
Set blocks not sent to far players
*/
- if(far_players.size() > 0)
+ if(!far_players.empty())
{
// Convert list format to that wanted by SetBlocksNotSent
std::map<v3s16, MapBlock*> 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 "
<<del_list.size()<<" playing sounds"<<std::endl;
for(std::set<int>::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<v3s16, u8> & from_nodes,
std::set<v3s16> & light_sources, INodeDefManager *nodemgr)
{
- if(from_nodes.size() == 0)
+ if(from_nodes.empty())
return;
for(std::map<v3s16, u8>::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<v3s16> lighted_nodes;
@@ -719,7 +719,7 @@ void VoxelManipulator::spreadLight(enum LightBank bank,
<<" for "<<from_nodes.size()<<" nodes"
<<std::endl;*/
- if(lighted_nodes.size() > 0)
+ if(!lighted_nodes.empty())
spreadLight(bank, lighted_nodes, nodemgr);
}
#endif