limiting spawn list write lock further

This commit is contained in:
Emagi 2025-07-30 19:15:47 -04:00
parent 8f47a27b1d
commit 9ef48d3bab
2 changed files with 54 additions and 53 deletions

View File

@ -4707,7 +4707,7 @@ int EQ2Emu_lua_Harvest(lua_State* state) {
((GroundSpawn*)node)->ProcessHarvest(client); ((GroundSpawn*)node)->ProcessHarvest(client);
if (((GroundSpawn*)node)->GetNumberHarvests() == 0) { if (((GroundSpawn*)node)->GetNumberHarvests() == 0) {
LuaSpell* spell = lua_interface->GetCurrentSpell(state); LuaSpell* spell = lua_interface->GetCurrentSpell(state);
player->GetZone()->RemoveSpawn(node, true, true, true, true, (spell != nullptr) ? false : true); player->GetZone()->RemoveSpawn(node, true, true, true, false, (spell != nullptr) ? false : true);
} }
} }
} }

View File

@ -1515,8 +1515,8 @@ void ZoneServer::DeleteSpawns(bool delete_all) {
// Prepare a list of entries well need to keep around // Prepare a list of entries well need to keep around
std::vector<std::pair<Spawn*,int32>> to_keep; std::vector<std::pair<Spawn*,int32>> to_keep;
if(to_process.size() > 0) {
to_keep.reserve(to_process.size()); to_keep.reserve(to_process.size());
int32 current_time = Timer::GetCurrentTime2(); int32 current_time = Timer::GetCurrentTime2();
MSpawnList.writelock(__FUNCTION__, __LINE__); MSpawnList.writelock(__FUNCTION__, __LINE__);
for (auto &entry : to_process) { for (auto &entry : to_process) {
@ -1575,6 +1575,7 @@ void ZoneServer::DeleteSpawns(bool delete_all) {
safe_delete(spawn); safe_delete(spawn);
} }
MSpawnList.releasewritelock(__FUNCTION__, __LINE__); MSpawnList.releasewritelock(__FUNCTION__, __LINE__);
}
// Add all the kept entries // Add all the kept entries
if (!to_keep.empty()) { if (!to_keep.empty()) {