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


C++ shared_str::size方法代码示例

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


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

示例1:

void CRestrictedObject::remove_restrictions	(const shared_str &out_restrictions, const shared_str &in_restrictions)
{
	if (!out_restrictions.size() && !in_restrictions.size())
		return;

	START_PROFILE("Restricted Object/Remove Restrictions");
	
	Level().space_restriction_manager().remove_restrictions	(object().ID(),*out_restrictions,*in_restrictions);
	
	actual						(false);

	STOP_PROFILE;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:13,代码来源:restricted_object.cpp

示例2:

BOOL is_combat_cover			(shared_str const &table_id)
{
	if (table_id.size() == 0)
		return					(FALSE);

	string256					temp;
	xr_strcpy					(temp, "smart_covers.descriptions.");
	xr_strcat					(temp, *table_id);

	luabind::object				table, value;
	bool						result = 
		ai().script_engine().function_object(
		temp,
		table,
		LUA_TTABLE
		);

	VERIFY2						(result, make_string("bad or missing description in smart_cover [%s]", table_id.c_str()));
	if (table.type() != LUA_TTABLE) {
		VERIFY					(table.type() != LUA_TNIL);
		return					(TRUE);
	}

	value						= table["is_combat_cover"];
	if (value.type() == LUA_TNIL) {
		Msg						("! is_combat_cover flag not found for smart_cover [%s], forcing to \"true\"", table_id.c_str());
		return					(TRUE);
	}

	return						(parse_bool(table, "is_combat_cover") ? TRUE : FALSE);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:31,代码来源:xrServer_Objects_Alife_Smartcovers.cpp

示例3: SetWeather

void CEnvironment::SetWeather(shared_str name, bool forced)
{
//.	static BOOL bAlready = FALSE;
//.	if(bAlready)	return;
	if (name.size())	{
//.		bAlready = TRUE;
        EnvsMapIt it		= WeatherCycles.find(name);
		if (it == WeatherCycles.end())
		{
			Msg("! Invalid weather name: %s", name.c_str());
			return;
		}
        R_ASSERT3			(it!=WeatherCycles.end(),"Invalid weather name.",*name);
		CurrentCycleName	= it->first;
		if (forced)			{Invalidate();			}
		if (!bWFX){
			CurrentWeather		= &it->second;
			CurrentWeatherName	= it->first;
		}
		if (forced)			{SelectEnvs(fGameTime);	}
#ifdef WEATHER_LOGGING
		Msg					("Starting Cycle: %s [%s]",*name,forced?"forced":"deferred");
#endif
    }else{
#ifndef _EDITOR
		FATAL				("! Empty weather name");
#endif
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:29,代码来源:Environment.cpp

示例4: SetAmmoIcon

void CUIHudStatesWnd::SetAmmoIcon(const shared_str& sect_name)
{
	if (!sect_name.size())
	{
		m_ui_weapon_icon->Show(false);
		return;
	}
	m_ui_weapon_icon->Show(true);

	Frect texture_rect;
	texture_rect.x1					= pSettings->r_float(sect_name,  "inv_grid_x")		*INV_GRID_WIDTH;
	texture_rect.y1					= pSettings->r_float(sect_name,  "inv_grid_y")		*INV_GRID_HEIGHT;
	texture_rect.x2					= pSettings->r_float( sect_name, "inv_grid_width")	*INV_GRID_WIDTH;
	texture_rect.y2					= pSettings->r_float( sect_name, "inv_grid_height")	*INV_GRID_HEIGHT;
	texture_rect.rb.add				(texture_rect.lt);
	m_ui_weapon_icon->GetUIStaticItem().SetTextureRect(texture_rect);
	m_ui_weapon_icon->SetStretchTexture(true);

	float h = texture_rect.height() * 0.8f;
	float w = texture_rect.width() * 0.8f;

// now perform only width scale for ammo, which (W)size >2
	if (texture_rect.width() > 2.01f*INV_GRID_WIDTH)
		w = INV_GRID_WIDTH * 1.5f;

	m_ui_weapon_icon->SetWidth( w*UI().get_current_kx() );
	m_ui_weapon_icon->SetHeight( h );
}
开发者ID:zcaliptium,项目名称:xray-16,代码行数:28,代码来源:UIHudStatesWnd.cpp

示例5:

CGameTaskManager::CGameTaskManager()
{
	m_gametasks					= xr_new<CGameTaskWrapper>();
	m_flags.zero				();
	m_flags.set					(eChanged, TRUE);
	if(g_active_task_id.size())	SetActiveTask(g_active_task_id, g_active_task_objective_id);
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:7,代码来源:GametaskManager.cpp

示例6: AddQuestion

void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value)
{
	if(text.size() == 0)
	{
		return;
	}
	UITalkDialogWnd->AddQuestion(*CStringTable().translate(text),value.c_str());
}
开发者ID:2asoft,项目名称:xray,代码行数:8,代码来源:UITalkWnd.cpp

示例7: AddAnswer

void CUITalkWnd::AddAnswer(const shared_str& text, LPCSTR SpeakerName)
{
	//для пустой фразы вообще ничего не выводим
	if(text.size() == 0) return;
	PlaySnd			(text.c_str());

	bool i_am = (0 == xr_strcmp(SpeakerName, m_pOurInvOwner->Name()));
	UITalkDialogWnd->AddAnswer(SpeakerName,*CStringTable().translate(text),i_am);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:UITalkWnd.cpp

示例8: SetWeatherFX

bool CEnvironment::SetWeatherFX(shared_str name)
{
	if (bWFX)				return false;
	if (name.size()){
		EnvsMapIt it		= WeatherFXs.find(name);
		R_ASSERT3			(it!=WeatherFXs.end(),"Invalid weather effect name.",*name);
		EnvVec* PrevWeather = CurrentWeather; VERIFY(PrevWeather);
		CurrentWeather		= &it->second;
		CurrentWeatherName	= it->first;

		float rewind_tm		= WFX_TRANS_TIME*fTimeFactor;
		float start_tm		= fGameTime+rewind_tm;
		float current_length;
		float current_weight;
		if (Current[0]->exec_time>Current[1]->exec_time){
			float x			= fGameTime>Current[0]->exec_time?fGameTime-Current[0]->exec_time:(DAY_LENGTH-Current[0]->exec_time)+fGameTime;
			current_length	= (DAY_LENGTH-Current[0]->exec_time)+Current[1]->exec_time;
			current_weight	= x/current_length; 
		}else{
			current_length	= Current[1]->exec_time-Current[0]->exec_time;
			current_weight	= (fGameTime-Current[0]->exec_time)/current_length; 
		}
		clamp				(current_weight,0.f,1.f);

		std::sort			(CurrentWeather->begin(),CurrentWeather->end(),sort_env_etl_pred);
		CEnvDescriptor* C0	= CurrentWeather->at(0);
		CEnvDescriptor* C1	= CurrentWeather->at(1);
		CEnvDescriptor* CE	= CurrentWeather->at(CurrentWeather->size()-2);
		CEnvDescriptor* CT	= CurrentWeather->at(CurrentWeather->size()-1);
		C0->copy			(*Current[0]);	C0->exec_time = NormalizeTime(fGameTime-((rewind_tm/(Current[1]->exec_time-fGameTime))*current_length-rewind_tm));
		C1->copy			(*Current[1]);	C1->exec_time = NormalizeTime(start_tm);
		for (EnvIt t_it=CurrentWeather->begin()+2; t_it!=CurrentWeather->end()-1; t_it++)
			(*t_it)->exec_time= NormalizeTime(start_tm+(*t_it)->exec_time_loaded);
		SelectEnv			(PrevWeather,WFX_end_desc[0],CE->exec_time);
		SelectEnv			(PrevWeather,WFX_end_desc[1],WFX_end_desc[0]->exec_time+0.5f);
		CT->copy			(*WFX_end_desc[0]);CT->exec_time = NormalizeTime(CE->exec_time+rewind_tm);
		wfx_time			= TimeDiff(fGameTime,CT->exec_time);
		bWFX				= true;

		// sort wfx envs
		std::sort			(CurrentWeather->begin(),CurrentWeather->end(),sort_env_pred);

		Current[0]			= C0;
		Current[1]			= C1;
#ifdef WEATHER_LOGGING
		Msg					("Starting WFX: '%s' - %3.2f sec",*name,wfx_time);
		for (EnvIt l_it=CurrentWeather->begin(); l_it!=CurrentWeather->end(); l_it++)
			Msg				(". Env: '%s' Tm: %3.2f",*(*l_it)->sect_name,(*l_it)->exec_time);
#endif
	}else{
#ifndef _EDITOR
		FATAL				("! Empty weather effect name");
#endif
	}
	return true;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:56,代码来源:Environment.cpp

示例9: OnFrame

void CEffect_Thunderbolt::OnFrame(shared_str id, float period, float duration)
{
	BOOL enabled			= !!(id.size());
	if (bEnabled!=enabled){
    	bEnabled			= enabled;
	    next_lightning_time = Device.fTimeGlobal+period+Random.randF(-period*0.5f,period*0.5f);
    }else if (bEnabled&&(Device.fTimeGlobal>next_lightning_time)){ 
    	if (state==stIdle && !!(id.size())) Bolt(id,period,duration);
    }
	if (state==stWorking){
    	if (current_time>life_time) state = stIdle;
    	current_time	+= Device.fTimeDelta;
		Fvector fClr;		
		int frame;
		u32 uClr		= current->color_anim->CalculateRGB(current_time/life_time,frame);
		fClr.set		(
			clampr(float(color_get_R(uClr)/255.f), 0.f, 1.f),
			clampr(float(color_get_G(uClr)/255.f), 0.f, 1.f),
			clampr(float(color_get_B(uClr)/255.f), 0.f, 1.f)
		);

        lightning_phase	= 1.5f*(current_time/life_time);
        clamp			(lightning_phase,0.f,1.f);

		CEnvironment&	environment = g_pGamePersistent->Environment();
		
		Fvector&		sky_color = environment.CurrentEnv->sky_color;
        sky_color.mad	( fClr, environment.p_sky_color );
		clamp			( sky_color.x, 0.f, 1.f );
		clamp			( sky_color.y, 0.f, 1.f );
		clamp			( sky_color.z, 0.f, 1.f );

        environment.CurrentEnv->sun_color.mad(fClr,environment.p_sun_color);
		environment.CurrentEnv->fog_color.mad(fClr,environment.p_fog_color);

		if (::Render->get_generation()==IRender_interface::GENERATION_R2)	{
			R_ASSERT	( _valid(current_direction) );
			g_pGamePersistent->Environment().CurrentEnv->sun_dir = current_direction;
			VERIFY2(g_pGamePersistent->Environment().CurrentEnv->sun_dir.y<0,"Invalid sun direction settings while CEffect_Thunderbolt");

		} 
    }
}
开发者ID:2asoft,项目名称:xray,代码行数:43,代码来源:thunderbolt.cpp

示例10: HasInfo

bool CInventoryOwner::HasInfo(shared_str info_id) const
{
	VERIFY( info_id.size() );
	const KNOWN_INFO_VECTOR* known_info = m_known_info_registry->registry().objects_ptr ();
	if(!known_info) return false;

	if(std::find_if(known_info->begin(), known_info->end(), CFindByIDPred(info_id)) == known_info->end())
		return false;

	return true;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:11,代码来源:inventory_owner_info.cpp

示例11: SetColorAnimation

void CUIColorAnimatorWrapper::SetColorAnimation(const shared_str &animationName)
{
	if (animationName.size() != 0)
	{
		colorAnimation	= LALib.FindItem(*animationName);
		R_ASSERT2(colorAnimation, *animationName);
	}
	else
	{
		colorAnimation	= NULL;
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,代码来源:UIColorAnimatorWrapper.cpp

示例12: CFindByIDPred

bool CInventoryOwner::GetInfo	(shared_str info_id, INFO_DATA& info_data) const
{
	VERIFY( info_id.size() );
	const KNOWN_INFO_VECTOR* known_info = m_known_info_registry->registry().objects_ptr ();
	if(!known_info) return false;

	KNOWN_INFO_VECTOR::const_iterator it = std::find_if(known_info->begin(), known_info->end(), CFindByIDPred(info_id));
	if(known_info->end() == it)
		return false;

	info_data = *it;
	return true;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:13,代码来源:inventory_owner_info.cpp

示例13: InitSpecificCharacter

void CCharacterInfo::InitSpecificCharacter (shared_str new_id)
{
    R_ASSERT(new_id.size());
    m_SpecificCharacterId = new_id;

    m_SpecificCharacter.Load(m_SpecificCharacterId);
    if(Rank().value() == NO_RANK)
        SetRank(m_SpecificCharacter.Rank());
    if(Reputation().value() == NO_REPUTATION)
        SetReputation(m_SpecificCharacter.Reputation());
    if(Community().index() == NO_COMMUNITY_INDEX)
        SetCommunity(m_SpecificCharacter.Community());
    if(!m_StartDialog || !m_StartDialog.size() )
        m_StartDialog = m_SpecificCharacter.data()->m_StartDialog;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:15,代码来源:character_info.cpp

示例14: OnDisableInfo

void CInventoryOwner::OnDisableInfo(shared_str info_id) const
{
	VERIFY( info_id.size() );
	//удалить запись из реестра
	
#ifdef DEBUG
	if(psAI_Flags.test(aiInfoPortion))
		Msg("[%s] Disabled Info [%s]", Name(), *info_id);
#endif

	KNOWN_INFO_VECTOR& known_info = m_known_info_registry->registry().objects();

	KNOWN_INFO_VECTOR_IT it = std::find_if(known_info.begin(), known_info.end(), CFindByIDPred(info_id));
	if( known_info.end() == it)	return;
	known_info.erase(it);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:16,代码来源:inventory_owner_info.cpp

示例15: AddQuestion

void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value
#ifdef NUM_PHRASES
, int number
#endif
)
{
	if(text.size() == 0)
	{
		return;
	}
	UITalkDialogWnd->AddQuestion(*CStringTable().translate(text),value.c_str()
#ifdef NUM_PHRASES
, number
#endif
);
}
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:16,代码来源:UITalkWnd.cpp


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