어그로 시스템 관련 오류 수정
순회 중 순회 대상을 수정해서 발생한 문제 순회와 수정을 분리함
This commit is contained in:
@@ -671,6 +671,7 @@ namespace Northbound
|
||||
private void DecayAggro()
|
||||
{
|
||||
List<ulong> keysToRemove = new List<ulong>();
|
||||
List<KeyValuePair<ulong, float>> updates = new List<KeyValuePair<ulong, float>>();
|
||||
|
||||
foreach (var kvp in _aggroTable)
|
||||
{
|
||||
@@ -681,10 +682,16 @@ namespace Northbound
|
||||
}
|
||||
else
|
||||
{
|
||||
_aggroTable[kvp.Key] = newAggro;
|
||||
updates.Add(new KeyValuePair<ulong, float>(kvp.Key, newAggro));
|
||||
}
|
||||
}
|
||||
|
||||
// 순회 후 수정 적용
|
||||
foreach (var update in updates)
|
||||
{
|
||||
_aggroTable[update.Key] = update.Value;
|
||||
}
|
||||
|
||||
// 어그로가 0 이하인 항목 제거
|
||||
foreach (var key in keysToRemove)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user