Update ChestTrap.cpp
Forgot some locking on GetNextChestTrap..
This commit is contained in:
parent
83a441f4e5
commit
71335bbe99
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue