1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

clientobject, clouds, collision, clientsimpleobject: code modernization (#6260)

* clientobject, clouds, collision, clientsimpleobject: code modernization

* use range-based for loops
* simplify some tests
* various code style fixes
* use emplace_back instead of push_back when necessary
* use auto on some iterators
* use default operator when needed
* unroll v3s16 creation on collisionMoveSimple
This commit is contained in:
Loïc Blot 2017-08-17 20:23:54 +02:00 committed by GitHub
parent 9bd18874a1
commit c738d1eeab
6 changed files with 41 additions and 44 deletions

View file

@ -42,7 +42,7 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
Client *client, ClientEnvironment *env)
{
// Find factory function
std::unordered_map<u16, Factory>::iterator n = m_types.find(type);
auto n = m_types.find(type);
if (n == m_types.end()) {
// If factory is not found, just return.
warningstream << "ClientActiveObject: No factory for type="
@ -57,8 +57,8 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
void ClientActiveObject::registerType(u16 type, Factory f)
{
std::unordered_map<u16, Factory>::iterator n = m_types.find(type);
if(n != m_types.end())
auto n = m_types.find(type);
if (n != m_types.end())
return;
m_types[type] = f;
}