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


C++ FitIniFile::readIdString方法代码示例

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


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

示例1: 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

示例2: 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

示例3: init

void LogisticsVehicle::init(FitIniFile& file)
{
	componentCount = 0;
	file.seekBlock("ObjectType");
	char tmp[256];
	file.readIdString("AppearanceName", tmp, 255);
	fileName = tmp;
	file.seekBlock("General");
	file.readIdLong("DescIndex", chassisNameID);
	file.readIdFloat("CurTonnage", maxWeight);
	char tmpWeightClass[256];
	cLoadString(IDS_VEHICLE_CLASS, tmpWeightClass, 256);
	mechClass = tmpWeightClass;
	if(NO_ERROR != file.readIdLong("HouseID", houseID))
	{
		houseID = -1;
	}
	if(NO_ERROR != file.readIdLong("EncyclopediaID", encyclopediaID))
	{
		encyclopediaID = IDS_VEHICLE_DESCRIPTION_0;
	}
	file.seekBlock("VehicleDynamics");
	file.readIdFloat("MaxVelocity", speed);
	PSTR parts[5] = { "Front", "Left", "Right", "Rear", "Turret" };
	baseArmor = 0;
	uint8_t pts;
	int32_t i;
	for(i = 0; i < 5; i++)
	{
		file.seekBlock(parts[i]);
		file.readIdUChar("MaxArmorPoints", pts);
		baseArmor += pts;
		file.readIdUChar("CurInternalStructure", pts);
		baseArmor += pts;
	}
	file.seekBlock("InventoryInfo");
	file.readIdUChar("NumWeapons", pts);
	char blockName[256];
	for(i = 4; i < 4 + pts; i++)
	{
		sprintf(blockName, "Item:%ld", i);
		if(NO_ERROR == file.seekBlock(blockName))
		{
			uint8_t fitID;
			file.readIdUChar("MasterID", fitID);
			LogisticsComponent* pComponent = LogisticsData::instance->getComponent(fitID);
			if(pComponent)
			{
				components[componentCount].component = pComponent;
				components[componentCount].xCoord = 0;
				components[componentCount].yCoord = 0;
				componentCount++;
			}
		}
	}
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:56,代码来源:logisticsvariant.cpp

示例4: sReadIdString

static long sReadIdString(FitIniFile &missionFile, const char *varName, CString &CStr) {
	long result = 0;
	char buffer[2001/*buffer size*/]; buffer[0] = '\0';
	result = missionFile.readIdString((char *)varName, buffer, 2001/*buffer size*/ - 1);
	if (NO_ERR != result) {
		//assert(false);
	} else {
		CStr = buffer;
	}
	return result;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: setMission

void LogisticsSaveDialog::setMission( const char* fileName)
{
	if ( strlen( fileName ) )
	{

		long textureHandle = MissionBriefingScreen::getMissionTGA( fileName );

		statics[MAP_STATIC].setTexture( textureHandle );
		statics[MAP_STATIC].setUVs( 0, 127, 127, 0);
		statics[MAP_STATIC].setColor( 0xffffffff );

		FullPathFileName path;
		FitIniFile file;

		path.init( missionPath, fileName, ".fit" );

		if ( NO_ERR == file.open( path ) )
		{
			char missionName[256];
			missionName[0] = 0;
			bool bRes = 0;

			file.seekBlock( "MissionSettings" );
			file.readIdBoolean( "MissionNameUseResourceString", bRes );
			if ( bRes )
			{
				unsigned long lRes;
				file.readIdULong( "MissionNameResourceStringID", lRes );
				cLoadString(lRes, missionName, 255);
			}
			else
			{
				file.readIdString("MissionName", missionName, 255);
			}

			textObjects[2].setText(missionName);

		}
		else
		{
			textObjects[2].setText( "" );
		}

	}
	else
	{
		statics[MAP_STATIC].setColor( 0 );
		textObjects[2].setText( "" );

	}

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

示例6: assignAnimation

void ComponentListItem::assignAnimation(FitIniFile& file, int32_t whichChild, char animNames[COMP_ANIMATION_COUNT][32],
										aObject* object)
{
	s_templateItem->pChildAnims[whichChild] = 0;
	char tmpAnimName[32];
	file.readIdString("Animation", tmpAnimName, 31);
	for(size_t i = 0; i < COMP_ANIMATION_COUNT; i++)
	{
		if(_stricmp(animNames[i], tmpAnimName) == 0)
		{
			s_templateItem->pChildAnims[whichChild] = &s_templateItem->animations[i];
			break;
		}
	}
	s_templateItem->addChild(object);
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:16,代码来源:componentlistbox.cpp

示例7: assignAnimation

void LogisticsMechIcon::assignAnimation( FitIniFile& file, long& number )
{
	number = -1;
	char buffer[64];
	if ( NO_ERR == file.readIdString( "Animation", buffer, 63 ) )
	{
		for ( int i = 0; i < strlen( buffer ); i++ )
		{
			if ( isdigit( buffer[i] ) )
			{
				buffer[i+1] = 0;
				number = atoi( &buffer[i] );
			}
		}
	}
}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:16,代码来源:logisticsmechicon.cpp

示例8: sReadIdString

static int32_t sReadIdString(FitIniFile& missionFile, PCSTR varName, CString& CStr)
{
	int32_t result = 0;
	char buffer[2001/*buffer size*/];
	buffer[0] = '\0';
	result = missionFile.readIdString((PSTR)varName, buffer, 2001/*buffer size*/ - 1);
	if(NO_ERROR != result)
	{
		//assert(false);
	}
	else
	{
		CStr = buffer;
	}
	return result;
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:16,代码来源:campaigndata.cpp

示例9: setAnimation

void LogisticsPilotListBoxItem::setAnimation(FitIniFile& file, int32_t whichOne)
{
	char animationText[64];
	if(NO_ERROR == file.readIdString("Animation", animationText, 63))
	{
		for(size_t i = 0; i < strlen(animationText); i++)
		{
			if(isdigit(animationText[i]))
			{
				animationText[i + 1] = nullptr;
				s_templateItem->pChildAnimations[whichOne] = atoi(&animationText[i]);
				return;
			}
		}
	}
	s_templateItem->pChildAnimations[whichOne] = -1;
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:17,代码来源:logisticspilotlistbox.cpp

示例10: assignAnimation

void MechListBoxItem::assignAnimation( FitIniFile& file, long& curAnim )
{
	char tmpStr[64];

	s_templateItem->animationIDs[curAnim] = -1;
	if ( NO_ERR == file.readIdString( "Animation", tmpStr, 63 ) )
	{
		for ( int j = 0; j < strlen( tmpStr ); j++ )
		{
			if ( isdigit( tmpStr[j] ) )
			{
				tmpStr[j+1] = 0;
				s_templateItem->animationIDs[curAnim] = atoi( &tmpStr[j] );
			}
		}
	}
	curAnim++;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:18,代码来源:MechListBox.cpp

示例11: init

void aAnimTextListItem::init( FitIniFile& file, const char* blockName )
{
	file.seekBlock( blockName );

	long x, y, width, height;

	file.readIdLong( "XLocation", x );
	file.readIdLong( "YLocation", y );
	file.readIdLong( "Width", width );
	file.readIdLong( "Height", height );

	aObject::init( x, y, width, height );

	long color;
	file.readIdLong( "Color", color );
	setColor( color );

	// I could read the font here

	char animationSt[256];
	if ( NO_ERR == file.readIdString( "Animation", animationSt, 255 ) )
		animInfo.init( &file, animationSt );
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:23,代码来源:ALISTBOX.CPP

示例12: getMapNameFromFile

void MPLoadMap::getMapNameFromFile( const char* pFileName, char* missionName, long bufferLength )
{
	FullPathFileName path;
	path.init( missionPath, pFileName, ".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( "MissionSettings" );
	Assert( result == NO_ERR, 0, "Coudln't find the mission settings block in the mission file" );

	missionName[0] = 0;
	bool bRes = 0;

	result = file.readIdBoolean( "MissionNameUseResourceString", bRes );
	//Assert( result == NO_ERR, 0, "couldn't find the MissionNameUseResourceString" );
	if ( bRes )
	{
		unsigned long lRes;
		result = file.readIdULong( "MissionNameResourceStringID", lRes );
		Assert( result == NO_ERR, 0, "couldn't find the MissionNameResourceStringID" );
		cLoadString( lRes, missionName, bufferLength );
	}
	else
	{
		result = file.readIdString( "MissionName", missionName, bufferLength );
		Assert( result == NO_ERR, 0, "couldn't find the missionName" );
	}
}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:36,代码来源:MPLoadMap.cpp

示例13: setMap

void LogisticsMapInfoDialog::setMap( const char* pFileName )
{
	long textureHandle = MissionBriefingScreen::getMissionTGA( pFileName );
	statics[10].setTexture( textureHandle );
	statics[10].setUVs( 0, 127, 127, 0  );
	statics[10].setColor( 0xffffffff );

	// need to set all the map info too....

		FitIniFile file;
		FullPathFileName path;
		path.init( missionPath, pFileName, ".fit" );

		if ( NO_ERR == file.open( path ) )
		{
		
			char missionName[256];
			char text[1024];
			missionName[0] = 0;
			char text2[1024];
			bool bRes = 0;

			char totalText[1024];

			file.seekBlock( "MissionSettings" );
			file.readIdBoolean( "MissionNameUseResourceString", bRes );
			if ( bRes )
			{
				unsigned long lRes;
				file.readIdULong( "MissionNameResourceStringID", lRes );
				cLoadString(lRes, missionName, 255);
			}
			else
			{
				file.readIdString("MissionName", missionName, 255);
			}
	
			cLoadString( IDS_MP_LM_MAP_LIST_MAP_NAME, text, 255 );
			sprintf(text2, text, missionName);

			sprintf( totalText, text2 );
			strcat( totalText, "\n" );

				unsigned long type = 0;
			file.readIdULong( "MissionType", type );
			cLoadString( IDS_MP_LM_MAP_LIST_TYPE, text, 255 );
			char mType[128];
			cLoadString( IDS_MP_LM_TYPE0 + type, mType, 127 );
			
			sprintf( text2, text, mType );

			strcat( totalText, text2 );
			strcat( totalText, "\n" );

			unsigned long numPlayers = 2;

			file.readIdULong( "MaximumNumberOfPlayers", numPlayers );
			cLoadString( IDS_MP_LM_MAP_LIST_MAX_PLAYERS, text, 255 );
			sprintf( text2, text, numPlayers );

			strcat( totalText, text2 );
			strcat( totalText, "\n" );

			textObjects[1].setText( totalText );

			char blurb[1024];
			long result = file.readIdString("Blurb2", blurb, 1023 );

			bool tmpBool = false;
			result = file.readIdBoolean("Blurb2UseResourceString", tmpBool);
			if (NO_ERR == result && tmpBool )
			{
				unsigned long tmpInt = 0;
				result = file.readIdULong("Blurb2ResourceStringID", tmpInt);
				if (NO_ERR == result)
				{
					cLoadString( tmpInt, blurb, 1024 );
				}
			}

			textObjects[2].setText( blurb );

		}

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

示例14: begin

void MissionBriefingScreen::begin()
{
	missionListBox.removeAllItems( true );

	runTime = 0;
	bClicked = 0;

	statics[VIDEO_SCREEN].setColor( 0 );

	memset( objectiveButtons, 0, sizeof ( aObject* ) * MAX_OBJECTIVES );
	// need to set up all pertinent mission info
	EString missionName = LogisticsData::instance->getCurrentMission();


	long tmpMapTextureHandle = getMissionTGA(missionName);
	statics[MAP_INDEX].setTexture( tmpMapTextureHandle );
	statics[MAP_INDEX].setUVs( 0, 127, 127, 0 );
	statics[MAP_INDEX].setColor( 0xffffffff );


	// need to get all the objectives and stuff
	FullPathFileName fitPath;
	fitPath.init(missionPath, missionName, ".fit");
	FitIniFile fitFile;
	fitFile.open( fitPath );

	// put initial divider in list box
	addItem(IDS_MN_DIVIDER, 0xff005392, -1);

	fitFile.seekBlock( "MissionSettings" );

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

	bool bRes;
	result = fitFile.readIdBoolean( "MissionNameUseResourceString", bRes );
	Assert( result == NO_ERR, 0, "couldn't find the MissionNameUseResourceString" );
	if ( bRes )
	{
		unsigned long ulRes;
		result = fitFile.readIdULong( "MissionNameResourceStringID", ulRes );
		Assert( result == NO_ERR, 0, "couldn't find the MissionNameResourceStringID" );
		addItem(ulRes, 0xff005392, -1);
	}
	else
	{
		char missionName[256];
		fitFile.readIdString("MissionName", missionName, 255);
		addLBItem(missionName, 0xff005392, -1);

	}

	addItem(IDS_MN_DIVIDER, 0xff005392, -1);
	addItem( IDS_MN_MISSION_OBJECTIVES, 0xff005392, -1 );
	addItem(IDS_MN_DIVIDER, 0xff005392, -1);

	// put in primary objectives
	fitFile.seekBlock( "Team0Objectives" );
	unsigned long objectiveCount;
	fitFile.readIdULong( "NumObjectives", objectiveCount );
	bool bHasSecondary = 0;
	int count = 0; 

	fitFile.seekBlock( "Terrain" );
	float terrainExtentX;
	float terrainExtentY;
	fitFile.readIdFloat( "TerrainMinX", terrainExtentX );
	if ( !terrainExtentX )
		terrainExtentX = 120 * 128;
	fitFile.readIdFloat( "TerrainMinY", terrainExtentY );
	if ( !terrainExtentY )
		terrainExtentY = 120 * 128;

	CObjectives Objectives(0/*alignment*/);
	/*Note that ObjectManager is probably NULL as these objectives are read, so it's not
	cool to call any of the Status() functions of this instance of objectives (access violation
	may ensue).*/
	Objectives.Read(&fitFile);

	gosASSERT( Objectives.Count() < MAX_OBJECTIVES );

	int buttonCount = 0;

	for ( int j = 1; j < 3; j++ )
	{
		CObjectives::EIterator it = Objectives.Begin();
		buttonCount = 0;
		for ( int i = 0; i < Objectives.Count(); i++, it++ )
		{
			CObjective *pObjective = (*it);
			if ( (!pObjective->IsHiddenTrigger()) && (pObjective->IsActive()) )
			{
				
				if ( pObjective->Priority() == j )
				{
					addObjectiveButton( pObjective->MarkerX(), pObjective->MarkerY(), buttonCount,pObjective->Priority(), fabs(terrainExtentX),
									fabs(terrainExtentY), pObjective->DisplayMarker());

					if ( j == 0 )
					{
//.........这里部分代码省略.........
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:101,代码来源:MissionBriefingScreen.cpp

示例15: init


//.........这里部分代码省略.........
	FitIniFile bldgFile;
	FitIniFile objTypeFile;
	
	result = objTypeFile.open(objFile, fileSize);
	if (result != NO_ERR)
	{
		FullPathFileName mFullFileName;
		mFullFileName.init(objectPath, builName, ".fit");
		//FitIniFile objTypeFile;
		//MtestFile.writeBlock( mFullFileName );
		//MtestFile.close();

		long result1 = bldgFile.open(mFullFileName);
		if (result1 != NO_ERR)
		{
			Fatal(objTypeNum, " BuildingType.init1: can't open building file ");
		}
	}
	else
		bldgFile.open(objFile, fileSize);

	objTypeFile.close();

	//magic 24022011 end	
	/*FitIniFile bldgFile;
	result = bldgFile.open(objFile,fileSize);
	if (result != NO_ERR)
		return(result);*/
	
	//------------------------------------------------------------------
	// Read in the data needed for the Gates
	result = bldgFile.seekBlock("GateData");
	if (result != NO_ERR)
		return(result);

	result = bldgFile.readIdULong("DmgLevel",dmgLevel);
	if (result != NO_ERR)
		return(result);

	bldgFile.readIdULong("BlownEffectId",blownEffectId);
	if (result != NO_ERR)
		blownEffectId = -1;
		
	bldgFile.readIdULong("NormalEffectId",normalEffectId);
	if (result != NO_ERR)
		normalEffectId = -1;
		
	bldgFile.readIdULong("DamageEffectId",damageEffectId);
	if (result != NO_ERR)
		damageEffectId = -1;

	result = bldgFile.readIdLong("BasePixelOffsetX",basePixelOffsetX);
	if (result != NO_ERR)
		basePixelOffsetX = 0;
	
	result = bldgFile.readIdLong("BasePixelOffsetY",basePixelOffsetY);
	if (result != NO_ERR)	
		basePixelOffsetY = 0;

	result = bldgFile.readIdFloat("ExplosionRadius",explRad);
	if (result != NO_ERR)
		explRad = 0.0;
		
	result = bldgFile.readIdFloat("ExplosionDamage",explDmg);
	if (result != NO_ERR)
		explDmg = 0.0;

	result = bldgFile.readIdFloat("OpenRadius",openRadius);
	if (result != NO_ERR)
		return(result);

	result = bldgFile.readIdFloat("LittleExtent",littleExtent);
	if (result != NO_ERR)
		littleExtent = 20.0;

	result = bldgFile.readIdLong ("BuildingName", gateTypeName);
	if (result != NO_ERR)
		gateTypeName = IDS_BLDOBJ_NAME;

	result = bldgFile.readIdLong( "BuildingDescription", buildingDescriptionID );
	if ( result != NO_ERR )
			buildingDescriptionID = -1;


	result = bldgFile.readIdBoolean("BlocksLineOfFire",blocksLineOfFire);
	if (result != NO_ERR)
		blocksLineOfFire = FALSE;

	//magic 09092011 begin
	char s[255];
	result = bldgFile.readIdString("Name",s,254); //magic 09092011
	strcpy_s(buildingName, s);//magic 09092011

	//magic 09092011 end

	//------------------------------------------------------------------
	// Initialize the base object Type from the current file.
	result = ObjectType::init(&bldgFile);
	return(result);
}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:101,代码来源:gate.cpp


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