Skip to content

Commit

Permalink
xrCore: removed redundant header _type_traits.h
Browse files Browse the repository at this point in the history
xrCore: removed DEFINE_%container name% macros
loki STATIC_CHECK replaced by static_assert
mk_pair from xrCore replaced by std::make_pair
  • Loading branch information
Im-dex committed Nov 9, 2016
1 parent ae4b026 commit 9107297
Show file tree
Hide file tree
Showing 361 changed files with 2,165 additions and 2,044 deletions.
2 changes: 1 addition & 1 deletion code/SDK/include/luabind/luabind_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#ifdef DEBUG
# ifdef NDEBUG
STATIC_CHECK(false,Do_not_define_NDEBUG_macros_in_DEBUG_configuration_since_luabind_classes_are_sensisitve_to_it)
static_assert(false, "Do not define NDEBUG macros in DEBUG configuration since luabind classes are sensisitve to it")
# endif // #ifdef NDEBUG
#endif // #ifdef DEBUG

Expand Down
2 changes: 1 addition & 1 deletion code/engine.vc2008/Layers/xrRender/Blender_Recorder_R2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ u32 CBlender_Compile::i_Sampler (LPCSTR _name)
}
void CBlender_Compile::i_Texture (u32 s, LPCSTR name)
{
if (name) passTextures.push_back (mk_pair(s, ref_texture(DEV->_CreateTexture(name))));
if (name) passTextures.push_back (std::make_pair(s, ref_texture(DEV->_CreateTexture(name))));
}
void CBlender_Compile::i_Projective (u32 s, bool b)
{
Expand Down
4 changes: 2 additions & 2 deletions code/engine.vc2008/Layers/xrRender/ColorMapManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void ColorMapManager::UpdateTexture(const shared_str &strTexName, int iTex)

if (strTexName.size())
{
map_TexIt I = m_TexCache.find(strTexName);
auto I = m_TexCache.find(strTexName);
if (I!=m_TexCache.end())
{
ID3DBaseTexture* e0 = I->second->surface_get();
Expand All @@ -37,7 +37,7 @@ void ColorMapManager::UpdateTexture(const shared_str &strTexName, int iTex)
ref_texture tmp;
tmp.create(strTexName.c_str());

m_TexCache.insert (mk_pair(strTexName,tmp));
m_TexCache.insert (std::make_pair(strTexName,tmp));

ID3DBaseTexture* e0 = tmp->surface_get();
m_CMap[iTex]->surface_set(e0);
Expand Down
2 changes: 1 addition & 1 deletion code/engine.vc2008/Layers/xrRender/ColorMapManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ColorMapManager
{ return x<y; }
};

DEFINE_MAP_PRED(shared_str, ref_texture, map_Tex, map_TexIt, str_pred);
using map_Tex = xr_map<shared_str, ref_texture, str_pred>;

private:

Expand Down
4 changes: 2 additions & 2 deletions code/engine.vc2008/Layers/xrRender/D3DUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static const WORD identboxindiceswire[identboxindexwirecount] = {

#define SIGN(x) ((x<0)?-1:1)

DEFINE_VECTOR(FVF::L,FLvertexVec,FLvertexIt)
using FLvertexVec = xr_vector<FVF::L>;

static FLvertexVec m_GridPoints;

Expand Down Expand Up @@ -1093,7 +1093,7 @@ void CDrawUtilities::DrawGrid()
u32 vBase;
// fill VB
FVF::L* pv = (FVF::L*)Stream->Lock(m_GridPoints.size(),vs_L->vb_stride,vBase);
for (FLvertexIt v_it=m_GridPoints.begin(); v_it!=m_GridPoints.end(); v_it++,pv++) pv->set(*v_it);
for (auto v_it=m_GridPoints.begin(); v_it!=m_GridPoints.end(); v_it++,pv++) pv->set(*v_it);
Stream->Unlock(m_GridPoints.size(),vs_L->vb_stride);
// Render it as triangle list
Fmatrix ddd;
Expand Down
2 changes: 1 addition & 1 deletion code/engine.vc2008/Layers/xrRender/DetailManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ECORE_API CDetailManager
Fvector c_rgb;
#endif
};
DEFINE_VECTOR(SlotItem*,SlotItemVec,SlotItemVecIt);
using SlotItemVec = xr_vector<SlotItem*>;
struct SlotPart { //
u32 id; // ID ìîäåëüêè
SlotItemVec items; // ñïèñîê êóñòèêîâ
Expand Down
4 changes: 2 additions & 2 deletions code/engine.vc2008/Layers/xrRender/DetailManager_VS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ void CDetailManager::hw_Render_dump (ref_constant x_array, u32 var_id, u32 lod_
xr_vector <SlotItemVec* >::iterator _vE = vis.end();
for (; _vI!=_vE; _vI++){
SlotItemVec* items = *_vI;
SlotItemVecIt _iI = items->begin();
SlotItemVecIt _iE = items->end();
auto _iI = items->begin();
auto _iE = items->end();
for (; _iI!=_iE; _iI++){
SlotItem& Instance = **_iI;
u32 base = dwBatch*4;
Expand Down
6 changes: 3 additions & 3 deletions code/engine.vc2008/Layers/xrRender/FSkinned.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ void CSkeletonX_ext::_FillVerticesHW1W(const Fmatrix& view, CSkeletonWallmark& w
{
vertHW_1W* vertices;
CHK_DX (V->p_rm_Vertices->Lock(V->vBase,V->vCount,(void**)&vertices,D3DLOCK_READONLY));
for (CBoneData::FacesVecIt it=faces.begin(); it!=faces.end(); it++){
for (auto it=faces.begin(); it!=faces.end(); it++){
Fvector p[3];
u32 idx = (*it)*3;
CSkeletonWallmark::WMFace F;
Expand Down Expand Up @@ -1138,7 +1138,7 @@ void CSkeletonX_ext::_FillVerticesHW2W(const Fmatrix& view, CSkeletonWallmark& w
vertHW_2W* vertices;
CHK_DX (V->p_rm_Vertices->Lock(V->vBase,V->vCount,(void**)&vertices,D3DLOCK_READONLY));

for (CBoneData::FacesVecIt it=faces.begin(); it!=faces.end(); ++it)
for (auto it=faces.begin(); it!=faces.end(); ++it)
{
Fvector p[3];
u32 idx = (*it)*3;
Expand Down Expand Up @@ -1288,7 +1288,7 @@ void CSkeletonX_ext::TEnumBoneVertices ( vertHW_2W &verteses, u16 bone_id, u16*
template <typename vertex_buffer_type>
IC void TEnumBoneVertices (vertex_buffer_type vertices, u16* indices, CBoneData::FacesVec& faces, SEnumVerticesCallback &C )
{
for (CBoneData::FacesVecIt it=faces.begin(); it!=faces.end(); it++){
for (auto it=faces.begin(); it!=faces.end(); it++){
u32 idx = (*it)*3;
for (u32 k=0; k<3; k++){
Fvector P;
Expand Down
4 changes: 2 additions & 2 deletions code/engine.vc2008/Layers/xrRender/ModelPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ dxRender_Visual* CModelPool::Create(const char* name, IReader* data)
}
// 3. If found - return (cloned) reference
dxRender_Visual* Model = Instance_Duplicate(Base);
Registry.insert ( mk_pair(Model,low_name) );
Registry.insert (std::make_pair(Model,low_name) );
return Model;
}
}
Expand Down Expand Up @@ -295,7 +295,7 @@ void CModelPool::DeleteInternal (dxRender_Visual* &V, BOOL bDiscard)
if (it!=Registry.end())
{
// Registry entry found - move it to pool
Pool.insert (mk_pair(it->second,V));
Pool.insert (std::make_pair(it->second,V));
} else {
// Registry entry not-found - just special type of visual / particles / etc.
xr_delete (V);
Expand Down
6 changes: 4 additions & 2 deletions code/engine.vc2008/Layers/xrRender/PSLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

namespace PS {
class CPEDef;
DEFINE_VECTOR(CPEDef*,PEDVec,PEDIt);
using PEDVec = xr_vector<CPEDef*>;
using PEDIt = PEDVec::iterator;

class CPGDef;
DEFINE_VECTOR(CPGDef*,PGDVec,PGDIt);
using PGDVec = xr_vector<CPGDef*>;
using PGDIt = PGDVec::iterator;
} // namespace PS

class ECORE_API CPSLibrary : public particles_systems::library_interface {
Expand Down
2 changes: 1 addition & 1 deletion code/engine.vc2008/Layers/xrRender/ParticleEffectDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace PAPI
struct ParticleEffect;
struct PAHeader;
struct ParticleAction;
DEFINE_VECTOR(ParticleAction*,PAVec,PAVecIt);
using PAVec = xr_vector<ParticleAction*>;
}
struct EParticleAction;

Expand Down
56 changes: 28 additions & 28 deletions code/engine.vc2008/Layers/xrRender/ParticleGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CPGDef::CPGDef()

CPGDef::~CPGDef()
{
for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++)
for (auto it=m_Effects.begin(); it!=m_Effects.end(); it++)
xr_delete (*it);
m_Effects.clear ();
}
Expand Down Expand Up @@ -72,7 +72,7 @@ BOOL CPGDef::Load(IReader& F)
if (F.find_chunk(PGD_CHUNK_EFFECTS))
{
m_Effects.resize(F.r_u32());
for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++){
for (auto it=m_Effects.begin(); it!=m_Effects.end(); it++){
*it = xr_new<SEffect>();
F.r_stringZ ((*it)->m_EffectName);
F.r_stringZ ((*it)->m_OnPlayChildName);
Expand All @@ -99,7 +99,7 @@ BOOL CPGDef::Load2(CInifile& ini)

u32 counter = 0;
string256 buff;
for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); ++it,++counter)
for (auto it=m_Effects.begin(); it!=m_Effects.end(); ++it,++counter)
{
*it = xr_new<SEffect>();

Expand Down Expand Up @@ -132,7 +132,7 @@ void CPGDef::Save(IWriter& F)

F.open_chunk (PGD_CHUNK_EFFECTS);
F.w_u32 (m_Effects.size());
for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++){
for (auto it=m_Effects.begin(); it!=m_Effects.end(); it++){
F.w_stringZ ((*it)->m_EffectName);
F.w_stringZ ((*it)->m_OnPlayChildName);
F.w_stringZ ((*it)->m_OnBirthChildName);
Expand All @@ -158,7 +158,7 @@ void CPGDef::Save2(CInifile& ini)

u32 counter = 0;
string256 buff;
for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); ++it,++counter)
for (auto it=m_Effects.begin(); it!=m_Effects.end(); ++it,++counter)
{
xr_sprintf (buff, sizeof(buff), "effect_%04d", counter);

Expand All @@ -184,7 +184,7 @@ void CParticleGroup::SItem::Clear()
{
VisualVec visuals;
GetVisuals (visuals);
for (VisualVecIt it=visuals.begin(); it!=visuals.end(); it++)
for (auto it=visuals.begin(); it!=visuals.end(); it++)
{
//::Render->model_Delete(*it);
IRenderVisual *pVisual = smart_cast<IRenderVisual*>(*it);
Expand Down Expand Up @@ -262,33 +262,33 @@ void CParticleGroup::SItem::Stop(BOOL def_stop)
// stop all effects
CParticleEffect* E = static_cast<CParticleEffect*>(_effect);
if (E) E->Stop(def_stop);
VisualVecIt it;
for (it=_children_related.begin(); it!=_children_related.end(); it++)

for (auto it=_children_related.begin(); it!=_children_related.end(); it++)
static_cast<CParticleEffect*>(*it)->Stop(def_stop);
for (it=_children_free.begin(); it!=_children_free.end(); it++)
for (auto it=_children_free.begin(); it!=_children_free.end(); it++)
static_cast<CParticleEffect*>(*it)->Stop(def_stop);
// and delete if !deffered
if (!def_stop)
{
for (it=_children_related.begin(); it!=_children_related.end(); it++)
for (auto it=_children_related.begin(); it!=_children_related.end(); it++)
{
//::Render->model_Delete(*it);
IRenderVisual *pVisual = smart_cast<IRenderVisual*>(*it);
::Render->model_Delete(pVisual);
*it = 0;
}
for (it=_children_free.begin(); it!=_children_free.end(); it++)
for (auto it=_children_free.begin(); it!=_children_free.end(); it++)
{
//::Render->model_Delete(*it);
IRenderVisual *pVisual = smart_cast<IRenderVisual*>(*it);
::Render->model_Delete(pVisual);
*it = 0;
*it = nullptr;
}
_children_related.clear();
_children_free.clear ();
}
}
BOOL CParticleGroup::SItem::IsPlaying()
BOOL CParticleGroup::SItem::IsPlaying() const
{
CParticleEffect* E = static_cast<CParticleEffect*>(_effect);
return E?E->IsPlaying():FALSE;
Expand Down Expand Up @@ -355,9 +355,9 @@ void CParticleGroup::SItem::OnFrame(u32 u_dt, const CPGDef::SEffect& def, Fbox&
}
}
}
VisualVecIt it;

if (!_children_related.empty()){
for (it=_children_related.begin(); it!=_children_related.end(); it++){
for (auto it=_children_related.begin(); it!=_children_related.end(); it++){
CParticleEffect* E = static_cast<CParticleEffect*>(*it);
if (E){
E->OnFrame (u_dt);
Expand All @@ -374,7 +374,7 @@ void CParticleGroup::SItem::OnFrame(u32 u_dt, const CPGDef::SEffect& def, Fbox&
}
if (!_children_free.empty()){
u32 rem_cnt = 0;
for (it=_children_free.begin(); it!=_children_free.end(); it++){
for (auto it=_children_free.begin(); it!=_children_free.end(); it++){
CParticleEffect* E = static_cast<CParticleEffect*>(*it);
if (E){
E->OnFrame (u_dt);
Expand All @@ -392,7 +392,7 @@ void CParticleGroup::SItem::OnFrame(u32 u_dt, const CPGDef::SEffect& def, Fbox&
}
// remove if stopped
if (rem_cnt){
VisualVecIt new_end=std::remove_if(_children_free.begin(),_children_free.end(),zero_vis_pred());
auto new_end=std::remove_if(_children_free.begin(),_children_free.end(),zero_vis_pred());
_children_free.erase(new_end,_children_free.end());
}
}
Expand All @@ -402,22 +402,22 @@ void CParticleGroup::SItem::OnDeviceCreate()
{
VisualVec visuals;
GetVisuals (visuals);
for (VisualVecIt it=visuals.begin(); it!=visuals.end(); it++)
for (auto it=visuals.begin(); it!=visuals.end(); it++)
static_cast<CParticleEffect*>(*it)->OnDeviceCreate();
}
void CParticleGroup::SItem::OnDeviceDestroy()
{
VisualVec visuals;
GetVisuals (visuals);
for (VisualVecIt it=visuals.begin(); it!=visuals.end(); it++)
for (auto it=visuals.begin(); it!=visuals.end(); it++)
static_cast<CParticleEffect*>(*it)->OnDeviceDestroy();
}
u32 CParticleGroup::SItem::ParticlesCount()
{
u32 p_count=0;
VisualVec visuals;
GetVisuals (visuals);
for (VisualVecIt it=visuals.begin(); it!=visuals.end(); it++)
for (auto it=visuals.begin(); it!=visuals.end(); it++)
p_count += static_cast<CParticleEffect*>(*it)->ParticlesCount();
return p_count;
}
Expand Down Expand Up @@ -464,7 +464,7 @@ void CParticleGroup::OnFrame(u32 u_dt)

bool bPlaying = false;
Fbox box; box.invalidate();
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++)
for (auto i_it=items.begin(); i_it!=items.end(); i_it++)
i_it->OnFrame(u_dt,*m_Def->m_Effects[i_it-items.begin()],box,bPlaying);

if (m_RT_Flags.is(flRT_DefferedStop)&&!bPlaying){
Expand All @@ -484,15 +484,15 @@ void CParticleGroup::OnFrame(u32 u_dt)
void CParticleGroup::UpdateParent(const Fmatrix& m, const Fvector& velocity, BOOL bXFORM)
{
m_InitialPosition = m.c;
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++)
for (auto i_it=items.begin(); i_it!=items.end(); i_it++)
i_it->UpdateParent(m,velocity,bXFORM);
}

BOOL CParticleGroup::Compile(CPGDef* def)
{
m_Def = def;
// destroy existing
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++)
for (auto i_it=items.begin(); i_it!=items.end(); i_it++)
i_it->Clear();
items.clear();
// create new
Expand Down Expand Up @@ -521,30 +521,30 @@ void CParticleGroup::Stop(BOOL bDefferedStop)
}else{
m_RT_Flags.set (flRT_Playing,FALSE);
}
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++) i_it->Stop(bDefferedStop);
for (auto i_it=items.begin(); i_it!=items.end(); i_it++) i_it->Stop(bDefferedStop);
}

void CParticleGroup::OnDeviceCreate()
{
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++) i_it->OnDeviceCreate();
for (auto i_it=items.begin(); i_it!=items.end(); i_it++) i_it->OnDeviceCreate();
}

void CParticleGroup::OnDeviceDestroy()
{
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++) i_it->OnDeviceDestroy();
for (auto i_it=items.begin(); i_it!=items.end(); i_it++) i_it->OnDeviceDestroy();
}

u32 CParticleGroup::ParticlesCount()
{
int p_count=0;
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); i_it++)
for (auto i_it=items.begin(); i_it!=items.end(); i_it++)
p_count += i_it->ParticlesCount();
return p_count;
}

void CParticleGroup::SetHudMode(BOOL b)
{
for (SItemVecIt i_it=items.begin(); i_it!=items.end(); ++i_it)
for (auto i_it=items.begin(); i_it!=items.end(); ++i_it)
{
CParticleEffect* E = static_cast<CParticleEffect*>(i_it->_effect);
E->SetHudMode(b);
Expand Down
8 changes: 4 additions & 4 deletions code/engine.vc2008/Layers/xrRender/ParticleGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace PS
BOOL Equal (const SEffect&);
#endif
};
DEFINE_VECTOR(SEffect*,EffectVec,EffectIt);
using EffectVec = xr_vector<SEffect*>;
EffectVec m_Effects;
#ifdef _EDITOR
// change Equal if variables changed
Expand Down Expand Up @@ -70,7 +70,7 @@ namespace PS
float m_CurrentTime;
Fvector m_InitialPosition;
public:
DEFINE_VECTOR(dxRender_Visual*,VisualVec,VisualVecIt);
using VisualVec = xr_vector<dxRender_Visual*>;
struct SItem {
dxRender_Visual* _effect;
VisualVec _children_related;
Expand Down Expand Up @@ -99,11 +99,11 @@ namespace PS
void OnFrame (u32 u_dt, const CPGDef::SEffect& def, Fbox& box, bool& bPlaying);

u32 ParticlesCount ();
BOOL IsPlaying ();
BOOL IsPlaying () const;
void Play ();
void Stop (BOOL def_stop);
};
DEFINE_VECTOR(SItem,SItemVec,SItemVecIt)
using SItemVec = xr_vector<SItem>;
SItemVec items;
public:
enum{
Expand Down
Loading

0 comments on commit 9107297

Please sign in to comment.