当前位置: 首页>>代码示例>>C++>>正文


C++ FitIniFile类代码示例

本文整理汇总了C++中FitIniFile的典型用法代码示例。如果您正苦于以下问题:C++ FitIniFile类的具体用法?C++ FitIniFile怎么用?C++ FitIniFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FitIniFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

int	LogisticsMechDisplay::init( )
{
	FitIniFile file;
	FullPathFileName path;
	path.init( artPath, "mcl_mechinfo", ".fit" );
	if ( NO_ERR !=  file.open( path ) )
	{
		Assert( 0, 0, "Couldn't open mcl_mechinfo.fit" );
		return 0;
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
	
	mechCamera.init( rects[1].left(), rects[2].top(),
			rects[2].left(), rects[2].bottom() );

	char blockName[64];
	for ( int i = 0; i < 3; i++ )
	{
		sprintf( blockName, "AttributeMeter%ld", i );
		attributeMeters[i].init( &file, blockName );
	}

	
	componentListBox.init( rects[0].left(), rects[0].top(),
		rects[0].width(), rects[0].height() );


	return 1;


}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:32,代码来源:logisticsmechdisplay.cpp

示例2: HotKeyListItem

void HotKeyListItem::init()
{
	if ( s_item )
		return;

	s_item = new HotKeyListItem();
	FitIniFile file;
	FullPathFileName path;
	path.init( artPath, "mcl_options_combobox1", ".fit" );
	if ( NO_ERR != file.open( path ) )
	{
		char error[256];
		sprintf( error, "couldn't open file %s", path );
		Assert( 0, 0, error );
		return;	
	}

	s_item->description.init( &file, "Text0" );
	s_item->text.init( &file, "Text1" );

	s_item->animations[0].init( &file, "Animation0" );
	s_item->animations[1].init( &file, "Animation1" );
	s_item->animations[2].init( &file, "Animation2" );

	s_item->rects[0].init( &file, "Rect0" );
	s_item->rects[1].init( &file, "Rect1" );
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例3: init

int LogisticsVariantDialog::init( FitIniFile& file )
{
	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button", "Edit");

		file.seekBlock( "InAnim" );
		enterAnim.init( &file, "" );
		file.seekBlock( "OutAnim" );
		exitAnim.init( &file, "" );

		gameListBox.init( rects[1].globalX(), 
			rects[1].globalY(), 
			rects[1].width(),
			rects[1].height() );

		gameListBox.setOrange(true);

		for ( int i = 0; i < buttonCount; i++ )
			buttons[i].setMessageOnRelease();

	edits[0].limitEntry( 14 );

	templateItem.init( file, "AnimText" );

	for ( i = 0; i < editCount; i++ )
	{
		edits[i].allowWierdChars( 0 );
	}
	return 0;		
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:29,代码来源:LogisticsDialog.cpp

示例4: init

long LightType::init (FilePtr objFile, unsigned long fileSize) {

	long result = 0;
	
	FitIniFile explFile;
	result = explFile.open(objFile,fileSize);
	if (result != NO_ERR)
		return(result);

	result = explFile.seekBlock("LightData");
	if (result != NO_ERR)
		return result;

	result = explFile.readIdBoolean("OneShotFlag",oneShotFlag);
	if (result != NO_ERR)
		return result;

	result = explFile.readIdFloat("AltitudeOffset",altitudeOffset);
	if (result != NO_ERR)
		return result;

	//------------------------------------------------------------------
	// Initialize the base object Type from the current file.
	result = ObjectType::init(&explFile);
	return(result);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:26,代码来源:light.cpp

示例5: updateCampaignMissionInfo

void LogisticsSaveDialog::updateCampaignMissionInfo()
{

	FitIniFile file;
	FullPathFileName path;
	path.init( campaignPath, selectedName, ".fit" );
	if ( NO_ERR != file.open( path ) )
	{
		Assert( 0, 0, "coudln't find the campaign file\n" );
	}

	char fileName[256];

	if ( NO_ERR == file.seekBlock( "Group0Mission0" ) )
	{
		if ( NO_ERR != file.readIdString( "FileName", fileName, 1023 ) )
		{				
			setMission( "" );
		}		
		else
		{
			setMission( fileName );
		}
	}	
	else
		setMission( "" );

}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:28,代码来源:LogisticsDialog.cpp

示例6: UpdateData

void CMissionDialog::OnMiPurchaseFileBrowseButton() {
	UpdateData(TRUE);
	while (true) {
		CFileDialog selectFileDialog(TRUE,_T("FIT"),_T("*.FIT"),
						 OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_NOCHANGEDIR,
						 _T("FIT File (*.FIT)|*.FIT|"));
		selectFileDialog.m_ofn.lpstrInitialDir = missionPath;
		if( selectFileDialog.DoModal()==IDOK ) {
			CString purchasePath = selectFileDialog.GetPathName();
			FitIniFile file;
			long result = 0;
			result = file.open( (char*)(const char*)purchasePath );
			if (NO_ERR != result) {
				AfxMessageBox(IDS_COULDNT_OPEN_PURCHASE_FILE);
			} else {
				long result = 0;
				result = file.seekBlock("Mechs");
				if (NO_ERR != result)
				{
					AfxMessageBox(IDS_NOT_A_VALID_PURCHASE_FILE);
				}
				file.close();
			}
			m_PurchaseFileEdit = selectFileDialog.GetFileTitle();
			break;
		} else {
			break;
		}
	}
	UpdateData(FALSE);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:31,代码来源:missiondialog.cpp

示例7: init

void aAnimButton::init( FitIniFile& file, const char* headerName, HGOSFONT3D font )
{
	if ( NO_ERR != file.seekBlock( headerName ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't find block %s in file %s", headerName, file.getFilename() );
		Assert( 0, 0, errorStr );
		animateBmp = 0;
		animateText = 0;
		return;
	}
	aButton::init( file, headerName, font );
	normalData.init( &file, "Normal" );
	pressedData.init( &file, "Pressed" );
	highlightData.init( &file, "Highlight" );
	disabledData.init( &file, "Disabled" );
	normalData.begin();

	if ( NO_ERR != file.readIdBoolean( "AnimateBmp", animateBmp ) )
		animateBmp = 1;
	if ( NO_ERR != file.readIdBoolean( "AnimateText", animateText ) )
		animateText = 1;

	bool bTmp = 0;
	if ( NO_ERR == file.readIdBoolean( "AnimateChildren", bTmp  ) )
	{
		bAnimateChildren = bTmp;
	}
	
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例8: init

int32_t LogisticsSaveDialog::init(FitIniFile& file)
{
	if (!s_instance)
	{
		s_instance = new LogisticsSaveDialog();
		((LogisticsScreen*)s_instance)->init(file, "Static", "Text", "Rect", "Button");
		file.seekBlock("InAnim");
		s_instance->enterAnim.init(&file, "");
		file.seekBlock("OutAnim");
		s_instance->exitAnim.init(&file, "");
		s_instance->gameListBox.init(s_instance->rects[1].globalX(), s_instance->rects[1].globalY(),
			s_instance->rects[1].width(), s_instance->rects[1].height());
		s_instance->gameListBox.setTopSkip(3);
		s_instance->gameListBox.setOrange(true);
		for (size_t i = 0; i < s_instance->buttonCount; i++)
			s_instance->buttons[i].setMessageOnRelease();
		s_instance->templateItem.init(&file, "AnimText");
		s_instance->templateItem.resize(
			s_instance->gameListBox.width() - 30, s_instance->templateItem.height());
		for (i = 0; i < s_instance->editCount; i++)
		{
			s_instance->edits[i].allowWierdChars(0);
		}
	}
	s_instance->getButton(YES)->setPressFX(LOG_NEXTBACKBUTTONS);
	return 0;
}
开发者ID:mechasource,项目名称:mechcommander2,代码行数:27,代码来源:logisticsdialog.cpp

示例9: readCampaignNameFromFile

void LogisticsSaveDialog::readCampaignNameFromFile( char* fileName, char* resultName, long len )
{
	FullPathFileName path;
	path.init( campaignPath, fileName, ".fit" );

	FitIniFile file;

	if ( NO_ERR != file.open( (char*)(const char*)path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", path );
		Assert( 0, 0, errorStr );
	}

	
	long result = file.seekBlock( "Campaign" );
	Assert( result == NO_ERR, 0, "Coudln't find the mission settings block in the mission file" );

	resultName[0] = 0;
	long lName = 0;

	result = file.readIdLong( "NameID", lName );
	if ( result == NO_ERR )
	{
		cLoadString( lName, resultName, len );
	}
	else
	{
		result = file.readIdString( "CampaignName", resultName, len );
		Assert( result == NO_ERR, 0, "couldn't find the missionName" );
	}
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:32,代码来源:LogisticsDialog.cpp

示例10: Read

bool CCampaignData::Read(CString pathName) {
	FitIniFile fitFile;
	int result = fitFile.open(pathName.GetBuffer(0));
	if (NO_ERR != result) { assert(false); return false; }

	result = fitFile.seekBlock("Campaign");
	if (NO_ERR != result) { assert(false); }
	result = sReadIdString(fitFile, "CampaignName", m_Name);
	if (NO_ERR == result) { m_NameUseResourceString = false; }
	result = sReadIdInteger(fitFile, "NameID", m_NameResourceStringID);
	if (NO_ERR == result) { m_NameUseResourceString = true; }
	result = sReadIdBoolean(fitFile, "NameUseResourceString", m_NameUseResourceString);
	result = sReadIdInteger(fitFile, "CBills", m_CBills);
	result = sReadIdString(fitFile, "FinalVideo", m_FinalVideo);
	int groupCount = 0;
	result = sReadIdInteger(fitFile, "GroupCount", groupCount);
	if (NO_ERR != result) { return false; }

	int index;
	for (index = 0; groupCount > index; index+=1) {
		ECharString blockName;
		blockName.Format("Group%d", index);
		result = fitFile.seekBlock(blockName.Data());
		if (NO_ERR != result) { assert(false); continue; }
		CGroupData groupData;
		bool bresult = groupData.Read(fitFile, blockName.Data());
		if (true != bresult) { assert(false); continue; }
		m_GroupList.Append(groupData);
	}

	fitFile.close();
	return true;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例11: isCorrectVersionSaveGame

bool LogisticsSaveDialog::isCorrectVersionSaveGame( char* fileName )
{
	FullPathFileName path;
	path.init( savePath, fileName, ".fit" );

	FitIniFile file;

	if ( NO_ERR != file.open( (char*)(const char*)path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", path );
		STOP((errorStr));
	}

	
	long result = file.seekBlock( "Version" );
	if (result != NO_ERR)
		return false;

	long testVersionNum = 0;
	result = file.readIdLong( "VersionNumber", testVersionNum );
	if ( (result == NO_ERR) && (testVersionNum == SaveGameVersionNumber))
		return true;

	return false;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:26,代码来源:LogisticsDialog.cpp

示例12: init

void MechListBoxItem::init( FitIniFile& file )
{
	if ( !s_templateItem )
	{
		s_templateItem = new MechListBoxItem( NULL, 0 );
		file.seekBlock( "MainBox" );

		long width, height;

		file.readIdLong( "Width", width );
		file.readIdLong( "Height", height );

		((aObject*)s_templateItem)->init( 0, 0, width, height );

		memset( s_templateItem->animationIDs, 0, sizeof(long) * 9  );

		// rects
		s_templateItem->line.init( &file, "Rect1" );
		s_templateItem->outline.init( &file, "Rect0" );

		long curAnim = 0;
		// statics
		s_templateItem->weightIcon.init( &file, "Static0" );
		assignAnimation( file, curAnim );
	
		s_templateItem->mechIcon.init( &file, "Static1" );
		assignAnimation( file, curAnim );
		s_templateItem->costIcon.init( &file, "Static2" );
		assignAnimation( file, curAnim );

		// texts
		s_templateItem->chassisName.init( &file, "Text0" );
		assignAnimation( file, curAnim );
		s_templateItem->weightText.init( &file, "Text1" );
		assignAnimation( file, curAnim );
		s_templateItem->countText.init( &file, "Text2" );
		assignAnimation( file, curAnim );
		s_templateItem->variantName.init( &file, "Text3" );
		assignAnimation( file, curAnim );
		s_templateItem->costText.init( &file, "Text4" );
		assignAnimation( file, curAnim );

		char blockName[64];
		for ( int i = 0; i < 4; i++ )
		{
			sprintf( blockName, "OrangeAnimation%ld", i );
			s_templateItem->animations[1][i].init( &file, blockName );
			sprintf( blockName, "Animation%ld", i );
			s_templateItem->animations[0][i].init( &file, blockName );
		}
		
	}

}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:54,代码来源:MechListBox.cpp

示例13: strcpy

void MPGameBrowser::init(FitIniFile* file)
{
	LogisticsScreen::init( *file, "Static", "Text", "Rect", "Button" );

	if ( buttonCount )
	{
		for ( int i = 0; i < buttonCount; i++ )
		{
			buttons[i].setMessageOnRelease();
			if (buttons[i].getID() == 0)
			{
				buttons[i].setID(FIRST_BUTTON_ID + i);
				buttons[i].setPressFX( LOG_VIDEOBUTTONS );
				buttons[i].setHighlightFX( LOG_DIGITALHIGHLIGHT );
				buttons[i].setDisabledFX( LOG_WRONGBUTTON );
			}
		}
	}


	{
		char path[256];
		strcpy( path, artPath );
		strcat( path, "mcl_mp_lanbrowsercombobox0.fit" );
		
		FitIniFile PNfile;
		if ( NO_ERR != PNfile.open( path ) )
		{
			char error[256];
			sprintf( error, "couldn't open file %s", path );
			Assert( 0, 0, error );
			return;
		}
		
		PNfile.seekBlock("GameList"); /*for some reason aListBox::init(...) doesn't do the seekBlock itself*/
		gameList.init(&PNfile, "GameList");

		gameList.SelectItem(0);
		gameList.init( rects[0].left(), rects[0].top(), rects[0].width(), rects[0].height() );
		gameList.setOrange( true );

		templateItem.init(&PNfile, "GameListItem");

		for ( int i = 0; i < 256; i++ )
		{
			items[i] = templateItem;
		}

	}


	hostDlg.init();
}
开发者ID:Jacic,项目名称:MechCommander2,代码行数:53,代码来源:MPGameBrowser.cpp

示例14: save

long LogisticsVariant::save( FitIniFile& file, long counter )
{
	char tmp[256];
	char tmp2[256];
	sprintf( tmp, "Variant%ld", counter );
	file.writeBlock( tmp );
	
	file.writeIdString( "Chassis", chassis->fileName );
	file.writeIdString( "VariantName", variantName );
	file.writeIdLong( "ComponentCount", componentCount );

	for ( int i = 0; i < componentCount; i++ )
	{
		sprintf( tmp, "Component%ld", i );
		file.writeIdLong(tmp, components[i].component->getID() );
		
		strcpy( tmp2, tmp );
		strcat( tmp2, "x" );
		file.writeIdLong( tmp2, components[i].xCoord );

		strcpy( tmp2, tmp );
		strcat( tmp2, "y" );
		file.writeIdLong( tmp2, components[i].yCoord );

		strcpy( tmp2, tmp );
		strcat( tmp2, "Location" );
		file.writeIdLong( tmp2, components[i].location );
	}

	return 0;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:31,代码来源:LogisticsVariant.cpp

示例15: if

int	LogisticsMechDisplay::init( )
{
	FitIniFile file;
	FullPathFileName path;
	//path.init( artPath, "mcl_mechinfo", ".fit" );
	/*//magic 16092011 begin
	if ( Environment.screenWidth == 800 ) 
		path.init( artPath, "mcl_mechinfo", ".fit" );
	if ( Environment.screenWidth == 1280 )
		path.init( artPath, "mcl_mechinfo_1280x1024", ".fit" );
	if ( Environment.screenWidth == 1440 )
		path.init( artPath, "mcl_mechinfo_1440x900", ".fit" );
	//magic 16092011 end*/
	//magic 26092011 begin
	if ( Environment.screenWidth == 1280 )
		path.init( artPath, "mcl_mechinfo_1280x1024", ".fit" );
	else if ( Environment.screenWidth == 1440 )
		path.init( artPath, "mcl_mechinfo_1440x900", ".fit" );
	else
		path.init( artPath, "mcl_mechinfo", ".fit" );

	//magic 26092011 end
	if ( NO_ERR !=  file.open( path ) )
	{
		Assert( 0, 0, "Couldn't open mcl_mechinfo.fit" );
		return 0;
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
	
	mechCamera.init( rects[1].left(), rects[2].top(),
			rects[2].left(), rects[2].bottom() );

	char blockName[64];
	for ( int i = 0; i < 3; i++ )
	{
		sprintf( blockName, "AttributeMeter%ld", i );
		attributeMeters[i].init( &file, blockName );
	}

	
	componentListBox.init( rects[0].left(), rects[0].top(),
		rects[0].width(), rects[0].height() );


	return 1;


}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:49,代码来源:LogisticsMechDisplay.cpp


注:本文中的FitIniFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。