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;
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;
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;
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());
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());
#include <map>
#include <set>
#include <vector>
+#include <unordered_set>
#include "clientobject.h"
#include "gamedef.h"
#include "inventorymanager.h"
// 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;
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;
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;
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);
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;
}
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);
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;
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;
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();
};
};
+typedef std::unordered_map<u16, ClientActiveObject*> ClientActiveObjectMap;
class ClientEnvironment : public Environment
{
public:
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;
{
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;
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);
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;
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())
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())
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())
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())
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())
//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);
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;
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())
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())
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())
#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>
const u64 m_connection_time;
};
+typedef std::unordered_map<u16, RemoteClient*> RemoteClientMap;
+
class ClientInterface {
public:
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 */
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
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;
#include <map>
#include <set>
#include <vector>
-#include "util/cpp11_container.h"
+#include <unordered_map>
class Client;
struct HTTPFetchResult;
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
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;
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;
#include "irrlichttypes_extrabloated.h"
#include "activeobject.h"
#include <map>
-#include "util/cpp11_container.h"
+#include <unordered_map>
class ClientEnvironment;
class ITextureSource;
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
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),
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)),
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;
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;
#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
// 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),
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;
}
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);
}
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);
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
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++;
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);
}
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
// (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++;
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);
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:
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;
}
};
-typedef UNORDERED_MAP<std::string, std::string> PlayerAttributes;
+typedef std::unordered_map<std::string, std::string> PlayerAttributes;
class RemotePlayer;
class PlayerSAO : public UnitSAO
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())
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;
#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;
#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.
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;
};
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;
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;
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 {
#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)
{
#include "voxel.h"
#include "modifiedstate.h"
#include "util/container.h"
-#include "util/cpp11_container.h"
#include "nodetimer.h"
#include "map_settings_manager.h"
#include "irrlichttypes_extrabloated.h"
#include "client/tile.h"
#include "voxel.h"
-#include "util/cpp11_container.h"
#include <map>
class Client;
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;
}
}
// 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
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);
}
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)
#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);
#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"
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 {
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;
}
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;
}
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;
}
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;
}
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;
}
#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"
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();
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++;
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;
// 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) + "\"";
}
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)
#include <string>
#include <map>
#include <json/json.h>
-#include "util/cpp11_container.h"
+#include <unordered_set>
#include "config.h"
#include "metadata.h"
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;
// 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() {}
{
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);
#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
{
m_id_to_name[id] = name;
m_name_to_id[name] = id;
}
+
void removeId(u16 id)
{
std::string name;
}
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;
}
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;
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
*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);
*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())
*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;
// 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;
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;
}
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;
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(
}
// 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();
#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.
int countNonPrivate() const;
Inventory *m_inventory;
- UNORDERED_SET<std::string> m_privatevars;
+ std::unordered_set<std::string> m_privatevars;
};
#include "mapblock.h"
#include "nodedef.h"
#include "util/timetaker.h"
-#include "util/cpp11.h"
ReflowScan::ReflowScan(Map *map, INodeDefManager *ndef) :
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");
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");
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");
}
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();
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);
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);
#define C_CONVERTER_H_
#include <vector>
-#include "util/cpp11_container.h"
+#include <unordered_map>
#include "irrlichttypes_bloated.h"
#include "common/c_types.h"
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,
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);
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)) {
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;
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;
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))
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))
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
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;
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());
// 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(;;) {
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>;
}
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
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;
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;
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);
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;
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
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;
}
/*
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);
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) {
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());
{
ServerSoundParams params;
SimpleSoundSpec spec;
- UNORDERED_SET<u16> clients; // peer ids
+ std::unordered_set<u16> clients; // peer ids
};
class Server : public con::PeerHandler, public MapEventReceiver,
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;
/*
// 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);
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;
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)
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
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) {
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;
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);
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;
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;
- 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;
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(): "
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;
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;
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
{
// 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
// 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
#ifndef SERVEROBJECT_HEADER
#define SERVEROBJECT_HEADER
+#include <unordered_set>
#include "irrlichttypes_bloated.h"
#include "activeobject.h"
#include "inventorymanager.h"
{}
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()
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
#include "util/string.h"
#include "threading/mutex.h"
#include <string>
-#include "util/cpp11_container.h"
#include <list>
#include <set>
>
> SettingsCallbackList;
-typedef UNORDERED_MAP<std::string, SettingsCallbackList> SettingsCallbackMap;
+typedef std::unordered_map<std::string, SettingsCallbackList> SettingsCallbackMap;
enum ValueType {
VALUETYPE_STRING,
bool is_group;
};
-typedef UNORDERED_MAP<std::string, SettingsEntry> SettingEntries;
+typedef std::unordered_map<std::string, SettingsEntry> SettingEntries;
class Settings {
public:
#include "porting.h"
#include <vector>
#include <fstream>
-#include "util/cpp11_container.h"
+#include <unordered_map>
#define BUFFER_SIZE 30000
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() {}
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;
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;
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);
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;
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;
<<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;
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);
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;
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;
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;
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);
#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;
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;
};
-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
{
+++ /dev/null
-/*
-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
+++ /dev/null
-/*
-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
#define UTIL_STRING_HEADER
#include "irrlichttypes_bloated.h"
-#include "cpp11_container.h"
#include <stdlib.h>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <cctype>
+#include <unordered_map>
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
(((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;
#include "voxel.h"
#include "mapnode.h"
#include "util/container.h"
-#include "util/cpp11_container.h"
class Map;
class ServerMap;