From a98baef5e4fedca36c8c8755ad7c8233469f6a3f Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sun, 4 Jun 2017 21:00:04 +0200 Subject: C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) --- src/client.cpp | 11 +++++----- src/client.h | 13 +++++------ src/client/tile.cpp | 4 ++-- src/clientenvironment.cpp | 18 ++++++++-------- src/clientenvironment.h | 3 ++- src/clientiface.cpp | 30 ++++++++++++-------------- src/clientiface.h | 7 +++--- src/clientmedia.cpp | 2 +- src/clientmedia.h | 4 ++-- src/clientobject.cpp | 6 +++--- src/clientobject.h | 4 ++-- src/content_cao.cpp | 6 +++--- src/content_cao.h | 3 ++- src/content_mapblock.cpp | 3 +-- src/content_sao.cpp | 18 ++++++++-------- src/content_sao.h | 8 +++---- src/emerge.cpp | 2 +- src/emerge.h | 2 +- src/face_position_cache.cpp | 4 ++-- src/face_position_cache.h | 4 ++-- src/guiFormSpecMenu.cpp | 2 +- src/guiFormSpecMenu.h | 4 ++-- src/itemgroup.h | 4 ++-- src/map.h | 1 - src/mapblock_mesh.h | 1 - src/mapsector.cpp | 6 +++--- src/mapsector.h | 2 +- src/mg_decoration.cpp | 13 +++++------ src/mg_decoration.h | 6 ++---- src/mg_ore.cpp | 10 ++++----- src/mg_ore.h | 4 ++-- src/mg_schematic.cpp | 4 ++-- src/mods.cpp | 9 ++++---- src/mods.h | 10 ++++----- src/nameidmapping.cpp | 2 +- src/nameidmapping.h | 14 +++++++----- src/network/clientpackethandler.cpp | 4 ++-- src/network/serverpackethandler.cpp | 3 ++- src/nodedef.cpp | 12 +++++------ src/nodemetadata.h | 4 ++-- src/reflowscan.cpp | 1 - src/script/common/c_content.cpp | 16 +++++++------- src/script/common/c_converter.h | 4 ++-- src/script/lua_api/l_mapgen.cpp | 8 +++---- src/script/lua_api/l_object.cpp | 4 ++-- src/script/lua_api/l_util.cpp | 2 +- src/server.cpp | 43 +++++++++++++++++++------------------ src/server.h | 8 +++---- src/serverenvironment.cpp | 29 +++++++++++++------------ src/serverenvironment.h | 8 +++---- src/serverobject.h | 7 +++--- src/settings.h | 5 ++--- src/sound_openal.cpp | 28 ++++++++++++------------ src/tool.cpp | 2 +- src/tool.h | 9 ++++---- src/util/cpp11.h | 32 --------------------------- src/util/cpp11_container.h | 43 ------------------------------------- src/util/string.h | 4 ++-- src/voxelalgorithms.h | 1 - 59 files changed, 223 insertions(+), 298 deletions(-) delete mode 100644 src/util/cpp11.h delete mode 100644 src/util/cpp11_container.h (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index a5228132d..56e35ac1f 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -242,7 +242,7 @@ Client::~Client() delete m_inventory_from_server; // Delete detached inventories - for (UNORDERED_MAP::iterator + for (std::unordered_map::iterator i = m_detached_inventories.begin(); i != m_detached_inventories.end(); ++i) { delete i->second; @@ -571,7 +571,7 @@ void Client::step(float dtime) Update positions of sounds attached to objects */ { - for(UNORDERED_MAP::iterator i = m_sounds_to_objects.begin(); + for(std::unordered_map::iterator i = m_sounds_to_objects.begin(); i != m_sounds_to_objects.end(); ++i) { int client_id = i->first; u16 object_id = i->second; @@ -591,7 +591,7 @@ void Client::step(float dtime) m_removed_sounds_check_timer = 0; // Find removed sounds and clear references to them std::vector removed_server_ids; - for(UNORDERED_MAP::iterator i = m_sounds_server_to_client.begin(); + for (std::unordered_map::iterator i = m_sounds_server_to_client.begin(); i != m_sounds_server_to_client.end();) { s32 server_id = i->first; int client_id = i->second; @@ -614,7 +614,7 @@ void Client::step(float dtime) if (m_mod_storage_save_timer <= 0.0f) { verbosestream << "Saving registered mod storages." << std::endl; m_mod_storage_save_timer = g_settings->getFloat("server_map_save_interval"); - for (UNORDERED_MAP::const_iterator + for (std::unordered_map::const_iterator it = m_mod_storages.begin(); it != m_mod_storages.end(); ++it) { if (it->second->isModified()) { it->second->save(getModStoragePath()); @@ -1959,7 +1959,8 @@ bool Client::registerModStorage(ModMetadata *storage) void Client::unregisterModStorage(const std::string &name) { - UNORDERED_MAP::const_iterator it = m_mod_storages.find(name); + std::unordered_map::const_iterator it = + m_mod_storages.find(name); if (it != m_mod_storages.end()) { // Save unconditionaly on unregistration it->second->save(getModStoragePath()); diff --git a/src/client.h b/src/client.h index b4145c76f..fc2416087 100644 --- a/src/client.h +++ b/src/client.h @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include "clientobject.h" #include "gamedef.h" #include "inventorymanager.h" @@ -656,18 +657,18 @@ private: // Sounds float m_removed_sounds_check_timer; // Mapping from server sound ids to our sound ids - UNORDERED_MAP m_sounds_server_to_client; + std::unordered_map m_sounds_server_to_client; // And the other way! - UNORDERED_MAP m_sounds_client_to_server; + std::unordered_map m_sounds_client_to_server; // And relations to objects - UNORDERED_MAP m_sounds_to_objects; + std::unordered_map m_sounds_to_objects; // Privileges - UNORDERED_SET m_privileges; + std::unordered_set m_privileges; // Detached inventories // key = name - UNORDERED_MAP m_detached_inventories; + std::unordered_map m_detached_inventories; // Storage for mesh data for creating multiple instances of the same mesh StringMap m_mesh_data; @@ -682,7 +683,7 @@ private: ClientScripting *m_script; bool m_modding_enabled; - UNORDERED_MAP m_mod_storages; + std::unordered_map m_mod_storages; float m_mod_storage_save_timer; GameUIFlags *m_game_ui_flags; diff --git a/src/client/tile.cpp b/src/client/tile.cpp index 99495132b..0918836e5 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -427,7 +427,7 @@ private: std::vector m_texture_trash; // Maps image file names to loaded palettes. - UNORDERED_MAP m_palettes; + std::unordered_map m_palettes; // Cached settings needed for making textures from meshes bool m_setting_trilinear_filter; @@ -700,7 +700,7 @@ Palette* TextureSource::getPalette(const std::string &name) if (name == "") return NULL; - UNORDERED_MAP::iterator it = m_palettes.find(name); + std::unordered_map::iterator it = m_palettes.find(name); if (it == m_palettes.end()) { // Create palette video::IImage *img = generateImage(name); diff --git a/src/clientenvironment.cpp b/src/clientenvironment.cpp index cc7cb54dd..d6af06dde 100644 --- a/src/clientenvironment.cpp +++ b/src/clientenvironment.cpp @@ -55,8 +55,8 @@ ClientEnvironment::ClientEnvironment(ClientMap *map, scene::ISceneManager *smgr, ClientEnvironment::~ClientEnvironment() { // delete active objects - for (UNORDERED_MAP::iterator i = m_active_objects.begin(); - i != m_active_objects.end(); ++i) { + for (ClientActiveObjectMap::iterator i = m_active_objects.begin(); + i != m_active_objects.end(); ++i) { delete i->second; } @@ -346,8 +346,8 @@ void ClientEnvironment::step(float dtime) g_profiler->avg("CEnv: num of objects", m_active_objects.size()); bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21); - for (UNORDERED_MAP::iterator i = m_active_objects.begin(); - i != m_active_objects.end(); ++i) { + for (ClientActiveObjectMap::iterator i = m_active_objects.begin(); + i != m_active_objects.end(); ++i) { ClientActiveObject* obj = i->second; // Step object obj->step(dtime, this); @@ -406,14 +406,14 @@ GenericCAO* ClientEnvironment::getGenericCAO(u16 id) ClientActiveObject* ClientEnvironment::getActiveObject(u16 id) { - UNORDERED_MAP::iterator n = m_active_objects.find(id); + ClientActiveObjectMap::iterator n = m_active_objects.find(id); if (n == m_active_objects.end()) return NULL; return n->second; } bool isFreeClientActiveObjectId(const u16 id, - UNORDERED_MAP &objects) + ClientActiveObjectMap &objects) { if(id == 0) return false; @@ -421,7 +421,7 @@ bool isFreeClientActiveObjectId(const u16 id, return objects.find(id) == objects.end(); } -u16 getFreeClientActiveObjectId(UNORDERED_MAP &objects) +u16 getFreeClientActiveObjectId(ClientActiveObjectMap &objects) { //try to reuse id's as late as possible static u16 last_used_id = 0; @@ -583,8 +583,8 @@ void ClientEnvironment::updateLocalPlayerBreath(u16 breath) void ClientEnvironment::getActiveObjects(v3f origin, f32 max_d, std::vector &dest) { - for (UNORDERED_MAP::iterator i = m_active_objects.begin(); - i != m_active_objects.end(); ++i) { + for (ClientActiveObjectMap::iterator i = m_active_objects.begin(); + i != m_active_objects.end(); ++i) { ClientActiveObject* obj = i->second; f32 d = (obj->getPosition() - origin).getLength(); diff --git a/src/clientenvironment.h b/src/clientenvironment.h index 79b4797ad..2906553f0 100644 --- a/src/clientenvironment.h +++ b/src/clientenvironment.h @@ -64,6 +64,7 @@ struct ClientEnvEvent }; }; +typedef std::unordered_map ClientActiveObjectMap; class ClientEnvironment : public Environment { public: @@ -181,7 +182,7 @@ private: Client *m_client; ClientScripting *m_script; IrrlichtDevice *m_irr; - UNORDERED_MAP m_active_objects; + ClientActiveObjectMap m_active_objects; std::vector m_simple_objects; std::queue m_client_event_queue; IntervalLimiter m_active_object_light_update_interval; diff --git a/src/clientiface.cpp b/src/clientiface.cpp index 68bd4afe7..b79d36ea2 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -611,7 +611,7 @@ ClientInterface::~ClientInterface() { MutexAutoLock clientslock(m_clients_mutex); - for (UNORDERED_MAP::iterator i = m_clients.begin(); + for (RemoteClientMap::iterator i = m_clients.begin(); i != m_clients.end(); ++i) { // Delete client delete i->second; @@ -624,7 +624,7 @@ std::vector ClientInterface::getClientIDs(ClientState min_state) std::vector reply; MutexAutoLock clientslock(m_clients_mutex); - for(UNORDERED_MAP::iterator i = m_clients.begin(); + for (RemoteClientMap::iterator i = m_clients.begin(); i != m_clients.end(); ++i) { if (i->second->getState() >= min_state) reply.push_back(i->second->peer_id); @@ -682,7 +682,7 @@ void ClientInterface::send(u16 peer_id, u8 channelnum, void ClientInterface::sendToAll(NetworkPacket *pkt) { MutexAutoLock clientslock(m_clients_mutex); - for (UNORDERED_MAP::iterator i = m_clients.begin(); + for (RemoteClientMap::iterator i = m_clients.begin(); i != m_clients.end(); ++i) { RemoteClient *client = i->second; @@ -697,7 +697,7 @@ void ClientInterface::sendToAll(NetworkPacket *pkt) RemoteClient* ClientInterface::getClientNoEx(u16 peer_id, ClientState state_min) { MutexAutoLock clientslock(m_clients_mutex); - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::const_iterator n = m_clients.find(peer_id); // The client may not exist; clients are immediately removed if their // access is denied, and this event occurs later then. if (n == m_clients.end()) @@ -711,7 +711,7 @@ RemoteClient* ClientInterface::getClientNoEx(u16 peer_id, ClientState state_min) RemoteClient* ClientInterface::lockedGetClientNoEx(u16 peer_id, ClientState state_min) { - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::const_iterator n = m_clients.find(peer_id); // The client may not exist; clients are immediately removed if their // access is denied, and this event occurs later then. if (n == m_clients.end()) @@ -726,7 +726,7 @@ RemoteClient* ClientInterface::lockedGetClientNoEx(u16 peer_id, ClientState stat ClientState ClientInterface::getClientState(u16 peer_id) { MutexAutoLock clientslock(m_clients_mutex); - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::const_iterator n = m_clients.find(peer_id); // The client may not exist; clients are immediately removed if their // access is denied, and this event occurs later then. if (n == m_clients.end()) @@ -738,7 +738,7 @@ ClientState ClientInterface::getClientState(u16 peer_id) void ClientInterface::setPlayerName(u16 peer_id,std::string name) { MutexAutoLock clientslock(m_clients_mutex); - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::iterator n = m_clients.find(peer_id); // The client may not exist; clients are immediately removed if their // access is denied, and this event occurs later then. if (n != m_clients.end()) @@ -750,7 +750,7 @@ void ClientInterface::DeleteClient(u16 peer_id) MutexAutoLock conlock(m_clients_mutex); // Error check - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::iterator n = m_clients.find(peer_id); // The client may not exist; clients are immediately removed if their // access is denied, and this event occurs later then. if (n == m_clients.end()) @@ -762,10 +762,8 @@ void ClientInterface::DeleteClient(u16 peer_id) //TODO this should be done by client destructor!!! RemoteClient *client = n->second; // Handle objects - for(std::set::iterator - i = client->m_known_objects.begin(); - i != client->m_known_objects.end(); ++i) - { + for (std::set::iterator i = client->m_known_objects.begin(); + i != client->m_known_objects.end(); ++i) { // Get object u16 id = *i; ServerActiveObject* obj = m_env->getActiveObject(id); @@ -784,7 +782,7 @@ void ClientInterface::CreateClient(u16 peer_id) MutexAutoLock conlock(m_clients_mutex); // Error check - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::iterator n = m_clients.find(peer_id); // The client shouldn't already exist if (n != m_clients.end()) return; @@ -800,7 +798,7 @@ void ClientInterface::event(u16 peer_id, ClientStateEvent event) MutexAutoLock clientlock(m_clients_mutex); // Error check - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::iterator n = m_clients.find(peer_id); // No client to deliver event if (n == m_clients.end()) @@ -821,7 +819,7 @@ u16 ClientInterface::getProtocolVersion(u16 peer_id) MutexAutoLock conlock(m_clients_mutex); // Error check - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::iterator n = m_clients.find(peer_id); // No client to get version if (n == m_clients.end()) @@ -835,7 +833,7 @@ void ClientInterface::setClientVersion(u16 peer_id, u8 major, u8 minor, u8 patch MutexAutoLock conlock(m_clients_mutex); // Error check - UNORDERED_MAP::iterator n = m_clients.find(peer_id); + RemoteClientMap::iterator n = m_clients.find(peer_id); // No client to set versions if (n == m_clients.end()) diff --git a/src/clientiface.h b/src/clientiface.h index d2299c879..107ed3bf3 100644 --- a/src/clientiface.h +++ b/src/clientiface.h @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "serialization.h" // for SER_FMT_VER_INVALID #include "threading/mutex.h" #include "network/networkpacket.h" -#include "util/cpp11_container.h" #include "porting.h" #include @@ -435,6 +434,8 @@ private: const u64 m_connection_time; }; +typedef std::unordered_map RemoteClientMap; + class ClientInterface { public: @@ -499,7 +500,7 @@ protected: void lock() { m_clients_mutex.lock(); } void unlock() { m_clients_mutex.unlock(); } - UNORDERED_MAP& getClientList() { return m_clients; } + RemoteClientMap& getClientList() { return m_clients; } private: /* update internal player list */ @@ -509,7 +510,7 @@ private: con::Connection* m_con; Mutex m_clients_mutex; // Connected clients (behind the con mutex) - UNORDERED_MAP m_clients; + RemoteClientMap m_clients; std::vector m_clients_names; //for announcing masterserver // Environment diff --git a/src/clientmedia.cpp b/src/clientmedia.cpp index 9c1e430df..2877d8a2e 100644 --- a/src/clientmedia.cpp +++ b/src/clientmedia.cpp @@ -348,7 +348,7 @@ void ClientMediaDownloader::remoteMediaReceived( std::string name; { - UNORDERED_MAP::iterator it = + std::unordered_map::iterator it = m_remote_file_transfers.find(fetch_result.request_id); assert(it != m_remote_file_transfers.end()); name = it->second; diff --git a/src/clientmedia.h b/src/clientmedia.h index 3c96dfe8a..4c0c3c888 100644 --- a/src/clientmedia.h +++ b/src/clientmedia.h @@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include "util/cpp11_container.h" +#include class Client; struct HTTPFetchResult; @@ -138,7 +138,7 @@ private: s32 m_httpfetch_active; s32 m_httpfetch_active_limit; s32 m_outstanding_hash_sets; - UNORDERED_MAP m_remote_file_transfers; + std::unordered_map m_remote_file_transfers; // All files up to this name have either been received from a // remote server or failed on all remote servers, so those files diff --git a/src/clientobject.cpp b/src/clientobject.cpp index 89a0474a4..329f10469 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -42,8 +42,8 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type, Client *client, ClientEnvironment *env) { // Find factory function - UNORDERED_MAP::iterator n = m_types.find(type); - if(n == m_types.end()) { + std::unordered_map::iterator n = m_types.find(type); + if (n == m_types.end()) { // If factory is not found, just return. warningstream << "ClientActiveObject: No factory for type=" << (int)type << std::endl; @@ -57,7 +57,7 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type, void ClientActiveObject::registerType(u16 type, Factory f) { - UNORDERED_MAP::iterator n = m_types.find(type); + std::unordered_map::iterator n = m_types.find(type); if(n != m_types.end()) return; m_types[type] = f; diff --git a/src/clientobject.h b/src/clientobject.h index aa0ec9c56..a3eb3e242 100644 --- a/src/clientobject.h +++ b/src/clientobject.h @@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_extrabloated.h" #include "activeobject.h" #include -#include "util/cpp11_container.h" +#include class ClientEnvironment; class ITextureSource; @@ -89,7 +89,7 @@ protected: ClientEnvironment *m_env; private: // Used for creating objects based on type - static UNORDERED_MAP m_types; + static std::unordered_map m_types; }; struct DistanceSortedActiveObject diff --git a/src/content_cao.cpp b/src/content_cao.cpp index d15c53e7a..c904082d6 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -49,7 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc., class Settings; struct ToolCapabilities; -UNORDERED_MAP ClientActiveObject::m_types; +std::unordered_map ClientActiveObject::m_types; SmoothTranslator::SmoothTranslator(): vect_old(0,0,0), @@ -565,7 +565,7 @@ GenericCAO::GenericCAO(Client *client, ClientEnvironment *env): m_animation_speed(15), m_animation_blend(0), m_animation_loop(true), - m_bone_position(UNORDERED_MAP >()), + m_bone_position(), m_attachment_bone(""), m_attachment_position(v3f(0,0,0)), m_attachment_rotation(v3f(0,0,0)), @@ -1493,7 +1493,7 @@ void GenericCAO::updateBonePosition() return; m_animated_meshnode->setJointMode(irr::scene::EJUOR_CONTROL); // To write positions to the mesh on render - for(UNORDERED_MAP >::const_iterator + for(std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { std::string bone_name = (*ii).first; v3f bone_pos = (*ii).second.X; diff --git a/src/content_cao.h b/src/content_cao.h index 412cdff12..e5b23aa35 100644 --- a/src/content_cao.h +++ b/src/content_cao.h @@ -91,7 +91,8 @@ private: int m_animation_speed; int m_animation_blend; bool m_animation_loop; - UNORDERED_MAP > m_bone_position; // stores position and rotation for each bone name + // stores position and rotation for each bone name + std::unordered_map> m_bone_position; std::string m_attachment_bone; v3f m_attachment_position; v3f m_attachment_rotation; diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index e6dd8e83e..326433141 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client.h" #include "log.h" #include "noise.h" -#include "util/cpp11.h" // Distance of light extrapolation (for oversized nodes) // After this distance, it gives up and considers light level constant @@ -43,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc., // Corresponding offsets are listed in g_27dirs #define FRAMED_NEIGHBOR_COUNT 18 -static constexpr v3s16 light_dirs[8] = { +static const v3s16 light_dirs[8] = { v3s16(-1, -1, -1), v3s16(-1, -1, 1), v3s16(-1, 1, -1), diff --git a/src/content_sao.cpp b/src/content_sao.cpp index be1c52fe6..90d830ce3 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -213,7 +213,7 @@ void UnitSAO::removeAttachmentChild(int child_id) m_attachment_child_ids.erase(child_id); } -const UNORDERED_SET &UnitSAO::getAttachmentChildIds() +const std::unordered_set &UnitSAO::getAttachmentChildIds() { return m_attachment_child_ids; } @@ -263,7 +263,7 @@ LuaEntitySAO::~LuaEntitySAO() m_env->getScriptIface()->luaentity_Remove(m_id); } - for (UNORDERED_SET::iterator it = m_attached_particle_spawners.begin(); + for (std::unordered_set::iterator it = m_attached_particle_spawners.begin(); it != m_attached_particle_spawners.end(); ++it) { m_env->deleteParticleSpawner(*it, false); } @@ -461,7 +461,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) if(m_bone_position_sent == false){ m_bone_position_sent = true; - for (UNORDERED_MAP >::const_iterator + for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){ std::string str = gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y); @@ -498,7 +498,7 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version) msg_os << serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2 msg_os << serializeLongString(gob_cmd_update_animation( m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3 - for (UNORDERED_MAP >::const_iterator + for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size @@ -506,7 +506,7 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version) msg_os << serializeLongString(gob_cmd_update_attachment(m_attachment_parent_id, m_attachment_bone, m_attachment_position, m_attachment_rotation)); // 4 int message_count = 4 + m_bone_position.size(); - for (UNORDERED_SET::const_iterator ii = m_attachment_child_ids.begin(); + for (std::unordered_set::const_iterator ii = m_attachment_child_ids.begin(); (ii != m_attachment_child_ids.end()); ++ii) { if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) { message_count++; @@ -868,7 +868,7 @@ void PlayerSAO::removingFromEnvironment() ServerActiveObject::removingFromEnvironment(); if (m_player->getPlayerSAO() == this) { unlinkPlayerSessionAndSave(); - for (UNORDERED_SET::iterator it = m_attached_particle_spawners.begin(); + for (std::unordered_set::iterator it = m_attached_particle_spawners.begin(); it != m_attached_particle_spawners.end(); ++it) { m_env->deleteParticleSpawner(*it, false); } @@ -893,7 +893,7 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version) msg_os << serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2 msg_os << serializeLongString(gob_cmd_update_animation( m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3 - for (UNORDERED_MAP >::const_iterator + for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size @@ -906,7 +906,7 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version) // (GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES) : Deprecated, for backwards compatibility only. msg_os << serializeLongString(gob_cmd_update_nametag_attributes(m_prop.nametag_color)); // 6 int message_count = 6 + m_bone_position.size(); - for (UNORDERED_SET::const_iterator ii = m_attachment_child_ids.begin(); + for (std::unordered_set::const_iterator ii = m_attachment_child_ids.begin(); ii != m_attachment_child_ids.end(); ++ii) { if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) { message_count++; @@ -1083,7 +1083,7 @@ void PlayerSAO::step(float dtime, bool send_recommended) if (!m_bone_position_sent) { m_bone_position_sent = true; - for (UNORDERED_MAP >::const_iterator + for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { std::string str = gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y); diff --git a/src/content_sao.h b/src/content_sao.h index 0dad54805..bb1a61a19 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -52,7 +52,7 @@ public: void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation); void addAttachmentChild(int child_id); void removeAttachmentChild(int child_id); - const UNORDERED_SET &getAttachmentChildIds(); + const std::unordered_set &getAttachmentChildIds(); ObjectProperties* accessObjectProperties(); void notifyObjectPropertiesModified(); protected: @@ -72,11 +72,11 @@ protected: bool m_animation_sent; // Stores position and rotation for each bone name - UNORDERED_MAP > m_bone_position; + std::unordered_map> m_bone_position; bool m_bone_position_sent; int m_attachment_parent_id; - UNORDERED_SET m_attachment_child_ids; + std::unordered_set m_attachment_child_ids; std::string m_attachment_bone; v3f m_attachment_position; v3f m_attachment_rotation; @@ -188,7 +188,7 @@ public: } }; -typedef UNORDERED_MAP PlayerAttributes; +typedef std::unordered_map PlayerAttributes; class RemotePlayer; class PlayerSAO : public UnitSAO diff --git a/src/emerge.cpp b/src/emerge.cpp index d24971e44..053f4dd45 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -375,7 +375,7 @@ bool EmergeManager::pushBlockEmergeData( bool EmergeManager::popBlockEmergeData(v3s16 pos, BlockEmergeData *bedata) { std::map::iterator it; - UNORDERED_MAP::iterator it2; + std::unordered_map::iterator it2; it = m_blocks_enqueued.find(pos); if (it == m_blocks_enqueued.end()) diff --git a/src/emerge.h b/src/emerge.h index 76653e6cd..55be370d2 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -157,7 +157,7 @@ private: Mutex m_queue_mutex; std::map m_blocks_enqueued; - UNORDERED_MAP m_peer_queue_count; + std::unordered_map m_peer_queue_count; u16 m_qlimit_total; u16 m_qlimit_diskonly; diff --git a/src/face_position_cache.cpp b/src/face_position_cache.cpp index f57e75da9..d2883a1b3 100644 --- a/src/face_position_cache.cpp +++ b/src/face_position_cache.cpp @@ -21,14 +21,14 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "threading/mutex_auto_lock.h" -UNORDERED_MAP > FacePositionCache::cache; +std::unordered_map> FacePositionCache::cache; Mutex FacePositionCache::cache_mutex; // Calculate the borders of a "d-radius" cube const std::vector &FacePositionCache::getFacePositions(u16 d) { MutexAutoLock lock(cache_mutex); - UNORDERED_MAP >::iterator it = cache.find(d); + std::unordered_map>::const_iterator it = cache.find(d); if (it != cache.end()) return it->second; diff --git a/src/face_position_cache.h b/src/face_position_cache.h index c1d2841c4..5ea0d938b 100644 --- a/src/face_position_cache.h +++ b/src/face_position_cache.h @@ -22,10 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irr_v3d.h" #include "threading/mutex.h" -#include "util/cpp11_container.h" #include #include +#include /* * This class permits caching getFacePosition call results. @@ -37,7 +37,7 @@ public: private: static const std::vector &generateFacePosition(u16 d); - static UNORDERED_MAP > cache; + static std::unordered_map> cache; static Mutex cache_mutex; }; diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 19fd9f1f0..888536128 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -3807,7 +3807,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) if (s.ftype == f_Unknown && s.fid == event.GUIEvent.Caller->getID()) { current_field_enter_pending = s.fname; - UNORDERED_MAP::const_iterator it = + std::unordered_map::const_iterator it = field_close_on_enter.find(s.fname); if (it != field_close_on_enter.end()) close_on_enter = (*it).second; diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 9eaf60ac6..bf0b4f356 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -397,7 +397,7 @@ protected: std::vector m_images; std::vector m_itemimages; std::vector m_boxes; - UNORDERED_MAP field_close_on_enter; + std::unordered_map field_close_on_enter; std::vector m_fields; std::vector m_static_texts; std::vector > m_tables; @@ -460,7 +460,7 @@ private: GUITable::TableOptions table_options; GUITable::TableColumns table_columns; // used to restore table selection/scroll/treeview state - UNORDERED_MAP table_dyndata; + std::unordered_map table_dyndata; } parserData; typedef struct { diff --git a/src/itemgroup.h b/src/itemgroup.h index 2206857fd..e9d050cd1 100644 --- a/src/itemgroup.h +++ b/src/itemgroup.h @@ -21,9 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define ITEMGROUP_HEADER #include -#include "util/cpp11_container.h" +#include -typedef UNORDERED_MAP ItemGroupList; +typedef std::unordered_map ItemGroupList; static inline int itemgroup_get(const ItemGroupList &groups, const std::string &name) { diff --git a/src/map.h b/src/map.h index 4b6e08f96..0be0e96a3 100644 --- a/src/map.h +++ b/src/map.h @@ -32,7 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "voxel.h" #include "modifiedstate.h" #include "util/container.h" -#include "util/cpp11_container.h" #include "nodetimer.h" #include "map_settings_manager.h" diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index 93d932a7b..f56111620 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_extrabloated.h" #include "client/tile.h" #include "voxel.h" -#include "util/cpp11_container.h" #include class Client; diff --git a/src/mapsector.cpp b/src/mapsector.cpp index 410689f5e..ad7cb7b70 100644 --- a/src/mapsector.cpp +++ b/src/mapsector.cpp @@ -42,7 +42,7 @@ void MapSector::deleteBlocks() m_block_cache = NULL; // Delete all - for (UNORDERED_MAP::iterator i = m_blocks.begin(); + for (std::unordered_map::iterator i = m_blocks.begin(); i != m_blocks.end(); ++i) { delete i->second; } @@ -60,7 +60,7 @@ MapBlock * MapSector::getBlockBuffered(s16 y) } // If block doesn't exist, return NULL - UNORDERED_MAP::iterator n = m_blocks.find(y); + std::unordered_map::const_iterator n = m_blocks.find(y); block = (n != m_blocks.end() ? n->second : NULL); // Cache the last result @@ -127,7 +127,7 @@ void MapSector::deleteBlock(MapBlock *block) void MapSector::getBlocks(MapBlockVect &dest) { - for (UNORDERED_MAP::iterator bi = m_blocks.begin(); + for (std::unordered_map::iterator bi = m_blocks.begin(); bi != m_blocks.end(); ++bi) { dest.push_back(bi->second); } diff --git a/src/mapsector.h b/src/mapsector.h index c3bff3575..ddafbc77d 100644 --- a/src/mapsector.h +++ b/src/mapsector.h @@ -71,7 +71,7 @@ public: protected: // The pile of MapBlocks - UNORDERED_MAP m_blocks; + std::unordered_map m_blocks; Map *m_parent; // Position on parent (in MapBlock widths) diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp index b0566e830..1a469cd9c 100644 --- a/src/mg_decoration.cpp +++ b/src/mg_decoration.cpp @@ -208,14 +208,11 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) #endif } - if (mg->biomemap) { - UNORDERED_SET::iterator iter; - - if (!biomes.empty()) { - iter = biomes.find(mg->biomemap[mapindex]); - if (iter == biomes.end()) - continue; - } + if (mg->biomemap && !biomes.empty()) { + std::unordered_set::const_iterator iter = + biomes.find(mg->biomemap[mapindex]); + if (iter == biomes.end()) + continue; } v3s16 pos(x, y, z); diff --git a/src/mg_decoration.h b/src/mg_decoration.h index 950800ec8..6a48796d8 100644 --- a/src/mg_decoration.h +++ b/src/mg_decoration.h @@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef MG_DECORATION_HEADER #define MG_DECORATION_HEADER -#include "util/cpp11_container.h" +#include #include "objdef.h" #include "noise.h" #include "nodedef.h" @@ -87,9 +87,7 @@ public: std::vector c_spawnby; s16 nspawnby; - UNORDERED_SET biomes; - //std::list cutoffs; - //Mutex cutoff_mutex; + std::unordered_set biomes; }; class DecoSimple : public Decoration { diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp index 89319238e..6275de313 100644 --- a/src/mg_ore.cpp +++ b/src/mg_ore.cpp @@ -150,7 +150,7 @@ void OreScatter::generate(MMVManip *vm, int mapseed, u32 blockseed, if (biomemap && !biomes.empty()) { u32 index = sizex * (z0 - nmin.Z) + (x0 - nmin.X); - UNORDERED_SET::iterator it = biomes.find(biomemap[index]); + std::unordered_set::const_iterator it = biomes.find(biomemap[index]); if (it == biomes.end()) continue; } @@ -204,7 +204,7 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed, continue; if (biomemap && !biomes.empty()) { - UNORDERED_SET::iterator it = biomes.find(biomemap[index]); + std::unordered_set::const_iterator it = biomes.find(biomemap[index]); if (it == biomes.end()) continue; } @@ -272,7 +272,7 @@ void OrePuff::generate(MMVManip *vm, int mapseed, u32 blockseed, continue; if (biomemap && !biomes.empty()) { - UNORDERED_SET::iterator it = biomes.find(biomemap[index]); + std::unordered_set::const_iterator it = biomes.find(biomemap[index]); if (it == biomes.end()) continue; } @@ -340,7 +340,7 @@ void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed, if (biomemap && !biomes.empty()) { u32 bmapidx = sizex * (z0 - nmin.Z) + (x0 - nmin.X); - UNORDERED_SET::iterator it = biomes.find(biomemap[bmapidx]); + std::unordered_set::const_iterator it = biomes.find(biomemap[bmapidx]); if (it == biomes.end()) continue; } @@ -424,7 +424,7 @@ void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed, if (biomemap && !biomes.empty()) { u32 bmapidx = sizex * (z - nmin.Z) + (x - nmin.X); - UNORDERED_SET::iterator it = biomes.find(biomemap[bmapidx]); + std::unordered_set::const_iterator it = biomes.find(biomemap[bmapidx]); if (it == biomes.end()) continue; } diff --git a/src/mg_ore.h b/src/mg_ore.h index 0503a6ca0..77025e1bb 100644 --- a/src/mg_ore.h +++ b/src/mg_ore.h @@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef MG_ORE_HEADER #define MG_ORE_HEADER -#include "util/cpp11_container.h" +#include #include "objdef.h" #include "noise.h" #include "nodedef.h" @@ -66,7 +66,7 @@ public: float nthresh; // threshold for noise at which an ore is placed NoiseParams np; // noise for distribution of clusters (NULL for uniform scattering) Noise *noise; - UNORDERED_SET biomes; + std::unordered_set biomes; Ore(); virtual ~Ore(); diff --git a/src/mg_schematic.cpp b/src/mg_schematic.cpp index 67931497f..3cea3c321 100644 --- a/src/mg_schematic.cpp +++ b/src/mg_schematic.cpp @@ -561,14 +561,14 @@ void Schematic::applyProbabilities(v3s16 p0, void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount, std::vector *usednodes, INodeDefManager *ndef) { - UNORDERED_MAP nodeidmap; + std::unordered_map nodeidmap; content_t numids = 0; for (size_t i = 0; i != nodecount; i++) { content_t id; content_t c = nodes[i].getContent(); - UNORDERED_MAP::const_iterator it = nodeidmap.find(c); + std::unordered_map::const_iterator it = nodeidmap.find(c); if (it == nodeidmap.end()) { id = numids; numids++; diff --git a/src/mods.cpp b/src/mods.cpp index 0e583b2db..5a71ca2d4 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -144,7 +144,8 @@ void ModConfiguration::printUnsatisfiedModsError() const it != m_unsatisfied_mods.end(); ++it) { ModSpec mod = *it; errorstream << "mod \"" << mod.name << "\" has unsatisfied dependencies: "; - for (UNORDERED_SET::iterator dep_it = mod.unsatisfied_depends.begin(); + for (std::unordered_set::iterator dep_it = + mod.unsatisfied_depends.begin(); dep_it != mod.unsatisfied_depends.end(); ++dep_it) errorstream << " \"" << *dep_it << "\""; errorstream << std::endl; @@ -268,8 +269,8 @@ void ModConfiguration::checkConflictsAndDeps() // report on name conflicts if (!m_name_conflicts.empty()) { std::string s = "Unresolved name conflicts for mods "; - for (UNORDERED_SET::const_iterator it = m_name_conflicts.begin(); - it != m_name_conflicts.end(); ++it) { + for (std::unordered_set::const_iterator it = + m_name_conflicts.begin(); it != m_name_conflicts.end(); ++it) { if (it != m_name_conflicts.begin()) s += ", "; s += std::string("\"") + (*it) + "\""; } @@ -299,7 +300,7 @@ void ModConfiguration::resolveDependencies() ModSpec mod = *it; mod.unsatisfied_depends = mod.depends; // check which optional dependencies actually exist - for (UNORDERED_SET::iterator it_optdep = mod.optdepends.begin(); + for (std::unordered_set::iterator it_optdep = mod.optdepends.begin(); it_optdep != mod.optdepends.end(); ++it_optdep) { std::string optdep = *it_optdep; if (modnames.count(optdep) != 0) diff --git a/src/mods.h b/src/mods.h index 7455a51ea..792280b8b 100644 --- a/src/mods.h +++ b/src/mods.h @@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include "util/cpp11_container.h" +#include #include "config.h" #include "metadata.h" @@ -38,9 +38,9 @@ struct ModSpec std::string name; std::string path; //if normal mod: - UNORDERED_SET depends; - UNORDERED_SET optdepends; - UNORDERED_SET unsatisfied_depends; + std::unordered_set depends; + std::unordered_set optdepends; + std::unordered_set unsatisfied_depends; bool part_of_modpack; bool is_modpack; @@ -125,7 +125,7 @@ private: // 1. game mod in modpack; 2. game mod; // 3. world mod in modpack; 4. world mod; // 5. addon mod in modpack; 6. addon mod. - UNORDERED_SET m_name_conflicts; + std::unordered_set m_name_conflicts; // Deleted default constructor ModConfiguration() {} diff --git a/src/nameidmapping.cpp b/src/nameidmapping.cpp index d031f0808..78e4a0a56 100644 --- a/src/nameidmapping.cpp +++ b/src/nameidmapping.cpp @@ -25,7 +25,7 @@ void NameIdMapping::serialize(std::ostream &os) const { writeU8(os, 0); // version writeU16(os, m_id_to_name.size()); - for (UNORDERED_MAP::const_iterator i = m_id_to_name.begin(); + for (IdToNameMap::const_iterator i = m_id_to_name.begin(); i != m_id_to_name.end(); ++i) { writeU16(os, i->first); os << serializeString(i->second); diff --git a/src/nameidmapping.h b/src/nameidmapping.h index be353327d..389843061 100644 --- a/src/nameidmapping.h +++ b/src/nameidmapping.h @@ -23,8 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include "irrlichttypes_bloated.h" -#include "util/cpp11_container.h" + +typedef std::unordered_map IdToNameMap; +typedef std::unordered_map NameToIdMap; class NameIdMapping { @@ -43,6 +46,7 @@ public: m_id_to_name[id] = name; m_name_to_id[name] = id; } + void removeId(u16 id) { std::string name; @@ -63,7 +67,7 @@ public: } bool getName(u16 id, std::string &result) const { - UNORDERED_MAP::const_iterator i; + IdToNameMap::const_iterator i; i = m_id_to_name.find(id); if (i == m_id_to_name.end()) return false; @@ -72,7 +76,7 @@ public: } bool getId(const std::string &name, u16 &result) const { - UNORDERED_MAP::const_iterator i; + NameToIdMap::const_iterator i; i = m_name_to_id.find(name); if (i == m_name_to_id.end()) return false; @@ -82,8 +86,8 @@ public: u16 size() const { return m_id_to_name.size(); } private: - UNORDERED_MAP m_id_to_name; - UNORDERED_MAP m_name_to_id; + IdToNameMap m_id_to_name; + NameToIdMap m_name_to_id; }; #endif diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 59669fe6d..d002ae10d 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -818,7 +818,7 @@ void Client::handleCommand_StopSound(NetworkPacket* pkt) *pkt >> server_id; - UNORDERED_MAP::iterator i = m_sounds_server_to_client.find(server_id); + std::unordered_map::iterator i = m_sounds_server_to_client.find(server_id); if (i != m_sounds_server_to_client.end()) { int client_id = i->second; m_sound->stopSound(client_id); @@ -833,7 +833,7 @@ void Client::handleCommand_FadeSound(NetworkPacket *pkt) *pkt >> sound_id >> step >> gain; - UNORDERED_MAP::iterator i = + std::unordered_map::const_iterator i = m_sounds_server_to_client.find(sound_id); if (i != m_sounds_server_to_client.end()) diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 5b026bbdb..098c6e11e 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -1695,7 +1695,8 @@ void Server::handleCommand_RemovedSounds(NetworkPacket* pkt) *pkt >> id; - UNORDERED_MAP::iterator i = m_playing_sounds.find(id); + std::unordered_map::iterator i = + m_playing_sounds.find(id); if (i == m_playing_sounds.end()) continue; diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 98b34ea9e..6b2718636 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -912,12 +912,12 @@ private: // item aliases too. Updated by updateAliases() // Note: Not serialized. - UNORDERED_MAP m_name_id_mapping_with_aliases; + std::unordered_map m_name_id_mapping_with_aliases; // A mapping from groups to a list of content_ts (and their levels) // that belong to it. Necessary for a direct lookup in getIds(). // Note: Not serialized. - UNORDERED_MAP m_group_to_items; + std::unordered_map m_group_to_items; // Next possibly free id content_t m_next_id; @@ -1050,7 +1050,7 @@ inline const ContentFeatures& CNodeDefManager::get(const MapNode &n) const bool CNodeDefManager::getId(const std::string &name, content_t &result) const { - UNORDERED_MAP::const_iterator + std::unordered_map::const_iterator i = m_name_id_mapping_with_aliases.find(name); if(i == m_name_id_mapping_with_aliases.end()) return false; @@ -1080,7 +1080,7 @@ bool CNodeDefManager::getIds(const std::string &name, } std::string group = name.substr(6); - UNORDERED_MAP::const_iterator + std::unordered_map::const_iterator i = m_group_to_items.find(group); if (i == m_group_to_items.end()) return true; @@ -1282,7 +1282,7 @@ content_t CNodeDefManager::set(const std::string &name, const ContentFeatures &d i != def.groups.end(); ++i) { std::string group_name = i->first; - UNORDERED_MAP::iterator + std::unordered_map::iterator j = m_group_to_items.find(group_name); if (j == m_group_to_items.end()) { m_group_to_items[group_name].push_back( @@ -1318,7 +1318,7 @@ void CNodeDefManager::removeNode(const std::string &name) } // Erase node content from all groups it belongs to - for (UNORDERED_MAP::iterator iter_groups = + for (std::unordered_map::iterator iter_groups = m_group_to_items.begin(); iter_groups != m_group_to_items.end();) { GroupItems &items = iter_groups->second; for (GroupItems::iterator iter_groupitems = items.begin(); diff --git a/src/nodemetadata.h b/src/nodemetadata.h index 0d72485bc..4b4cb17c7 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -20,8 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef NODEMETADATA_HEADER #define NODEMETADATA_HEADER +#include #include "metadata.h" -#include "util/cpp11_container.h" /* NodeMetadata stores arbitary amounts of data for special blocks. @@ -63,7 +63,7 @@ private: int countNonPrivate() const; Inventory *m_inventory; - UNORDERED_SET m_privatevars; + std::unordered_set m_privatevars; }; diff --git a/src/reflowscan.cpp b/src/reflowscan.cpp index eec371022..439b75265 100644 --- a/src/reflowscan.cpp +++ b/src/reflowscan.cpp @@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "nodedef.h" #include "util/timetaker.h" -#include "util/cpp11.h" ReflowScan::ReflowScan(Map *map, INodeDefManager *ndef) : diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index c0e29abf0..9be9d7717 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -132,7 +132,7 @@ void push_item_definition(lua_State *L, const ItemDefinition &i) void push_item_definition_full(lua_State *L, const ItemDefinition &i) { std::string type(es_ItemType[(int)i.type].str); - + lua_newtable(L); lua_pushstring(L, i.name.c_str()); lua_setfield(L, -2, "name"); @@ -721,9 +721,9 @@ void push_content_features(lua_State *L, const ContentFeatures &c) std::string paramtype2(ScriptApiNode::es_ContentParamType2[(int)c.param_type_2].str); std::string drawtype(ScriptApiNode::es_DrawType[(int)c.drawtype].str); std::string liquid_type(ScriptApiNode::es_LiquidType[(int)c.liquid_type].str); - + /* Missing "tiles" because I don't see a usecase (at least not yet). */ - + lua_newtable(L); lua_pushboolean(L, c.has_on_construct); lua_setfield(L, -2, "has_on_construct"); @@ -756,10 +756,10 @@ void push_content_features(lua_State *L, const ContentFeatures &c) if (!c.palette_name.empty()) { push_ARGB8(L, c.color); lua_setfield(L, -2, "color"); - + lua_pushstring(L, c.palette_name.c_str()); lua_setfield(L, -2, "palette_name"); - + push_palette(L, c.palette); lua_setfield(L, -2, "palette"); } @@ -767,7 +767,7 @@ void push_content_features(lua_State *L, const ContentFeatures &c) lua_setfield(L, -2, "waving"); lua_pushnumber(L, c.connect_sides); lua_setfield(L, -2, "connect_sides"); - + lua_newtable(L); u16 i = 1; for (std::vector::const_iterator it = c.connects_to.begin(); @@ -776,7 +776,7 @@ void push_content_features(lua_State *L, const ContentFeatures &c) lua_rawseti(L, -2, i); } lua_setfield(L, -2, "connects_to"); - + push_ARGB8(L, c.post_effect_color); lua_setfield(L, -2, "post_effect_color"); lua_pushnumber(L, c.leveled); @@ -1171,7 +1171,7 @@ void push_tool_capabilities(lua_State *L, const ToolGroupCap &groupcap = i->second; // Create subtable "times" lua_newtable(L); - for (UNORDERED_MAP::const_iterator + for (std::unordered_map::const_iterator i = groupcap.times.begin(); i != groupcap.times.end(); ++i) { lua_pushinteger(L, i->first); lua_pushnumber(L, i->second); diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h index b0f61a8ca..f7d9294d6 100644 --- a/src/script/common/c_converter.h +++ b/src/script/common/c_converter.h @@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define C_CONVERTER_H_ #include -#include "util/cpp11_container.h" +#include #include "irrlichttypes_bloated.h" #include "common/c_types.h" @@ -60,7 +60,7 @@ bool getintfield(lua_State *L, int table, bool getintfield(lua_State *L, int table, const char *fieldname, u32 &result); void read_groups(lua_State *L, int index, - UNORDERED_MAP &result); + std::unordered_map &result); bool getboolfield(lua_State *L, int table, const char *fieldname, bool &result); bool getfloatfield(lua_State *L, int table, diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 32eb7af84..454e8f719 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -100,7 +100,7 @@ Biome *get_or_load_biome(lua_State *L, int index, BiomeManager *biomemgr); Biome *read_biome_def(lua_State *L, int index, INodeDefManager *ndef); size_t get_biome_list(lua_State *L, int index, - BiomeManager *biomemgr, UNORDERED_SET *biome_id_list); + BiomeManager *biomemgr, std::unordered_set *biome_id_list); Schematic *get_or_load_schematic(lua_State *L, int index, SchematicManager *schemmgr, StringMap *replace_names); @@ -244,7 +244,7 @@ bool read_schematic_def(lua_State *L, int index, schem->schemdata = new MapNode[numnodes]; size_t names_base = names->size(); - UNORDERED_MAP name_id_map; + std::unordered_map name_id_map; u32 i = 0; for (lua_pushnil(L); lua_next(L, -2); i++, lua_pop(L, 1)) { @@ -266,7 +266,7 @@ bool read_schematic_def(lua_State *L, int index, u8 param2 = getintfield_default(L, -1, "param2", 0); //// Find or add new nodename-to-ID mapping - UNORDERED_MAP::iterator it = name_id_map.find(name); + std::unordered_map::iterator it = name_id_map.find(name); content_t name_index; if (it != name_id_map.end()) { name_index = it->second; @@ -409,7 +409,7 @@ Biome *read_biome_def(lua_State *L, int index, INodeDefManager *ndef) size_t get_biome_list(lua_State *L, int index, - BiomeManager *biomemgr, UNORDERED_SET *biome_id_list) + BiomeManager *biomemgr, std::unordered_set *biome_id_list) { if (index < 0) index = lua_gettop(L) + 1 + index; diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index aaab0d98e..d37c525dd 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -137,8 +137,8 @@ int ObjectRef::l_remove(lua_State *L) if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) return 0; - const UNORDERED_SET &child_ids = co->getAttachmentChildIds(); - UNORDERED_SET::const_iterator it; + const std::unordered_set &child_ids = co->getAttachmentChildIds(); + std::unordered_set::const_iterator it; for (it = child_ids.begin(); it != child_ids.end(); ++it) { // Child can be NULL if it was deleted earlier if (ServerActiveObject *child = env->getActiveObject(*it)) diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index c4a988e07..3cf19f024 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -174,7 +174,7 @@ int ModApiUtil::l_get_dig_params(lua_State *L) int ModApiUtil::l_get_hit_params(lua_State *L) { NO_MAP_LOCK_REQUIRED; - UNORDERED_MAP groups; + std::unordered_map groups; read_groups(L, 1, groups); ToolCapabilities tp = read_tool_capabilities(L, 2); if(lua_isnoneornil(L, 3)) diff --git a/src/server.cpp b/src/server.cpp index 1e8e6a5d2..b2fdecfa9 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -634,7 +634,7 @@ void Server::AsyncRunStep(bool initial_step) MutexAutoLock envlock(m_env_mutex); m_clients.lock(); - UNORDERED_MAP clients = m_clients.getClientList(); + RemoteClientMap clients = m_clients.getClientList(); ScopeProfiler sp(g_profiler, "Server: checking added and deleted objs"); // Radius inside which objects are active @@ -650,7 +650,7 @@ void Server::AsyncRunStep(bool initial_step) if (player_radius == 0 && is_transfer_limited) player_radius = radius; - for (UNORDERED_MAP::iterator i = clients.begin(); + for (RemoteClientMap::iterator i = clients.begin(); i != clients.end(); ++i) { RemoteClient *client = i->second; @@ -761,7 +761,7 @@ void Server::AsyncRunStep(bool initial_step) if (m_mod_storage_save_timer <= 0.0f) { infostream << "Saving registered mod storages." << std::endl; m_mod_storage_save_timer = g_settings->getFloat("server_map_save_interval"); - for (UNORDERED_MAP::const_iterator + for (std::unordered_map::const_iterator it = m_mod_storages.begin(); it != m_mod_storages.end(); ++it) { if (it->second->isModified()) { it->second->save(getModStoragePath()); @@ -779,7 +779,7 @@ void Server::AsyncRunStep(bool initial_step) // Key = object id // Value = data sent by object - UNORDERED_MAP* > buffered_messages; + std::unordered_map*> buffered_messages; // Get active object messages from environment for(;;) { @@ -788,7 +788,7 @@ void Server::AsyncRunStep(bool initial_step) break; std::vector* message_list = NULL; - UNORDERED_MAP* >::iterator n; + std::unordered_map* >::iterator n; n = buffered_messages.find(aom.id); if (n == buffered_messages.end()) { message_list = new std::vector; @@ -801,15 +801,15 @@ void Server::AsyncRunStep(bool initial_step) } m_clients.lock(); - UNORDERED_MAP clients = m_clients.getClientList(); + RemoteClientMap clients = m_clients.getClientList(); // Route data to every client - for (UNORDERED_MAP::iterator i = clients.begin(); - i != clients.end(); ++i) { + for (std::unordered_map::iterator i = clients.begin(); + i != clients.end(); ++i) { RemoteClient *client = i->second; std::string reliable_data; std::string unreliable_data; // Go through all objects in message buffer - for (UNORDERED_MAP* >::iterator + for (std::unordered_map* >::iterator j = buffered_messages.begin(); j != buffered_messages.end(); ++j) { // If object is not known by client, skip it @@ -853,7 +853,7 @@ void Server::AsyncRunStep(bool initial_step) m_clients.unlock(); // Clear buffered_messages - for (UNORDERED_MAP* >::iterator + for (std::unordered_map* >::iterator i = buffered_messages.begin(); i != buffered_messages.end(); ++i) { delete i->second; @@ -2112,7 +2112,8 @@ s32 Server::playSound(const SimpleSoundSpec &spec, void Server::stopSound(s32 handle) { // Get sound reference - UNORDERED_MAP::iterator i = m_playing_sounds.find(handle); + std::unordered_map::iterator i = + m_playing_sounds.find(handle); if (i == m_playing_sounds.end()) return; ServerPlayingSound &psound = i->second; @@ -2120,10 +2121,10 @@ void Server::stopSound(s32 handle) NetworkPacket pkt(TOCLIENT_STOP_SOUND, 4); pkt << handle; - for (UNORDERED_SET::iterator i = psound.clients.begin(); - i != psound.clients.end(); ++i) { + for (std::unordered_set::const_iterator si = psound.clients.begin(); + si != psound.clients.end(); ++si) { // Send as reliable - m_clients.send(*i, 0, &pkt, true); + m_clients.send(*si, 0, &pkt, true); } // Remove sound reference m_playing_sounds.erase(i); @@ -2132,8 +2133,8 @@ void Server::stopSound(s32 handle) void Server::fadeSound(s32 handle, float step, float gain) { // Get sound reference - UNORDERED_MAP::iterator i = - m_playing_sounds.find(handle); + std::unordered_map::iterator i = + m_playing_sounds.find(handle); if (i == m_playing_sounds.end()) return; @@ -2151,7 +2152,7 @@ void Server::fadeSound(s32 handle, float step, float gain) NetworkPacket compat_pkt(TOCLIENT_STOP_SOUND, 4); compat_pkt << handle; - for (UNORDERED_SET::iterator it = psound.clients.begin(); + for (std::unordered_set::iterator it = psound.clients.begin(); it != psound.clients.end();) { if (m_clients.getProtocolVersion(*it) >= 32) { // Send as reliable @@ -2460,7 +2461,7 @@ void Server::sendMediaAnnouncement(u16 peer_id) NetworkPacket pkt(TOCLIENT_ANNOUNCE_MEDIA, 0, peer_id); pkt << (u16) m_media.size(); - for (UNORDERED_MAP::iterator i = m_media.begin(); + for (std::unordered_map::iterator i = m_media.begin(); i != m_media.end(); ++i) { pkt << i->first << i->second.sha1_digest; } @@ -2769,7 +2770,7 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason) /* Clear references to playing sounds */ - for (UNORDERED_MAP::iterator + for (std::unordered_map::iterator i = m_playing_sounds.begin(); i != m_playing_sounds.end();) { ServerPlayingSound &psound = i->second; psound.clients.erase(peer_id); @@ -3560,7 +3561,7 @@ void Server::requestShutdown(const std::string &msg, bool reconnect, float delay if (delay == 0.0f) { // No delay, shutdown immediately m_shutdown_requested = true; - // only print to the infostream, a chat message saying + // only print to the infostream, a chat message saying // "Server Shutting Down" is sent when the server destructs. infostream << "*** Immediate Server shutdown requested." << std::endl; } else if (delay < 0.0f && m_shutdown_timer > 0.0f) { @@ -3645,7 +3646,7 @@ bool Server::registerModStorage(ModMetadata *storage) void Server::unregisterModStorage(const std::string &name) { - UNORDERED_MAP::const_iterator it = m_mod_storages.find(name); + std::unordered_map::const_iterator it = m_mod_storages.find(name); if (it != m_mod_storages.end()) { // Save unconditionaly on unregistration it->second->save(getModStoragePath()); diff --git a/src/server.h b/src/server.h index 2e735e77c..935be5f95 100644 --- a/src/server.h +++ b/src/server.h @@ -135,7 +135,7 @@ struct ServerPlayingSound { ServerSoundParams params; SimpleSoundSpec spec; - UNORDERED_SET clients; // peer ids + std::unordered_set clients; // peer ids }; class Server : public con::PeerHandler, public MapEventReceiver, @@ -653,12 +653,12 @@ private: u16 m_ignore_map_edit_events_peer_id; // media files known to server - UNORDERED_MAP m_media; + std::unordered_map m_media; /* Sounds */ - UNORDERED_MAP m_playing_sounds; + std::unordered_map m_playing_sounds; s32 m_next_sound_id; /* @@ -669,7 +669,7 @@ private: // value = "" (visible to all players) or player name std::map m_detached_inventories_player; - UNORDERED_MAP m_mod_storages; + std::unordered_map m_mod_storages; float m_mod_storage_save_timer; DISABLE_CLASS_COPY(Server); diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index cbdc747d1..f013a3cc7 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -999,9 +999,10 @@ bool ServerEnvironment::swapNode(v3s16 p, const MapNode &n) return true; } -void ServerEnvironment::getObjectsInsideRadius(std::vector &objects, v3f pos, float radius) +void ServerEnvironment::getObjectsInsideRadius(std::vector &objects, v3f pos, + float radius) { - for (ActiveObjectMap::iterator i = m_active_objects.begin(); + for (ServerActiveObjectMap::iterator i = m_active_objects.begin(); i != m_active_objects.end(); ++i) { ServerActiveObject* obj = i->second; u16 id = i->first; @@ -1017,7 +1018,7 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode) infostream << "ServerEnvironment::clearObjects(): " << "Removing all active objects" << std::endl; std::vector objects_to_remove; - for (ActiveObjectMap::iterator i = m_active_objects.begin(); + for (ServerActiveObjectMap::iterator i = m_active_objects.begin(); i != m_active_objects.end(); ++i) { ServerActiveObject* obj = i->second; if (obj->getType() == ACTIVEOBJECT_TYPE_PLAYER) @@ -1395,7 +1396,7 @@ void ServerEnvironment::step(float dtime) send_recommended = true; } - for(ActiveObjectMap::iterator i = m_active_objects.begin(); + for (ServerActiveObjectMap::iterator i = m_active_objects.begin(); i != m_active_objects.end(); ++i) { ServerActiveObject* obj = i->second; // Don't step if is to be removed or stored statically @@ -1429,7 +1430,7 @@ void ServerEnvironment::step(float dtime) Manage particle spawner expiration */ if (m_particle_management_interval.step(dtime, 1.0)) { - for (UNORDERED_MAP::iterator i = m_particle_spawners.begin(); + for (std::unordered_map::iterator i = m_particle_spawners.begin(); i != m_particle_spawners.end(); ) { //non expiring spawners if (i->second == PARTICLE_SPAWNER_NO_EXPIRY) { @@ -1454,7 +1455,7 @@ u32 ServerEnvironment::addParticleSpawner(float exptime) u32 id = 0; for (;;) { // look for unused particlespawner id id++; - UNORDERED_MAP::iterator f = m_particle_spawners.find(id); + std::unordered_map::iterator f = m_particle_spawners.find(id); if (f == m_particle_spawners.end()) { m_particle_spawners[id] = time; break; @@ -1476,7 +1477,7 @@ u32 ServerEnvironment::addParticleSpawner(float exptime, u16 attached_id) void ServerEnvironment::deleteParticleSpawner(u32 id, bool remove_from_object) { m_particle_spawners.erase(id); - UNORDERED_MAP::iterator it = m_particle_spawner_attachments.find(id); + std::unordered_map::iterator it = m_particle_spawner_attachments.find(id); if (it != m_particle_spawner_attachments.end()) { u16 obj_id = (*it).second; ServerActiveObject *sao = getActiveObject(obj_id); @@ -1489,11 +1490,11 @@ void ServerEnvironment::deleteParticleSpawner(u32 id, bool remove_from_object) ServerActiveObject* ServerEnvironment::getActiveObject(u16 id) { - ActiveObjectMap::iterator n = m_active_objects.find(id); + ServerActiveObjectMap::const_iterator n = m_active_objects.find(id); return (n != m_active_objects.end() ? n->second : NULL); } -bool isFreeServerActiveObjectId(u16 id, ActiveObjectMap &objects) +bool isFreeServerActiveObjectId(u16 id, ServerActiveObjectMap &objects) { if (id == 0) return false; @@ -1501,7 +1502,7 @@ bool isFreeServerActiveObjectId(u16 id, ActiveObjectMap &objects) return objects.find(id) == objects.end(); } -u16 getFreeServerActiveObjectId(ActiveObjectMap &objects) +u16 getFreeServerActiveObjectId(ServerActiveObjectMap &objects) { //try to reuse id's as late as possible static u16 last_used_id = 0; @@ -1546,7 +1547,7 @@ void ServerEnvironment::getAddedActiveObjects(PlayerSAO *playersao, s16 radius, - discard objects that are found in current_objects. - add remaining objects to added_objects */ - for (ActiveObjectMap::iterator i = m_active_objects.begin(); + for (ServerActiveObjectMap::iterator i = m_active_objects.begin(); i != m_active_objects.end(); ++i) { u16 id = i->first; @@ -1642,7 +1643,7 @@ void ServerEnvironment::setStaticForActiveObjectsInBlock( so_it = block->m_static_objects.m_active.begin(); so_it != block->m_static_objects.m_active.end(); ++so_it) { // Get the ServerActiveObject counterpart to this StaticObject - ActiveObjectMap::iterator ao_it = m_active_objects.find(so_it->first); + ServerActiveObjectMap::const_iterator ao_it = m_active_objects.find(so_it->first); if (ao_it == m_active_objects.end()) { // If this ever happens, there must be some kind of nasty bug. errorstream << "ServerEnvironment::setStaticForObjectsInBlock(): " @@ -1761,7 +1762,7 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, void ServerEnvironment::removeRemovedObjects() { std::vector objects_to_remove; - for(ActiveObjectMap::iterator i = m_active_objects.begin(); + for(ServerActiveObjectMap::iterator i = m_active_objects.begin(); i != m_active_objects.end(); ++i) { u16 id = i->first; ServerActiveObject* obj = i->second; @@ -1979,7 +1980,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) void ServerEnvironment::deactivateFarObjects(bool _force_delete) { std::vector objects_to_remove; - for(ActiveObjectMap::iterator i = m_active_objects.begin(); + for (ServerActiveObjectMap::iterator i = m_active_objects.begin(); i != m_active_objects.end(); ++i) { // force_delete might be overriden per object bool force_delete = _force_delete; diff --git a/src/serverenvironment.h b/src/serverenvironment.h index 7c370fd54..3b7bf8fb0 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -190,7 +190,7 @@ enum ClearObjectsMode { This is not thread-safe. Server uses an environment mutex. */ -typedef UNORDERED_MAP ActiveObjectMap; +typedef std::unordered_map ServerActiveObjectMap; class ServerEnvironment : public Environment { @@ -395,7 +395,7 @@ private: // World path const std::string m_path_world; // Active object list - ActiveObjectMap m_active_objects; + ServerActiveObjectMap m_active_objects; // Outgoing network message buffer for active objects std::queue m_active_object_messages; // Some timers @@ -431,8 +431,8 @@ private: // Particles IntervalLimiter m_particle_management_interval; - UNORDERED_MAP m_particle_spawners; - UNORDERED_MAP m_particle_spawner_attachments; + std::unordered_map m_particle_spawners; + std::unordered_map m_particle_spawner_attachments; }; #endif diff --git a/src/serverobject.h b/src/serverobject.h index 38204980e..3041910d1 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef SERVEROBJECT_HEADER #define SERVEROBJECT_HEADER +#include #include "irrlichttypes_bloated.h" #include "activeobject.h" #include "inventorymanager.h" @@ -166,8 +167,8 @@ public: {} virtual void removeAttachmentChild(int child_id) {} - virtual const UNORDERED_SET &getAttachmentChildIds() - { static const UNORDERED_SET rv; return rv; } + virtual const std::unordered_set &getAttachmentChildIds() + { static const std::unordered_set rv; return rv; } virtual ObjectProperties* accessObjectProperties() { return NULL; } virtual void notifyObjectPropertiesModified() @@ -251,7 +252,7 @@ protected: ServerEnvironment *m_env; v3f m_base_position; - UNORDERED_SET m_attached_particle_spawners; + std::unordered_set m_attached_particle_spawners; private: // Used for creating objects based on type diff --git a/src/settings.h b/src/settings.h index 8c4f6e559..e570c1a84 100644 --- a/src/settings.h +++ b/src/settings.h @@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/string.h" #include "threading/mutex.h" #include -#include "util/cpp11_container.h" #include #include @@ -45,7 +44,7 @@ typedef std::vector< > > SettingsCallbackList; -typedef UNORDERED_MAP SettingsCallbackMap; +typedef std::unordered_map SettingsCallbackMap; enum ValueType { VALUETYPE_STRING, @@ -95,7 +94,7 @@ struct SettingsEntry { bool is_group; }; -typedef UNORDERED_MAP SettingEntries; +typedef std::unordered_map SettingEntries; class Settings { public: diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp index a425af827..d1a5279b3 100644 --- a/src/sound_openal.cpp +++ b/src/sound_openal.cpp @@ -43,7 +43,7 @@ with this program; ifnot, write to the Free Software Foundation, Inc., #include "porting.h" #include #include -#include "util/cpp11_container.h" +#include #define BUFFER_SIZE 30000 @@ -271,8 +271,8 @@ private: ALCdevice *m_device; ALCcontext *m_context; int m_next_id; - UNORDERED_MAP > m_buffers; - UNORDERED_MAP m_sounds_playing; + std::unordered_map> m_buffers; + std::unordered_map m_sounds_playing; v3f m_listener_pos; struct FadeState { FadeState() {} @@ -285,7 +285,7 @@ private: float target_gain; }; - UNORDERED_MAP m_sounds_fading; + std::unordered_map m_sounds_fading; float m_fade_delay; public: bool m_is_initialized; @@ -351,8 +351,8 @@ public: alcCloseDevice(m_device); m_device = NULL; - for (UNORDERED_MAP >::iterator i = m_buffers.begin(); - i != m_buffers.end(); ++i) { + for (std::unordered_map>::iterator i = + m_buffers.begin(); i != m_buffers.end(); ++i) { for (std::vector::iterator iter = (*i).second.begin(); iter != (*i).second.end(); ++iter) { delete *iter; @@ -370,7 +370,7 @@ public: void addBuffer(const std::string &name, SoundBuffer *buf) { - UNORDERED_MAP >::iterator i = + std::unordered_map>::iterator i = m_buffers.find(name); if(i != m_buffers.end()){ i->second.push_back(buf); @@ -384,7 +384,7 @@ public: SoundBuffer* getBuffer(const std::string &name) { - UNORDERED_MAP >::iterator i = + std::unordered_map>::iterator i = m_buffers.find(name); if(i == m_buffers.end()) return NULL; @@ -461,7 +461,7 @@ public: void deleteSound(int id) { - UNORDERED_MAP::iterator i = m_sounds_playing.find(id); + std::unordered_map::iterator i = m_sounds_playing.find(id); if(i == m_sounds_playing.end()) return; PlayingSound *sound = i->second; @@ -501,7 +501,7 @@ public: < del_list; - for(UNORDERED_MAP::iterator i = m_sounds_playing.begin(); + for(std::unordered_map::iterator i = m_sounds_playing.begin(); i != m_sounds_playing.end(); ++i) { int id = i->first; PlayingSound *sound = i->second; @@ -615,7 +615,7 @@ public: return; float chkGain = 0; - for (UNORDERED_MAP::iterator i = m_sounds_fading.begin(); + for (std::unordered_map::iterator i = m_sounds_fading.begin(); i != m_sounds_fading.end();) { if (i->second.step < 0.f) chkGain = -(i->second.current_gain); @@ -646,7 +646,7 @@ public: void updateSoundPosition(int id, v3f pos) { - UNORDERED_MAP::iterator i = m_sounds_playing.find(id); + std::unordered_map::iterator i = m_sounds_playing.find(id); if (i == m_sounds_playing.end()) return; PlayingSound *sound = i->second; @@ -659,7 +659,7 @@ public: bool updateSoundGain(int id, float gain) { - UNORDERED_MAP::iterator i = m_sounds_playing.find(id); + std::unordered_map::iterator i = m_sounds_playing.find(id); if (i == m_sounds_playing.end()) return false; @@ -670,7 +670,7 @@ public: float getSoundGain(int id) { - UNORDERED_MAP::iterator i = m_sounds_playing.find(id); + std::unordered_map::iterator i = m_sounds_playing.find(id); if (i == m_sounds_playing.end()) return 0; diff --git a/src/tool.cpp b/src/tool.cpp index bb884938c..1afd71630 100644 --- a/src/tool.cpp +++ b/src/tool.cpp @@ -38,7 +38,7 @@ void ToolCapabilities::serialize(std::ostream &os, u16 protocol_version) const writeS16(os, cap->uses); writeS16(os, cap->maxlevel); writeU32(os, cap->times.size()); - for (UNORDERED_MAP::const_iterator + for (std::unordered_map::const_iterator j = cap->times.begin(); j != cap->times.end(); ++j) { writeS16(os, j->first); writeF1000(os, j->second); diff --git a/src/tool.h b/src/tool.h index f33152355..083328d06 100644 --- a/src/tool.h +++ b/src/tool.h @@ -23,12 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes.h" #include #include -#include "util/cpp11_container.h" #include "itemgroup.h" struct ToolGroupCap { - UNORDERED_MAP times; + std::unordered_map times; int maxlevel; int uses; @@ -39,7 +38,7 @@ struct ToolGroupCap bool getTime(int rating, float *time) const { - UNORDERED_MAP::const_iterator i = times.find(rating); + std::unordered_map::const_iterator i = times.find(rating); if (i == times.end()) { *time = 0; return false; @@ -50,8 +49,8 @@ struct ToolGroupCap }; -typedef UNORDERED_MAP ToolGCMap; -typedef UNORDERED_MAP DamageGroup; +typedef std::unordered_map ToolGCMap; +typedef std::unordered_map DamageGroup; struct ToolCapabilities { diff --git a/src/util/cpp11.h b/src/util/cpp11.h deleted file mode 100644 index 14913cb86..000000000 --- a/src/util/cpp11.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -Minetest -Copyright (C) 2016 nerzhul, Loic Blot - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef MT_CPP11_HEADER -#define MT_CPP11_HEADER - -#if __cplusplus < 201103L || _MSC_VER < 1600 -#define USE_CPP11_FAKE_KEYWORD -#endif - -#ifdef USE_CPP11_FAKE_KEYWORD -#define constexpr const -#define nullptr NULL -#endif - -#endif diff --git a/src/util/cpp11_container.h b/src/util/cpp11_container.h deleted file mode 100644 index 0194385fc..000000000 --- a/src/util/cpp11_container.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Minetest -Copyright (C) 2016 nerzhul, Loic Blot - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef MT_CPP11CONTAINER_HEADER -#define MT_CPP11CONTAINER_HEADER - -#if __cplusplus >= 201103L -#define USE_UNORDERED_CONTAINERS -#endif - -#if _MSC_VER >= 1600 -#define USE_UNORDERED_CONTAINERS -#endif - -#ifdef USE_UNORDERED_CONTAINERS -#include -#include -#define UNORDERED_MAP std::unordered_map -#define UNORDERED_SET std::unordered_set -#else -#include -#include -#define UNORDERED_MAP std::map -#define UNORDERED_SET std::set -#endif - -#endif diff --git a/src/util/string.h b/src/util/string.h index cc278da13..c0f4beefb 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define UTIL_STRING_HEADER #include "irrlichttypes_bloated.h" -#include "cpp11_container.h" #include #include #include @@ -30,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) @@ -55,7 +55,7 @@ with this program; if not, write to the Free Software Foundation, Inc., (((unsigned char)(x) < 0xe0) ? 2 : \ (((unsigned char)(x) < 0xf0) ? 3 : 4)) -typedef UNORDERED_MAP StringMap; +typedef std::unordered_map StringMap; struct FlagDesc { const char *name; diff --git a/src/voxelalgorithms.h b/src/voxelalgorithms.h index b518979d7..699624612 100644 --- a/src/voxelalgorithms.h +++ b/src/voxelalgorithms.h @@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "voxel.h" #include "mapnode.h" #include "util/container.h" -#include "util/cpp11_container.h" class Map; class ServerMap; -- cgit v1.2.3