/*===========================================================================
 *
 * Class CSrIdKeyRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrIdKeyRecord::InitializeNew (void) 
{
  CSrIdRecord::InitializeNew();

  AddNewSubrecord(SR_NAME_KSIZ);
  if (m_pKeywordCount != NULL) m_pKeywordCount->InitializeNew();

  AddNewSubrecord(SR_NAME_KWDA);
  if (m_pKeywords != NULL) m_pKeywords->InitializeNew();   
}
/*===========================================================================
 *
 * Class CSrLvliRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrLvliRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_LVLD);
	if (m_pChanceNone != NULL) m_pChanceNone->InitializeNew();

	AddNewSubrecord(SR_NAME_LVLF);
	if (m_pFlags != NULL) m_pFlags->InitializeNew();

	AddNewSubrecord(SR_NAME_LLCT);
	if (m_pListCount != NULL) m_pListCount->InitializeNew();
}
/*===========================================================================
 *
 * Class CSrArmaRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrArmaRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_BODT);
	if (m_pBodtData != NULL) m_pBodtData->InitializeNew();

	AddNewSubrecord(SR_NAME_RNAM);
	if (m_pRace != NULL) m_pRace->InitializeNew();

	AddNewSubrecord(SR_NAME_DNAM);
	if (m_pDnamData != NULL) m_pDnamData->InitializeNew();

}
/*===========================================================================
 *
 * Class CSrSndrRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrSndrRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_CNAM);
	if (m_pCnamData != NULL) m_pCnamData->InitializeNew();

	AddNewSubrecord(SR_NAME_ONAM);
	if (m_pOutputMarker != NULL) m_pOutputMarker->InitializeNew();

	AddNewSubrecord(SR_NAME_BNAM);
	if (m_pSndrData != NULL) m_pSndrData->InitializeNew();

}
/*===========================================================================
 *
 * Class CSrGlobRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrGlobRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();
		
	AddNewSubrecord(SR_NAME_FLTV);
	if (m_pValue != NULL) m_pValue->InitializeNew();

	AddNewSubrecord(SR_NAME_FNAM);

	if (m_pType != NULL) 
	{
		m_pType->InitializeNew();
		m_pType->SetValue('f');
	}
	
}
/*===========================================================================
 *
 * Class CSrIdKeyRecord Method - void SetKeywords (Buffer);
 *
 *=========================================================================*/
void CSrIdKeyRecord::SetKeywords (const CSString Buffer)
{
	CSStringArray Strings;
	CSrRecord*    pRecord;

	if (m_pParent == NULL) return;
	SplitString(Strings, Buffer, ',');
		
	if (m_pKeywords == NULL) 
	{
		AddNewSubrecord(SR_NAME_KWDA);
		if (m_pKeywords == NULL) return;
		m_pKeywords->InitializeNew();
	}

	m_pKeywords->GetFormIDArray().Empty();

	for (dword i = 0; i < Strings.GetSize(); ++i)
	{
		pRecord = m_pParent->FindEditorID(Strings[i]->c_str());
		if (pRecord == NULL) continue;
		m_pKeywords->GetFormIDArray().Add(pRecord->GetFormID());
	}	

	SetKeywordCount(m_pKeywords->GetFormIDArray().GetSize());
}
/*===========================================================================
 *
 * Class CSrMiscRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrMiscRecord::InitializeNew (void) 
{
	CSrItem1Record::InitializeNew();

	AddNewSubrecord(SR_NAME_DATA);
	if (m_pMiscData != NULL) m_pMiscData->InitializeNew();
}
/*===========================================================================
 *
 * Class CSrEcznRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrEcznRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_DATA);
	if (m_pEncounterData != NULL) m_pEncounterData->InitializeNew();
}
Example #9
0
/*===========================================================================
 *
 * Class CSrIdRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrIdRecord::InitializeNew (void) 
{
	CSrRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_EDID);
	if (m_pEditorID != NULL) m_pEditorID->InitializeNew(); 
}
/*===========================================================================
 *
 * Class CSrCobjRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrCobjRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_COCT);
	if (m_pComponentCount != NULL) m_pComponentCount->InitializeNew();

	AddNewSubrecord(SR_NAME_CNAM);
	if (m_pItemResult != NULL) m_pItemResult->InitializeNew();

	AddNewSubrecord(SR_NAME_NAM1);
	if (m_pResultQnt != NULL) m_pResultQnt->InitializeNew();

	AddNewSubrecord(SR_NAME_BNAM);
	if (m_pStation != NULL) m_pStation->InitializeNew();

}
Example #11
0
/*===========================================================================
 *
 * Class CSrWatrRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrWatrRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_NULL);
	if (m_pItemName != NULL) m_pItemName->InitializeNew();

}
void CSrAvifRecord::CreateFromSectionInfo (CSrAvifSectionArray& InfoArray)
{
	CSrDwordSubrecord* pCNameCopy = NULL;

		/* Save the first CNAM if required */
	for (dword i = 0; i < m_Subrecords.GetSize(); ++i)
	{
		if (m_Subrecords[i]->GetRecordType() == SR_NAME_PNAM) break;

		if (m_Subrecords[i]->GetRecordType() == SR_NAME_CNAM) 
		{
			pCNameCopy = new CSrDwordSubrecord;
			pCNameCopy->CopyFull(m_Subrecords[i]);
			break;
		}
	}

	DeleteSubrecords(SR_NAME_PNAM);	DeleteSubrecords(SR_NAME_FNAM);	DeleteSubrecords(SR_NAME_XNAM);
	DeleteSubrecords(SR_NAME_YNAM);	DeleteSubrecords(SR_NAME_HNAM);	DeleteSubrecords(SR_NAME_VNAM);
	DeleteSubrecords(SR_NAME_SNAM);	DeleteSubrecords(SR_NAME_CNAM);	DeleteSubrecords(SR_NAME_INAM);

		/* Re-add the saved CNAM if needed */
	if (pCNameCopy != NULL)
	{
		AddNewSubrecordAfter(SR_NAME_CNAM, SR_NAME_DESC)->CopyFull(pCNameCopy);
		delete pCNameCopy;
		pCNameCopy = NULL;
	}

	for (dword i = 0; i < InfoArray.GetSize(); ++i)
	{
		sravifsection_t& Section = *InfoArray[i];

		AddNewSubrecord(SR_NAME_PNAM)->Copy(&Section.PName);
		AddNewSubrecord(SR_NAME_FNAM)->Copy(&Section.FName);
		AddNewSubrecord(SR_NAME_XNAM)->Copy(&Section.XName);
		AddNewSubrecord(SR_NAME_YNAM)->Copy(&Section.YName);
		AddNewSubrecord(SR_NAME_HNAM)->Copy(&Section.HName);
		AddNewSubrecord(SR_NAME_VNAM)->Copy(&Section.VName);
		AddNewSubrecord(SR_NAME_SNAM)->Copy(&Section.SName);

		for (dword j = 0; j < Section.CNames.GetSize(); ++j)
		{
			AddNewSubrecord(SR_NAME_CNAM)->Copy(Section.CNames[j]);
		}

		AddNewSubrecord(SR_NAME_INAM)->Copy(&Section.IName);
	}

}
void CSrGlobRecord::SetGlobalValue (const float Value)
{
	if (m_pValue == NULL)
	{
		AddNewSubrecord(SR_NAME_FLTV);
		if (m_pValue == NULL) return;
	}

	m_pValue->SetValue(Value);
}
Example #14
0
 void CSrIdRecord::SetBoundsData (const srboundsdata_t Data)
 {
	 if (m_pBounds == NULL)
	 {
		 AddNewSubrecord(SR_NAME_OBND);
		 if (m_pBounds != NULL) m_pBounds->InitializeNew();
	 }

	 m_pBounds->GetBoundsData() = Data;
 }
Example #15
0
/*===========================================================================
 *
 * Class CSrIdRecord Method - void SetEditorID (pString);
 *
 *=========================================================================*/
void CSrIdRecord::SetEditorID (const SSCHAR* pString) 
{

	if (m_pEditorID == NULL) 
	{
		AddNewSubrecord(SR_NAME_EDID);
		if (m_pEditorID == NULL) return;
	}

	m_pEditorID->SetString(pString);
}
void CSrFlstRecord::AddItem (const srformid_t FormID)
{
	CSrSubrecord* pSubrecord = AddNewSubrecord(SR_NAME_LNAM);
	CSrFormidSubrecord* pFormID = SrCastClassNull(CSrFormidSubrecord, pSubrecord);

	if (pFormID != NULL) 
	{
		pFormID->InitializeNew();
		pFormID->SetValue(FormID);
	}
}
void CSrIdKeyRecord::SetKeywordCount (const dword Count)
{
	if (m_pKeywordCount == NULL)
	{
		AddNewSubrecord(SR_NAME_KSIZ);
		if (m_pKeywordCount == NULL) return;
		m_pKeywordCount->InitializeNew();
	}

	m_pKeywordCount->SetValue(Count);
}
Example #18
0
void CSrLvliRecord::SetChanceNone (const byte Value)
{
	if (m_pChanceNone == NULL)
	{
		AddNewSubrecord(SR_NAME_LVLD);
		if (m_pChanceNone == NULL) return;
		m_pChanceNone->InitializeNew();
	}

	m_pChanceNone->SetValue(Value);
}
void CSrCobjRecord::UpdateComponentCount (void)
{
	if (m_pComponentCount == NULL)
	{
		AddNewSubrecord(SR_NAME_COCT);
		if (m_pComponentCount == NULL) return;
		m_pComponentCount->InitializeNew();
	}

	m_pComponentCount->SetValue(CountSubrecords(SR_NAME_CNTO));
}
Example #20
0
void CSrWeapRecord::SetEquipSlotID (const srformid_t FormID)
{
	if (m_pEquipSlot == NULL)
	{
		AddNewSubrecord(SR_NAME_ETYP);
		if (m_pEquipSlot == NULL) return;
		m_pEquipSlot->InitializeNew();
	}

	m_pEquipSlot->SetValue(FormID);

}
/*===========================================================================
 *
 * Class CSrItem2Record Method - void SetEnchantPoints (Points);
 *
 *=========================================================================*/
void CSrItem2Record::SetEnchantPoints (const word Points) 
{
  
  if (m_pEnchantPoints == NULL) 
  {
     AddNewSubrecord(SR_NAME_EAMT);
     if (m_pEnchantPoints == NULL) return;
     m_pEnchantPoints->InitializeNew();
  }

  m_pEnchantPoints->SetValue(Points);
} 
Example #22
0
void CSrLvliRecord::SetListCount (const dword Value)
{

	if (m_pListCount == NULL)
	{
		AddNewSubrecord(SR_NAME_LLCT);
		if (m_pListCount == NULL) return;
		m_pListCount->InitializeNew();
	}

	if (Value > SR_LVLO_MAXCOUNT) return;
	m_pListCount->SetValue((byte) Value);
}
Example #23
0
/*===========================================================================
 *
 * Class CSrWeapRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrWeapRecord::InitializeNew (void) 
{

	/* Call the base class method first */
  CSrItem2Record::InitializeNew();

  AddNewSubrecord(SR_NAME_VNAM);
  if (m_pVNAM != NULL) m_pVNAM->InitializeNew();   

  AddNewSubrecord(SR_NAME_DATA);
  if (m_pWeaponData != NULL) m_pWeaponData->InitializeNew();

  AddNewSubrecord(SR_NAME_ETYP);
  if (m_pEquipSlot != NULL) m_pEquipSlot->InitializeNew();

  AddNewSubrecord(SR_NAME_DNAM);
  if (m_pDName != NULL) m_pDName->InitializeNew();

  AddNewSubrecord(SR_NAME_CRDT);
  if (m_pCrdtData != NULL) m_pCrdtData->InitializeNew();
    
}
/*===========================================================================
 *
 * Class CSrGmstRecord Method - void InitializeNew (void);
 *
 *=========================================================================*/
void CSrGmstRecord::InitializeNew (void) 
{
	CSrIdRecord::InitializeNew();

	AddNewSubrecord(SR_NAME_DATA);

	if (m_pGlobalData != NULL) 
	{
		m_pGlobalData->InitializeNew();
		m_pGlobalData->SetInteger(0);
		UpdateGlobalType();
	}
}
CSrStringSubrecord* CSrSndrRecord::AddSoundFile (const char* pFilename)
{
	CSrStringSubrecord* pNewString;

	if (pFilename == NULL || pFilename[0] == 0) return NULL;

	CSrSubrecord* pSubrecord = AddNewSubrecord(SR_NAME_ANAM);
	pNewString = SrCastClassNull(CSrStringSubrecord, pSubrecord);
	if (pNewString == NULL) return NULL;

	pNewString->InitializeNew();
	pNewString->SetString(pFilename);

	return pNewString;
}
Example #26
0
CSrLvloSubrecord* CSrLvliRecord::AddItem (const srformid_t FormID, const dword Level, const dword Count)
{
	if (GetListCount() > SR_LVLO_MAXCOUNT) return NULL;

	CSrSubrecord* pSubrecord = AddNewSubrecord(SR_NAME_LVLO);
	CSrLvloSubrecord* pNewLvlo = SrCastClassNull(CSrLvloSubrecord, pSubrecord);
	if (pNewLvlo == NULL) return NULL;
	pNewLvlo->InitializeNew();

	pNewLvlo->GetListData().Count  = Count;
	pNewLvlo->GetListData().Level  = Level;
	pNewLvlo->GetListData().FormID = FormID;

	SetListCount(GetListCount() + 1);
	return pNewLvlo;
}
/*===========================================================================
 *
 * Class CSrIdKeyRecord Method - void SetKeywords (FormIDs);
 *
 *=========================================================================*/
void CSrIdKeyRecord::SetKeywords (CSrFormidArray& FormIDs)
{
	if (FormIDs.GetSize() == 0)
	{	
		DeleteSubrecords(SR_NAME_KWDA);
		m_pKeywords = NULL;
	}
	else if (m_pKeywords == NULL)
	{
		AddNewSubrecord(SR_NAME_KWDA);
		if (m_pKeywords == NULL) return;
		m_pKeywords->InitializeNew();
	}

	SetKeywordCount(FormIDs.GetSize());
	m_pKeywords->GetFormIDArray() = FormIDs;
}
/*===========================================================================
 *
 * Class CSrItem2Record Method - void SetEnchantment (FormID);
 *
 *=========================================================================*/
void CSrItem2Record::SetEnchantment (const srformid_t FormID)
{

  if (FormID == SR_FORMID_NULL && m_pEnchantment != NULL) 
  {
    DeleteSubrecords(SR_NAME_EITM);
    m_pEnchantment = NULL;
    return;
  }

  if (m_pEnchantment == NULL) 
  {
     AddNewSubrecord(SR_NAME_EITM);
     if (m_pEnchantment == NULL) return;
     m_pEnchantment->InitializeNew();
  }

  m_pEnchantment->SetValue(FormID);
} 
void CSrGlobRecord::SetGlobalType (const byte  Value)
{
	if (m_pType == NULL)
	{
		AddNewSubrecord(SR_NAME_FNAM);
		if (m_pType == NULL) return;
	}

	switch (tolower(Value))
	{
	case 'l':
		m_pType->SetValue('l');
		break;
	case 's':
		m_pType->SetValue('s');
		break;
	case 'f':
		m_pType->SetValue('f');
		break;
	}
}