forked from Mirrorlandia_minetest/minetest
C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821)
This commit is contained in:
parent
2362d3f926
commit
a98baef5e4
@ -242,7 +242,7 @@ Client::~Client()
|
|||||||
delete m_inventory_from_server;
|
delete m_inventory_from_server;
|
||||||
|
|
||||||
// Delete detached inventories
|
// 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.begin();
|
||||||
i != m_detached_inventories.end(); ++i) {
|
i != m_detached_inventories.end(); ++i) {
|
||||||
delete i->second;
|
delete i->second;
|
||||||
@ -571,7 +571,7 @@ void Client::step(float dtime)
|
|||||||
Update positions of sounds attached to objects
|
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) {
|
i != m_sounds_to_objects.end(); ++i) {
|
||||||
int client_id = i->first;
|
int client_id = i->first;
|
||||||
u16 object_id = i->second;
|
u16 object_id = i->second;
|
||||||
@ -591,7 +591,7 @@ void Client::step(float dtime)
|
|||||||
m_removed_sounds_check_timer = 0;
|
m_removed_sounds_check_timer = 0;
|
||||||
// Find removed sounds and clear references to them
|
// Find removed sounds and clear references to them
|
||||||
std::vector<s32> removed_server_ids;
|
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();) {
|
i != m_sounds_server_to_client.end();) {
|
||||||
s32 server_id = i->first;
|
s32 server_id = i->first;
|
||||||
int client_id = i->second;
|
int client_id = i->second;
|
||||||
@ -614,7 +614,7 @@ void Client::step(float dtime)
|
|||||||
if (m_mod_storage_save_timer <= 0.0f) {
|
if (m_mod_storage_save_timer <= 0.0f) {
|
||||||
verbosestream << "Saving registered mod storages." << std::endl;
|
verbosestream << "Saving registered mod storages." << std::endl;
|
||||||
m_mod_storage_save_timer = g_settings->getFloat("server_map_save_interval");
|
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) {
|
it = m_mod_storages.begin(); it != m_mod_storages.end(); ++it) {
|
||||||
if (it->second->isModified()) {
|
if (it->second->isModified()) {
|
||||||
it->second->save(getModStoragePath());
|
it->second->save(getModStoragePath());
|
||||||
@ -1959,7 +1959,8 @@ bool Client::registerModStorage(ModMetadata *storage)
|
|||||||
|
|
||||||
void Client::unregisterModStorage(const std::string &name)
|
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()) {
|
if (it != m_mod_storages.end()) {
|
||||||
// Save unconditionaly on unregistration
|
// Save unconditionaly on unregistration
|
||||||
it->second->save(getModStoragePath());
|
it->second->save(getModStoragePath());
|
||||||
|
13
src/client.h
13
src/client.h
@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <unordered_set>
|
||||||
#include "clientobject.h"
|
#include "clientobject.h"
|
||||||
#include "gamedef.h"
|
#include "gamedef.h"
|
||||||
#include "inventorymanager.h"
|
#include "inventorymanager.h"
|
||||||
@ -656,18 +657,18 @@ private:
|
|||||||
// Sounds
|
// Sounds
|
||||||
float m_removed_sounds_check_timer;
|
float m_removed_sounds_check_timer;
|
||||||
// Mapping from server sound ids to our sound ids
|
// 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!
|
// 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
|
// And relations to objects
|
||||||
UNORDERED_MAP<int, u16> m_sounds_to_objects;
|
std::unordered_map<int, u16> m_sounds_to_objects;
|
||||||
|
|
||||||
// Privileges
|
// Privileges
|
||||||
UNORDERED_SET<std::string> m_privileges;
|
std::unordered_set<std::string> m_privileges;
|
||||||
|
|
||||||
// Detached inventories
|
// Detached inventories
|
||||||
// key = name
|
// 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
|
// Storage for mesh data for creating multiple instances of the same mesh
|
||||||
StringMap m_mesh_data;
|
StringMap m_mesh_data;
|
||||||
@ -682,7 +683,7 @@ private:
|
|||||||
|
|
||||||
ClientScripting *m_script;
|
ClientScripting *m_script;
|
||||||
bool m_modding_enabled;
|
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;
|
float m_mod_storage_save_timer;
|
||||||
GameUIFlags *m_game_ui_flags;
|
GameUIFlags *m_game_ui_flags;
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ private:
|
|||||||
std::vector<video::ITexture*> m_texture_trash;
|
std::vector<video::ITexture*> m_texture_trash;
|
||||||
|
|
||||||
// Maps image file names to loaded palettes.
|
// 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
|
// Cached settings needed for making textures from meshes
|
||||||
bool m_setting_trilinear_filter;
|
bool m_setting_trilinear_filter;
|
||||||
@ -700,7 +700,7 @@ Palette* TextureSource::getPalette(const std::string &name)
|
|||||||
if (name == "")
|
if (name == "")
|
||||||
return NULL;
|
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()) {
|
if (it == m_palettes.end()) {
|
||||||
// Create palette
|
// Create palette
|
||||||
video::IImage *img = generateImage(name);
|
video::IImage *img = generateImage(name);
|
||||||
|
@ -55,7 +55,7 @@ ClientEnvironment::ClientEnvironment(ClientMap *map, scene::ISceneManager *smgr,
|
|||||||
ClientEnvironment::~ClientEnvironment()
|
ClientEnvironment::~ClientEnvironment()
|
||||||
{
|
{
|
||||||
// delete active objects
|
// delete active objects
|
||||||
for (UNORDERED_MAP<u16, ClientActiveObject*>::iterator i = m_active_objects.begin();
|
for (ClientActiveObjectMap::iterator i = m_active_objects.begin();
|
||||||
i != m_active_objects.end(); ++i) {
|
i != m_active_objects.end(); ++i) {
|
||||||
delete i->second;
|
delete i->second;
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ void ClientEnvironment::step(float dtime)
|
|||||||
|
|
||||||
g_profiler->avg("CEnv: num of objects", m_active_objects.size());
|
g_profiler->avg("CEnv: num of objects", m_active_objects.size());
|
||||||
bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21);
|
bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21);
|
||||||
for (UNORDERED_MAP<u16, ClientActiveObject*>::iterator i = m_active_objects.begin();
|
for (ClientActiveObjectMap::iterator i = m_active_objects.begin();
|
||||||
i != m_active_objects.end(); ++i) {
|
i != m_active_objects.end(); ++i) {
|
||||||
ClientActiveObject* obj = i->second;
|
ClientActiveObject* obj = i->second;
|
||||||
// Step object
|
// Step object
|
||||||
@ -406,14 +406,14 @@ GenericCAO* ClientEnvironment::getGenericCAO(u16 id)
|
|||||||
|
|
||||||
ClientActiveObject* ClientEnvironment::getActiveObject(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())
|
if (n == m_active_objects.end())
|
||||||
return NULL;
|
return NULL;
|
||||||
return n->second;
|
return n->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFreeClientActiveObjectId(const u16 id,
|
bool isFreeClientActiveObjectId(const u16 id,
|
||||||
UNORDERED_MAP<u16, ClientActiveObject*> &objects)
|
ClientActiveObjectMap &objects)
|
||||||
{
|
{
|
||||||
if(id == 0)
|
if(id == 0)
|
||||||
return false;
|
return false;
|
||||||
@ -421,7 +421,7 @@ bool isFreeClientActiveObjectId(const u16 id,
|
|||||||
return objects.find(id) == objects.end();
|
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
|
//try to reuse id's as late as possible
|
||||||
static u16 last_used_id = 0;
|
static u16 last_used_id = 0;
|
||||||
@ -583,7 +583,7 @@ void ClientEnvironment::updateLocalPlayerBreath(u16 breath)
|
|||||||
void ClientEnvironment::getActiveObjects(v3f origin, f32 max_d,
|
void ClientEnvironment::getActiveObjects(v3f origin, f32 max_d,
|
||||||
std::vector<DistanceSortedActiveObject> &dest)
|
std::vector<DistanceSortedActiveObject> &dest)
|
||||||
{
|
{
|
||||||
for (UNORDERED_MAP<u16, ClientActiveObject*>::iterator i = m_active_objects.begin();
|
for (ClientActiveObjectMap::iterator i = m_active_objects.begin();
|
||||||
i != m_active_objects.end(); ++i) {
|
i != m_active_objects.end(); ++i) {
|
||||||
ClientActiveObject* obj = i->second;
|
ClientActiveObject* obj = i->second;
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ struct ClientEnvEvent
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::unordered_map<u16, ClientActiveObject*> ClientActiveObjectMap;
|
||||||
class ClientEnvironment : public Environment
|
class ClientEnvironment : public Environment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -181,7 +182,7 @@ private:
|
|||||||
Client *m_client;
|
Client *m_client;
|
||||||
ClientScripting *m_script;
|
ClientScripting *m_script;
|
||||||
IrrlichtDevice *m_irr;
|
IrrlichtDevice *m_irr;
|
||||||
UNORDERED_MAP<u16, ClientActiveObject*> m_active_objects;
|
ClientActiveObjectMap m_active_objects;
|
||||||
std::vector<ClientSimpleObject*> m_simple_objects;
|
std::vector<ClientSimpleObject*> m_simple_objects;
|
||||||
std::queue<ClientEnvEvent> m_client_event_queue;
|
std::queue<ClientEnvEvent> m_client_event_queue;
|
||||||
IntervalLimiter m_active_object_light_update_interval;
|
IntervalLimiter m_active_object_light_update_interval;
|
||||||
|
@ -611,7 +611,7 @@ ClientInterface::~ClientInterface()
|
|||||||
{
|
{
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
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) {
|
i != m_clients.end(); ++i) {
|
||||||
// Delete client
|
// Delete client
|
||||||
delete i->second;
|
delete i->second;
|
||||||
@ -624,7 +624,7 @@ std::vector<u16> ClientInterface::getClientIDs(ClientState min_state)
|
|||||||
std::vector<u16> reply;
|
std::vector<u16> reply;
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
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) {
|
i != m_clients.end(); ++i) {
|
||||||
if (i->second->getState() >= min_state)
|
if (i->second->getState() >= min_state)
|
||||||
reply.push_back(i->second->peer_id);
|
reply.push_back(i->second->peer_id);
|
||||||
@ -682,7 +682,7 @@ void ClientInterface::send(u16 peer_id, u8 channelnum,
|
|||||||
void ClientInterface::sendToAll(NetworkPacket *pkt)
|
void ClientInterface::sendToAll(NetworkPacket *pkt)
|
||||||
{
|
{
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
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) {
|
i != m_clients.end(); ++i) {
|
||||||
RemoteClient *client = i->second;
|
RemoteClient *client = i->second;
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ void ClientInterface::sendToAll(NetworkPacket *pkt)
|
|||||||
RemoteClient* ClientInterface::getClientNoEx(u16 peer_id, ClientState state_min)
|
RemoteClient* ClientInterface::getClientNoEx(u16 peer_id, ClientState state_min)
|
||||||
{
|
{
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
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
|
// The client may not exist; clients are immediately removed if their
|
||||||
// access is denied, and this event occurs later then.
|
// access is denied, and this event occurs later then.
|
||||||
if (n == m_clients.end())
|
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)
|
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
|
// The client may not exist; clients are immediately removed if their
|
||||||
// access is denied, and this event occurs later then.
|
// access is denied, and this event occurs later then.
|
||||||
if (n == m_clients.end())
|
if (n == m_clients.end())
|
||||||
@ -726,7 +726,7 @@ RemoteClient* ClientInterface::lockedGetClientNoEx(u16 peer_id, ClientState stat
|
|||||||
ClientState ClientInterface::getClientState(u16 peer_id)
|
ClientState ClientInterface::getClientState(u16 peer_id)
|
||||||
{
|
{
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
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
|
// The client may not exist; clients are immediately removed if their
|
||||||
// access is denied, and this event occurs later then.
|
// access is denied, and this event occurs later then.
|
||||||
if (n == m_clients.end())
|
if (n == m_clients.end())
|
||||||
@ -738,7 +738,7 @@ ClientState ClientInterface::getClientState(u16 peer_id)
|
|||||||
void ClientInterface::setPlayerName(u16 peer_id,std::string name)
|
void ClientInterface::setPlayerName(u16 peer_id,std::string name)
|
||||||
{
|
{
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
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
|
// The client may not exist; clients are immediately removed if their
|
||||||
// access is denied, and this event occurs later then.
|
// access is denied, and this event occurs later then.
|
||||||
if (n != m_clients.end())
|
if (n != m_clients.end())
|
||||||
@ -750,7 +750,7 @@ void ClientInterface::DeleteClient(u16 peer_id)
|
|||||||
MutexAutoLock conlock(m_clients_mutex);
|
MutexAutoLock conlock(m_clients_mutex);
|
||||||
|
|
||||||
// Error check
|
// 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
|
// The client may not exist; clients are immediately removed if their
|
||||||
// access is denied, and this event occurs later then.
|
// access is denied, and this event occurs later then.
|
||||||
if (n == m_clients.end())
|
if (n == m_clients.end())
|
||||||
@ -762,10 +762,8 @@ void ClientInterface::DeleteClient(u16 peer_id)
|
|||||||
//TODO this should be done by client destructor!!!
|
//TODO this should be done by client destructor!!!
|
||||||
RemoteClient *client = n->second;
|
RemoteClient *client = n->second;
|
||||||
// Handle objects
|
// Handle objects
|
||||||
for(std::set<u16>::iterator
|
for (std::set<u16>::iterator i = client->m_known_objects.begin();
|
||||||
i = client->m_known_objects.begin();
|
i != client->m_known_objects.end(); ++i) {
|
||||||
i != client->m_known_objects.end(); ++i)
|
|
||||||
{
|
|
||||||
// Get object
|
// Get object
|
||||||
u16 id = *i;
|
u16 id = *i;
|
||||||
ServerActiveObject* obj = m_env->getActiveObject(id);
|
ServerActiveObject* obj = m_env->getActiveObject(id);
|
||||||
@ -784,7 +782,7 @@ void ClientInterface::CreateClient(u16 peer_id)
|
|||||||
MutexAutoLock conlock(m_clients_mutex);
|
MutexAutoLock conlock(m_clients_mutex);
|
||||||
|
|
||||||
// Error check
|
// 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
|
// The client shouldn't already exist
|
||||||
if (n != m_clients.end()) return;
|
if (n != m_clients.end()) return;
|
||||||
|
|
||||||
@ -800,7 +798,7 @@ void ClientInterface::event(u16 peer_id, ClientStateEvent event)
|
|||||||
MutexAutoLock clientlock(m_clients_mutex);
|
MutexAutoLock clientlock(m_clients_mutex);
|
||||||
|
|
||||||
// Error check
|
// 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
|
// No client to deliver event
|
||||||
if (n == m_clients.end())
|
if (n == m_clients.end())
|
||||||
@ -821,7 +819,7 @@ u16 ClientInterface::getProtocolVersion(u16 peer_id)
|
|||||||
MutexAutoLock conlock(m_clients_mutex);
|
MutexAutoLock conlock(m_clients_mutex);
|
||||||
|
|
||||||
// Error check
|
// 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
|
// No client to get version
|
||||||
if (n == m_clients.end())
|
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);
|
MutexAutoLock conlock(m_clients_mutex);
|
||||||
|
|
||||||
// Error check
|
// 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
|
// No client to set versions
|
||||||
if (n == m_clients.end())
|
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 "serialization.h" // for SER_FMT_VER_INVALID
|
||||||
#include "threading/mutex.h"
|
#include "threading/mutex.h"
|
||||||
#include "network/networkpacket.h"
|
#include "network/networkpacket.h"
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -435,6 +434,8 @@ private:
|
|||||||
const u64 m_connection_time;
|
const u64 m_connection_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::unordered_map<u16, RemoteClient*> RemoteClientMap;
|
||||||
|
|
||||||
class ClientInterface {
|
class ClientInterface {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -499,7 +500,7 @@ protected:
|
|||||||
void lock() { m_clients_mutex.lock(); }
|
void lock() { m_clients_mutex.lock(); }
|
||||||
void unlock() { m_clients_mutex.unlock(); }
|
void unlock() { m_clients_mutex.unlock(); }
|
||||||
|
|
||||||
UNORDERED_MAP<u16, RemoteClient*>& getClientList() { return m_clients; }
|
RemoteClientMap& getClientList() { return m_clients; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* update internal player list */
|
/* update internal player list */
|
||||||
@ -509,7 +510,7 @@ private:
|
|||||||
con::Connection* m_con;
|
con::Connection* m_con;
|
||||||
Mutex m_clients_mutex;
|
Mutex m_clients_mutex;
|
||||||
// Connected clients (behind the con 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
|
std::vector<std::string> m_clients_names; //for announcing masterserver
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
|
@ -348,7 +348,7 @@ void ClientMediaDownloader::remoteMediaReceived(
|
|||||||
|
|
||||||
std::string name;
|
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);
|
m_remote_file_transfers.find(fetch_result.request_id);
|
||||||
assert(it != m_remote_file_transfers.end());
|
assert(it != m_remote_file_transfers.end());
|
||||||
name = it->second;
|
name = it->second;
|
||||||
|
@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_map>
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
struct HTTPFetchResult;
|
struct HTTPFetchResult;
|
||||||
@ -138,7 +138,7 @@ private:
|
|||||||
s32 m_httpfetch_active;
|
s32 m_httpfetch_active;
|
||||||
s32 m_httpfetch_active_limit;
|
s32 m_httpfetch_active_limit;
|
||||||
s32 m_outstanding_hash_sets;
|
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
|
// All files up to this name have either been received from a
|
||||||
// remote server or failed on all remote servers, so those files
|
// remote server or failed on all remote servers, so those files
|
||||||
|
@ -42,7 +42,7 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
|
|||||||
Client *client, ClientEnvironment *env)
|
Client *client, ClientEnvironment *env)
|
||||||
{
|
{
|
||||||
// Find factory function
|
// Find factory function
|
||||||
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()) {
|
if (n == m_types.end()) {
|
||||||
// If factory is not found, just return.
|
// If factory is not found, just return.
|
||||||
warningstream << "ClientActiveObject: No factory for type="
|
warningstream << "ClientActiveObject: No factory for type="
|
||||||
@ -57,7 +57,7 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
|
|||||||
|
|
||||||
void ClientActiveObject::registerType(u16 type, Factory f)
|
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())
|
if(n != m_types.end())
|
||||||
return;
|
return;
|
||||||
m_types[type] = f;
|
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 "irrlichttypes_extrabloated.h"
|
||||||
#include "activeobject.h"
|
#include "activeobject.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_map>
|
||||||
|
|
||||||
class ClientEnvironment;
|
class ClientEnvironment;
|
||||||
class ITextureSource;
|
class ITextureSource;
|
||||||
@ -89,7 +89,7 @@ protected:
|
|||||||
ClientEnvironment *m_env;
|
ClientEnvironment *m_env;
|
||||||
private:
|
private:
|
||||||
// Used for creating objects based on type
|
// Used for creating objects based on type
|
||||||
static UNORDERED_MAP<u16, Factory> m_types;
|
static std::unordered_map<u16, Factory> m_types;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DistanceSortedActiveObject
|
struct DistanceSortedActiveObject
|
||||||
|
@ -49,7 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
class Settings;
|
class Settings;
|
||||||
struct ToolCapabilities;
|
struct ToolCapabilities;
|
||||||
|
|
||||||
UNORDERED_MAP<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
|
std::unordered_map<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
|
||||||
|
|
||||||
SmoothTranslator::SmoothTranslator():
|
SmoothTranslator::SmoothTranslator():
|
||||||
vect_old(0,0,0),
|
vect_old(0,0,0),
|
||||||
@ -565,7 +565,7 @@ GenericCAO::GenericCAO(Client *client, ClientEnvironment *env):
|
|||||||
m_animation_speed(15),
|
m_animation_speed(15),
|
||||||
m_animation_blend(0),
|
m_animation_blend(0),
|
||||||
m_animation_loop(true),
|
m_animation_loop(true),
|
||||||
m_bone_position(UNORDERED_MAP<std::string, core::vector2d<v3f> >()),
|
m_bone_position(),
|
||||||
m_attachment_bone(""),
|
m_attachment_bone(""),
|
||||||
m_attachment_position(v3f(0,0,0)),
|
m_attachment_position(v3f(0,0,0)),
|
||||||
m_attachment_rotation(v3f(0,0,0)),
|
m_attachment_rotation(v3f(0,0,0)),
|
||||||
@ -1493,7 +1493,7 @@ void GenericCAO::updateBonePosition()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_animated_meshnode->setJointMode(irr::scene::EJUOR_CONTROL); // To write positions to the mesh on render
|
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) {
|
ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) {
|
||||||
std::string bone_name = (*ii).first;
|
std::string bone_name = (*ii).first;
|
||||||
v3f bone_pos = (*ii).second.X;
|
v3f bone_pos = (*ii).second.X;
|
||||||
|
@ -91,7 +91,8 @@ private:
|
|||||||
int m_animation_speed;
|
int m_animation_speed;
|
||||||
int m_animation_blend;
|
int m_animation_blend;
|
||||||
bool m_animation_loop;
|
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;
|
std::string m_attachment_bone;
|
||||||
v3f m_attachment_position;
|
v3f m_attachment_position;
|
||||||
v3f m_attachment_rotation;
|
v3f m_attachment_rotation;
|
||||||
|
@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
#include "util/cpp11.h"
|
|
||||||
|
|
||||||
// Distance of light extrapolation (for oversized nodes)
|
// Distance of light extrapolation (for oversized nodes)
|
||||||
// After this distance, it gives up and considers light level constant
|
// 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
|
// Corresponding offsets are listed in g_27dirs
|
||||||
#define FRAMED_NEIGHBOR_COUNT 18
|
#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),
|
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);
|
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;
|
return m_attachment_child_ids;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ LuaEntitySAO::~LuaEntitySAO()
|
|||||||
m_env->getScriptIface()->luaentity_Remove(m_id);
|
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) {
|
it != m_attached_particle_spawners.end(); ++it) {
|
||||||
m_env->deleteParticleSpawner(*it, false);
|
m_env->deleteParticleSpawner(*it, false);
|
||||||
}
|
}
|
||||||
@ -461,7 +461,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
|
|||||||
|
|
||||||
if(m_bone_position_sent == false){
|
if(m_bone_position_sent == false){
|
||||||
m_bone_position_sent = true;
|
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){
|
ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){
|
||||||
std::string str = gob_cmd_update_bone_position((*ii).first,
|
std::string str = gob_cmd_update_bone_position((*ii).first,
|
||||||
(*ii).second.X, (*ii).second.Y);
|
(*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_armor_groups(m_armor_groups)); // 2
|
||||||
msg_os << serializeLongString(gob_cmd_update_animation(
|
msg_os << serializeLongString(gob_cmd_update_animation(
|
||||||
m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3
|
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) {
|
ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) {
|
||||||
msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first,
|
msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first,
|
||||||
(*ii).second.X, (*ii).second.Y)); // m_bone_position.size
|
(*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,
|
msg_os << serializeLongString(gob_cmd_update_attachment(m_attachment_parent_id,
|
||||||
m_attachment_bone, m_attachment_position, m_attachment_rotation)); // 4
|
m_attachment_bone, m_attachment_position, m_attachment_rotation)); // 4
|
||||||
int message_count = 4 + m_bone_position.size();
|
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) {
|
(ii != m_attachment_child_ids.end()); ++ii) {
|
||||||
if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) {
|
if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) {
|
||||||
message_count++;
|
message_count++;
|
||||||
@ -868,7 +868,7 @@ void PlayerSAO::removingFromEnvironment()
|
|||||||
ServerActiveObject::removingFromEnvironment();
|
ServerActiveObject::removingFromEnvironment();
|
||||||
if (m_player->getPlayerSAO() == this) {
|
if (m_player->getPlayerSAO() == this) {
|
||||||
unlinkPlayerSessionAndSave();
|
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) {
|
it != m_attached_particle_spawners.end(); ++it) {
|
||||||
m_env->deleteParticleSpawner(*it, false);
|
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_armor_groups(m_armor_groups)); // 2
|
||||||
msg_os << serializeLongString(gob_cmd_update_animation(
|
msg_os << serializeLongString(gob_cmd_update_animation(
|
||||||
m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3
|
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) {
|
ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) {
|
||||||
msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first,
|
msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first,
|
||||||
(*ii).second.X, (*ii).second.Y)); // m_bone_position.size
|
(*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.
|
// (GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES) : Deprecated, for backwards compatibility only.
|
||||||
msg_os << serializeLongString(gob_cmd_update_nametag_attributes(m_prop.nametag_color)); // 6
|
msg_os << serializeLongString(gob_cmd_update_nametag_attributes(m_prop.nametag_color)); // 6
|
||||||
int message_count = 6 + m_bone_position.size();
|
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) {
|
ii != m_attachment_child_ids.end(); ++ii) {
|
||||||
if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) {
|
if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) {
|
||||||
message_count++;
|
message_count++;
|
||||||
@ -1083,7 +1083,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
|||||||
|
|
||||||
if (!m_bone_position_sent) {
|
if (!m_bone_position_sent) {
|
||||||
m_bone_position_sent = true;
|
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) {
|
ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) {
|
||||||
std::string str = gob_cmd_update_bone_position((*ii).first,
|
std::string str = gob_cmd_update_bone_position((*ii).first,
|
||||||
(*ii).second.X, (*ii).second.Y);
|
(*ii).second.X, (*ii).second.Y);
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation);
|
void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation);
|
||||||
void addAttachmentChild(int child_id);
|
void addAttachmentChild(int child_id);
|
||||||
void removeAttachmentChild(int child_id);
|
void removeAttachmentChild(int child_id);
|
||||||
const UNORDERED_SET<int> &getAttachmentChildIds();
|
const std::unordered_set<int> &getAttachmentChildIds();
|
||||||
ObjectProperties* accessObjectProperties();
|
ObjectProperties* accessObjectProperties();
|
||||||
void notifyObjectPropertiesModified();
|
void notifyObjectPropertiesModified();
|
||||||
protected:
|
protected:
|
||||||
@ -72,11 +72,11 @@ protected:
|
|||||||
bool m_animation_sent;
|
bool m_animation_sent;
|
||||||
|
|
||||||
// Stores position and rotation for each bone name
|
// 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;
|
bool m_bone_position_sent;
|
||||||
|
|
||||||
int m_attachment_parent_id;
|
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;
|
std::string m_attachment_bone;
|
||||||
v3f m_attachment_position;
|
v3f m_attachment_position;
|
||||||
v3f m_attachment_rotation;
|
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 RemotePlayer;
|
||||||
|
|
||||||
class PlayerSAO : public UnitSAO
|
class PlayerSAO : public UnitSAO
|
||||||
|
@ -375,7 +375,7 @@ bool EmergeManager::pushBlockEmergeData(
|
|||||||
bool EmergeManager::popBlockEmergeData(v3s16 pos, BlockEmergeData *bedata)
|
bool EmergeManager::popBlockEmergeData(v3s16 pos, BlockEmergeData *bedata)
|
||||||
{
|
{
|
||||||
std::map<v3s16, BlockEmergeData>::iterator it;
|
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);
|
it = m_blocks_enqueued.find(pos);
|
||||||
if (it == m_blocks_enqueued.end())
|
if (it == m_blocks_enqueued.end())
|
||||||
|
@ -157,7 +157,7 @@ private:
|
|||||||
|
|
||||||
Mutex m_queue_mutex;
|
Mutex m_queue_mutex;
|
||||||
std::map<v3s16, BlockEmergeData> m_blocks_enqueued;
|
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_total;
|
||||||
u16 m_qlimit_diskonly;
|
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"
|
#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;
|
Mutex FacePositionCache::cache_mutex;
|
||||||
|
|
||||||
// Calculate the borders of a "d-radius" cube
|
// Calculate the borders of a "d-radius" cube
|
||||||
const std::vector<v3s16> &FacePositionCache::getFacePositions(u16 d)
|
const std::vector<v3s16> &FacePositionCache::getFacePositions(u16 d)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(cache_mutex);
|
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())
|
if (it != cache.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
#include "threading/mutex.h"
|
#include "threading/mutex.h"
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class permits caching getFacePosition call results.
|
* This class permits caching getFacePosition call results.
|
||||||
@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const std::vector<v3s16> &generateFacePosition(u16 d);
|
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;
|
static Mutex cache_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3807,7 +3807,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
|
|||||||
if (s.ftype == f_Unknown &&
|
if (s.ftype == f_Unknown &&
|
||||||
s.fid == event.GUIEvent.Caller->getID()) {
|
s.fid == event.GUIEvent.Caller->getID()) {
|
||||||
current_field_enter_pending = s.fname;
|
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);
|
field_close_on_enter.find(s.fname);
|
||||||
if (it != field_close_on_enter.end())
|
if (it != field_close_on_enter.end())
|
||||||
close_on_enter = (*it).second;
|
close_on_enter = (*it).second;
|
||||||
|
@ -397,7 +397,7 @@ protected:
|
|||||||
std::vector<ImageDrawSpec> m_images;
|
std::vector<ImageDrawSpec> m_images;
|
||||||
std::vector<ImageDrawSpec> m_itemimages;
|
std::vector<ImageDrawSpec> m_itemimages;
|
||||||
std::vector<BoxDrawSpec> m_boxes;
|
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<FieldSpec> m_fields;
|
||||||
std::vector<StaticTextSpec> m_static_texts;
|
std::vector<StaticTextSpec> m_static_texts;
|
||||||
std::vector<std::pair<FieldSpec,GUITable*> > m_tables;
|
std::vector<std::pair<FieldSpec,GUITable*> > m_tables;
|
||||||
@ -460,7 +460,7 @@ private:
|
|||||||
GUITable::TableOptions table_options;
|
GUITable::TableOptions table_options;
|
||||||
GUITable::TableColumns table_columns;
|
GUITable::TableColumns table_columns;
|
||||||
// used to restore table selection/scroll/treeview state
|
// 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;
|
} parserData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -21,9 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#define ITEMGROUP_HEADER
|
#define ITEMGROUP_HEADER
|
||||||
|
|
||||||
#include <string>
|
#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)
|
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 "voxel.h"
|
||||||
#include "modifiedstate.h"
|
#include "modifiedstate.h"
|
||||||
#include "util/container.h"
|
#include "util/container.h"
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
#include "nodetimer.h"
|
#include "nodetimer.h"
|
||||||
#include "map_settings_manager.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 "irrlichttypes_extrabloated.h"
|
||||||
#include "client/tile.h"
|
#include "client/tile.h"
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
|
@ -42,7 +42,7 @@ void MapSector::deleteBlocks()
|
|||||||
m_block_cache = NULL;
|
m_block_cache = NULL;
|
||||||
|
|
||||||
// Delete all
|
// 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) {
|
i != m_blocks.end(); ++i) {
|
||||||
delete i->second;
|
delete i->second;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ MapBlock * MapSector::getBlockBuffered(s16 y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If block doesn't exist, return NULL
|
// 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);
|
block = (n != m_blocks.end() ? n->second : NULL);
|
||||||
|
|
||||||
// Cache the last result
|
// Cache the last result
|
||||||
@ -127,7 +127,7 @@ void MapSector::deleteBlock(MapBlock *block)
|
|||||||
|
|
||||||
void MapSector::getBlocks(MapBlockVect &dest)
|
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) {
|
bi != m_blocks.end(); ++bi) {
|
||||||
dest.push_back(bi->second);
|
dest.push_back(bi->second);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
// The pile of MapBlocks
|
// The pile of MapBlocks
|
||||||
UNORDERED_MAP<s16, MapBlock*> m_blocks;
|
std::unordered_map<s16, MapBlock*> m_blocks;
|
||||||
|
|
||||||
Map *m_parent;
|
Map *m_parent;
|
||||||
// Position on parent (in MapBlock widths)
|
// Position on parent (in MapBlock widths)
|
||||||
|
@ -208,15 +208,12 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mg->biomemap) {
|
if (mg->biomemap && !biomes.empty()) {
|
||||||
UNORDERED_SET<u8>::iterator iter;
|
std::unordered_set<u8>::const_iterator iter =
|
||||||
|
biomes.find(mg->biomemap[mapindex]);
|
||||||
if (!biomes.empty()) {
|
|
||||||
iter = biomes.find(mg->biomemap[mapindex]);
|
|
||||||
if (iter == biomes.end())
|
if (iter == biomes.end())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
v3s16 pos(x, y, z);
|
v3s16 pos(x, y, z);
|
||||||
if (generate(mg->vm, &ps, pos))
|
if (generate(mg->vm, &ps, pos))
|
||||||
|
@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef MG_DECORATION_HEADER
|
#ifndef MG_DECORATION_HEADER
|
||||||
#define MG_DECORATION_HEADER
|
#define MG_DECORATION_HEADER
|
||||||
|
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_set>
|
||||||
#include "objdef.h"
|
#include "objdef.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
#include "nodedef.h"
|
#include "nodedef.h"
|
||||||
@ -87,9 +87,7 @@ public:
|
|||||||
std::vector<content_t> c_spawnby;
|
std::vector<content_t> c_spawnby;
|
||||||
s16 nspawnby;
|
s16 nspawnby;
|
||||||
|
|
||||||
UNORDERED_SET<u8> biomes;
|
std::unordered_set<u8> biomes;
|
||||||
//std::list<CutoffData> cutoffs;
|
|
||||||
//Mutex cutoff_mutex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DecoSimple : public Decoration {
|
class DecoSimple : public Decoration {
|
||||||
|
@ -150,7 +150,7 @@ void OreScatter::generate(MMVManip *vm, int mapseed, u32 blockseed,
|
|||||||
|
|
||||||
if (biomemap && !biomes.empty()) {
|
if (biomemap && !biomes.empty()) {
|
||||||
u32 index = sizex * (z0 - nmin.Z) + (x0 - nmin.X);
|
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())
|
if (it == biomes.end())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (biomemap && !biomes.empty()) {
|
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())
|
if (it == biomes.end())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ void OrePuff::generate(MMVManip *vm, int mapseed, u32 blockseed,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (biomemap && !biomes.empty()) {
|
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())
|
if (it == biomes.end())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
|
|||||||
|
|
||||||
if (biomemap && !biomes.empty()) {
|
if (biomemap && !biomes.empty()) {
|
||||||
u32 bmapidx = sizex * (z0 - nmin.Z) + (x0 - nmin.X);
|
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())
|
if (it == biomes.end())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed,
|
|||||||
|
|
||||||
if (biomemap && !biomes.empty()) {
|
if (biomemap && !biomes.empty()) {
|
||||||
u32 bmapidx = sizex * (z - nmin.Z) + (x - nmin.X);
|
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())
|
if (it == biomes.end())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef MG_ORE_HEADER
|
#ifndef MG_ORE_HEADER
|
||||||
#define MG_ORE_HEADER
|
#define MG_ORE_HEADER
|
||||||
|
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_set>
|
||||||
#include "objdef.h"
|
#include "objdef.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
#include "nodedef.h"
|
#include "nodedef.h"
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
float nthresh; // threshold for noise at which an ore is placed
|
float nthresh; // threshold for noise at which an ore is placed
|
||||||
NoiseParams np; // noise for distribution of clusters (NULL for uniform scattering)
|
NoiseParams np; // noise for distribution of clusters (NULL for uniform scattering)
|
||||||
Noise *noise;
|
Noise *noise;
|
||||||
UNORDERED_SET<u8> biomes;
|
std::unordered_set<u8> biomes;
|
||||||
|
|
||||||
Ore();
|
Ore();
|
||||||
virtual ~Ore();
|
virtual ~Ore();
|
||||||
|
@ -561,14 +561,14 @@ void Schematic::applyProbabilities(v3s16 p0,
|
|||||||
void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount,
|
void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount,
|
||||||
std::vector<std::string> *usednodes, INodeDefManager *ndef)
|
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;
|
content_t numids = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i != nodecount; i++) {
|
for (size_t i = 0; i != nodecount; i++) {
|
||||||
content_t id;
|
content_t id;
|
||||||
content_t c = nodes[i].getContent();
|
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()) {
|
if (it == nodeidmap.end()) {
|
||||||
id = numids;
|
id = numids;
|
||||||
numids++;
|
numids++;
|
||||||
|
@ -144,7 +144,8 @@ void ModConfiguration::printUnsatisfiedModsError() const
|
|||||||
it != m_unsatisfied_mods.end(); ++it) {
|
it != m_unsatisfied_mods.end(); ++it) {
|
||||||
ModSpec mod = *it;
|
ModSpec mod = *it;
|
||||||
errorstream << "mod \"" << mod.name << "\" has unsatisfied dependencies: ";
|
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)
|
dep_it != mod.unsatisfied_depends.end(); ++dep_it)
|
||||||
errorstream << " \"" << *dep_it << "\"";
|
errorstream << " \"" << *dep_it << "\"";
|
||||||
errorstream << std::endl;
|
errorstream << std::endl;
|
||||||
@ -268,8 +269,8 @@ void ModConfiguration::checkConflictsAndDeps()
|
|||||||
// report on name conflicts
|
// report on name conflicts
|
||||||
if (!m_name_conflicts.empty()) {
|
if (!m_name_conflicts.empty()) {
|
||||||
std::string s = "Unresolved name conflicts for mods ";
|
std::string s = "Unresolved name conflicts for mods ";
|
||||||
for (UNORDERED_SET<std::string>::const_iterator it = m_name_conflicts.begin();
|
for (std::unordered_set<std::string>::const_iterator it =
|
||||||
it != m_name_conflicts.end(); ++it) {
|
m_name_conflicts.begin(); it != m_name_conflicts.end(); ++it) {
|
||||||
if (it != m_name_conflicts.begin()) s += ", ";
|
if (it != m_name_conflicts.begin()) s += ", ";
|
||||||
s += std::string("\"") + (*it) + "\"";
|
s += std::string("\"") + (*it) + "\"";
|
||||||
}
|
}
|
||||||
@ -299,7 +300,7 @@ void ModConfiguration::resolveDependencies()
|
|||||||
ModSpec mod = *it;
|
ModSpec mod = *it;
|
||||||
mod.unsatisfied_depends = mod.depends;
|
mod.unsatisfied_depends = mod.depends;
|
||||||
// check which optional dependencies actually exist
|
// 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) {
|
it_optdep != mod.optdepends.end(); ++it_optdep) {
|
||||||
std::string optdep = *it_optdep;
|
std::string optdep = *it_optdep;
|
||||||
if (modnames.count(optdep) != 0)
|
if (modnames.count(optdep) != 0)
|
||||||
|
10
src/mods.h
10
src/mods.h
@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_set>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
|
|
||||||
@ -38,9 +38,9 @@ struct ModSpec
|
|||||||
std::string name;
|
std::string name;
|
||||||
std::string path;
|
std::string path;
|
||||||
//if normal mod:
|
//if normal mod:
|
||||||
UNORDERED_SET<std::string> depends;
|
std::unordered_set<std::string> depends;
|
||||||
UNORDERED_SET<std::string> optdepends;
|
std::unordered_set<std::string> optdepends;
|
||||||
UNORDERED_SET<std::string> unsatisfied_depends;
|
std::unordered_set<std::string> unsatisfied_depends;
|
||||||
|
|
||||||
bool part_of_modpack;
|
bool part_of_modpack;
|
||||||
bool is_modpack;
|
bool is_modpack;
|
||||||
@ -125,7 +125,7 @@ private:
|
|||||||
// 1. game mod in modpack; 2. game mod;
|
// 1. game mod in modpack; 2. game mod;
|
||||||
// 3. world mod in modpack; 4. world mod;
|
// 3. world mod in modpack; 4. world mod;
|
||||||
// 5. addon mod in modpack; 6. addon 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
|
// Deleted default constructor
|
||||||
ModConfiguration() {}
|
ModConfiguration() {}
|
||||||
|
@ -25,7 +25,7 @@ void NameIdMapping::serialize(std::ostream &os) const
|
|||||||
{
|
{
|
||||||
writeU8(os, 0); // version
|
writeU8(os, 0); // version
|
||||||
writeU16(os, m_id_to_name.size());
|
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) {
|
i != m_id_to_name.end(); ++i) {
|
||||||
writeU16(os, i->first);
|
writeU16(os, i->first);
|
||||||
os << serializeString(i->second);
|
os << serializeString(i->second);
|
||||||
|
@ -23,8 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <unordered_map>
|
||||||
#include "irrlichttypes_bloated.h"
|
#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
|
class NameIdMapping
|
||||||
{
|
{
|
||||||
@ -43,6 +46,7 @@ public:
|
|||||||
m_id_to_name[id] = name;
|
m_id_to_name[id] = name;
|
||||||
m_name_to_id[name] = id;
|
m_name_to_id[name] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeId(u16 id)
|
void removeId(u16 id)
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
@ -63,7 +67,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool getName(u16 id, std::string &result) const
|
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);
|
i = m_id_to_name.find(id);
|
||||||
if (i == m_id_to_name.end())
|
if (i == m_id_to_name.end())
|
||||||
return false;
|
return false;
|
||||||
@ -72,7 +76,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool getId(const std::string &name, u16 &result) const
|
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);
|
i = m_name_to_id.find(name);
|
||||||
if (i == m_name_to_id.end())
|
if (i == m_name_to_id.end())
|
||||||
return false;
|
return false;
|
||||||
@ -82,8 +86,8 @@ public:
|
|||||||
u16 size() const { return m_id_to_name.size(); }
|
u16 size() const { return m_id_to_name.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UNORDERED_MAP<u16, std::string> m_id_to_name;
|
IdToNameMap m_id_to_name;
|
||||||
UNORDERED_MAP<std::string, u16> m_name_to_id;
|
NameToIdMap m_name_to_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -818,7 +818,7 @@ void Client::handleCommand_StopSound(NetworkPacket* pkt)
|
|||||||
|
|
||||||
*pkt >> server_id;
|
*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()) {
|
if (i != m_sounds_server_to_client.end()) {
|
||||||
int client_id = i->second;
|
int client_id = i->second;
|
||||||
m_sound->stopSound(client_id);
|
m_sound->stopSound(client_id);
|
||||||
@ -833,7 +833,7 @@ void Client::handleCommand_FadeSound(NetworkPacket *pkt)
|
|||||||
|
|
||||||
*pkt >> sound_id >> step >> gain;
|
*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);
|
m_sounds_server_to_client.find(sound_id);
|
||||||
|
|
||||||
if (i != m_sounds_server_to_client.end())
|
if (i != m_sounds_server_to_client.end())
|
||||||
|
@ -1695,7 +1695,8 @@ void Server::handleCommand_RemovedSounds(NetworkPacket* pkt)
|
|||||||
|
|
||||||
*pkt >> id;
|
*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())
|
if (i == m_playing_sounds.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -912,12 +912,12 @@ private:
|
|||||||
// item aliases too. Updated by updateAliases()
|
// item aliases too. Updated by updateAliases()
|
||||||
// Note: Not serialized.
|
// 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)
|
// A mapping from groups to a list of content_ts (and their levels)
|
||||||
// that belong to it. Necessary for a direct lookup in getIds().
|
// that belong to it. Necessary for a direct lookup in getIds().
|
||||||
// Note: Not serialized.
|
// 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
|
// Next possibly free id
|
||||||
content_t m_next_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
|
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);
|
i = m_name_id_mapping_with_aliases.find(name);
|
||||||
if(i == m_name_id_mapping_with_aliases.end())
|
if(i == m_name_id_mapping_with_aliases.end())
|
||||||
return false;
|
return false;
|
||||||
@ -1080,7 +1080,7 @@ bool CNodeDefManager::getIds(const std::string &name,
|
|||||||
}
|
}
|
||||||
std::string group = name.substr(6);
|
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);
|
i = m_group_to_items.find(group);
|
||||||
if (i == m_group_to_items.end())
|
if (i == m_group_to_items.end())
|
||||||
return true;
|
return true;
|
||||||
@ -1282,7 +1282,7 @@ content_t CNodeDefManager::set(const std::string &name, const ContentFeatures &d
|
|||||||
i != def.groups.end(); ++i) {
|
i != def.groups.end(); ++i) {
|
||||||
std::string group_name = i->first;
|
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);
|
j = m_group_to_items.find(group_name);
|
||||||
if (j == m_group_to_items.end()) {
|
if (j == m_group_to_items.end()) {
|
||||||
m_group_to_items[group_name].push_back(
|
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
|
// 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();) {
|
m_group_to_items.begin(); iter_groups != m_group_to_items.end();) {
|
||||||
GroupItems &items = iter_groups->second;
|
GroupItems &items = iter_groups->second;
|
||||||
for (GroupItems::iterator iter_groupitems = items.begin();
|
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
|
#ifndef NODEMETADATA_HEADER
|
||||||
#define NODEMETADATA_HEADER
|
#define NODEMETADATA_HEADER
|
||||||
|
|
||||||
|
#include <unordered_set>
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NodeMetadata stores arbitary amounts of data for special blocks.
|
NodeMetadata stores arbitary amounts of data for special blocks.
|
||||||
@ -63,7 +63,7 @@ private:
|
|||||||
int countNonPrivate() const;
|
int countNonPrivate() const;
|
||||||
|
|
||||||
Inventory *m_inventory;
|
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 "mapblock.h"
|
||||||
#include "nodedef.h"
|
#include "nodedef.h"
|
||||||
#include "util/timetaker.h"
|
#include "util/timetaker.h"
|
||||||
#include "util/cpp11.h"
|
|
||||||
|
|
||||||
|
|
||||||
ReflowScan::ReflowScan(Map *map, INodeDefManager *ndef) :
|
ReflowScan::ReflowScan(Map *map, INodeDefManager *ndef) :
|
||||||
|
@ -1171,7 +1171,7 @@ void push_tool_capabilities(lua_State *L,
|
|||||||
const ToolGroupCap &groupcap = i->second;
|
const ToolGroupCap &groupcap = i->second;
|
||||||
// Create subtable "times"
|
// Create subtable "times"
|
||||||
lua_newtable(L);
|
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) {
|
i = groupcap.times.begin(); i != groupcap.times.end(); ++i) {
|
||||||
lua_pushinteger(L, i->first);
|
lua_pushinteger(L, i->first);
|
||||||
lua_pushnumber(L, i->second);
|
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_
|
#define C_CONVERTER_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "irrlichttypes_bloated.h"
|
#include "irrlichttypes_bloated.h"
|
||||||
#include "common/c_types.h"
|
#include "common/c_types.h"
|
||||||
@ -60,7 +60,7 @@ bool getintfield(lua_State *L, int table,
|
|||||||
bool getintfield(lua_State *L, int table,
|
bool getintfield(lua_State *L, int table,
|
||||||
const char *fieldname, u32 &result);
|
const char *fieldname, u32 &result);
|
||||||
void read_groups(lua_State *L, int index,
|
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,
|
bool getboolfield(lua_State *L, int table,
|
||||||
const char *fieldname, bool &result);
|
const char *fieldname, bool &result);
|
||||||
bool getfloatfield(lua_State *L, int table,
|
bool getfloatfield(lua_State *L, int table,
|
||||||
|
@ -100,7 +100,7 @@ Biome *get_or_load_biome(lua_State *L, int index,
|
|||||||
BiomeManager *biomemgr);
|
BiomeManager *biomemgr);
|
||||||
Biome *read_biome_def(lua_State *L, int index, INodeDefManager *ndef);
|
Biome *read_biome_def(lua_State *L, int index, INodeDefManager *ndef);
|
||||||
size_t get_biome_list(lua_State *L, int index,
|
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,
|
Schematic *get_or_load_schematic(lua_State *L, int index,
|
||||||
SchematicManager *schemmgr, StringMap *replace_names);
|
SchematicManager *schemmgr, StringMap *replace_names);
|
||||||
@ -244,7 +244,7 @@ bool read_schematic_def(lua_State *L, int index,
|
|||||||
schem->schemdata = new MapNode[numnodes];
|
schem->schemdata = new MapNode[numnodes];
|
||||||
|
|
||||||
size_t names_base = names->size();
|
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;
|
u32 i = 0;
|
||||||
for (lua_pushnil(L); lua_next(L, -2); i++, lua_pop(L, 1)) {
|
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);
|
u8 param2 = getintfield_default(L, -1, "param2", 0);
|
||||||
|
|
||||||
//// Find or add new nodename-to-ID mapping
|
//// 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;
|
content_t name_index;
|
||||||
if (it != name_id_map.end()) {
|
if (it != name_id_map.end()) {
|
||||||
name_index = it->second;
|
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,
|
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)
|
if (index < 0)
|
||||||
index = lua_gettop(L) + 1 + index;
|
index = lua_gettop(L) + 1 + index;
|
||||||
|
@ -137,8 +137,8 @@ int ObjectRef::l_remove(lua_State *L)
|
|||||||
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const UNORDERED_SET<int> &child_ids = co->getAttachmentChildIds();
|
const std::unordered_set<int> &child_ids = co->getAttachmentChildIds();
|
||||||
UNORDERED_SET<int>::const_iterator it;
|
std::unordered_set<int>::const_iterator it;
|
||||||
for (it = child_ids.begin(); it != child_ids.end(); ++it) {
|
for (it = child_ids.begin(); it != child_ids.end(); ++it) {
|
||||||
// Child can be NULL if it was deleted earlier
|
// Child can be NULL if it was deleted earlier
|
||||||
if (ServerActiveObject *child = env->getActiveObject(*it))
|
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)
|
int ModApiUtil::l_get_hit_params(lua_State *L)
|
||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
UNORDERED_MAP<std::string, int> groups;
|
std::unordered_map<std::string, int> groups;
|
||||||
read_groups(L, 1, groups);
|
read_groups(L, 1, groups);
|
||||||
ToolCapabilities tp = read_tool_capabilities(L, 2);
|
ToolCapabilities tp = read_tool_capabilities(L, 2);
|
||||||
if(lua_isnoneornil(L, 3))
|
if(lua_isnoneornil(L, 3))
|
||||||
|
@ -634,7 +634,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
MutexAutoLock envlock(m_env_mutex);
|
MutexAutoLock envlock(m_env_mutex);
|
||||||
|
|
||||||
m_clients.lock();
|
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");
|
ScopeProfiler sp(g_profiler, "Server: checking added and deleted objs");
|
||||||
|
|
||||||
// Radius inside which objects are active
|
// Radius inside which objects are active
|
||||||
@ -650,7 +650,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
if (player_radius == 0 && is_transfer_limited)
|
if (player_radius == 0 && is_transfer_limited)
|
||||||
player_radius = radius;
|
player_radius = radius;
|
||||||
|
|
||||||
for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = clients.begin();
|
for (RemoteClientMap::iterator i = clients.begin();
|
||||||
i != clients.end(); ++i) {
|
i != clients.end(); ++i) {
|
||||||
RemoteClient *client = i->second;
|
RemoteClient *client = i->second;
|
||||||
|
|
||||||
@ -761,7 +761,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
if (m_mod_storage_save_timer <= 0.0f) {
|
if (m_mod_storage_save_timer <= 0.0f) {
|
||||||
infostream << "Saving registered mod storages." << std::endl;
|
infostream << "Saving registered mod storages." << std::endl;
|
||||||
m_mod_storage_save_timer = g_settings->getFloat("server_map_save_interval");
|
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) {
|
it = m_mod_storages.begin(); it != m_mod_storages.end(); ++it) {
|
||||||
if (it->second->isModified()) {
|
if (it->second->isModified()) {
|
||||||
it->second->save(getModStoragePath());
|
it->second->save(getModStoragePath());
|
||||||
@ -779,7 +779,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
|
|
||||||
// Key = object id
|
// Key = object id
|
||||||
// Value = data sent by object
|
// 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
|
// Get active object messages from environment
|
||||||
for(;;) {
|
for(;;) {
|
||||||
@ -788,7 +788,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
std::vector<ActiveObjectMessage>* message_list = NULL;
|
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);
|
n = buffered_messages.find(aom.id);
|
||||||
if (n == buffered_messages.end()) {
|
if (n == buffered_messages.end()) {
|
||||||
message_list = new std::vector<ActiveObjectMessage>;
|
message_list = new std::vector<ActiveObjectMessage>;
|
||||||
@ -801,15 +801,15 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_clients.lock();
|
m_clients.lock();
|
||||||
UNORDERED_MAP<u16, RemoteClient*> clients = m_clients.getClientList();
|
RemoteClientMap clients = m_clients.getClientList();
|
||||||
// Route data to every client
|
// Route data to every client
|
||||||
for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = clients.begin();
|
for (std::unordered_map<u16, RemoteClient*>::iterator i = clients.begin();
|
||||||
i != clients.end(); ++i) {
|
i != clients.end(); ++i) {
|
||||||
RemoteClient *client = i->second;
|
RemoteClient *client = i->second;
|
||||||
std::string reliable_data;
|
std::string reliable_data;
|
||||||
std::string unreliable_data;
|
std::string unreliable_data;
|
||||||
// Go through all objects in message buffer
|
// 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.begin();
|
||||||
j != buffered_messages.end(); ++j) {
|
j != buffered_messages.end(); ++j) {
|
||||||
// If object is not known by client, skip it
|
// If object is not known by client, skip it
|
||||||
@ -853,7 +853,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||||||
m_clients.unlock();
|
m_clients.unlock();
|
||||||
|
|
||||||
// Clear buffered_messages
|
// 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.begin();
|
||||||
i != buffered_messages.end(); ++i) {
|
i != buffered_messages.end(); ++i) {
|
||||||
delete i->second;
|
delete i->second;
|
||||||
@ -2112,7 +2112,8 @@ s32 Server::playSound(const SimpleSoundSpec &spec,
|
|||||||
void Server::stopSound(s32 handle)
|
void Server::stopSound(s32 handle)
|
||||||
{
|
{
|
||||||
// Get sound reference
|
// 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())
|
if (i == m_playing_sounds.end())
|
||||||
return;
|
return;
|
||||||
ServerPlayingSound &psound = i->second;
|
ServerPlayingSound &psound = i->second;
|
||||||
@ -2120,10 +2121,10 @@ void Server::stopSound(s32 handle)
|
|||||||
NetworkPacket pkt(TOCLIENT_STOP_SOUND, 4);
|
NetworkPacket pkt(TOCLIENT_STOP_SOUND, 4);
|
||||||
pkt << handle;
|
pkt << handle;
|
||||||
|
|
||||||
for (UNORDERED_SET<u16>::iterator i = psound.clients.begin();
|
for (std::unordered_set<u16>::const_iterator si = psound.clients.begin();
|
||||||
i != psound.clients.end(); ++i) {
|
si != psound.clients.end(); ++si) {
|
||||||
// Send as reliable
|
// Send as reliable
|
||||||
m_clients.send(*i, 0, &pkt, true);
|
m_clients.send(*si, 0, &pkt, true);
|
||||||
}
|
}
|
||||||
// Remove sound reference
|
// Remove sound reference
|
||||||
m_playing_sounds.erase(i);
|
m_playing_sounds.erase(i);
|
||||||
@ -2132,7 +2133,7 @@ void Server::stopSound(s32 handle)
|
|||||||
void Server::fadeSound(s32 handle, float step, float gain)
|
void Server::fadeSound(s32 handle, float step, float gain)
|
||||||
{
|
{
|
||||||
// Get sound reference
|
// Get sound reference
|
||||||
UNORDERED_MAP<s32, ServerPlayingSound>::iterator i =
|
std::unordered_map<s32, ServerPlayingSound>::iterator i =
|
||||||
m_playing_sounds.find(handle);
|
m_playing_sounds.find(handle);
|
||||||
if (i == m_playing_sounds.end())
|
if (i == m_playing_sounds.end())
|
||||||
return;
|
return;
|
||||||
@ -2151,7 +2152,7 @@ void Server::fadeSound(s32 handle, float step, float gain)
|
|||||||
NetworkPacket compat_pkt(TOCLIENT_STOP_SOUND, 4);
|
NetworkPacket compat_pkt(TOCLIENT_STOP_SOUND, 4);
|
||||||
compat_pkt << handle;
|
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();) {
|
it != psound.clients.end();) {
|
||||||
if (m_clients.getProtocolVersion(*it) >= 32) {
|
if (m_clients.getProtocolVersion(*it) >= 32) {
|
||||||
// Send as reliable
|
// Send as reliable
|
||||||
@ -2460,7 +2461,7 @@ void Server::sendMediaAnnouncement(u16 peer_id)
|
|||||||
NetworkPacket pkt(TOCLIENT_ANNOUNCE_MEDIA, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_ANNOUNCE_MEDIA, 0, peer_id);
|
||||||
pkt << (u16) m_media.size();
|
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) {
|
i != m_media.end(); ++i) {
|
||||||
pkt << i->first << i->second.sha1_digest;
|
pkt << i->first << i->second.sha1_digest;
|
||||||
}
|
}
|
||||||
@ -2769,7 +2770,7 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
|||||||
/*
|
/*
|
||||||
Clear references to playing sounds
|
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();) {
|
i = m_playing_sounds.begin(); i != m_playing_sounds.end();) {
|
||||||
ServerPlayingSound &psound = i->second;
|
ServerPlayingSound &psound = i->second;
|
||||||
psound.clients.erase(peer_id);
|
psound.clients.erase(peer_id);
|
||||||
@ -3645,7 +3646,7 @@ bool Server::registerModStorage(ModMetadata *storage)
|
|||||||
|
|
||||||
void Server::unregisterModStorage(const std::string &name)
|
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()) {
|
if (it != m_mod_storages.end()) {
|
||||||
// Save unconditionaly on unregistration
|
// Save unconditionaly on unregistration
|
||||||
it->second->save(getModStoragePath());
|
it->second->save(getModStoragePath());
|
||||||
|
@ -135,7 +135,7 @@ struct ServerPlayingSound
|
|||||||
{
|
{
|
||||||
ServerSoundParams params;
|
ServerSoundParams params;
|
||||||
SimpleSoundSpec spec;
|
SimpleSoundSpec spec;
|
||||||
UNORDERED_SET<u16> clients; // peer ids
|
std::unordered_set<u16> clients; // peer ids
|
||||||
};
|
};
|
||||||
|
|
||||||
class Server : public con::PeerHandler, public MapEventReceiver,
|
class Server : public con::PeerHandler, public MapEventReceiver,
|
||||||
@ -653,12 +653,12 @@ private:
|
|||||||
u16 m_ignore_map_edit_events_peer_id;
|
u16 m_ignore_map_edit_events_peer_id;
|
||||||
|
|
||||||
// media files known to server
|
// media files known to server
|
||||||
UNORDERED_MAP<std::string, MediaInfo> m_media;
|
std::unordered_map<std::string, MediaInfo> m_media;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Sounds
|
Sounds
|
||||||
*/
|
*/
|
||||||
UNORDERED_MAP<s32, ServerPlayingSound> m_playing_sounds;
|
std::unordered_map<s32, ServerPlayingSound> m_playing_sounds;
|
||||||
s32 m_next_sound_id;
|
s32 m_next_sound_id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -669,7 +669,7 @@ private:
|
|||||||
// value = "" (visible to all players) or player name
|
// value = "" (visible to all players) or player name
|
||||||
std::map<std::string, std::string> m_detached_inventories_player;
|
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;
|
float m_mod_storage_save_timer;
|
||||||
|
|
||||||
DISABLE_CLASS_COPY(Server);
|
DISABLE_CLASS_COPY(Server);
|
||||||
|
@ -999,9 +999,10 @@ bool ServerEnvironment::swapNode(v3s16 p, const MapNode &n)
|
|||||||
return true;
|
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) {
|
i != m_active_objects.end(); ++i) {
|
||||||
ServerActiveObject* obj = i->second;
|
ServerActiveObject* obj = i->second;
|
||||||
u16 id = i->first;
|
u16 id = i->first;
|
||||||
@ -1017,7 +1018,7 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
|
|||||||
infostream << "ServerEnvironment::clearObjects(): "
|
infostream << "ServerEnvironment::clearObjects(): "
|
||||||
<< "Removing all active objects" << std::endl;
|
<< "Removing all active objects" << std::endl;
|
||||||
std::vector<u16> objects_to_remove;
|
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) {
|
i != m_active_objects.end(); ++i) {
|
||||||
ServerActiveObject* obj = i->second;
|
ServerActiveObject* obj = i->second;
|
||||||
if (obj->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
if (obj->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
||||||
@ -1395,7 +1396,7 @@ void ServerEnvironment::step(float dtime)
|
|||||||
send_recommended = true;
|
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) {
|
i != m_active_objects.end(); ++i) {
|
||||||
ServerActiveObject* obj = i->second;
|
ServerActiveObject* obj = i->second;
|
||||||
// Don't step if is to be removed or stored statically
|
// Don't step if is to be removed or stored statically
|
||||||
@ -1429,7 +1430,7 @@ void ServerEnvironment::step(float dtime)
|
|||||||
Manage particle spawner expiration
|
Manage particle spawner expiration
|
||||||
*/
|
*/
|
||||||
if (m_particle_management_interval.step(dtime, 1.0)) {
|
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(); ) {
|
i != m_particle_spawners.end(); ) {
|
||||||
//non expiring spawners
|
//non expiring spawners
|
||||||
if (i->second == PARTICLE_SPAWNER_NO_EXPIRY) {
|
if (i->second == PARTICLE_SPAWNER_NO_EXPIRY) {
|
||||||
@ -1454,7 +1455,7 @@ u32 ServerEnvironment::addParticleSpawner(float exptime)
|
|||||||
u32 id = 0;
|
u32 id = 0;
|
||||||
for (;;) { // look for unused particlespawner id
|
for (;;) { // look for unused particlespawner id
|
||||||
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()) {
|
if (f == m_particle_spawners.end()) {
|
||||||
m_particle_spawners[id] = time;
|
m_particle_spawners[id] = time;
|
||||||
break;
|
break;
|
||||||
@ -1476,7 +1477,7 @@ u32 ServerEnvironment::addParticleSpawner(float exptime, u16 attached_id)
|
|||||||
void ServerEnvironment::deleteParticleSpawner(u32 id, bool remove_from_object)
|
void ServerEnvironment::deleteParticleSpawner(u32 id, bool remove_from_object)
|
||||||
{
|
{
|
||||||
m_particle_spawners.erase(id);
|
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()) {
|
if (it != m_particle_spawner_attachments.end()) {
|
||||||
u16 obj_id = (*it).second;
|
u16 obj_id = (*it).second;
|
||||||
ServerActiveObject *sao = getActiveObject(obj_id);
|
ServerActiveObject *sao = getActiveObject(obj_id);
|
||||||
@ -1489,11 +1490,11 @@ void ServerEnvironment::deleteParticleSpawner(u32 id, bool remove_from_object)
|
|||||||
|
|
||||||
ServerActiveObject* ServerEnvironment::getActiveObject(u16 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);
|
return (n != m_active_objects.end() ? n->second : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFreeServerActiveObjectId(u16 id, ActiveObjectMap &objects)
|
bool isFreeServerActiveObjectId(u16 id, ServerActiveObjectMap &objects)
|
||||||
{
|
{
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return false;
|
return false;
|
||||||
@ -1501,7 +1502,7 @@ bool isFreeServerActiveObjectId(u16 id, ActiveObjectMap &objects)
|
|||||||
return objects.find(id) == objects.end();
|
return objects.find(id) == objects.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 getFreeServerActiveObjectId(ActiveObjectMap &objects)
|
u16 getFreeServerActiveObjectId(ServerActiveObjectMap &objects)
|
||||||
{
|
{
|
||||||
//try to reuse id's as late as possible
|
//try to reuse id's as late as possible
|
||||||
static u16 last_used_id = 0;
|
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.
|
- discard objects that are found in current_objects.
|
||||||
- add remaining objects to added_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) {
|
i != m_active_objects.end(); ++i) {
|
||||||
u16 id = i->first;
|
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.begin();
|
||||||
so_it != block->m_static_objects.m_active.end(); ++so_it) {
|
so_it != block->m_static_objects.m_active.end(); ++so_it) {
|
||||||
// Get the ServerActiveObject counterpart to this StaticObject
|
// 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 (ao_it == m_active_objects.end()) {
|
||||||
// If this ever happens, there must be some kind of nasty bug.
|
// If this ever happens, there must be some kind of nasty bug.
|
||||||
errorstream << "ServerEnvironment::setStaticForObjectsInBlock(): "
|
errorstream << "ServerEnvironment::setStaticForObjectsInBlock(): "
|
||||||
@ -1761,7 +1762,7 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object,
|
|||||||
void ServerEnvironment::removeRemovedObjects()
|
void ServerEnvironment::removeRemovedObjects()
|
||||||
{
|
{
|
||||||
std::vector<u16> objects_to_remove;
|
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) {
|
i != m_active_objects.end(); ++i) {
|
||||||
u16 id = i->first;
|
u16 id = i->first;
|
||||||
ServerActiveObject* obj = i->second;
|
ServerActiveObject* obj = i->second;
|
||||||
@ -1979,7 +1980,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s)
|
|||||||
void ServerEnvironment::deactivateFarObjects(bool _force_delete)
|
void ServerEnvironment::deactivateFarObjects(bool _force_delete)
|
||||||
{
|
{
|
||||||
std::vector<u16> objects_to_remove;
|
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) {
|
i != m_active_objects.end(); ++i) {
|
||||||
// force_delete might be overriden per object
|
// force_delete might be overriden per object
|
||||||
bool force_delete = _force_delete;
|
bool force_delete = _force_delete;
|
||||||
|
@ -190,7 +190,7 @@ enum ClearObjectsMode {
|
|||||||
This is not thread-safe. Server uses an environment mutex.
|
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
|
class ServerEnvironment : public Environment
|
||||||
{
|
{
|
||||||
@ -395,7 +395,7 @@ private:
|
|||||||
// World path
|
// World path
|
||||||
const std::string m_path_world;
|
const std::string m_path_world;
|
||||||
// Active object list
|
// Active object list
|
||||||
ActiveObjectMap m_active_objects;
|
ServerActiveObjectMap m_active_objects;
|
||||||
// Outgoing network message buffer for active objects
|
// Outgoing network message buffer for active objects
|
||||||
std::queue<ActiveObjectMessage> m_active_object_messages;
|
std::queue<ActiveObjectMessage> m_active_object_messages;
|
||||||
// Some timers
|
// Some timers
|
||||||
@ -431,8 +431,8 @@ private:
|
|||||||
|
|
||||||
// Particles
|
// Particles
|
||||||
IntervalLimiter m_particle_management_interval;
|
IntervalLimiter m_particle_management_interval;
|
||||||
UNORDERED_MAP<u32, float> m_particle_spawners;
|
std::unordered_map<u32, float> m_particle_spawners;
|
||||||
UNORDERED_MAP<u32, u16> m_particle_spawner_attachments;
|
std::unordered_map<u32, u16> m_particle_spawner_attachments;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef SERVEROBJECT_HEADER
|
#ifndef SERVEROBJECT_HEADER
|
||||||
#define SERVEROBJECT_HEADER
|
#define SERVEROBJECT_HEADER
|
||||||
|
|
||||||
|
#include <unordered_set>
|
||||||
#include "irrlichttypes_bloated.h"
|
#include "irrlichttypes_bloated.h"
|
||||||
#include "activeobject.h"
|
#include "activeobject.h"
|
||||||
#include "inventorymanager.h"
|
#include "inventorymanager.h"
|
||||||
@ -166,8 +167,8 @@ public:
|
|||||||
{}
|
{}
|
||||||
virtual void removeAttachmentChild(int child_id)
|
virtual void removeAttachmentChild(int child_id)
|
||||||
{}
|
{}
|
||||||
virtual const UNORDERED_SET<int> &getAttachmentChildIds()
|
virtual const std::unordered_set<int> &getAttachmentChildIds()
|
||||||
{ static const UNORDERED_SET<int> rv; return rv; }
|
{ static const std::unordered_set<int> rv; return rv; }
|
||||||
virtual ObjectProperties* accessObjectProperties()
|
virtual ObjectProperties* accessObjectProperties()
|
||||||
{ return NULL; }
|
{ return NULL; }
|
||||||
virtual void notifyObjectPropertiesModified()
|
virtual void notifyObjectPropertiesModified()
|
||||||
@ -251,7 +252,7 @@ protected:
|
|||||||
|
|
||||||
ServerEnvironment *m_env;
|
ServerEnvironment *m_env;
|
||||||
v3f m_base_position;
|
v3f m_base_position;
|
||||||
UNORDERED_SET<u32> m_attached_particle_spawners;
|
std::unordered_set<u32> m_attached_particle_spawners;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Used for creating objects based on type
|
// 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 "util/string.h"
|
||||||
#include "threading/mutex.h"
|
#include "threading/mutex.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ typedef std::vector<
|
|||||||
>
|
>
|
||||||
> SettingsCallbackList;
|
> SettingsCallbackList;
|
||||||
|
|
||||||
typedef UNORDERED_MAP<std::string, SettingsCallbackList> SettingsCallbackMap;
|
typedef std::unordered_map<std::string, SettingsCallbackList> SettingsCallbackMap;
|
||||||
|
|
||||||
enum ValueType {
|
enum ValueType {
|
||||||
VALUETYPE_STRING,
|
VALUETYPE_STRING,
|
||||||
@ -95,7 +94,7 @@ struct SettingsEntry {
|
|||||||
bool is_group;
|
bool is_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef UNORDERED_MAP<std::string, SettingsEntry> SettingEntries;
|
typedef std::unordered_map<std::string, SettingsEntry> SettingEntries;
|
||||||
|
|
||||||
class Settings {
|
class Settings {
|
||||||
public:
|
public:
|
||||||
|
@ -43,7 +43,7 @@ with this program; ifnot, write to the Free Software Foundation, Inc.,
|
|||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "util/cpp11_container.h"
|
#include <unordered_map>
|
||||||
|
|
||||||
#define BUFFER_SIZE 30000
|
#define BUFFER_SIZE 30000
|
||||||
|
|
||||||
@ -271,8 +271,8 @@ private:
|
|||||||
ALCdevice *m_device;
|
ALCdevice *m_device;
|
||||||
ALCcontext *m_context;
|
ALCcontext *m_context;
|
||||||
int m_next_id;
|
int m_next_id;
|
||||||
UNORDERED_MAP<std::string, std::vector<SoundBuffer*> > m_buffers;
|
std::unordered_map<std::string, std::vector<SoundBuffer*>> m_buffers;
|
||||||
UNORDERED_MAP<int, PlayingSound*> m_sounds_playing;
|
std::unordered_map<int, PlayingSound*> m_sounds_playing;
|
||||||
v3f m_listener_pos;
|
v3f m_listener_pos;
|
||||||
struct FadeState {
|
struct FadeState {
|
||||||
FadeState() {}
|
FadeState() {}
|
||||||
@ -285,7 +285,7 @@ private:
|
|||||||
float target_gain;
|
float target_gain;
|
||||||
};
|
};
|
||||||
|
|
||||||
UNORDERED_MAP<int, FadeState> m_sounds_fading;
|
std::unordered_map<int, FadeState> m_sounds_fading;
|
||||||
float m_fade_delay;
|
float m_fade_delay;
|
||||||
public:
|
public:
|
||||||
bool m_is_initialized;
|
bool m_is_initialized;
|
||||||
@ -351,8 +351,8 @@ public:
|
|||||||
alcCloseDevice(m_device);
|
alcCloseDevice(m_device);
|
||||||
m_device = NULL;
|
m_device = NULL;
|
||||||
|
|
||||||
for (UNORDERED_MAP<std::string, std::vector<SoundBuffer*> >::iterator i = m_buffers.begin();
|
for (std::unordered_map<std::string, std::vector<SoundBuffer*>>::iterator i =
|
||||||
i != m_buffers.end(); ++i) {
|
m_buffers.begin(); i != m_buffers.end(); ++i) {
|
||||||
for (std::vector<SoundBuffer*>::iterator iter = (*i).second.begin();
|
for (std::vector<SoundBuffer*>::iterator iter = (*i).second.begin();
|
||||||
iter != (*i).second.end(); ++iter) {
|
iter != (*i).second.end(); ++iter) {
|
||||||
delete *iter;
|
delete *iter;
|
||||||
@ -370,7 +370,7 @@ public:
|
|||||||
|
|
||||||
void addBuffer(const std::string &name, SoundBuffer *buf)
|
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);
|
m_buffers.find(name);
|
||||||
if(i != m_buffers.end()){
|
if(i != m_buffers.end()){
|
||||||
i->second.push_back(buf);
|
i->second.push_back(buf);
|
||||||
@ -384,7 +384,7 @@ public:
|
|||||||
|
|
||||||
SoundBuffer* getBuffer(const std::string &name)
|
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);
|
m_buffers.find(name);
|
||||||
if(i == m_buffers.end())
|
if(i == m_buffers.end())
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -461,7 +461,7 @@ public:
|
|||||||
|
|
||||||
void deleteSound(int id)
|
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())
|
if(i == m_sounds_playing.end())
|
||||||
return;
|
return;
|
||||||
PlayingSound *sound = i->second;
|
PlayingSound *sound = i->second;
|
||||||
@ -501,7 +501,7 @@ public:
|
|||||||
<<m_sounds_playing.size()<<" playing sounds, "
|
<<m_sounds_playing.size()<<" playing sounds, "
|
||||||
<<m_buffers.size()<<" sound names loaded"<<std::endl;
|
<<m_buffers.size()<<" sound names loaded"<<std::endl;
|
||||||
std::set<int> del_list;
|
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) {
|
i != m_sounds_playing.end(); ++i) {
|
||||||
int id = i->first;
|
int id = i->first;
|
||||||
PlayingSound *sound = i->second;
|
PlayingSound *sound = i->second;
|
||||||
@ -615,7 +615,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float chkGain = 0;
|
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();) {
|
i != m_sounds_fading.end();) {
|
||||||
if (i->second.step < 0.f)
|
if (i->second.step < 0.f)
|
||||||
chkGain = -(i->second.current_gain);
|
chkGain = -(i->second.current_gain);
|
||||||
@ -646,7 +646,7 @@ public:
|
|||||||
|
|
||||||
void updateSoundPosition(int id, v3f pos)
|
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())
|
if (i == m_sounds_playing.end())
|
||||||
return;
|
return;
|
||||||
PlayingSound *sound = i->second;
|
PlayingSound *sound = i->second;
|
||||||
@ -659,7 +659,7 @@ public:
|
|||||||
|
|
||||||
bool updateSoundGain(int id, float gain)
|
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())
|
if (i == m_sounds_playing.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ public:
|
|||||||
|
|
||||||
float getSoundGain(int id)
|
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())
|
if (i == m_sounds_playing.end())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void ToolCapabilities::serialize(std::ostream &os, u16 protocol_version) const
|
|||||||
writeS16(os, cap->uses);
|
writeS16(os, cap->uses);
|
||||||
writeS16(os, cap->maxlevel);
|
writeS16(os, cap->maxlevel);
|
||||||
writeU32(os, cap->times.size());
|
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) {
|
j = cap->times.begin(); j != cap->times.end(); ++j) {
|
||||||
writeS16(os, j->first);
|
writeS16(os, j->first);
|
||||||
writeF1000(os, j->second);
|
writeF1000(os, j->second);
|
||||||
|
@ -23,12 +23,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "irrlichttypes.h"
|
#include "irrlichttypes.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
#include "itemgroup.h"
|
#include "itemgroup.h"
|
||||||
|
|
||||||
struct ToolGroupCap
|
struct ToolGroupCap
|
||||||
{
|
{
|
||||||
UNORDERED_MAP<int, float> times;
|
std::unordered_map<int, float> times;
|
||||||
int maxlevel;
|
int maxlevel;
|
||||||
int uses;
|
int uses;
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ struct ToolGroupCap
|
|||||||
|
|
||||||
bool getTime(int rating, float *time) const
|
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()) {
|
if (i == times.end()) {
|
||||||
*time = 0;
|
*time = 0;
|
||||||
return false;
|
return false;
|
||||||
@ -50,8 +49,8 @@ struct ToolGroupCap
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef UNORDERED_MAP<std::string, struct ToolGroupCap> ToolGCMap;
|
typedef std::unordered_map<std::string, struct ToolGroupCap> ToolGCMap;
|
||||||
typedef UNORDERED_MAP<std::string, s16> DamageGroup;
|
typedef std::unordered_map<std::string, s16> DamageGroup;
|
||||||
|
|
||||||
struct ToolCapabilities
|
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
|
#define UTIL_STRING_HEADER
|
||||||
|
|
||||||
#include "irrlichttypes_bloated.h"
|
#include "irrlichttypes_bloated.h"
|
||||||
#include "cpp11_container.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -30,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
#define TOSTRING(x) STRINGIFY(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) < 0xe0) ? 2 : \
|
||||||
(((unsigned char)(x) < 0xf0) ? 3 : 4))
|
(((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 {
|
struct FlagDesc {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include "mapnode.h"
|
#include "mapnode.h"
|
||||||
#include "util/container.h"
|
#include "util/container.h"
|
||||||
#include "util/cpp11_container.h"
|
|
||||||
|
|
||||||
class Map;
|
class Map;
|
||||||
class ServerMap;
|
class ServerMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user