mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-09 15:37:14 +00:00
refactor: unglob std::unordered_set
This commit is contained in:
parent
49d02788c0
commit
0855e6ddf4
|
|
@ -55,8 +55,8 @@ public:
|
|||
|
||||
private:
|
||||
std::unordered_map<int, std::shared_ptr<Entity>, IntKeyHash2, IntKeyEq> entitiesById; // 4J - was IntHashMap
|
||||
unordered_set<std::shared_ptr<Entity> > forced;
|
||||
unordered_set<std::shared_ptr<Entity> > reEntries;
|
||||
std::unordered_set<std::shared_ptr<Entity> > forced;
|
||||
std::unordered_set<std::shared_ptr<Entity> > reEntries;
|
||||
|
||||
public:
|
||||
virtual bool addEntity(std::shared_ptr<Entity> e);
|
||||
|
|
@ -82,7 +82,7 @@ protected:
|
|||
|
||||
public:
|
||||
void animateTickDoWork(); // 4J added
|
||||
unordered_set<int> chunksToAnimate; // 4J added
|
||||
std::unordered_set<int> chunksToAnimate; // 4J added
|
||||
|
||||
public:
|
||||
void removeAllPendingEntityRemovals();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ private:
|
|||
|
||||
CRITICAL_SECTION m_tickNextTickCS; // 4J added
|
||||
set<TickNextTickData, TickNextTickDataKeyCompare> tickNextTickList; // 4J Was TreeSet
|
||||
unordered_set<TickNextTickData, TickNextTickDataKeyHash, TickNextTickDataKeyEq> tickNextTickSet; // 4J Was HashSet
|
||||
std::unordered_set<TickNextTickData, TickNextTickDataKeyHash, TickNextTickDataKeyEq> tickNextTickSet; // 4J Was HashSet
|
||||
|
||||
std::vector<Pos *> m_queuedSendTileUpdates; // 4J added
|
||||
CRITICAL_SECTION m_csQueueSendTileUpdates;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ServerChunkCache : public ChunkSource
|
|||
{
|
||||
|
||||
private:
|
||||
// unordered_set<int,IntKeyHash, IntKeyEq> toDrop;
|
||||
// std::unordered_set<int,IntKeyHash, IntKeyEq> toDrop;
|
||||
private:
|
||||
LevelChunk *emptyChunk;
|
||||
ChunkSource *source;
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@ bool SQRNetworkManager_Orbis::FriendRoomManagerSearch2()
|
|||
if( m_aFriendSearchResults.size() > 0 )
|
||||
{
|
||||
// If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room.
|
||||
unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
std::unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
for( unsigned int i = 0; i < m_aFriendSearchResults.size(); i++ )
|
||||
{
|
||||
if(m_aFriendSearchResults[i].m_RoomFound)
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ bool SQRNetworkManager_PS3::FriendRoomManagerSearch2()
|
|||
if( m_searchResultCount )
|
||||
{
|
||||
// If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room.
|
||||
unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
std::unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
for( unsigned int i = 0; i < m_searchResultCount; i++ )
|
||||
{
|
||||
if(m_aSearchResultRoomFound[ i ])
|
||||
|
|
|
|||
|
|
@ -723,7 +723,7 @@ bool SQRNetworkManager_AdHoc_Vita::FriendRoomManagerSearch2()
|
|||
// if( m_aFriendSearchResults.size() > 0 )
|
||||
// {
|
||||
// // If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room.
|
||||
// unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
// std::unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
// for( unsigned int i = 0; i < m_aFriendSearchResults.size(); i++ )
|
||||
// {
|
||||
// if(m_aFriendSearchResults[i].m_RoomFound)
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ bool SQRNetworkManager_Vita::FriendRoomManagerSearch2()
|
|||
if( m_aFriendSearchResults.size() > 0 )
|
||||
{
|
||||
// If we have some results, then we also want to make sure that we don't have any duplicate rooms here if more than one friend is playing in the same room.
|
||||
unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
std::unordered_set<SceNpMatching2RoomId> uniqueRooms;
|
||||
for( unsigned int i = 0; i < m_aFriendSearchResults.size(); i++ )
|
||||
{
|
||||
if(m_aFriendSearchResults[i].m_RoomFound)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class EntityTracker
|
|||
{
|
||||
private:
|
||||
ServerLevel *level;
|
||||
unordered_set<std::shared_ptr<TrackedEntity> > entities;
|
||||
std::unordered_set<std::shared_ptr<TrackedEntity> > entities;
|
||||
std::unordered_map<int, std::shared_ptr<TrackedEntity> , IntKeyHash2, IntKeyEq> entityMap; // was IntHashMap
|
||||
int maxRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public:
|
|||
double lastMoveX, lastMoveZ;
|
||||
list<ChunkPos> chunksToSend;
|
||||
std::vector<int> entitiesToRemove;
|
||||
unordered_set<ChunkPos, ChunkPosKeyHash, ChunkPosKeyEq> seenChunks;
|
||||
std::unordered_set<ChunkPos, ChunkPosKeyHash, ChunkPosKeyEq> seenChunks;
|
||||
int spewTimer;
|
||||
|
||||
// 4J-Added, for 'Adventure Time' achievement.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ private:
|
|||
public:
|
||||
bool moved;
|
||||
|
||||
unordered_set<std::shared_ptr<ServerPlayer> , PlayerKeyHash, PlayerKeyEq > seenBy;
|
||||
std::unordered_set<std::shared_ptr<ServerPlayer> , PlayerKeyHash, PlayerKeyEq > seenBy;
|
||||
|
||||
TrackedEntity(std::shared_ptr<Entity> e, int range, int updateInterval, bool trackDelta);
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void Chunk::rebuild()
|
|||
|
||||
LevelChunk::touchedSky = false;
|
||||
|
||||
// unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// std::unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// renderableTileEntities.clear();
|
||||
|
||||
std::vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||
|
|
@ -554,10 +554,10 @@ void Chunk::rebuild()
|
|||
*/
|
||||
|
||||
|
||||
unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
std::unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
|
||||
AUTO_VAR(endIt, oldTileEntities.end());
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
for( std::unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
newTileEntities.erase(*it);
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@ void Chunk::rebuild()
|
|||
|
||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||
endIt = newTileEntities.end();
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
for( std::unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
globalRenderableTileEntities->push_back(*it);
|
||||
}
|
||||
|
|
@ -656,7 +656,7 @@ void Chunk::rebuild_SPU()
|
|||
|
||||
LevelChunk::touchedSky = false;
|
||||
|
||||
// unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// std::unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||
// renderableTileEntities.clear();
|
||||
|
||||
std::vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||
|
|
@ -883,10 +883,10 @@ void Chunk::rebuild_SPU()
|
|||
*/
|
||||
|
||||
|
||||
unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
std::unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||
|
||||
AUTO_VAR(endIt, oldTileEntities.end());
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
for( std::unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
newTileEntities.erase(*it);
|
||||
}
|
||||
|
|
@ -895,7 +895,7 @@ void Chunk::rebuild_SPU()
|
|||
|
||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||
endIt = newTileEntities.end();
|
||||
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
for( std::unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||
{
|
||||
globalRenderableTileEntities.push_back(*it);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
static const std::wstring TEXTURE_LINE_OVERLAY;
|
||||
private:
|
||||
bool shouldSignal;
|
||||
unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> toUpdate;
|
||||
std::unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> toUpdate;
|
||||
Icon *iconCross;
|
||||
Icon *iconLine;
|
||||
Icon *iconCrossOver;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ private:
|
|||
#else
|
||||
std::unordered_map<EGameCommand, Command *> commandsById;
|
||||
#endif
|
||||
unordered_set<Command *> commands;
|
||||
std::unordered_set<Command *> commands;
|
||||
|
||||
public:
|
||||
void performCommand(std::shared_ptr<CommandSender> sender, EGameCommand command, byteArray commandData);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public:
|
|||
short backup(std::shared_ptr<Inventory> inventory);
|
||||
|
||||
private:
|
||||
unordered_set<std::shared_ptr<Player> , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers;
|
||||
std::unordered_set<std::shared_ptr<Player> , PlayerKeyHash, PlayerKeyEq> unSynchedPlayers;
|
||||
|
||||
public:
|
||||
bool isSynched(std::shared_ptr<Player> player);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
std::shared_ptr<Entity> source;
|
||||
float r;
|
||||
|
||||
unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> toBlow;
|
||||
std::unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> toBlow;
|
||||
|
||||
private:
|
||||
typedef std::unordered_map<std::shared_ptr<Player>, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map;
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ protected:
|
|||
// AP - See CustomSet.h for an explanation of this
|
||||
CustomSet chunksToPoll;
|
||||
#else
|
||||
unordered_set<ChunkPos,ChunkPosKeyHash,ChunkPosKeyEq> chunksToPoll;
|
||||
std::unordered_set<ChunkPos,ChunkPosKeyHash,ChunkPosKeyEq> chunksToPoll;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ ExplodePacket::ExplodePacket()
|
|||
knockbackZ = 0.0f;
|
||||
}
|
||||
|
||||
ExplodePacket::ExplodePacket(double x, double y, double z, float r, unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> *toBlow, Vec3 *knockback, bool knockBackOnly)
|
||||
ExplodePacket::ExplodePacket(double x, double y, double z, float r, std::unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> *toBlow, Vec3 *knockback, bool knockBackOnly)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public:
|
|||
public:
|
||||
|
||||
ExplodePacket();
|
||||
ExplodePacket(double x, double y, double z, float r, unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> *toBlow, Vec3 *knockback, bool knockBackOnly);
|
||||
ExplodePacket(double x, double y, double z, float r, std::unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> *toBlow, Vec3 *knockback, bool knockBackOnly);
|
||||
|
||||
virtual void read(DataInputStream *dis);
|
||||
virtual void write(DataOutputStream *dos);
|
||||
|
|
|
|||
|
|
@ -165,9 +165,9 @@ Packet::Packet() : createTime( System::currentTimeMillis() )
|
|||
|
||||
std::unordered_map<int, packetCreateFn> Packet::idToCreateMap;
|
||||
|
||||
unordered_set<int> Packet::clientReceivedPackets = unordered_set<int>();
|
||||
unordered_set<int> Packet::serverReceivedPackets = unordered_set<int>();
|
||||
unordered_set<int> Packet::sendToAnyClientPackets = unordered_set<int>();
|
||||
std::unordered_set<int> Packet::clientReceivedPackets = std::unordered_set<int>();
|
||||
std::unordered_set<int> Packet::serverReceivedPackets = std::unordered_set<int>();
|
||||
std::unordered_set<int> Packet::sendToAnyClientPackets = std::unordered_set<int>();
|
||||
|
||||
// 4J Added
|
||||
std::unordered_map<int, Packet::PacketStatistics *> Packet::outgoingStatistics = std::unordered_map<int, Packet::PacketStatistics *>();
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ public:
|
|||
public:
|
||||
static std::unordered_map<int, packetCreateFn> idToCreateMap; // IntHashMap in 1.8.2 ... needed? // Made public in 1.0.1
|
||||
|
||||
static unordered_set<int> clientReceivedPackets;
|
||||
static unordered_set<int> serverReceivedPackets;
|
||||
static unordered_set<int> sendToAnyClientPackets;
|
||||
static std::unordered_set<int> clientReceivedPackets;
|
||||
static std::unordered_set<int> serverReceivedPackets;
|
||||
static std::unordered_set<int> sendToAnyClientPackets;
|
||||
|
||||
// 4J Stu - Added the sendToAnyClient param so we can limit some packets to be only sent to one player on a system
|
||||
// 4J Stu - Added renderStats param for use in debugging
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ template <class T> T _fromHEXString(const std::wstring& s)
|
|||
return t;
|
||||
}
|
||||
|
||||
std::wstring convStringToWstring(const string& converting);
|
||||
std::wstring convStringToWstring(const std::string& converting);
|
||||
const char *wstringtofilename(const std::wstring& name);
|
||||
std::wstring filenametowstring(const char *name);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue