C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821)

This commit is contained in:
Loïc Blot 2017-06-04 21:00:04 +02:00 committed by GitHub
parent 2362d3f926
commit a98baef5e4
59 changed files with 223 additions and 298 deletions

@ -242,7 +242,7 @@ Client::~Client()
delete m_inventory_from_server;
// Delete detached inventories
for (UNORDERED_MAP<std::string, Inventory*>::iterator
for (std::unordered_map<std::string, Inventory*>::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<int, u16>::iterator i = m_sounds_to_objects.begin();
for(std::unordered_map<int, u16>::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<s32> removed_server_ids;
for(UNORDERED_MAP<s32, int>::iterator i = m_sounds_server_to_client.begin();
for (std::unordered_map<s32, int>::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<std::string, ModMetadata *>::const_iterator
for (std::unordered_map<std::string, ModMetadata *>::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<std::string, ModMetadata *>::const_iterator it = m_mod_storages.find(name);
std::unordered_map<std::string, ModMetadata *>::const_iterator it =
m_mod_storages.find(name);
if (it != m_mod_storages.end()) {
// Save unconditionaly on unregistration
it->second->save(getModStoragePath());

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <map>
#include <set>
#include <vector>
#include <unordered_set>
#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<s32, int> m_sounds_server_to_client;
std::unordered_map<s32, int> m_sounds_server_to_client;
// And the other way!
UNORDERED_MAP<int, s32> m_sounds_client_to_server;
std::unordered_map<int, s32> m_sounds_client_to_server;
// And relations to objects
UNORDERED_MAP<int, u16> m_sounds_to_objects;
std::unordered_map<int, u16> m_sounds_to_objects;
// Privileges
UNORDERED_SET<std::string> m_privileges;
std::unordered_set<std::string> m_privileges;
// Detached inventories
// key = name
UNORDERED_MAP<std::string, Inventory*> m_detached_inventories;
std::unordered_map<std::string, Inventory*> 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<std::string, ModMetadata *> m_mod_storages;
std::unordered_map<std::string, ModMetadata *> m_mod_storages;
float m_mod_storage_save_timer;
GameUIFlags *m_game_ui_flags;

@ -427,7 +427,7 @@ private:
std::vector<video::ITexture*> m_texture_trash;
// Maps image file names to loaded palettes.
UNORDERED_MAP<std::string, Palette> m_palettes;
std::unordered_map<std::string, Palette> 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<std::string, Palette>::iterator it = m_palettes.find(name);
std::unordered_map<std::string, Palette>::iterator it = m_palettes.find(name);
if (it == m_palettes.end()) {
// Create palette
video::IImage *img = generateImage(name);

@ -55,8 +55,8 @@ ClientEnvironment::ClientEnvironment(ClientMap *map, scene::ISceneManager *smgr,
ClientEnvironment::~ClientEnvironment()
{
// delete active objects
for (UNORDERED_MAP<u16, ClientActiveObject*>::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<u16, ClientActiveObject*>::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<u16, ClientActiveObject*>::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<u16, ClientActiveObject*> &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<u16, ClientActiveObject*> &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<DistanceSortedActiveObject> &dest)
{
for (UNORDERED_MAP<u16, ClientActiveObject*>::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();

@ -64,6 +64,7 @@ struct ClientEnvEvent
};
};
typedef std::unordered_map<u16, ClientActiveObject*> ClientActiveObjectMap;
class ClientEnvironment : public Environment
{
public:
@ -181,7 +182,7 @@ private:
Client *m_client;
ClientScripting *m_script;
IrrlichtDevice *m_irr;
UNORDERED_MAP<u16, ClientActiveObject*> m_active_objects;
ClientActiveObjectMap m_active_objects;
std::vector<ClientSimpleObject*> m_simple_objects;
std::queue<ClientEnvEvent> m_client_event_queue;
IntervalLimiter m_active_object_light_update_interval;

@ -611,7 +611,7 @@ ClientInterface::~ClientInterface()
{
MutexAutoLock clientslock(m_clients_mutex);
for (UNORDERED_MAP<u16, RemoteClient*>::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<u16> ClientInterface::getClientIDs(ClientState min_state)
std::vector<u16> reply;
MutexAutoLock clientslock(m_clients_mutex);
for(UNORDERED_MAP<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16>::iterator
i = client->m_known_objects.begin();
i != client->m_known_objects.end(); ++i)
{
for (std::set<u16>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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<u16, RemoteClient*>::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())

@ -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 <list>
@ -435,6 +434,8 @@ private:
const u64 m_connection_time;
};
typedef std::unordered_map<u16, RemoteClient*> RemoteClientMap;
class ClientInterface {
public:
@ -499,7 +500,7 @@ protected:
void lock() { m_clients_mutex.lock(); }
void unlock() { m_clients_mutex.unlock(); }
UNORDERED_MAP<u16, RemoteClient*>& 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<u16, RemoteClient*> m_clients;
RemoteClientMap m_clients;
std::vector<std::string> m_clients_names; //for announcing masterserver
// Environment

@ -348,7 +348,7 @@ void ClientMediaDownloader::remoteMediaReceived(
std::string name;
{
UNORDERED_MAP<unsigned long, std::string>::iterator it =
std::unordered_map<unsigned long, std::string>::iterator it =
m_remote_file_transfers.find(fetch_result.request_id);
assert(it != m_remote_file_transfers.end());
name = it->second;

@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <map>
#include <set>
#include <vector>
#include "util/cpp11_container.h"
#include <unordered_map>
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<unsigned long, std::string> m_remote_file_transfers;
std::unordered_map<unsigned long, std::string> 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

@ -42,8 +42,8 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
Client *client, ClientEnvironment *env)
{
// Find factory function
UNORDERED_MAP<u16, Factory>::iterator n = m_types.find(type);
if(n == m_types.end()) {
std::unordered_map<u16, Factory>::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<u16, Factory>::iterator n = m_types.find(type);
std::unordered_map<u16, Factory>::iterator n = m_types.find(type);
if(n != m_types.end())
return;
m_types[type] = f;

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h"
#include "activeobject.h"
#include <map>
#include "util/cpp11_container.h"
#include <unordered_map>
class ClientEnvironment;
class ITextureSource;
@ -89,7 +89,7 @@ protected:
ClientEnvironment *m_env;
private:
// Used for creating objects based on type
static UNORDERED_MAP<u16, Factory> m_types;
static std::unordered_map<u16, Factory> m_types;
};
struct DistanceSortedActiveObject

@ -49,7 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Settings;
struct ToolCapabilities;
UNORDERED_MAP<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
std::unordered_map<u16, ClientActiveObject::Factory> 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<std::string, core::vector2d<v3f> >()),
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<std::string, core::vector2d<v3f> >::const_iterator
for(std::unordered_map<std::string, core::vector2d<v3f>>::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;

@ -91,7 +91,8 @@ private:
int m_animation_speed;
int m_animation_blend;
bool m_animation_loop;
UNORDERED_MAP<std::string, core::vector2d<v3f> > m_bone_position; // stores position and rotation for each bone name
// stores position and rotation for each bone name
std::unordered_map<std::string, core::vector2d<v3f>> m_bone_position;
std::string m_attachment_bone;
v3f m_attachment_position;
v3f m_attachment_rotation;

@ -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),

@ -213,7 +213,7 @@ void UnitSAO::removeAttachmentChild(int child_id)
m_attachment_child_ids.erase(child_id);
}
const UNORDERED_SET<int> &UnitSAO::getAttachmentChildIds()
const std::unordered_set<int> &UnitSAO::getAttachmentChildIds()
{
return m_attachment_child_ids;
}
@ -263,7 +263,7 @@ LuaEntitySAO::~LuaEntitySAO()
m_env->getScriptIface()->luaentity_Remove(m_id);
}
for (UNORDERED_SET<u32>::iterator it = m_attached_particle_spawners.begin();
for (std::unordered_set<u32>::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<std::string, core::vector2d<v3f> >::const_iterator
for (std::unordered_map<std::string, core::vector2d<v3f>>::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<std::string, core::vector2d<v3f> >::const_iterator
for (std::unordered_map<std::string, core::vector2d<v3f>>::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<int>::const_iterator ii = m_attachment_child_ids.begin();
for (std::unordered_set<int>::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<u32>::iterator it = m_attached_particle_spawners.begin();
for (std::unordered_set<u32>::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<std::string, core::vector2d<v3f> >::const_iterator
for (std::unordered_map<std::string, core::vector2d<v3f>>::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<int>::const_iterator ii = m_attachment_child_ids.begin();
for (std::unordered_set<int>::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<std::string, core::vector2d<v3f> >::const_iterator
for (std::unordered_map<std::string, core::vector2d<v3f>>::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);

@ -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<int> &getAttachmentChildIds();
const std::unordered_set<int> &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<std::string, core::vector2d<v3f> > m_bone_position;
std::unordered_map<std::string, core::vector2d<v3f>> m_bone_position;
bool m_bone_position_sent;
int m_attachment_parent_id;
UNORDERED_SET<int> m_attachment_child_ids;
std::unordered_set<int> 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<std::string, std::string> PlayerAttributes;
typedef std::unordered_map<std::string, std::string> PlayerAttributes;
class RemotePlayer;
class PlayerSAO : public UnitSAO

@ -375,7 +375,7 @@ bool EmergeManager::pushBlockEmergeData(
bool EmergeManager::popBlockEmergeData(v3s16 pos, BlockEmergeData *bedata)
{
std::map<v3s16, BlockEmergeData>::iterator it;
UNORDERED_MAP<u16, u16>::iterator it2;
std::unordered_map<u16, u16>::iterator it2;
it = m_blocks_enqueued.find(pos);
if (it == m_blocks_enqueued.end())

@ -157,7 +157,7 @@ private:
Mutex m_queue_mutex;
std::map<v3s16, BlockEmergeData> m_blocks_enqueued;
UNORDERED_MAP<u16, u16> m_peer_queue_count;
std::unordered_map<u16, u16> m_peer_queue_count;
u16 m_qlimit_total;
u16 m_qlimit_diskonly;

@ -21,14 +21,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "threading/mutex_auto_lock.h"
UNORDERED_MAP<u16, std::vector<v3s16> > FacePositionCache::cache;
std::unordered_map<u16, std::vector<v3s16>> FacePositionCache::cache;
Mutex FacePositionCache::cache_mutex;
// Calculate the borders of a "d-radius" cube
const std::vector<v3s16> &FacePositionCache::getFacePositions(u16 d)
{
MutexAutoLock lock(cache_mutex);
UNORDERED_MAP<u16, std::vector<v3s16> >::iterator it = cache.find(d);
std::unordered_map<u16, std::vector<v3s16>>::const_iterator it = cache.find(d);
if (it != cache.end())
return it->second;

@ -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 <map>
#include <vector>
#include <unordered_map>
/*
* This class permits caching getFacePosition call results.
@ -37,7 +37,7 @@ public:
private:
static const std::vector<v3s16> &generateFacePosition(u16 d);
static UNORDERED_MAP<u16, std::vector<v3s16> > cache;
static std::unordered_map<u16, std::vector<v3s16>> cache;
static Mutex cache_mutex;
};

@ -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<std::string, bool>::const_iterator it =
std::unordered_map<std::string, bool>::const_iterator it =
field_close_on_enter.find(s.fname);
if (it != field_close_on_enter.end())
close_on_enter = (*it).second;

@ -397,7 +397,7 @@ protected:
std::vector<ImageDrawSpec> m_images;
std::vector<ImageDrawSpec> m_itemimages;
std::vector<BoxDrawSpec> m_boxes;
UNORDERED_MAP<std::string, bool> field_close_on_enter;
std::unordered_map<std::string, bool> field_close_on_enter;
std::vector<FieldSpec> m_fields;
std::vector<StaticTextSpec> m_static_texts;
std::vector<std::pair<FieldSpec,GUITable*> > 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<std::string, GUITable::DynamicData> table_dyndata;
std::unordered_map<std::string, GUITable::DynamicData> table_dyndata;
} parserData;
typedef struct {

@ -21,9 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define ITEMGROUP_HEADER
#include <string>
#include "util/cpp11_container.h"
#include <unordered_map>
typedef UNORDERED_MAP<std::string, int> ItemGroupList;
typedef std::unordered_map<std::string, int> ItemGroupList;
static inline int itemgroup_get(const ItemGroupList &groups, const std::string &name)
{

@ -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"

@ -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 <map>
class Client;

@ -42,7 +42,7 @@ void MapSector::deleteBlocks()
m_block_cache = NULL;
// Delete all
for (UNORDERED_MAP<s16, MapBlock*>::iterator i = m_blocks.begin();
for (std::unordered_map<s16, MapBlock*>::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<s16, MapBlock*>::iterator n = m_blocks.find(y);
std::unordered_map<s16, MapBlock*>::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<s16, MapBlock*>::iterator bi = m_blocks.begin();
for (std::unordered_map<s16, MapBlock*>::iterator bi = m_blocks.begin();
bi != m_blocks.end(); ++bi) {
dest.push_back(bi->second);
}

@ -71,7 +71,7 @@ public:
protected:
// The pile of MapBlocks
UNORDERED_MAP<s16, MapBlock*> m_blocks;
std::unordered_map<s16, MapBlock*> m_blocks;
Map *m_parent;
// Position on parent (in MapBlock widths)

@ -208,14 +208,11 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
#endif
}
if (mg->biomemap) {
UNORDERED_SET<u8>::iterator iter;
if (!biomes.empty()) {
iter = biomes.find(mg->biomemap[mapindex]);
if (iter == biomes.end())
continue;
}
if (mg->biomemap && !biomes.empty()) {
std::unordered_set<u8>::const_iterator iter =
biomes.find(mg->biomemap[mapindex]);
if (iter == biomes.end())
continue;
}
v3s16 pos(x, y, z);

@ -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 <unordered_set>
#include "objdef.h"
#include "noise.h"
#include "nodedef.h"
@ -87,9 +87,7 @@ public:
std::vector<content_t> c_spawnby;
s16 nspawnby;
UNORDERED_SET<u8> biomes;
//std::list<CutoffData> cutoffs;
//Mutex cutoff_mutex;
std::unordered_set<u8> biomes;
};
class DecoSimple : public Decoration {

@ -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<u8>::iterator it = biomes.find(biomemap[index]);
std::unordered_set<u8>::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<u8>::iterator it = biomes.find(biomemap[index]);
std::unordered_set<u8>::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<u8>::iterator it = biomes.find(biomemap[index]);
std::unordered_set<u8>::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<u8>::iterator it = biomes.find(biomemap[bmapidx]);
std::unordered_set<u8>::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<u8>::iterator it = biomes.find(biomemap[bmapidx]);
std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[bmapidx]);
if (it == biomes.end())
continue;
}

@ -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 <unordered_set>
#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<u8> biomes;
std::unordered_set<u8> biomes;
Ore();
virtual ~Ore();

@ -561,14 +561,14 @@ void Schematic::applyProbabilities(v3s16 p0,
void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount,
std::vector<std::string> *usednodes, INodeDefManager *ndef)
{
UNORDERED_MAP<content_t, content_t> nodeidmap;
std::unordered_map<content_t, content_t> nodeidmap;
content_t numids = 0;
for (size_t i = 0; i != nodecount; i++) {
content_t id;
content_t c = nodes[i].getContent();
UNORDERED_MAP<content_t, content_t>::const_iterator it = nodeidmap.find(c);
std::unordered_map<content_t, content_t>::const_iterator it = nodeidmap.find(c);
if (it == nodeidmap.end()) {
id = numids;
numids++;

@ -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<std::string>::iterator dep_it = mod.unsatisfied_depends.begin();
for (std::unordered_set<std::string>::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<std::string>::const_iterator it = m_name_conflicts.begin();
it != m_name_conflicts.end(); ++it) {
for (std::unordered_set<std::string>::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<std::string>::iterator it_optdep = mod.optdepends.begin();
for (std::unordered_set<std::string>::iterator it_optdep = mod.optdepends.begin();
it_optdep != mod.optdepends.end(); ++it_optdep) {
std::string optdep = *it_optdep;
if (modnames.count(optdep) != 0)

@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string>
#include <map>
#include <json/json.h>
#include "util/cpp11_container.h"
#include <unordered_set>
#include "config.h"
#include "metadata.h"
@ -38,9 +38,9 @@ struct ModSpec
std::string name;
std::string path;
//if normal mod:
UNORDERED_SET<std::string> depends;
UNORDERED_SET<std::string> optdepends;
UNORDERED_SET<std::string> unsatisfied_depends;
std::unordered_set<std::string> depends;
std::unordered_set<std::string> optdepends;
std::unordered_set<std::string> 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<std::string> m_name_conflicts;
std::unordered_set<std::string> m_name_conflicts;
// Deleted default constructor
ModConfiguration() {}

@ -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<u16, std::string>::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);

@ -23,8 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string>
#include <iostream>
#include <set>
#include <unordered_map>
#include "irrlichttypes_bloated.h"
#include "util/cpp11_container.h"
typedef std::unordered_map<u16, std::string> IdToNameMap;
typedef std::unordered_map<std::string, u16> 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<u16, std::string>::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<std::string, u16>::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<u16, std::string> m_id_to_name;
UNORDERED_MAP<std::string, u16> m_name_to_id;
IdToNameMap m_id_to_name;
NameToIdMap m_name_to_id;
};
#endif

@ -818,7 +818,7 @@ void Client::handleCommand_StopSound(NetworkPacket* pkt)
*pkt >> server_id;
UNORDERED_MAP<s32, int>::iterator i = m_sounds_server_to_client.find(server_id);
std::unordered_map<s32, int>::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<s32, int>::iterator i =
std::unordered_map<s32, int>::const_iterator i =
m_sounds_server_to_client.find(sound_id);
if (i != m_sounds_server_to_client.end())

@ -1695,7 +1695,8 @@ void Server::handleCommand_RemovedSounds(NetworkPacket* pkt)
*pkt >> id;
UNORDERED_MAP<s32, ServerPlayingSound>::iterator i = m_playing_sounds.find(id);
std::unordered_map<s32, ServerPlayingSound>::iterator i =
m_playing_sounds.find(id);
if (i == m_playing_sounds.end())
continue;

@ -912,12 +912,12 @@ private:
// item aliases too. Updated by updateAliases()
// Note: Not serialized.
UNORDERED_MAP<std::string, content_t> m_name_id_mapping_with_aliases;
std::unordered_map<std::string, content_t> 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<std::string, GroupItems> m_group_to_items;
std::unordered_map<std::string, GroupItems> 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<std::string, content_t>::const_iterator
std::unordered_map<std::string, content_t>::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<std::string, GroupItems>::const_iterator
std::unordered_map<std::string, GroupItems>::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<std::string, GroupItems>::iterator
std::unordered_map<std::string, GroupItems>::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<std::string, GroupItems>::iterator iter_groups =
for (std::unordered_map<std::string, GroupItems>::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();

@ -20,8 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef NODEMETADATA_HEADER
#define NODEMETADATA_HEADER
#include <unordered_set>
#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<std::string> m_privatevars;
std::unordered_set<std::string> m_privatevars;
};

@ -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) :

@ -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<std::string>::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<int, float>::const_iterator
for (std::unordered_map<int, float>::const_iterator
i = groupcap.times.begin(); i != groupcap.times.end(); ++i) {
lua_pushinteger(L, i->first);
lua_pushnumber(L, i->second);

@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define C_CONVERTER_H_
#include <vector>
#include "util/cpp11_container.h"
#include <unordered_map>
#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<std::string, int> &result);
std::unordered_map<std::string, int> &result);
bool getboolfield(lua_State *L, int table,
const char *fieldname, bool &result);
bool getfloatfield(lua_State *L, int table,

@ -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<u8> *biome_id_list);
BiomeManager *biomemgr, std::unordered_set<u8> *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<std::string, content_t> name_id_map;
std::unordered_map<std::string, content_t> 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<std::string, content_t>::iterator it = name_id_map.find(name);
std::unordered_map<std::string, content_t>::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<u8> *biome_id_list)
BiomeManager *biomemgr, std::unordered_set<u8> *biome_id_list)
{
if (index < 0)
index = lua_gettop(L) + 1 + index;

@ -137,8 +137,8 @@ int ObjectRef::l_remove(lua_State *L)
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
return 0;
const UNORDERED_SET<int> &child_ids = co->getAttachmentChildIds();
UNORDERED_SET<int>::const_iterator it;
const std::unordered_set<int> &child_ids = co->getAttachmentChildIds();
std::unordered_set<int>::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))

@ -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<std::string, int> groups;
std::unordered_map<std::string, int> groups;
read_groups(L, 1, groups);
ToolCapabilities tp = read_tool_capabilities(L, 2);
if(lua_isnoneornil(L, 3))

@ -634,7 +634,7 @@ void Server::AsyncRunStep(bool initial_step)
MutexAutoLock envlock(m_env_mutex);
m_clients.lock();
UNORDERED_MAP<u16, RemoteClient*> 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<u16, RemoteClient*>::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<std::string, ModMetadata *>::const_iterator
for (std::unordered_map<std::string, ModMetadata *>::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<u16, std::vector<ActiveObjectMessage>* > buffered_messages;
std::unordered_map<u16, std::vector<ActiveObjectMessage>*> buffered_messages;
// Get active object messages from environment
for(;;) {
@ -788,7 +788,7 @@ void Server::AsyncRunStep(bool initial_step)
break;
std::vector<ActiveObjectMessage>* message_list = NULL;
UNORDERED_MAP<u16, std::vector<ActiveObjectMessage>* >::iterator n;
std::unordered_map<u16, std::vector<ActiveObjectMessage>* >::iterator n;
n = buffered_messages.find(aom.id);
if (n == buffered_messages.end()) {
message_list = new std::vector<ActiveObjectMessage>;
@ -801,15 +801,15 @@ void Server::AsyncRunStep(bool initial_step)
}
m_clients.lock();
UNORDERED_MAP<u16, RemoteClient*> clients = m_clients.getClientList();
RemoteClientMap clients = m_clients.getClientList();
// Route data to every client
for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = clients.begin();
i != clients.end(); ++i) {
for (std::unordered_map<u16, RemoteClient*>::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<u16, std::vector<ActiveObjectMessage>* >::iterator
for (std::unordered_map<u16, std::vector<ActiveObjectMessage>* >::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<u16, std::vector<ActiveObjectMessage>* >::iterator
for (std::unordered_map<u16, std::vector<ActiveObjectMessage>* >::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<s32, ServerPlayingSound>::iterator i = m_playing_sounds.find(handle);
std::unordered_map<s32, ServerPlayingSound>::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<u16>::iterator i = psound.clients.begin();
i != psound.clients.end(); ++i) {
for (std::unordered_set<u16>::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<s32, ServerPlayingSound>::iterator i =
m_playing_sounds.find(handle);
std::unordered_map<s32, ServerPlayingSound>::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<u16>::iterator it = psound.clients.begin();
for (std::unordered_set<u16>::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<std::string, MediaInfo>::iterator i = m_media.begin();
for (std::unordered_map<std::string, MediaInfo>::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<s32, ServerPlayingSound>::iterator
for (std::unordered_map<s32, ServerPlayingSound>::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<std::string, ModMetadata *>::const_iterator it = m_mod_storages.find(name);
std::unordered_map<std::string, ModMetadata *>::const_iterator it = m_mod_storages.find(name);
if (it != m_mod_storages.end()) {
// Save unconditionaly on unregistration
it->second->save(getModStoragePath());

@ -135,7 +135,7 @@ struct ServerPlayingSound
{
ServerSoundParams params;
SimpleSoundSpec spec;
UNORDERED_SET<u16> clients; // peer ids
std::unordered_set<u16> 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<std::string, MediaInfo> m_media;
std::unordered_map<std::string, MediaInfo> m_media;
/*
Sounds
*/
UNORDERED_MAP<s32, ServerPlayingSound> m_playing_sounds;
std::unordered_map<s32, ServerPlayingSound> m_playing_sounds;
s32 m_next_sound_id;
/*
@ -669,7 +669,7 @@ private:
// value = "" (visible to all players) or player name
std::map<std::string, std::string> m_detached_inventories_player;
UNORDERED_MAP<std::string, ModMetadata *> m_mod_storages;
std::unordered_map<std::string, ModMetadata *> m_mod_storages;
float m_mod_storage_save_timer;
DISABLE_CLASS_COPY(Server);

@ -999,9 +999,10 @@ bool ServerEnvironment::swapNode(v3s16 p, const MapNode &n)
return true;
}
void ServerEnvironment::getObjectsInsideRadius(std::vector<u16> &objects, v3f pos, float radius)
void ServerEnvironment::getObjectsInsideRadius(std::vector<u16> &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<u16> 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<u32, float>::iterator i = m_particle_spawners.begin();
for (std::unordered_map<u32, float>::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<u32, float>::iterator f = m_particle_spawners.find(id);
std::unordered_map<u32, float>::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<u32, u16>::iterator it = m_particle_spawner_attachments.find(id);
std::unordered_map<u32, u16>::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<u16> 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<u16> 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;

@ -190,7 +190,7 @@ enum ClearObjectsMode {
This is not thread-safe. Server uses an environment mutex.
*/
typedef UNORDERED_MAP<u16, ServerActiveObject *> ActiveObjectMap;
typedef std::unordered_map<u16, ServerActiveObject *> 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<ActiveObjectMessage> m_active_object_messages;
// Some timers
@ -431,8 +431,8 @@ private:
// Particles
IntervalLimiter m_particle_management_interval;
UNORDERED_MAP<u32, float> m_particle_spawners;
UNORDERED_MAP<u32, u16> m_particle_spawner_attachments;
std::unordered_map<u32, float> m_particle_spawners;
std::unordered_map<u32, u16> m_particle_spawner_attachments;
};
#endif

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef SERVEROBJECT_HEADER
#define SERVEROBJECT_HEADER
#include <unordered_set>
#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<int> &getAttachmentChildIds()
{ static const UNORDERED_SET<int> rv; return rv; }
virtual const std::unordered_set<int> &getAttachmentChildIds()
{ static const std::unordered_set<int> 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<u32> m_attached_particle_spawners;
std::unordered_set<u32> m_attached_particle_spawners;
private:
// Used for creating objects based on type

@ -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 <string>
#include "util/cpp11_container.h"
#include <list>
#include <set>
@ -45,7 +44,7 @@ typedef std::vector<
>
> SettingsCallbackList;
typedef UNORDERED_MAP<std::string, SettingsCallbackList> SettingsCallbackMap;
typedef std::unordered_map<std::string, SettingsCallbackList> SettingsCallbackMap;
enum ValueType {
VALUETYPE_STRING,
@ -95,7 +94,7 @@ struct SettingsEntry {
bool is_group;
};
typedef UNORDERED_MAP<std::string, SettingsEntry> SettingEntries;
typedef std::unordered_map<std::string, SettingsEntry> SettingEntries;
class Settings {
public:

@ -43,7 +43,7 @@ with this program; ifnot, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include <vector>
#include <fstream>
#include "util/cpp11_container.h"
#include <unordered_map>
#define BUFFER_SIZE 30000
@ -271,8 +271,8 @@ private:
ALCdevice *m_device;
ALCcontext *m_context;
int m_next_id;
UNORDERED_MAP<std::string, std::vector<SoundBuffer*> > m_buffers;
UNORDERED_MAP<int, PlayingSound*> m_sounds_playing;
std::unordered_map<std::string, std::vector<SoundBuffer*>> m_buffers;
std::unordered_map<int, PlayingSound*> m_sounds_playing;
v3f m_listener_pos;
struct FadeState {
FadeState() {}
@ -285,7 +285,7 @@ private:
float target_gain;
};
UNORDERED_MAP<int, FadeState> m_sounds_fading;
std::unordered_map<int, FadeState> 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<std::string, std::vector<SoundBuffer*> >::iterator i = m_buffers.begin();
i != m_buffers.end(); ++i) {
for (std::unordered_map<std::string, std::vector<SoundBuffer*>>::iterator i =
m_buffers.begin(); i != m_buffers.end(); ++i) {
for (std::vector<SoundBuffer*>::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<std::string, std::vector<SoundBuffer*> >::iterator i =
std::unordered_map<std::string, std::vector<SoundBuffer*>>::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<std::string, std::vector<SoundBuffer*> >::iterator i =
std::unordered_map<std::string, std::vector<SoundBuffer*>>::iterator i =
m_buffers.find(name);
if(i == m_buffers.end())
return NULL;
@ -461,7 +461,7 @@ public:
void deleteSound(int id)
{
UNORDERED_MAP<int, PlayingSound*>::iterator i = m_sounds_playing.find(id);
std::unordered_map<int, PlayingSound*>::iterator i = m_sounds_playing.find(id);
if(i == m_sounds_playing.end())
return;
PlayingSound *sound = i->second;
@ -501,7 +501,7 @@ public:
<<m_sounds_playing.size()<<" playing sounds, "
<<m_buffers.size()<<" sound names loaded"<<std::endl;
std::set<int> del_list;
for(UNORDERED_MAP<int, PlayingSound*>::iterator i = m_sounds_playing.begin();
for(std::unordered_map<int, PlayingSound*>::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<int, FadeState>::iterator i = m_sounds_fading.begin();
for (std::unordered_map<int, FadeState>::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<int, PlayingSound*>::iterator i = m_sounds_playing.find(id);
std::unordered_map<int, PlayingSound*>::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<int, PlayingSound*>::iterator i = m_sounds_playing.find(id);
std::unordered_map<int, PlayingSound*>::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<int, PlayingSound*>::iterator i = m_sounds_playing.find(id);
std::unordered_map<int, PlayingSound*>::iterator i = m_sounds_playing.find(id);
if (i == m_sounds_playing.end())
return 0;

@ -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<int, float>::const_iterator
for (std::unordered_map<int, float>::const_iterator
j = cap->times.begin(); j != cap->times.end(); ++j) {
writeS16(os, j->first);
writeF1000(os, j->second);

@ -23,12 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h"
#include <string>
#include <iostream>
#include "util/cpp11_container.h"
#include "itemgroup.h"
struct ToolGroupCap
{
UNORDERED_MAP<int, float> times;
std::unordered_map<int, float> times;
int maxlevel;
int uses;
@ -39,7 +38,7 @@ struct ToolGroupCap
bool getTime(int rating, float *time) const
{
UNORDERED_MAP<int, float>::const_iterator i = times.find(rating);
std::unordered_map<int, float>::const_iterator i = times.find(rating);
if (i == times.end()) {
*time = 0;
return false;
@ -50,8 +49,8 @@ struct ToolGroupCap
};
typedef UNORDERED_MAP<std::string, struct ToolGroupCap> ToolGCMap;
typedef UNORDERED_MAP<std::string, s16> DamageGroup;
typedef std::unordered_map<std::string, struct ToolGroupCap> ToolGCMap;
typedef std::unordered_map<std::string, s16> DamageGroup;
struct ToolCapabilities
{

@ -1,32 +0,0 @@
/*
Minetest
Copyright (C) 2016 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
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

@ -1,43 +0,0 @@
/*
Minetest
Copyright (C) 2016 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
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 <unordered_map>
#include <unordered_set>
#define UNORDERED_MAP std::unordered_map
#define UNORDERED_SET std::unordered_set
#else
#include <map>
#include <set>
#define UNORDERED_MAP std::map
#define UNORDERED_SET std::set
#endif
#endif

@ -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 <stdlib.h>
#include <string>
#include <cstring>
@ -30,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sstream>
#include <iomanip>
#include <cctype>
#include <unordered_map>
#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<std::string, std::string> StringMap;
typedef std::unordered_map<std::string, std::string> StringMap;
struct FlagDesc {
const char *name;

@ -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;