瀏覽代碼

Update ChestTrap.cpp

Forgot some locking on GetNextChestTrap..
Image 4 年之前
父節點
當前提交
71335bbe99
共有 1 個文件被更改,包括 6 次插入0 次删除
  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;
 }