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


C++ CInifile::section_exist方法代码示例

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


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

示例1: _load_

void TDB_packer::_load_(const xr_string& fname)
{
    	lbIncludeFolders->Items->Clear		();
    	lbIncludeFiles->Items->Clear		();

     	CInifile ini						(fname.c_str());

        if(ini.section_exist("include_folders"))
        {
           CInifile::Sect S 		= ini.r_section("include_folders");
           CInifile::SectCIt it 		= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFolders->Items->Add	(ws);
           }
        }
        if(ini.section_exist("include_files"))
        {
           CInifile::Sect S 		= ini.r_section("include_files");
           CInifile::SectCIt it 	= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFiles->Items->Add	(ws);
           }
        }
        Caption	=	fname.c_str();
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:33,代码来源:FrmDBXpacker.cpp

示例2: strstr

void CGameFont::Initialize		(LPCSTR cShader, LPCSTR cTextureName)
{
	string_path					cTexture;

	LPCSTR _lang				= pSettings->r_string("string_table", "font_prefix");
	bool is_di					= strstr(cTextureName, "ui_font_hud_01") || 
								  strstr(cTextureName, "ui_font_hud_02") ||
								  strstr(cTextureName, "ui_font_console_02");
	if(_lang && !is_di)
		strconcat				(cTexture, cTextureName, _lang);
	else
		strcpy					(cTexture, cTextureName);

	uFlags						&=~fsValid;
	vTS.set						(1.f,1.f); // обязательно !!!

	eCurrentAlignment			= alLeft;
	vInterval.set				(1.f,1.f);

	for (int i=0; i<256; i++)	CharMap[i] = i;
	strings.reserve				(128);

	// check ini exist
	string256 fn,buf;
	strcpy		(buf,cTexture); if (strext(buf)) *strext(buf)=0;
	R_ASSERT2	(FS.exist(fn,"$game_textures$",buf,".ini"),fn);
	CInifile* ini				= CInifile::Create(fn);
	if (ini->section_exist("symbol_coords")){
		for (int i=0; i<256; i++){
			sprintf					(buf,"%03d",i);
			Fvector v				= ini->r_fvector3("symbol_coords",buf);
			TCMap[i].set			(v.x,v.y,v[2]-v[0]);
		}
		fHeight						= ini->r_float("symbol_coords","height");
	}else{
		if (ini->section_exist("char widths")){
			fHeight					= ini->r_float("char widths","height");
			int cpl					= 16;
			for (int i=0; i<256; i++){
				sprintf				(buf,"%d",i);
				float w				= ini->r_float("char widths",buf);
				TCMap[i].set		((i%cpl)*fHeight,(i/cpl)*fHeight,w);
			}
		}else{
			R_ASSERT(ini->section_exist("font_size"));
			fHeight					= ini->r_float("font_size","height");
			float width				= ini->r_float("font_size","width");
			const int cpl			= ini->r_s32	("font_size","cpl");
			for (int i=0; i<256; i++)
				TCMap[i].set		((i%cpl)*width,(i/cpl)*fHeight,width);
		}
	}
	fCurrentHeight				= fHeight;

	CInifile::Destroy			(ini);

	// Shading
	pShader.create				(cShader,cTexture);
	pGeom.create				(FVF::F_TL, RCache.Vertex.Buffer(), RCache.QuadIB);
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:60,代码来源:GameFont.cpp

示例3: Visual

void CPhysicObject::create_collision_model			( )
{
	xr_delete( collidable.model );
	
	VERIFY( Visual() );
	IKinematics *K = Visual()->dcast_PKinematics	();
	VERIFY( K );
	
	CInifile* ini = K->LL_UserData();
	if( ini && ini->section_exist( "collide" ) && ini->line_exist("collide", "mesh" ) && ini->r_bool("collide", "mesh" ) )
	{
		collidable.model = xr_new<CCF_DynamicMesh>( this );
		return;
	}

	collidable.model = xr_new<CCF_Skeleton>(this);

	/*
	switch(m_type) {
		case epotBox:			
		case epotFixedChain:
		case epotFreeChain :
		case epotSkeleton  :	collidable.model = xr_new<CCF_Skeleton>(this);	break;

		default: NODEFAULT; 
		
	}
	*/
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:29,代码来源:PhysicObject.cpp

示例4: LoadParticles

void CParticlesPlayer::LoadParticles(CKinematics* K)
{
    VERIFY				(K);

    m_Bones.clear();


    //считать список косточек и соответствующих
    //офсетов  куда можно вешать партиклы
    CInifile* ini		= K->LL_UserData();
    if(ini&&ini->section_exist("particle_bones")) {
        bone_mask		= 0;
        CInifile::Sect& data		= ini->r_section("particle_bones");
        for (CInifile::SectIt I=data.begin(); I!=data.end(); I++) {
            CInifile::Item& item	= *I;
            u16 index				= K->LL_BoneID(*item.first);
            R_ASSERT3(index != BI_NONE, "Particles bone not found", *item.first);
            Fvector					offs;
            sscanf					(*item.second,"%f,%f,%f",&offs.x,&offs.y,&offs.z);
            m_Bones.push_back		(SBoneInfo(index,offs));
            bone_mask				|= u64(1)<<u64(index);
        }
    }
    if(m_Bones.empty())
    {
        bone_mask			= u64(1)<<u64(0);
        m_Bones.push_back	(SBoneInfo(K->LL_GetBoneRoot(),Fvector().set(0,0,0)));
    }
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:29,代码来源:ParticlesPlayer.cpp

示例5: if

void CCar::SWheel::Load(LPCSTR section)
{
	CKinematics		*K			=PKinematics(car->Visual())		;
	CInifile		*ini		=K->LL_UserData()				;
	VERIFY						(ini)							;
	if(ini->section_exist(section))
	{
		collision_params.damping_factor	=READ_IF_EXISTS(ini,r_float,section,"damping_factor",collision_params.damping_factor);
		collision_params.spring_factor	=READ_IF_EXISTS(ini,r_float,section,"spring_factor",collision_params.spring_factor);
		collision_params.mu_factor		=READ_IF_EXISTS(ini,r_float,section,"friction_factor",collision_params.mu_factor);
	} 
	else if(ini->section_exist("wheels_params"))
	{
		collision_params.damping_factor	=ini->r_float("wheels_params","damping_factor")		;	
		collision_params.spring_factor	=ini->r_float("wheels_params","spring_factor")		;
		collision_params.mu_factor		=ini->r_float("wheels_params","friction_factor")	;
	}

}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:19,代码来源:CarWheels.cpp

示例6: PKinematics

BOOL	CCar::net_Spawn				(CSE_Abstract* DC)
{
#ifdef DEBUG
	InitDebug();
#endif
	CSE_Abstract					*e = (CSE_Abstract*)(DC);
	CSE_ALifeCar					*co=smart_cast<CSE_ALifeCar*>(e);
	BOOL							R = inherited::net_Spawn(DC);

	PKinematics(Visual())->CalculateBones_Invalidate();
	PKinematics(Visual())->CalculateBones(TRUE);

	CPHSkeleton::Spawn(e);
	setEnabled						(TRUE);
	setVisible						(TRUE);
	PKinematics(Visual())->CalculateBones_Invalidate();
	PKinematics(Visual())->CalculateBones(TRUE);
	m_fSaveMaxRPM					= m_max_rpm;
	SetfHealth						(co->health);

	if(!g_Alive())					b_exploded=true;
	else							b_exploded=false;
									
	CDamagableItem::RestoreEffect();
	
	
	CInifile* pUserData		= PKinematics(Visual())->LL_UserData(); 
	if(pUserData->section_exist("destroyed"))
		CPHDestroyable::Load(pUserData,"destroyed");
	if(pUserData->section_exist("mounted_weapon_definition"))
		m_car_weapon = xr_new<CCarWeapon>(this);

	if(pUserData->section_exist("visual_memory_definition"))
	{
		m_memory			= xr_new<car_memory>(this);
		m_memory->reload	(pUserData->r_string("visual_memory_definition", "section"));
	}

	return							(CScriptEntity::net_Spawn(DC) && R);
	
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:41,代码来源:Car.cpp

示例7:

void CCar::SWheelBreak::Load(LPCSTR section)
{
	CKinematics		*K			=PKinematics(pwheel->car->Visual())												;
	CInifile		*ini		=K->LL_UserData()																;
	VERIFY						(ini)																			;
	break_torque		=		ini->r_float("car_definition","break_torque")									;
	hand_break_torque	=		READ_IF_EXISTS(ini,r_float,"car_definition","hand_break_torque",break_torque)	;
	if(ini->section_exist(section))
	{	
		break_torque					=READ_IF_EXISTS(ini,r_float,section,"break_torque",break_torque);
		hand_break_torque				=READ_IF_EXISTS(ini,r_float,section,"hand_break_torque",hand_break_torque);
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:13,代码来源:CarWheels.cpp

示例8: LoadMapInfo

void CMapListHelper::LoadMapInfo(LPCSTR map_cfg_fn, const xr_string& map_name, LPCSTR map_ver)
{
	CInifile	ini				(map_cfg_fn);

	shared_str _map_name		= map_name.substr(0,map_name.find('\\')).c_str();
	shared_str _map_ver			= map_ver;

	if(ini.section_exist("map_usage"))
	{
		if(ini.line_exist("map_usage","ver") && !map_ver)
			_map_ver				= ini.r_string("map_usage", "ver");

		CInifile::Sect S			= ini.r_section("map_usage");
		CInifile::SectCIt si		= S.Data.begin();
		CInifile::SectCIt si_e		= S.Data.end();
		for( ;si!=si_e; ++si)
		{
			const shared_str& game_type = (*si).first;
			
			if(game_type=="ver")		continue;

			SGameTypeMaps* M			= GetMapListInt(game_type);
			if(!M)
			{
				Msg						("--unknown game type-%s",game_type.c_str());
				m_storage.resize		(m_storage.size()+1);
				SGameTypeMaps&	Itm		= m_storage.back();
				Itm.m_game_type_name	= game_type;
				Itm.m_game_type_id		= ParseStringToGameType(game_type.c_str());
				M						= &m_storage.back();
			}
			
			SGameTypeMaps::SMapItm	Itm;
			Itm.map_name				= _map_name;
			Itm.map_ver					= _map_ver;
			
			if(M->m_map_names.end()!=std::find(M->m_map_names.begin(),M->m_map_names.end(),Itm))
			{
				Msg("! duplicate map found [%s] [%s]", _map_name.c_str(), _map_ver.c_str());
			}else
			{
#ifndef MASTER_GOLD
				Msg("added map [%s] [%s]", _map_name.c_str(), _map_ver.c_str());
#endif // #ifndef MASTER_GOLD
				M->m_map_names.push_back	(Itm);
			}
		}			
	}

}
开发者ID:BeaconDev,项目名称:xray-16,代码行数:50,代码来源:UIGameCustom.cpp

示例9: IsFolderAccepted

bool IsFolderAccepted(CInifile& ltx, LPCSTR path, BOOL& recurse)
{
	// exclude folders
	if( ltx.section_exist("exclude_folders") )
	{
		CInifile::Sect& ef_sect	= ltx.r_section("exclude_folders");
		for (CInifile::SectCIt ef_it=ef_sect.Data.begin(); ef_it!=ef_sect.Data.end(); ef_it++){
			recurse	= CInifile::IsBOOL(ef_it->second.c_str());
			if (recurse)	{
				if (path==strstr(path,ef_it->first.c_str()))	return false;
			}else{
				if (0==xr_strcmp(path,ef_it->first.c_str()))	return false;
			}
		}
	}
	return true;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:17,代码来源:xrCompress.cpp

示例10:

void weather::reload_time_frame	(shared_str const& frame_id)
{
	string_path			file_name;
	FS.update_path		(file_name, "$game_weathers$", m_id.c_str());
	strcat_s			(file_name, ".ltx");
	CInifile*			config = CInifile::Create(file_name);

	container_type::iterator	i = m_times.begin();
	container_type::iterator	e = m_times.end();
	for ( ; i != e; ++i) {
		if (frame_id._get() != (*i)->id()._get())
			continue;

		if (!config->section_exist((*i)->id()))
			return;

		(*i)->load_from		((*i)->id(), *config, (*i)->id());
		CInifile::Destroy	(config);
		return;
	}

	CInifile::Destroy	(config);
}
开发者ID:2asoft,项目名称:xray,代码行数:23,代码来源:editor_environment_weathers_weather.cpp

示例11: ProcessLTX

void xrCompressor::ProcessLTX(CInifile& ltx)
{
	config_ltx	=&ltx;

	if (ltx.line_exist("options","exclude_exts"))
		_SequenceToList(exclude_exts, ltx.r_string("options","exclude_exts"));

	files_list				= xr_new< xr_vector<char*> >();
	folders_list			= xr_new< xr_vector<char*> >();

	if(ltx.section_exist("include_folders"))
	{
		CInifile::Sect& if_sect	= ltx.r_section("include_folders");

		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it)
		{
			BOOL ifRecurse		= CInifile::IsBOOL(if_it->second.c_str());
			u32 folder_mask		= FS_ListFolders | (ifRecurse?0:FS_RootOnly);

			string_path path;
			LPCSTR _path		= 0==xr_strcmp(if_it->first.c_str(),".\\")?"":if_it->first.c_str();
			xr_strcpy			(path,_path);
			u32 path_len		= xr_strlen(path);
			if ((0!=path_len)&&(path[path_len-1]!='\\')) xr_strcat(path,"\\");

			Msg					("");
			Msg					("Processing folder: '%s'",path);
			BOOL efRecurse;
			BOOL val			= IsFolderAccepted(ltx,path,efRecurse);
			if (val || (!val&&!efRecurse))
			{ 
				if (val)		
					GatherFiles	(path);

				xr_vector<char*>*	i_fl_list	= FS.file_list_open	("$target_folder$",path,folder_mask);
				if (!i_fl_list)
				{
					Msg			("ERROR: Unable to open folder list:", path);
					continue;
				}

				xr_vector<char*>::iterator it	= i_fl_list->begin();
				xr_vector<char*>::iterator itE	= i_fl_list->end();
				for (;it!=itE;++it)
				{ 
					xr_string tmp_path	= xr_string(path)+xr_string(*it);
					bool val		= IsFolderAccepted(ltx,tmp_path.c_str(),efRecurse);
					if (val)
					{
						folders_list->push_back(xr_strdup(tmp_path.c_str()));
						Msg			("+F: %s",tmp_path.c_str());
						// collect files
						if (ifRecurse) 
							GatherFiles (tmp_path.c_str());
					}else
					{
						Msg			("-F: %s",tmp_path.c_str());
					}
				}
				FS.file_list_close	(i_fl_list);
			}else
			{
				Msg					("-F: %s",path);
			}
		}
	}//if(ltx.section_exist("include_folders"))
	
	if(ltx.section_exist("include_files"))
	{
		CInifile::Sect& if_sect	= ltx.r_section("include_files");
		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it)
		{
		  files_list->push_back	(xr_strdup(if_it->first.c_str()));
		}	
	}

	PerformWork	();

	// free
	xr_vector<char*>::iterator it	= files_list->begin();
	xr_vector<char*>::iterator itE	= files_list->end();
	for (;it!=itE;++it) 
		xr_free(*it);
	xr_delete(files_list);

	it				= folders_list->begin();
	itE				= folders_list->end();
	for (;it!=itE;++it) 
		xr_free(*it);
	xr_delete(folders_list);

	exclude_exts.clear_and_free();
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:93,代码来源:xrCompress.cpp

示例12: CInifile

CGraphMerger::CGraphMerger(
		LPCSTR game_graph_id,
		LPCSTR name,
		bool rebuild
	)
{
	// load all the graphs
	Phase("Processing level graphs");
	
	CInifile *Ini = new CInifile(INI_FILE);
	if (!Ini->section_exist("levels"))
		THROW(false);
	R_ASSERT						(Ini->section_exist("levels"));

	tGraphHeader.m_guid				= generate_guid();

	GRAPH_P_MAP						tpGraphs;
	string4096						S1, S2;
	CGameGraph::SLevel				tLevel;
	u32								dwOffset = 0;
	u32								l_dwPointOffset = 0;
	LEVEL_POINT_STORAGE				l_tpLevelPoints;
	l_tpLevelPoints.clear			();

	xr_set<CLevelInfo>				levels;
	xr_vector<LPCSTR>				needed_levels;
	string4096						levels_string;
	strcpy_s						(levels_string,name);
	strlwr							(levels_string);
	fill_needed_levels				(levels_string,needed_levels);

	read_levels						(
		Ini,
		levels,
		rebuild,
		&needed_levels
	);

	xr_set<CLevelInfo>::const_iterator	I = levels.begin();
	xr_set<CLevelInfo>::const_iterator	E = levels.end();
	for ( ; I != E; ++I) {
		tLevel.m_offset				= (*I).m_offset;
		tLevel.m_name				= (*I).m_name;
		strcpy_s					(S1,sizeof(S1),*(*I).m_name);
		strconcat					(sizeof(S2),S2,name,S1);
		strconcat					(sizeof(S1),S1,S2,"\\");
		tLevel.m_id					= (*I).m_id;
		tLevel.m_section			= (*I).m_section;
		Msg							("%9s %2d %s","level",tLevel.id(),*tLevel.m_name);
		string_path					_0, _1;
		generate_temp_file_name		("local_graph_",*tLevel.m_name,_0);
		generate_temp_file_name		("raw_cross_table_",*tLevel.m_name,_1);
		string_path					level_folder;
		FS.update_path				(level_folder,"$game_levels$",*tLevel.m_name);
		strcat						(level_folder,"\\");
		CGameGraphBuilder().build_graph	(_0,_1,level_folder);
		::CLevelGameGraph			*tpLevelGraph = new ::CLevelGameGraph(
			_0,
			_1,
			&tLevel,
			level_folder,
			dwOffset,
			tLevel.id(),
			Ini
		);
		dwOffset					+= tpLevelGraph->m_tpGraph->header().vertex_count();
		R_ASSERT2					(tpGraphs.find(tLevel.id()) == tpGraphs.end(),"Level ids _MUST_ be different!");
		tpGraphs.insert				(mk_pair(tLevel.id(),tpLevelGraph));
		tGraphHeader.m_levels.insert(std::make_pair(tLevel.id(),tLevel));
	}
	
	R_ASSERT(tpGraphs.size());
	
	Phase("Adding interconnection points");
	{
		GRAPH_P_PAIR_IT				I = tpGraphs.begin();
		GRAPH_P_PAIR_IT				E = tpGraphs.end();
		for ( ; I != E; I++) {
			VERTEX_PAIR_IT			i = (*I).second->m_tVertexMap.begin();
			VERTEX_PAIR_IT			e = (*I).second->m_tVertexMap.end();
			for ( ; i != e; i++)
				if ((*i).second.caConnectName[0]) {
					GRAPH_P_PAIR_IT				K;
					VERTEX_PAIR_IT				M;
					CGameGraph::CEdge			tGraphEdge;
					SConnectionVertex			&tConnectionVertex = (*i).second;
					K							= tpGraphs.find(tConnectionVertex.dwLevelID);
					if (K == tpGraphs.end()) {
						Msg						("Cannot find level with level_id %d. Connection point will not be generated!",tConnectionVertex.dwLevelID);
						continue;
					}
					R_ASSERT					(K != tpGraphs.end());
					M							= (*K).second->m_tVertexMap.find(tConnectionVertex.caConnectName);
					if (M == (*K).second->m_tVertexMap.end()) {
						Msg						("Level %s with id %d has an INVALID connection point %s,\nwhich references to graph point %s on the level %s with id %d\n",*(*I).second->m_tLevel.name(),(*I).second->m_tLevel.id(),(*i).first,tConnectionVertex.caConnectName,*(*K).second->m_tLevel.name(),(*K).second->m_tLevel.id());
						R_ASSERT				(M != (*K).second->m_tVertexMap.end());
					}

//					if (!stricmp("l06_rostok",*(*I).second->m_tLevel.name())) {
//						__asm int 3;
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:xray,代码行数:101,代码来源:xr_graph_merge.cpp

示例13: ParseDefinitions

void CCar::ParseDefinitions()
{
	 
	
	bone_map.clear();

	IKinematics* pKinematics=smart_cast<IKinematics*>(Visual());
	bone_map.insert(mk_pair(pKinematics->LL_GetBoneRoot(),physicsBone()));
	CInifile* ini = pKinematics->LL_UserData();
	R_ASSERT2(ini,"Car has no description !!! See ActorEditor Object - UserData");
	CExplosive::Load(ini,"explosion");
	//CExplosive::SetInitiator(ID());
	m_camera_position			= ini->r_fvector3("car_definition","camera_pos");
	///////////////////////////car definition///////////////////////////////////////////////////
	fill_wheel_vector			(ini->r_string	("car_definition","driving_wheels"),m_driving_wheels);
	fill_wheel_vector			(ini->r_string	("car_definition","steering_wheels"),m_steering_wheels);
	fill_wheel_vector			(ini->r_string	("car_definition","breaking_wheels"),m_breaking_wheels);
	fill_exhaust_vector			(ini->r_string	("car_definition","exhausts"),m_exhausts);
	fill_doors_map				(ini->r_string	("car_definition","doors"),m_doors);

	///////////////////////////car properties///////////////////////////////


	m_max_power			=		ini->r_float("car_definition","engine_power");
	m_max_power			*=		(0.8f*1000.f);

	m_max_rpm			=		ini->r_float("car_definition","max_engine_rpm");
	m_max_rpm			*=		(1.f/60.f*2.f*M_PI);


	m_min_rpm					=		ini->r_float("car_definition","idling_engine_rpm");
	m_min_rpm					*=		(1.f/60.f*2.f*M_PI);

	m_power_rpm					=		ini->r_float("car_definition","max_power_rpm");
	m_power_rpm					*=		(1.f/60.f*2.f*M_PI);//

	m_torque_rpm				=		ini->r_float("car_definition","max_torque_rpm");
	m_torque_rpm				*=		(1.f/60.f*2.f*M_PI);//

	m_power_increment_factor	=		READ_IF_EXISTS(ini,r_float,"car_definition","power_increment_factor",m_power_increment_factor);
	m_rpm_increment_factor		=		READ_IF_EXISTS(ini,r_float,"car_definition","rpm_increment_factor",m_rpm_increment_factor);
	m_power_decrement_factor	=		READ_IF_EXISTS(ini,r_float,"car_definition","power_decrement_factor",m_power_increment_factor);
	m_rpm_decrement_factor		=		READ_IF_EXISTS(ini,r_float,"car_definition","rpm_decrement_factor",m_rpm_increment_factor);
	m_power_neutral_factor		=		READ_IF_EXISTS(ini,r_float,"car_definition","power_neutral_factor",m_power_neutral_factor);
	R_ASSERT2(m_power_neutral_factor>0.1f&&m_power_neutral_factor<1.f,"power_neutral_factor must be 0 - 1 !!");
	if(ini->line_exist("car_definition","exhaust_particles"))
	{
		m_exhaust_particles =ini->r_string("car_definition","exhaust_particles");
	}
			
	b_auto_switch_transmission= !!ini->r_bool("car_definition","auto_transmission");

	InitParabola		();

	m_axle_friction		=		ini->r_float("car_definition","axle_friction");
	m_steering_speed	=		ini->r_float("car_definition","steering_speed");

	if(ini->line_exist("car_definition","break_time"))
	{
		m_break_time=ini->r_float("car_definition","break_time");
	}
	/////////////////////////transmission////////////////////////////////////////////////////////////////////////
	float main_gear_ratio=ini->r_float("car_definition","main_gear_ratio");

	R_ASSERT2(ini->section_exist("transmission_gear_ratio"),"no section transmission_gear_ratio");
	m_gear_ratious.push_back(ini->r_fvector3("transmission_gear_ratio","R"));
	m_gear_ratious[0][0]=-m_gear_ratious[0][0]*main_gear_ratio;
	string32 rat_num;
	for(int i=1;true;++i)
	{
		xr_sprintf(rat_num,"N%d",i);
		if(!ini->line_exist("transmission_gear_ratio",rat_num)) break;
		Fvector gear_rat=ini->r_fvector3("transmission_gear_ratio",rat_num);
		gear_rat[0]*=main_gear_ratio;
		gear_rat[1]*=(1.f/60.f*2.f*M_PI);
		gear_rat[2]*=(1.f/60.f*2.f*M_PI);
		m_gear_ratious.push_back(gear_rat);
	}

	///////////////////////////////sound///////////////////////////////////////////////////////
	m_car_sound->Init();
	///////////////////////////////fuel///////////////////////////////////////////////////
	m_fuel_tank=ini->r_float("car_definition","fuel_tank");
	m_fuel=m_fuel_tank;
	m_fuel_consumption=ini->r_float("car_definition","fuel_consumption");
	m_fuel_consumption/=100000.f;
	if(ini->line_exist("car_definition","exhaust_particles"))
		m_exhaust_particles = ini->r_string("car_definition","exhaust_particles");
	///////////////////////////////lights///////////////////////////////////////////////////
	m_lights.Init(this);
	m_lights.ParseDefinitions();


	
	if(ini->section_exist("animations"))
	{
		m_driver_anim_type=ini->r_u16("animations","driver_animation_type");
	}

	
//.........这里部分代码省略.........
开发者ID:AntonioModer,项目名称:xray-16,代码行数:101,代码来源:Car.cpp

示例14: Init

void CCar::Init()
{

	CPHCollisionDamageReceiver::Init();

	//get reference wheel radius
	IKinematics* pKinematics=smart_cast<IKinematics*>(Visual());
	CInifile* ini = pKinematics->LL_UserData();
	R_ASSERT2(ini,"Car has no description !!! See ActorEditor Object - UserData");
	///SWheel& ref_wheel=m_wheels_map.find(pKinematics->LL_BoneID(ini->r_string("car_definition","reference_wheel")))->second;

	if(ini->section_exist("air_resistance"))
	{
		PPhysicsShell()->SetAirResistance(default_k_l*ini->r_float("air_resistance","linear_factor"),default_k_w*ini->r_float("air_resistance","angular_factor"));
	}
	if(ini->line_exist("car_definition","steer"))
	{
		
		
		m_bone_steer=pKinematics->LL_BoneID(ini->r_string("car_definition","steer"));
		VERIFY2(fsimilar(DET(pKinematics->LL_GetTransform(m_bone_steer)),1.f,EPS_L),"BBADD MTX");
		pKinematics->LL_GetBoneInstance(m_bone_steer).set_callback(bctPhysics,cb_Steer,this);
	}
	m_steer_angle=0.f;
	//ref_wheel.Init();
	m_ref_radius=ini->r_float("car_definition","reference_radius");//ref_wheel.radius;
	b_exploded						=false;
	b_engine_on						=false;
	b_clutch						=false;
	b_starting						=false;
	b_stalling						=false;
	b_transmission_switching		=false;
	m_root_transform.set(bone_map.find(pKinematics->LL_GetBoneRoot())->second.element->mXFORM);
	m_current_transmission_num=0;
	m_pPhysicsShell->set_DynamicScales(1.f,1.f);
	CDamagableItem::Init(GetfHealth(),3);
	float l_time_to_explosion=READ_IF_EXISTS(ini,r_float,"car_definition","time_to_explosion",120.f);
	CDelayedActionFuse::Initialize(l_time_to_explosion,CDamagableItem::DamageLevelToHealth(2));
	{
		xr_map<u16,SWheel>::iterator i,e;
		i=m_wheels_map.begin();
		e=m_wheels_map.end();
		for(;i!=e;++i)
		{
			i->second.Init();
			i->second.CDamagableHealthItem::Init(100.f,2);
		}
	}

	{
		xr_vector<SWheelDrive>::iterator i,e;
		i=m_driving_wheels.begin();
		e=m_driving_wheels.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_vector<SWheelBreak>::iterator i,e;
		i=m_breaking_wheels.begin();
		e=m_breaking_wheels.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_vector<SWheelSteer>::iterator i,e;
		i=m_steering_wheels.begin();
		e=m_steering_wheels.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_vector<SExhaust>::iterator i,e;
		i=m_exhausts.begin();
		e=m_exhausts.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_map<u16,SDoor>::iterator i,e;
		i=m_doors.begin();
		e=m_doors.end();
		for(;i!=e;++i)
		{
			i->second.Init();
			i->second.CDamagableHealthItem::Init(100,1);
		}
			
	}

	if(ini->section_exist("damage_items"))
	{
		CInifile::Sect& data		= ini->r_section("damage_items");
		for (CInifile::SectCIt		I=data.Data.begin(); I!=data.Data.end(); I++){
			const CInifile::Item& item	= *I;
			u16 index				= pKinematics->LL_BoneID(*item.first); 
			R_ASSERT3(index != BI_NONE, "Wrong bone name", *item.first);
//.........这里部分代码省略.........
开发者ID:AntonioModer,项目名称:xray-16,代码行数:101,代码来源:Car.cpp

示例15: strstr

void CGameFont::Initialize		(LPCSTR cShader, LPCSTR cTextureName)
{
	string_path					cTexture;

	LPCSTR _lang				= pSettings->r_string("string_table", "font_prefix");
	bool is_di					= strstr(cTextureName, "ui_font_hud_01") || 
								  strstr(cTextureName, "ui_font_hud_02") ||
								  strstr(cTextureName, "ui_font_console_02");
	if(_lang && !is_di)
		strconcat				(sizeof(cTexture),cTexture, cTextureName, _lang);
	else
		strcpy_s				(cTexture, sizeof(cTexture), cTextureName);

	uFlags						&=~fsValid;
	vTS.set						(1.f,1.f); // обязательно !!!

	eCurrentAlignment			= alLeft;
	vInterval.set				(1.f,1.f);

	strings.reserve				(128);

	// check ini exist
	string_path fn,buf;
	strcpy_s		(buf,cTexture); if (strext(buf)) *strext(buf)=0;
	R_ASSERT2	(FS.exist(fn,"$game_textures$",buf,".ini"),fn);
	CInifile* ini				= CInifile::Create(fn);

	nNumChars = 0x100;
	TCMap = ( Fvector* ) xr_realloc( ( void* ) TCMap , nNumChars * sizeof( Fvector ) );

	if ( ini->section_exist( "mb_symbol_coords" ) ) {
		nNumChars = 0x10000;
		TCMap = ( Fvector* ) xr_realloc( ( void* ) TCMap , nNumChars * sizeof( Fvector ) );
		uFlags |= fsMultibyte;
		fHeight = ini->r_float( "mb_symbol_coords" , "height" );
		
		fXStep = ceil( fHeight / 2.0f );

		// Searching for the first valid character

		Fvector vFirstValid = {0,0,0};

		if ( ini->line_exist( "mb_symbol_coords" , "09608" ) ) {
			Fvector v = ini->r_fvector3( "mb_symbol_coords" , "09608" );
			vFirstValid.set( v.x , v.y , 1 + v[2] - v[0] );
		} else 
		for ( u32 i=0 ; i < nNumChars ; i++ ) {
			sprintf_s( buf ,sizeof(buf), "%05d" , i );
			if ( ini->line_exist( "mb_symbol_coords" , buf ) ) {
				Fvector v = ini->r_fvector3( "mb_symbol_coords" , buf );
				vFirstValid.set( v.x , v.y , 1 + v[2] - v[0] );
				break;
			}
		}

		// Filling entire character table

		for ( u32 i=0 ; i < nNumChars ; i++ ) {
			sprintf_s( buf ,sizeof(buf), "%05d" , i );
			if ( ini->line_exist( "mb_symbol_coords" , buf ) ) {
				Fvector v = ini->r_fvector3( "mb_symbol_coords" , buf );
				TCMap[i].set( v.x , v.y , 1 + v[2] - v[0] );
			} else
				TCMap[i] = vFirstValid; // "unassigned" unprintable characters
		}

		// Special case for space
		TCMap[ 0x0020 ].set( 0 , 0 , 0 );
		// Special case for ideographic space
		TCMap[ 0x3000 ].set( 0 , 0 , 0 );


	}else
	if (ini->section_exist("symbol_coords"))
	{
		float d						= 0.0f;
//.		if(ini->section_exist("width_correction"))
//.			d						= ini->r_float("width_correction", "value");

		fHeight						= ini->r_float("symbol_coords","height");
		for (u32 i=0; i<nNumChars; i++){
			sprintf_s				(buf,sizeof(buf),"%03d",i);
			Fvector v				= ini->r_fvector3("symbol_coords",buf);
			TCMap[i].set			(v.x,v.y,v[2]-v[0]+d);
		}
	}else{
	if (ini->section_exist("char widths")){
		fHeight					= ini->r_float("char widths","height");
		int cpl					= 16;
		for (u32 i=0; i<nNumChars; i++){
			sprintf_s			(buf,sizeof(buf),"%d",i);
			float w				= ini->r_float("char widths",buf);
			TCMap[i].set		((i%cpl)*fHeight,(i/cpl)*fHeight,w);
		}
	}else{
		R_ASSERT(ini->section_exist("font_size"));
		fHeight					= ini->r_float("font_size","height");
		float width				= ini->r_float("font_size","width");
		const int cpl			= ini->r_s32	("font_size","cpl");
		for (u32 i=0; i<nNumChars; i++)
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:xray,代码行数:101,代码来源:GameFont.cpp


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