Browse Source

Update ChestTrap.cpp

Forgot some locking on GetNextChestTrap..
Image 4 years ago
parent
commit
71335bbe99
1 changed files with 6 additions and 0 deletions
  1. 6 0
      EQ2/source/WorldServer/Zone/ChestTrap.cpp

+ 6 - 0
EQ2/source/WorldServer/Zone/ChestTrap.cpp

@@ -61,12 +61,17 @@ void ChestTrapList::Clear() {
 }
 
 ChestTrap::ChestTrapInfo ChestTrapList::GetNextChestTrap() {
+	MChestTrapList.readlock(__FUNCTION__, __LINE__);
 	if (cycleItr == chesttrap_list.end())
 	{
+		MChestTrapList.releasereadlock(__FUNCTION__, __LINE__);
 		//re-shuffle the map, we reached the end
 		shuffleMap(this);
 	}
+	else
+		MChestTrapList.releasereadlock(__FUNCTION__, __LINE__);
 
+	MChestTrapList.writelock(__FUNCTION__, __LINE__);
 	ChestTrap* trap = cycleItr->second;
 
 	ChestTrap::ChestTrapInfo cti;
@@ -75,6 +80,7 @@ ChestTrap::ChestTrapInfo ChestTrapList::GetNextChestTrap() {
 		memcpy(&cti, &trap->GetChestTrapInfo(), sizeof(ChestTrap::ChestTrapInfo));
 
 	cycleItr++;
+	MChestTrapList.releasewritelock(__FUNCTION__, __LINE__);
 
 	return cti;
 }