mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
Remove redundant instance deletion
This commit is contained in:
parent
d840b0bbd0
commit
609d3cdb99
@ -267,8 +267,9 @@ void ChunkManager::createInstance(uint64_t instanceID) {
|
||||
}
|
||||
|
||||
void ChunkManager::destroyInstance(uint64_t instanceID) {
|
||||
std::cout << "Deleting instance " << instanceID << std::endl;
|
||||
|
||||
std::vector<std::tuple<int, int, uint64_t>> instanceChunks = ChunkManager::getChunksInMap(instanceID);
|
||||
std::cout << "Deleting instance " << instanceID << " (" << instanceChunks.size() << " chunks)" << std::endl;
|
||||
for (std::tuple<int, int, uint64_t>& coords : instanceChunks) {
|
||||
destroyChunk(coords);
|
||||
}
|
||||
|
@ -584,8 +584,6 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
|
||||
if (Warps.find(warpId) == Warps.end())
|
||||
return;
|
||||
|
||||
uint64_t fromInstance = plrv.plr->instanceID; // saved for post-warp
|
||||
|
||||
// std::cerr << "Warped to Map Num:" << Warps[warpId].instanceID << " NPC ID " << Warps[warpId].npcID << std::endl;
|
||||
if (Warps[warpId].isInstance) {
|
||||
uint64_t instanceID = Warps[warpId].instanceID;
|
||||
@ -625,9 +623,6 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
|
||||
plrv.plr->instanceID = INSTANCE_OVERWORLD;
|
||||
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_WARP_USE_NPC_SUCC, sizeof(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC));
|
||||
}
|
||||
|
||||
// post-warp: check if the source instance has no more players in it and delete it if so
|
||||
ChunkManager::destroyInstanceIfEmpty(fromInstance);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -241,7 +241,7 @@ void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I
|
||||
|
||||
MissionManager::failInstancedMissions(sock); // fail any instanced missions
|
||||
|
||||
uint64_t fromInstance = plr->instanceID;
|
||||
uint64_t fromInstance = plrv.plr->instanceID; // pre-warp instance, saved for post-warp
|
||||
|
||||
plr->instanceID = I;
|
||||
if (I != INSTANCE_OVERWORLD) {
|
||||
@ -264,6 +264,7 @@ void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I
|
||||
updatePlayerPosition(sock, X, Y, Z);
|
||||
}
|
||||
|
||||
// post-warp: check if the source instance has no more players in it and delete it if so
|
||||
ChunkManager::destroyInstanceIfEmpty(fromInstance);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user