Quote:
Originally Posted by mamAmok
Code:
void CMapObjectPropertyPageAmbience::OnUpdateUI(CProperty * pProperty)
{
prt::PropertyAmbienceStringToData(pProperty, &m_propertyAmbience);
[COLOR="Red"]std::vector<CFilename> & rSoundFileNameVector = m_propertyAmbience.AmbienceSoundVector;[/COLOR]
for (DWORD dwIndex = 0; dwIndex < rSoundFileNameVector.size(); ++dwIndex)
{
m_ctrlSoundFileList.InsertString(dwIndex, rSoundFileNameVector[dwIndex].c_str());
}
m_ctrlPlayType.SelectString(-1, m_propertyAmbience.strPlayType.c_str());
SetDialogFloatText(GetSafeHwnd(), IDC_MAP_OBJECT_PROPERTY_AMBIENCE_INTERVAL, m_propertyAmbience.fPlayInterval);
SetDialogFloatText(GetSafeHwnd(), IDC_MAP_OBJECT_PROPERTY_AMBIENCE_INTERVAL_VARIATION, m_propertyAmbience.fPlayIntervalVariation);
SetDialogFloatText(GetSafeHwnd(), IDC_MAP_OBJECT_PROPERTY_AMBIENCE_MAX_VOLUME_AREA_PERCENTAGE, m_propertyAmbience.fMaxVolumeAreaPercentage * 100.0f);
OnUpdatePropertyData(m_propertyAmbience.strName.c_str());
OnChangePlayType();
}
Code:
void CMapObjectPropertyPageAmbience::OnDeleteSoundFile()
{
DWORD dwCurSel = DWORD(m_ctrlSoundFileList.GetCurSel());
if (dwCurSel >= m_propertyAmbience.AmbienceSoundVector.size())
return;
[COLOR="Red"]DeleteVectorItem<CFilename>(&m_propertyAmbience.AmbienceSoundVector, dwCurSel);[/COLOR]
m_ctrlSoundFileList.DeleteString(dwCurSel);
}
|
Change:
Code:
std::vector<CFilename> & rSoundFileNameVector = m_propertyAmbience.AmbienceSoundVector;
To:
Code:
std::vector<std::string> & rSoundFileNameVector = m_propertyAmbience.AmbienceSoundVector;
Why? AmbienceSoundVector is a member of TPropertyAmbience struct, which is of type std::vector<std::string>, so you were assigning a value of different type to rSoundFileNameVector.
Change:
Code:
DeleteVectorItem<CFilename>(&m_propertyAmbience.AmbienceSoundVector, dwCurSel);
To:
Code:
DeleteVectorItem<std::string>(&m_propertyAmbience.AmbienceSoundVector, dwCurSel);
Pretty much the same reason... Also, refrain from using CFilename, it's deprecated I think, use std::string instead.