本文整理汇总了C++中xr_vector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector::begin方法的具体用法?C++ xr_vector::begin怎么用?C++ xr_vector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xr_vector
的用法示例。
在下文中一共展示了xr_vector::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
std::pair<u32,u32> get_id( const xr_vector<xrMU_Model*>& mu_models, const T * v )
{
u32 face_id = u32(-1);
struct find
{
const T * _v;
u32& _id;
find( const T * v, u32& id) : _v(v), _id( id )
{}
bool operator () ( const xrMU_Model * m )
{
VERIFY(m);
u32 id = m->find( _v );
if( id == u32(-1) )
return false;
_id = id;
return true;
}
} f( v, face_id );
xr_vector<xrMU_Model*> :: const_iterator ii =std::find_if( mu_models.begin(), mu_models.end(), f );
if( ii == mu_models.end() )
return std::pair<u32,u32>(u32(-1), u32(-1));
return std::pair<u32,u32>(u32(ii-mu_models.begin()), face_id );
}
示例2: read
void read( INetReader &r, CDB::MODEL &m )
{
verts.clear();
tris.clear();
r_pod_vector( r, verts );
u32 tris_count = r.r_u32();
tris.resize( tris_count );
for( u32 i = 0; i < tris_count; ++i)
::read( r, tris[i] );
m.build( &*verts.begin(), (int)verts.size(), &*tris.begin(), (int)tris.size() );
verts.clear();
tris.clear();
}
示例3: dump_list_wnd
void dump_list_wnd(){
Msg("------Total wnds %d",dbg_list_wnds.size());
xr_vector<DBGList>::iterator _it = dbg_list_wnds.begin();
for(;_it!=dbg_list_wnds.end();++_it)
if(!(*_it).closed)
Msg("--leak detected ---- wnd = %d",(*_it).num);
}
示例4: PlaceData
u32 PlaceData(xr_vector<vecW> &C, vecW &P)
{
if (P.size()>1) {
std::sort (P.begin(),P.end());
vecW::iterator I = std::unique (P.begin(),P.end());
P.erase(I,P.end());
}
// Search placeholder
u32 sz = P.size();
u32 pos = 0;
for (xr_vector<vecW>::iterator it=C.begin(); it!=C.end(); it++)
{
u32 S = it->size();
if (S!=sz) { pos+=S+1; continue; }
if (0!=memcmp(it->begin(),P.begin(),S*sizeof(u16))) { pos+=S+1; continue; }
// Ok-Ob :)
goto exit;
}
// If we get here - need to register _new set of data
C.push_back(P);
exit:
P.clear();
return pos*sizeof(u16);
}
示例5:
void CallFunctions (xr_vector<luabind::functor<void> >& v)
{
xr_vector<luabind::functor<void> >::iterator it = v.begin();
for(;it!=v.end();++it){
if( (*it).is_valid() ) (*it)();
}
}
示例6: vec_spetial_clear
void vec_spetial_clear( xr_vector<T> &v )
{
typename xr_vector<T>::iterator i = v.begin(), e = v.end();
for(;i!=e;++i)
clear(*i);
v.clear();
}
示例7: vec_clear
void vec_clear( xr_vector<T*> &v )
{
typename xr_vector<T*>::iterator i = v.begin(), e = v.end();
for(;i!=e;++i)
xr_delete(*i);
v.clear();
}
示例8: GetParent
CUIWindow::~CUIWindow()
{
VERIFY( !(GetParent()&&IsAutoDelete()) );
CUIWindow* parent = GetParent();
bool ad = IsAutoDelete();
if( parent && !ad )
parent->CUIWindow::DetachChild( this );
DetachAll();
if( GetPPMode() )
MainMenu()->UnregisterPPDraw (this);
#ifdef LOG_ALL_WNDS
xr_vector<DBGList>::iterator _it = dbg_list_wnds.begin();
bool bOK = false;
for(;_it!=dbg_list_wnds.end();++_it){
if( (*_it).num==m_dbg_id && !(*_it).closed){
bOK = true;
(*_it).closed = true;
dbg_list_wnds.erase(_it);
break;
}
if( (*_it).num==m_dbg_id && (*_it).closed){
Msg("--CUIWindow [%d] already deleted", m_dbg_id);
bOK = true;
}
}
if(!bOK)
Msg("CUIWindow::~CUIWindow.[%d] cannot find window in list", m_dbg_id);
#endif
}
示例9:
void CLevelChanger::net_Destroy ()
{
inherited ::net_Destroy ();
xr_vector<CLevelChanger*>::iterator it = std::find(g_lchangers.begin(), g_lchangers.end(), this);
if(it != g_lchangers.end())
g_lchangers.erase(it);
}
示例10: SaveDATA
void SaveDATA(IWriter &fs, xr_vector<vecW> &C)
{
for (xr_vector<vecW>::iterator it=C.begin(); it!=C.end(); it++)
{
fs.Wword(it->size());
fs.write(it->begin(),it->size()*sizeof(u16));
}
}
示例11:
BOOL reclaim (xr_vector<T*>& vec, const T* ptr)
{
xr_vector<T*>::iterator it = vec.begin ();
xr_vector<T*>::iterator end = vec.end ();
for (; it!=end; it++)
if (*it == ptr) { vec.erase (it); return TRUE; }
return FALSE;
}
示例12: highlight_ammo_for_weapon
void CUIActorMenu::highlight_ammo_for_weapon( PIItem weapon_item, CUIDragDropListEx* ddlist )
{
VERIFY( weapon_item );
VERIFY( ddlist );
static xr_vector<shared_str> ammo_types;
ammo_types.clear_not_free();
CWeapon* weapon = smart_cast<CWeapon*>(weapon_item);
if ( !weapon )
{
return;
}
ammo_types.assign( weapon->m_ammoTypes.begin(), weapon->m_ammoTypes.end() );
CWeaponMagazinedWGrenade* wg = smart_cast<CWeaponMagazinedWGrenade*>(weapon_item);
if ( wg )
{
if ( wg->IsGrenadeLauncherAttached() && wg->m_ammoTypes2.size() )
{
ammo_types.insert( ammo_types.end(), wg->m_ammoTypes2.begin(), wg->m_ammoTypes2.end() );
}
}
if ( ammo_types.size() == 0 )
{
return;
}
xr_vector<shared_str>::iterator ite = ammo_types.end();
u32 const cnt = ddlist->ItemsCount();
for ( u32 i = 0; i < cnt; ++i )
{
CUICellItem* ci = ddlist->GetItemIdx(i);
PIItem item = (PIItem)ci->m_pData;
if ( !item )
{
continue;
}
CWeaponAmmo* ammo = smart_cast<CWeaponAmmo*>(item);
if ( !ammo )
{
highlight_addons_for_weapon( weapon_item, ci );
continue; // for i
}
shared_str const& ammo_name = item->object().cNameSect();
xr_vector<shared_str>::iterator itb = ammo_types.begin();
for ( ; itb != ite; ++itb )
{
if ( ammo_name._get() == (*itb)._get() )
{
ci->m_select_armament = true;
break; // itb
}
}
}//for i
}
示例13: bfGetActionSuccessProbability
bool bfGetActionSuccessProbability(GroupHierarchyHolder::MEMBER_REGISTRY &Members, const xr_vector<const CEntityAlive *> &VisibleEnemies, float fMinProbability, CBaseFunction &fSuccessProbabilityFunction)
{
int i = 0, j = 0, I = (int)Members.size(), J = (int)VisibleEnemies.size();
xr_vector<const CEntityAlive*>::const_iterator II = VisibleEnemies.begin();
for ( ; (i < I) && (j < J); ) {
ai().ef_storage().non_alife().member() = smart_cast<CEntityAlive *>(Members[i]);
if (!(ai().ef_storage().non_alife().member()) || !(ai().ef_storage().non_alife().member()->g_Alive())) {
++i;
continue;
}
ai().ef_storage().non_alife().enemy() = *II;
if (!(ai().ef_storage().non_alife().enemy()) || !(ai().ef_storage().non_alife().enemy()->g_Alive())) {
++j;
++II;
continue;
}
float fProbability = fSuccessProbabilityFunction.ffGetValue()/100.f, fCurrentProbability;
if (fProbability > fMinProbability) {
fCurrentProbability = fProbability;
for (++j; (i < I) && (j < J); ++j) {
ai().ef_storage().non_alife().enemy() = *II;
if (!(ai().ef_storage().non_alife().enemy()) || !(ai().ef_storage().non_alife().enemy()->g_Alive())) {
++j;
++II;
continue;
}
fProbability = fSuccessProbabilityFunction.ffGetValue()/100.f;
if (fCurrentProbability*fProbability < fMinProbability) {
++i;
break;
}
else
fCurrentProbability *= fProbability;
}
}
else {
fCurrentProbability = 1.0f - fProbability;
for (++i; (i < I) && (j < J); ++i) {
ai().ef_storage().non_alife().member() = smart_cast<CEntityAlive *>(Members[i]);
if (!(ai().ef_storage().non_alife().member()) || !(ai().ef_storage().non_alife().member()->g_Alive())) {
++i;
continue;
}
fProbability = 1.0f - fSuccessProbabilityFunction.ffGetValue()/100.f;
if (fCurrentProbability*fProbability < (1.f - fMinProbability)) {
++II;
++j;
break;
}
else
fCurrentProbability *= fProbability;
}
}
}
return(j >= J);
}
示例14: dbg_draw_geoms
void dbg_draw_geoms(xr_vector<CODEGeom*>& m_weapon_geoms)
{
xr_vector<CODEGeom*>::iterator ii =m_weapon_geoms.begin(), ee = m_weapon_geoms.end();
for( ;ii!=ee; ++ii )
{
CODEGeom *g =(*ii);
g->dbg_draw( 0.01f, D3DCOLOR_XRGB( 0, 255, 100 ), Flags32() );
}
}
示例15: transfer
void transfer(const char *name, xr_vector<T> &dest, IReader& F, u32 chunk)
{
IReader* O = F.open_chunk(chunk);
u32 count = O?(O->length()/sizeof(T)):0;
clMsg ("* %16s: %d",name,count);
if (count)
{
dest.reserve(count);
dest.insert (dest.begin(), (T*)O->pointer(), (T*)O->pointer() + count);
}
if (O) O->close ();
}