本文整理汇总了C++中xr_vector类的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector类的具体用法?C++ xr_vector怎么用?C++ xr_vector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了xr_vector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CUIXml::~CUIXml()
{
#ifdef LOG_ALL_XMLS
xr_vector<DBGList_>::iterator _it = dbg_list_xmls.begin();
bool bOK = false;
for(;_it!=dbg_list_xmls.end();++_it){
if( (*_it).num==m_dbg_id && !(*_it).closed){
bOK = true;
(*_it).closed = true;
dbg_list_xmls.erase(_it);
break;
}
if( (*_it).num==m_dbg_id && (*_it).closed){
Msg("--XML [%d] already deleted", m_dbg_id);
bOK = true;
}
}
if(!bOK)
Msg("CUIXml::~CUIXml.[%d] cannot find xml in list", m_dbg_id);
#endif
}
示例2:
void CSE_InventoryBox::add_offline (const xr_vector<ALife::_OBJECT_ID> &saved_children, const bool &update_registries)
{
CSE_ALifeDynamicObjectVisual *object = (this);
for (u32 i=0, n=saved_children.size(); i<n; ++i) {
CSE_ALifeDynamicObject *child = smart_cast<CSE_ALifeDynamicObject*>(ai().alife().objects().object(saved_children[i],true));
R_ASSERT (child);
child->m_bOnline = false;
CSE_ALifeInventoryItem *inventory_item = smart_cast<CSE_ALifeInventoryItem*>(child);
VERIFY2 (inventory_item,"Non inventory item object has parent?!");
#ifdef DEBUG
// if (psAI_Flags.test(aiALife))
// Msg ("[LSS] Destroying item [%s][%s][%d]",inventory_item->base()->name_replace(),*inventory_item->base()->s_name,inventory_item->base()->ID);
Msg (
"[LSS][%d] Going offline [%d][%s][%d] with parent [%d][%s] on '%s'",
Device.dwFrame,
Device.dwTimeGlobal,
inventory_item->base()->name_replace(),
inventory_item->base()->ID,
ID,
name_replace(),
"*SERVER*"
);
#endif
ALife::_OBJECT_ID item_id = inventory_item->base()->ID;
inventory_item->base()->ID = object->alife().server().PerformIDgen(item_id);
if (!child->can_save()) {
object->alife().release (child);
--i;
--n;
continue;
}
#ifdef DEBUG
if (!client_data.empty())
Msg ("CSE_InventoryBox::add_offline: client_data is cleared for [%d][%s]",ID,name_replace());
#endif // DEBUG
if (!child->keep_saved_data_anyway())
child->client_data.clear ();
object->alife().graph().add (child,child->m_tGraphID,false);
// object->alife().graph().attach (*object,inventory_item,child->m_tGraphID,true);
alife().graph().remove (child,child->m_tGraphID);
children.push_back (child->ID);
child->ID_Parent = ID;
}
CSE_ALifeDynamicObjectVisual::add_offline(saved_children, update_registries);
}
示例3:
void SaveUVM (LPCSTR fname, xr_vector<b_rc_face>& vm)
{
IWriter* W = FS.w_open(fname);
string256 tmp;
// vertices
for (u32 v_idx=0; v_idx<vm.size(); v_idx++){
b_rc_face& rcf = vm[v_idx];
sprintf (tmp,"f %d %d [%3.2f,%3.2f]-[%3.2f,%3.2f]-[%3.2f,%3.2f]",rcf.dwMaterial,rcf.dwMaterialGame,
rcf.t[0].x,rcf.t[0].y, rcf.t[1].x,rcf.t[1].y, rcf.t[2].x,rcf.t[2].y);
W->w_string (tmp);
}
FS.w_close (W);
}
示例4: fill_exhaust_vector
IC void CCar::fill_exhaust_vector(LPCSTR S,xr_vector<SExhaust>& exhausts)
{
IKinematics* pKinematics =smart_cast<IKinematics*>(Visual());
string64 S1;
int count = _GetItemCount(S);
for (int i=0 ;i<count; ++i)
{
_GetItem (S,i,S1);
u16 bone_id = pKinematics->LL_BoneID(S1);
exhausts.push_back (SExhaust(this));
SExhaust& exhaust = exhausts.back();
exhaust.bone_id = bone_id;
BONE_P_PAIR_IT J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(mk_pair(bone_id,physicsBone()));
}
}
}
示例5: xrSimulate
int xrSimulate (xr_vector<u16> &indices, int iCacheSize )
{
VertexCache C(iCacheSize);
int count=0;
for (u32 i=0; i<indices.size(); i++)
{
int id = indices[i];
if (C.InCache(id)) continue;
count++;
C.AddEntry(id);
}
return count;
}
示例6:
BOOL testSKIP (LPCSTR path)
{
string256 p_name;
string256 p_ext;
_splitpath (path, 0, 0, p_name, p_ext );
if (0==stricmp(p_ext,".swatch"))return TRUE;
if (0==stricmp(p_ext,".db")) return TRUE;
if (PatternMatch(p_ext,"*avi*"))return TRUE;
if (0==stricmp(p_ext,".key")) return TRUE;
if (0==stricmp(p_ext,".tga")) return TRUE;
if (0==stricmp(p_ext,".txt")) return TRUE;
if (0==stricmp(p_ext,".smf")) return TRUE;
if (0==stricmp(p_ext,".uvm")) return TRUE;
if (0==stricmp(p_ext,".raw")) return TRUE;
if (0==stricmp(p_name,"build")) return TRUE;
if ('~'==p_ext[1]) return TRUE;
if ('_'==p_ext[1]) return TRUE;
for (xr_vector<shared_str>::iterator it=exclude_exts.begin(); it!=exclude_exts.end(); it++)
if (PatternMatch(p_ext,it->c_str()))return TRUE;
return FALSE;
}
示例7: xrSaveNodes
void xrSaveNodes(LPCSTR N, LPCSTR out_name)
{
Msg ("NS: %d, CNS: %d, ratio: %f%%",sizeof(vertex),sizeof(CLevelGraph::CVertex),100*float(sizeof(CLevelGraph::CVertex))/float(sizeof(vertex)));
Msg ("Renumbering nodes...");
string_path fName;
strconcat (sizeof(fName),fName,N,out_name);
IWriter *fs = FS.w_open(fName);
// Header
Status ("Saving header...");
hdrNODES H;
H.version = XRAI_CURRENT_VERSION;
H.count = g_nodes.size();
H.size = g_params.fPatchSize;
H.size_y = CalculateHeight(H.aabb);
H.guid = generate_guid();
fs->w (&H,sizeof(H));
// fs->w_u32 (g_covers_palette.size());
// for (u32 j=0; j<g_covers_palette.size(); ++j)
// fs->w (&g_covers_palette[j],sizeof(g_covers_palette[j]));
// All nodes
Status ("Saving nodes...");
for (u32 i=0; i<g_nodes.size(); ++i) {
vertex &N = g_nodes[i];
NodeCompressed NC;
Compress (NC,N,H);
compressed_nodes.push_back(NC);
}
xr_vector<u32> sorted;
xr_vector<u32> renumbering;
CNodeRenumberer A(compressed_nodes,sorted,renumbering);
for (u32 i=0; i<g_nodes.size(); ++i) {
fs->w (&compressed_nodes[i],sizeof(NodeCompressed));
Progress (float(i)/float(g_nodes.size()));
}
// Stats
u32 SizeTotal = fs->tell();
Msg ("%dK saved",SizeTotal/1024);
FS.w_close (fs);
}
示例8: dfComputeEvalResults
REAL dfComputeEvalResults(xr_vector<xr_vector<REAL> > &daEvalResults, xr_vector<xr_vector<REAL> > &A, xr_vector<xr_vector<REAL> > &B, xr_vector<REAL> &C, xr_vector<REAL> &D)
{
REAL dResult = 0.0;
u32 dwTestCount = (u32)B.size();
u32 dwParameterCount = (u32)B[0].size();
for (u32 i=0; i<dwTestCount; i++) {
for (u32 j=0; j<dwParameterCount; j++) {
daEvalResults[i][j] = dfEvaluation(A[i][j],C[j],D[j]);
REAL dTemp = B[i][j] - daEvalResults[i][j];
dResult += dTemp*dTemp;
}
}
return (dResult);
}
示例9: ProcessFolder
void ProcessFolder(xr_vector<char*>& list, LPCSTR path)
{
xr_vector<char*>* i_list = FS.file_list_open ("$target_folder$",path,FS_ListFiles|FS_RootOnly);
if (!i_list){
Log ("ERROR: Unable to open file list:", path);
return;
}
xr_vector<char*>::iterator it = i_list->begin();
xr_vector<char*>::iterator itE = i_list->end();
for (;it!=itE;++it){
xr_string tmp_path = xr_string(path)+xr_string(*it);
if (!testSKIP(tmp_path.c_str())){
list.push_back (xr_strdup(tmp_path.c_str()));
//. Msg ("+f: %s",tmp_path.c_str());
}else{
Msg ("-f: %s",tmp_path.c_str());
}
}
FS.file_list_close (i_list);
}
示例10: CreateList
void CUIMMShniaga::CreateList(xr_vector<CUIStatic*>& lst, CUIXml& xml_doc, LPCSTR path){
CGameFont* pF;
u32 color;
float button_height = xml_doc.ReadAttribFlt("button", 0, "h");
R_ASSERT (button_height);
CUIXmlInit::InitFont (xml_doc, path, 0, color, pF);
R_ASSERT (pF);
int nodes_num = xml_doc.GetNodesNum(path, 0, "btn");
XML_NODE* tab_node = xml_doc.NavigateToNode(path,0);
xml_doc.SetLocalRoot (tab_node);
CUIStatic* st;
for (int i = 0; i < nodes_num; ++i)
{
st = new CUIStatic();
st->SetWndPos (Fvector2().set(0,0));
st->SetWndSize (Fvector2().set(m_view->GetDesiredChildWidth(), button_height));
st->SetTextComplexMode (false);
st->SetTextST (xml_doc.ReadAttrib ("btn", i, "caption"));
if (pF)
st->SetFont (pF);
float font_height = st->GetFont()->GetHeight();
UI()->ClientToScreenScaledHeight(font_height);
st->SetTextY ( (button_height-font_height)/2.0f );
st->SetTextColor (color);
st->SetTextAlignment (CGameFont::alCenter);
st->SetWindowName (xml_doc.ReadAttrib("btn", i, "name"));
st->SetMessageTarget (this);
lst.push_back(st);
}
xml_doc.SetLocalRoot(xml_doc.GetRoot());
}
示例11: stats
IC void CSmartCastStats::show ()
{
if (m_stats.empty()) {
Msg ("CONGRATULATIONS : SmartCast stats is empty!!!");
return;
}
m_temp.clear ();
m_temp.insert (m_temp.begin(),m_stats.begin(),m_stats.end());
std::sort (m_temp.begin(),m_temp.end(),CStatsPredicate());
u32 total = 0;
xr_vector<CStats>::const_iterator I = m_temp.begin();
xr_vector<CStats>::const_iterator E = m_temp.end();
for ( ; I != E; ++I)
total += (*I).m_count;
Msg ("SmartCast stats (different %d, total %d) : ",(u32)m_stats.size(),total);
I = m_temp.begin();
for ( ; I != E; ++I)
Msg ("%8d %6.2f% : smart_cast<%s>(%s)",(*I).m_count,float((*I).m_count)*100.f/float(total),(*I).m_to,(*I).m_from);
}
示例12: read
void read( INetReader &r, CDB::MODEL* &m, xrLC_GlobalData &lc_global_data )
{
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], lc_global_data );
VERIFY(!m);
m = xr_new<CDB::MODEL> ();
m->build( &*verts.begin(), (int)verts.size(), &*tris.begin(), (int)tris.size() );
verts.clear();
tris.clear();
}
示例13: GetGlobalData
bool GetGlobalData( IAgent* agent,
DWORD sessionId )
{
if(!inlc_global_data())
{
VERIFY( agent );
net_pool.clear();
/*
IGenericStream* globalDataStream=0;
HRESULT rz = agent->GetData(sessionId, dataDesc, &globalDataStream);
if (rz!=S_OK)
return false;
*/
string_path cache_dir;
HRESULT rz = agent->GetSessionCacheDirectory( sessionId, cache_dir );
if (rz!=S_OK)
return false;
strconcat(sizeof(cache_dir),cache_dir,cache_dir,gl_data_net_file_name);
/*
IWriter* file = FS.w_open( cache_dir );
R_ASSERT(file);
file->w( globalDataStream->GetCurPointer(), globalDataStream->GetLength() );
free(globalDataStream->GetCurPointer());
FS.w_close(file);
agent->FreeCachedData(sessionId, dataDesc);
ULONG r =globalDataStream->AddRef();
r = globalDataStream->Release();
if(r>0)
globalDataStream->Release();
agent->FreeCachedData(sessionId, dataDesc);
Memory.mem_compact ();
*/
DataReadCreate( cache_dir );
return true;
}
return true;
}
示例14: OnNMClickServerslist
void CClientDlg::OnNMClickServerslist(NMHDR *pNMHDR, LRESULT *pResult)
{
NMITEMACTIVATE *pAct = (NMITEMACTIVATE*)pNMHDR;
*pResult = 0;
if (pAct->iItem >= 0 && u32(pAct->iItem) <net_Hosts.size())
{
m_pBtnJoin.EnableWindow(TRUE);
}
else
{
m_pBtnJoin.EnableWindow(FALSE);
};
}
示例15:
CUIWindow::CUIWindow()
{
m_pFont = NULL;
m_pParentWnd = NULL;
m_pMouseCapturer = NULL;
m_pOrignMouseCapturer = NULL;
m_pMessageTarget = NULL;
m_pKeyboardCapturer = NULL;
m_bAutoDelete = false;
Show (true);
Enable (true);
m_bCursorOverWindow = false;
m_bClickable = false;
m_bPP = false;
m_dwFocusReceiveTime = 0;
m_bCustomDraw = false;
#ifdef LOG_ALL_WNDS
ListWndCount++;
m_dbg_id = ListWndCount;
dbg_list_wnds.push_back(DBGList());
dbg_list_wnds.back().num = m_dbg_id;
dbg_list_wnds.back().closed = false;
#endif
}