Fix crash caused by an bug of nav_file.cpp (Part 2)

This commit is contained in:
s1lent 2017-02-02 23:56:35 +07:00
parent 34e5ceb637
commit f1f8e2d7b8

View File

@ -465,7 +465,7 @@ NavErrorType CNavArea::PostLoad()
// connect areas together // connect areas together
for (int d = 0; d < NUM_DIRECTIONS; ++d) for (int d = 0; d < NUM_DIRECTIONS; ++d)
{ {
for (auto connect : m_connect[d]) for (auto& connect : m_connect[d])
{ {
auto id = connect.id; auto id = connect.id;
connect.area = TheNavAreaGrid.GetNavAreaByID(id); connect.area = TheNavAreaGrid.GetNavAreaByID(id);
@ -503,7 +503,7 @@ NavErrorType CNavArea::PostLoad()
} }
// resolve spot encounter IDs // resolve spot encounter IDs
for (auto spote : m_spotEncounterList) for (auto& spote : m_spotEncounterList)
{ {
spote.from.area = TheNavAreaGrid.GetNavAreaByID(spote.from.id); spote.from.area = TheNavAreaGrid.GetNavAreaByID(spote.from.id);
if (spote.from.area == NULL) if (spote.from.area == NULL)
@ -532,7 +532,7 @@ NavErrorType CNavArea::PostLoad()
} }
// resolve HidingSpot IDs // resolve HidingSpot IDs
for (auto order : spote.spotList) for (auto& order : spote.spotList)
{ {
order.spot = GetHidingSpotByID(order.id); order.spot = GetHidingSpotByID(order.id);
if (order.spot == NULL) if (order.spot == NULL)