[SD2]Triage quest: fixing memory leak

This commit is contained in:
Olion 2015-05-07 11:56:17 +03:00
parent 2c0e0e8625
commit e81a9ad1f1

View File

@ -272,7 +272,12 @@ struct npc_doctor : public CreatureScript
m_uiPatientSavedCount = 0; m_uiPatientSavedCount = 0;
m_lPatientGuids.clear(); m_lPatientGuids.clear();
if (!m_vPatientSummonCoordinates.empty())
{
for (std::vector<Location*>::iterator itr = m_vPatientSummonCoordinates.begin(); itr != m_vPatientSummonCoordinates.end(); ++itr)
delete (*itr);
m_vPatientSummonCoordinates.clear(); m_vPatientSummonCoordinates.clear();
}
m_bIsEventInProgress = false; m_bIsEventInProgress = false;
@ -293,13 +298,13 @@ struct npc_doctor : public CreatureScript
case DOCTOR_ALLIANCE: case DOCTOR_ALLIANCE:
for (uint8 i = 0; i < ALLIANCE_COORDS; ++i) for (uint8 i = 0; i < ALLIANCE_COORDS; ++i)
{ {
m_vPatientSummonCoordinates.push_back(&AllianceCoords[i]); m_vPatientSummonCoordinates.push_back(new Location(AllianceCoords[i]));
} }
break; break;
case DOCTOR_HORDE: case DOCTOR_HORDE:
for (uint8 i = 0; i < HORDE_COORDS; ++i) for (uint8 i = 0; i < HORDE_COORDS; ++i)
{ {
m_vPatientSummonCoordinates.push_back(&HordeCoords[i]); m_vPatientSummonCoordinates.push_back(new Location(HordeCoords[i]));
} }
break; break;
} }
@ -433,6 +438,7 @@ struct npc_doctor : public CreatureScript
SendAIEvent(AI_EVENT_CUSTOM_A, m_creature, Patient); SendAIEvent(AI_EVENT_CUSTOM_A, m_creature, Patient);
//pPatientAI->m_doctorGuid = m_creature->GetObjectGuid(); //pPatientAI->m_doctorGuid = m_creature->GetObjectGuid();
//pPatientAI->m_pCoord = *itr; //pPatientAI->m_pCoord = *itr;
delete (*itr);
m_vPatientSummonCoordinates.erase(itr); m_vPatientSummonCoordinates.erase(itr);
} }
} }