mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-10-20 20:30:19 +00:00
Use direct members instead of pointers for viewableChunks and buyback
We had avoided putting STL containers into Players back when we thought Players was still POD and needed to remain POD, but it turned out that neither were the case all along, so there's no need for the indirection.
This commit is contained in:
@@ -26,9 +26,9 @@ static void newChunk(ChunkPos pos) {
|
||||
std::set<Chunk*> surroundings = getViewableChunks(pos);
|
||||
for (Chunk* c : surroundings) {
|
||||
for (CNSocket* sock : c->players)
|
||||
PlayerManager::getPlayer(sock)->viewableChunks->insert(chunk);
|
||||
PlayerManager::getPlayer(sock)->viewableChunks.insert(chunk);
|
||||
for (int32_t id : c->NPCs)
|
||||
NPCManager::NPCs[id]->viewableChunks->insert(chunk);
|
||||
NPCManager::NPCs[id]->viewableChunks.insert(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ static void deleteChunk(ChunkPos pos) {
|
||||
for(Chunk* c : surroundings)
|
||||
{
|
||||
for (CNSocket* sock : c->players)
|
||||
PlayerManager::getPlayer(sock)->viewableChunks->erase(chunk);
|
||||
PlayerManager::getPlayer(sock)->viewableChunks.erase(chunk);
|
||||
for (int32_t id : c->NPCs)
|
||||
NPCManager::NPCs[id]->viewableChunks->erase(chunk);
|
||||
NPCManager::NPCs[id]->viewableChunks.erase(chunk);
|
||||
}
|
||||
|
||||
chunks.erase(pos); // remove from map
|
||||
@@ -353,8 +353,8 @@ void Chunking::updatePlayerChunk(CNSocket* sock, ChunkPos from, ChunkPos to) {
|
||||
|
||||
plr->chunkPos = to; // update cached chunk position
|
||||
// updated cached viewable chunks
|
||||
plr->viewableChunks->clear();
|
||||
plr->viewableChunks->insert(newViewables.begin(), newViewables.end());
|
||||
plr->viewableChunks.clear();
|
||||
plr->viewableChunks.insert(newViewables.begin(), newViewables.end());
|
||||
}
|
||||
|
||||
void Chunking::updateNPCChunk(int32_t id, ChunkPos from, ChunkPos to) {
|
||||
@@ -389,8 +389,8 @@ void Chunking::updateNPCChunk(int32_t id, ChunkPos from, ChunkPos to) {
|
||||
|
||||
npc->chunkPos = to; // update cached chunk position
|
||||
// updated cached viewable chunks
|
||||
npc->viewableChunks->clear();
|
||||
npc->viewableChunks->insert(newViewables.begin(), newViewables.end());
|
||||
npc->viewableChunks.clear();
|
||||
npc->viewableChunks.insert(newViewables.begin(), newViewables.end());
|
||||
}
|
||||
|
||||
bool Chunking::chunkExists(ChunkPos chunk) {
|
||||
|
Reference in New Issue
Block a user