示例#1
0
void DialogEntityDefEditor::BuildDeclText( idStr &declText )
{
	CString declName;
	declNameEdit.GetWindowText(declName);
	CString inherit;
	inheritCombo.GetWindowText(inherit);
	CString spawnclass;
	spawnclassCombo.GetWindowText(spawnclass);

	declText = "entityDef " + declName + "\r{\r";
	declText += "\"inherit\"\t\t\t\"" + inherit + "\"\r";
	declText += "\"spawnclass\"\t\t\t\"" + spawnclass + "\"\r";
	for (int i=0; i<keyValsList.GetCount(); i++) {
		CPropertyItem* pItem = (CPropertyItem*)keyValsList.GetItemDataPtr(i);
		if (pItem) {
			// Items with a * in front are inherited and shouldn't be written out
			if (pItem->m_propName[0] == '*') {
				break;
			}
			declText += "\"" + pItem->m_propName + "\"\t\t\t\"" + pItem->m_curValue + "\"\r";
		}
	}
	declText += "}\r";

	declText.Replace( "\r", "\r\n" );
	declText.Insert( "\r\n\r\n", 0 );
	declText.StripTrailing( "\r\n" );
}