Example #1
0
/*===========================================================================
 *
 * Class CSrScrlView Method - void UpdateEffectList (ListIndex, Update);
 *
 *=========================================================================*/
void CSrScrlView::UpdateEffectList (const int ListIndex, const bool Update)
{
	CSrFormidSubrecord*	pEffectID;
	srrlcustomdata_t*	pCustomData;
	srformid_t			FormID;
	CString				Buffer;

	if (GetInputRecord() == NULL) return;

	pCustomData = m_EffectList.GetCustomData(ListIndex);
	if (pCustomData == NULL) return;

	if (Update) m_EffectList.UpdateRecord(ListIndex);

	pEffectID = SrCastClassNull(CSrFormidSubrecord, pCustomData->Subrecords[0]);
	if (pEffectID == NULL) return;
		
	FormID = pEffectID->GetValue();
	Buffer.Format("0x%08X", FormID);
	m_EffectList.SetCustomField(ListIndex, SR_FIELD_EFFECTID, Buffer);

	CSrRecord* pRecord = GetInputRecord()->GetParent()->FindFormID(FormID);
	CSrIdRecord* pIdRecord = SrCastClassNull(CSrIdRecord, pRecord);
	if (pIdRecord != NULL) m_EffectList.SetCustomField(ListIndex, SR_FIELD_EFFECTNAME, pIdRecord->GetEditorID());
	
	Buffer.Format("%d", pCustomData->UserCount);
	m_EffectList.SetCustomField(ListIndex, SR_FIELD_CONDITIONCOUNT, Buffer);  
}
Example #2
0
/*===========================================================================
 *
 * Class CSrSelectRecordDlg Method - int UpdateEditorID (void);
 *
 *=========================================================================*/
int CSrSelectRecordDlg::UpdateEditorID (void) {
    CString	Buffer;
    CSString	EditorID;
    CSrIdRecord*	pIdRecord;
    int		ListIndex;

    m_CurrentText.GetWindowText(Buffer);
    EditorID = Buffer;

    SrPrepareEditorID(EditorID);

    if (EditorID.IsEmpty())
    {
        m_CurrentFormID = 0;
    }
    else
    {
        pIdRecord = m_pRecordHandler->FindEditorID(EditorID);
        if (pIdRecord == NULL) return (SR_CHECKRESULT_ERROR);

        ListIndex = m_RecordList.FindRecord(pIdRecord);
        if (ListIndex < 0) return (SR_CHECKRESULT_ERROR);

        m_CurrentEditorID = pIdRecord->GetEditorID();
        m_CurrentFormID = pIdRecord->GetFormID();
    }

    if (m_CurrentFormID == m_InitialFormID) return (SR_CHECKRESULT_NOCHANGE);

    Buffer.Format(_T("0x%08X"), m_CurrentFormID);
    m_CurrentFormIDText.SetWindowText(Buffer);

    return (SR_CHECKRESULT_OK);
}
Example #3
0
/*===========================================================================
 *
 * Class CSrSelectRecordDlg Method - void SetControlData (void);
 *
 *=========================================================================*/
void CSrSelectRecordDlg::SetControlData (void) {
    CString      Buffer;
    CString      EditorID;
    CSrIdRecord* pIdRecord;

    m_RecordList.SortList(SR_FIELD_EDITORID);
    if (m_DlgInfo.SortField != SR_FIELD_EDITORID) m_RecordList.SortList(m_DlgInfo.SortField);

    m_RecordList.SelectRecord(m_pCurrentRecord);

    if (m_pPrevRecord == NULL) {
        m_PreviousText.SetWindowText("");
        m_PreviousFormIDText.SetWindowText("0x00000000");
    }
    else {
        pIdRecord = SrCastClass(CSrIdRecord, m_pPrevRecord);
        if (pIdRecord != NULL) EditorID = pIdRecord->GetEditorID();

        Buffer.Format("%s", EditorID);
        m_PreviousText.SetWindowText(Buffer);

        Buffer.Format("0x%08X", m_pPrevRecord->GetFormID());
        m_PreviousFormIDText.SetWindowText(Buffer);
    }

    UpdateCurrentRecord();
}
Example #4
0
/*===========================================================================
 *
 * Class CSrLvlEditDlg Method - int UpdateEditorID (void);
 *
 *=========================================================================*/
int CSrLvlEditDlg::UpdateEditorID (void)
{
    CString			Buffer;
    CSString		EditorID;
    CSrIdRecord*	pIdRecord;
    bool			Result;
    int				ListIndex;

    m_ObjectID.GetWindowText(Buffer);
    EditorID = Buffer;

    Result = SrPrepareEditorID(EditorID);
    if (!Result) return (SR_CHECKRESULT_ERROR);

    pIdRecord = m_pRecordHandler->FindEditorID(EditorID);
    if (pIdRecord == NULL) return (SR_CHECKRESULT_ERROR);
    if (pIdRecord->GetFormID() == m_ParentFormID) return (SR_CHECKRESULT_ERROR);

    ListIndex = m_RecordList.FindRecord(pIdRecord);
    if (ListIndex < 0) return (SR_CHECKRESULT_ERROR);

    m_ObjectFormID = pIdRecord->GetFormID();
    if (m_ObjectFormID == m_pListInfo->GetFormID()) return (SR_CHECKRESULT_NOCHANGE);

    Buffer.Format(_T("0x%08X"), m_ObjectFormID);
    m_FormID.SetWindowText(Buffer);

    return (SR_CHECKRESULT_OK);
}
Example #5
0
void CSrScrlView::GetCurrentEffect (void)
{	
	CString Buffer;

	if (m_pCurrentEffect == NULL) return;

	if (m_pCurrentEffect->pEffectData) 
	{
		m_Magnitude.GetWindowText(Buffer);
		m_pCurrentEffect->pEffectData->SetMagnitude((float) atof(Buffer));
		m_Area.GetWindowText(Buffer);
		m_pCurrentEffect->pEffectData->SetArea(atoi(Buffer));
		m_Duration.GetWindowText(Buffer);
		m_pCurrentEffect->pEffectData->SetDuration(atoi(Buffer));
	}

	if (m_pCurrentEffect->pEffect)
	{
		m_EffectName.GetWindowText(Buffer);
		Buffer.Trim();

		if (Buffer.IsEmpty())
		{
			m_pCurrentEffect->pEffect->SetValue(0);
		}
		else
		{
			CSrIdRecord* pRecord = GetInputRecord()->GetParent()->FindEditorID(Buffer);
			if (pRecord) m_pCurrentEffect->pEffect->SetValue(pRecord->GetFormID());
		}
	}

	for (dword i = 0; i < m_Effects.GetSize(); ++i)
	{
		srrlcustomdata_t* pCustomData = (srrlcustomdata_t *) m_EffectList.GetItemData(i);
		if (pCustomData == NULL) continue;

		CSrFormidSubrecord* pEffect = SrCastClassNull(CSrFormidSubrecord, pCustomData->Subrecords[0]);
		if (pEffect == NULL) continue;
		if (pEffect != m_pCurrentEffect->pEffect) continue;

		pCustomData->UserCount = m_pCurrentEffect->Conditions.GetSize();
		pCustomData->Subrecords.Truncate(2);

		int CDIndex = 2;

		for (dword j = 0; j < m_pCurrentEffect->Conditions.GetSize(); ++j)
		{
			srconditioninfo_t* pCondInfo = m_pCurrentEffect->Conditions[j];
			pCustomData->Subrecords.Add(&pCondInfo->Condition);
			if (pCondInfo->pParam1 != NULL)	pCustomData->Subrecords.Add(pCondInfo->pParam1);
			if (pCondInfo->pParam2 != NULL)	pCustomData->Subrecords.Add(pCondInfo->pParam2);
		}

		UpdateEffectList(i, true);
		break;
	}
	
}
void CSrWeapRecord::SetEquipSlot (const char* pEditorID)
{
	if (pEditorID == NULL || *pEditorID == 0)
	{
		SetEquipSlotID(0);
	}
	else if (m_pParent)
	{
		CSrIdRecord* pRecord = m_pParent->FindEditorID(pEditorID);

		if (pRecord == NULL)
			SetEquipSlotID(0);
		else
			SetEquipSlotID(pRecord->GetFormID());
	}
}
Example #7
0
/*===========================================================================
 *
 * Class CSrSelectRecordDlg Method - void UpdateCurrentRecord (void);
 *
 *=========================================================================*/
void CSrSelectRecordDlg::UpdateCurrentRecord (void) {
    CString      Buffer;
    CSrIdRecord* pIdRecord;

    //m_pCurrentRecord = m_RecordList.GetSelectedRecord();
    m_CurrentEditorID.Empty();

    if (m_pCurrentRecord == NULL) {
        m_CurrentText.SetWindowText("");
        m_CurrentFormIDText.SetWindowText("0x00000000");
    }
    else {
        pIdRecord = SrCastClass(CSrIdRecord, m_pCurrentRecord);
        if (pIdRecord != NULL) m_CurrentEditorID = pIdRecord->GetEditorID();

        Buffer.Format("%s", m_CurrentEditorID);
        m_CurrentText.SetWindowText(Buffer);

        Buffer.Format("0x%08X", m_pCurrentRecord->GetFormID());
        m_CurrentFormIDText.SetWindowText(Buffer);
    }

}