Skip to content

Commit 892f9ff

Browse files
committed
Replace DEFINE_* macro with inplace type alias (Part 2)
Thank to Im-Dex. From commit: Im-dex/xray-162@9107297
1 parent ece7b6f commit 892f9ff

40 files changed

+325
-369
lines changed

src/xrAICore/Navigation/game_graph_space.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,5 @@ struct STerrainPlace
148148
svector<_LOCATION_ID, LOCATION_TYPE_COUNT> tMask;
149149
};
150150

151-
DEFINE_VECTOR(STerrainPlace, TERRAIN_VECTOR, TERRAIN_IT);
151+
using TERRAIN_VECTOR = xr_vector<STerrainPlace>;
152152
}

src/xrEngine/Stats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ void CStats::OnRender()
217217
{
218218
CSound_stats_ext snd_stat_ext;
219219
::Sound->statistic(0, &snd_stat_ext);
220-
CSound_stats_ext::item_vec_it _I = snd_stat_ext.items.begin();
221-
CSound_stats_ext::item_vec_it _E = snd_stat_ext.items.end();
220+
auto _I = snd_stat_ext.items.begin();
221+
auto _E = snd_stat_ext.items.end();
222222
for (; _I != _E; _I++)
223223
{
224224
const CSound_stats_ext::SItem& item = *_I;

src/xrEngine/editor_environment_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ void manager::load_weathers()
111111
m_weathers->load();
112112

113113
// sorting weather envs
114-
EnvsMapIt _I = WeatherCycles.begin();
115-
EnvsMapIt _E = WeatherCycles.end();
114+
auto _I = WeatherCycles.begin();
115+
auto _E = WeatherCycles.end();
116116
for (; _I != _E; _I++)
117117
{
118118
R_ASSERT3(_I->second.size() > 1, "Environment in weather must >=2", *_I->first);

src/xrEngine/xr_collide_form.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void CCF_Skeleton::SElement::center(Fvector& center) const
4747
bool pred_find_elem(const CCF_Skeleton::SElement& E, u16 elem) { return E.elem_id < elem; }
4848
bool CCF_Skeleton::_ElementCenter(u16 elem_id, Fvector& e_center)
4949
{
50-
ElementVecIt it = std::lower_bound(elements.begin(), elements.end(), elem_id, pred_find_elem);
50+
auto it = std::lower_bound(elements.begin(), elements.end(), elem_id, pred_find_elem);
5151
if (it->elem_id == elem_id)
5252
{
5353
it->center(e_center);
@@ -132,7 +132,7 @@ void CCF_Skeleton::BuildState()
132132
}
133133
}
134134

135-
for (ElementVecIt I = elements.begin(); I != elements.end(); I++)
135+
for (auto I = elements.begin(); I != elements.end(); I++)
136136
{
137137
if (!I->valid())
138138
continue;
@@ -241,7 +241,7 @@ BOOL CCF_Skeleton::_RayQuery(const collide::ray_defs& Q, collide::rq_results& R)
241241
}
242242

243243
BOOL bHIT = FALSE;
244-
for (ElementVecIt I = elements.begin(); I != elements.end(); I++)
244+
for (auto I = elements.begin(); I != elements.end(); I++)
245245
{
246246
if (!I->valid())
247247
continue;

src/xrEngine/xr_collide_form.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class ENGINE_API ICollisionForm
9090
IGameObject* owner; // владелец
9191
u32 dwQueryID;
9292

93-
protected:
9493
Fbox bv_box; // (Local) BBox объекта
9594
Fsphere bv_sphere; // (Local) Sphere
9695
private:
@@ -134,13 +133,12 @@ class ENGINE_API CCF_Skeleton : public ICollisionForm
134133
u16 type;
135134
u16 elem_id;
136135

137-
public:
138136
SElement() : elem_id(u16(-1)), type(0) {}
139137
SElement(u16 id, u16 t) : elem_id(id), type(t) {}
140138
BOOL valid() const { return (elem_id != (u16(-1))) && (type != 0); }
141139
void center(Fvector& center) const;
142140
};
143-
DEFINE_VECTOR(SElement, ElementVec, ElementVecIt);
141+
using ElementVec = xr_vector<SElement>;
144142

145143
private:
146144
u64 vis_mask;
@@ -169,7 +167,6 @@ class ENGINE_API CCF_Skeleton : public ICollisionForm
169167

170168
class ENGINE_API CCF_EventBox : public ICollisionForm
171169
{
172-
private:
173170
Fplane Planes[6];
174171

175172
public:
@@ -200,7 +197,6 @@ class ENGINE_API CCF_Shape : public ICollisionForm
200197
};
201198
xr_vector<shape_def> shapes;
202199

203-
public:
204200
CCF_Shape(IGameObject* _owner);
205201

206202
virtual BOOL _RayQuery(const collide::ray_defs& Q, collide::rq_results& R);

src/xrEngine/xr_efflensflare.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ void CLensFlareDescriptor::OnDeviceCreate()
120120
// shaders
121121
m_Gradient.m_pRender->CreateShader(*m_Gradient.shader, *m_Gradient.texture);
122122
m_Source.m_pRender->CreateShader(*m_Source.shader, *m_Source.texture);
123-
for (FlareIt it = m_Flares.begin(); it != m_Flares.end(); it++)
123+
for (auto it = m_Flares.begin(); it != m_Flares.end(); it++)
124124
it->m_pRender->CreateShader(*it->shader, *it->texture);
125125
/*
126126
m_Gradient.hShader = CreateShader (*m_Gradient.texture,*m_Gradient.shader);
127127
m_Source.hShader = CreateShader (*m_Source.texture,*m_Source.shader);
128-
for (FlareIt it=m_Flares.begin(); it!=m_Flares.end(); it++) it->hShader = CreateShader(*it->texture,*it->shader);
128+
for (auto it=m_Flares.begin(); it!=m_Flares.end(); it++) it->hShader = CreateShader(*it->texture,*it->shader);
129129
*/
130130
}
131131

@@ -134,12 +134,12 @@ void CLensFlareDescriptor::OnDeviceDestroy()
134134
// shaders
135135
m_Gradient.m_pRender->DestroyShader();
136136
m_Source.m_pRender->DestroyShader();
137-
for (FlareIt it = m_Flares.begin(); it != m_Flares.end(); it++)
137+
for (auto it = m_Flares.begin(); it != m_Flares.end(); it++)
138138
it->m_pRender->DestroyShader();
139139
/*
140140
m_Gradient.hShader.destroy ();
141141
m_Source.hShader.destroy ();
142-
for (FlareIt it=m_Flares.begin(); it!=m_Flares.end(); it++) it->hShader.destroy();
142+
for (auto it=m_Flares.begin(); it!=m_Flares.end(); it++) it->hShader.destroy();
143143
*/
144144
}
145145

@@ -552,7 +552,7 @@ void CLensFlare::Render(BOOL bSun, BOOL bFlares, BOOL bGradient)
552552
vecDx.normalize (vecAxis);
553553
vecDy.crossproduct (vecDx, vecDir);
554554
if (m_Current->m_Flags.is(CLensFlareDescriptor::flFlare)){
555-
for (CLensFlareDescriptor::FlareIt it=m_Current->m_Flares.begin(); it!=m_Current->m_Flares.end(); it++){
555+
for (CLensFlareDescriptor::auto it=m_Current->m_Flares.begin(); it!=m_Current->m_Flares.end(); it++){
556556
CLensFlareDescriptor::SFlare& F = *it;
557557
vec.mul (vecAxis, F.fPosition);
558558
vec.add (vecCenter);
@@ -608,7 +608,7 @@ shared_str CLensFlare::AppendDef(CEnvironment& environment, CInifile* pIni, LPCS
608608
{
609609
if (!sect || (0 == sect[0]))
610610
return "";
611-
for (LensFlareDescIt it = m_Palette.begin(); it != m_Palette.end(); it++)
611+
for (auto it = m_Palette.begin(); it != m_Palette.end(); it++)
612612
if (0 == xr_strcmp(*(*it)->section, sect))
613613
return sect;
614614

@@ -623,14 +623,14 @@ void CLensFlare::OnDeviceCreate()
623623
m_pRender->OnDeviceCreate();
624624

625625
// palette
626-
for (LensFlareDescIt it = m_Palette.begin(); it != m_Palette.end(); it++)
626+
for (auto it = m_Palette.begin(); it != m_Palette.end(); it++)
627627
(*it)->OnDeviceCreate();
628628
}
629629

630630
void CLensFlare::OnDeviceDestroy()
631631
{
632632
// palette
633-
for (LensFlareDescIt it = m_Palette.begin(); it != m_Palette.end(); it++)
633+
for (auto it = m_Palette.begin(); it != m_Palette.end(); it++)
634634
(*it)->OnDeviceDestroy();
635635

636636
// VS

src/xrEngine/xr_efflensflare.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ class ENGINE_API CLensFlareDescriptor
2323
// ref_shader hShader;
2424
SFlare() { fOpacity = fRadius = fPosition = 0; }
2525
};
26+
2627
struct SSource : public SFlare
2728
{
2829
BOOL ignore_color;
2930
};
30-
DEFINE_VECTOR(SFlare, FlareVec, FlareIt);
31+
using FlareVec = xr_vector<SFlare>;
32+
3133
FlareVec m_Flares;
3234

3335
enum

src/xrParticles/particle_actions.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ struct PARTICLES_API ParticleAction
2121
virtual void Load(IReader& F) = 0;
2222
virtual void Save(IWriter& F) = 0;
2323
};
24-
DEFINE_VECTOR(ParticleAction*, PAVec, PAVecIt);
24+
using PAVec = xr_vector<ParticleAction*>;
25+
using PAVecIt = PAVec::iterator;
26+
2527
class ParticleActions
2628
{
2729
PAVec actions;
@@ -34,23 +36,27 @@ class ParticleActions
3436
m_bLocked = false;
3537
}
3638
~ParticleActions() { clear(); }
37-
IC void clear()
39+
40+
void clear()
3841
{
3942
R_ASSERT(!m_bLocked);
4043
for (PAVecIt it = actions.begin(); it != actions.end(); it++)
4144
xr_delete(*it);
4245
actions.clear();
4346
}
44-
IC void append(ParticleAction* pa)
47+
48+
void append(ParticleAction* pa)
4549
{
4650
R_ASSERT(!m_bLocked);
4751
actions.push_back(pa);
4852
}
49-
IC bool empty() { return actions.empty(); }
50-
IC PAVecIt begin() { return actions.begin(); }
51-
IC PAVecIt end() { return actions.end(); }
52-
IC int size() { return actions.size(); }
53-
IC void resize(int cnt)
53+
54+
bool empty() { return actions.empty(); }
55+
PAVecIt begin() { return actions.begin(); }
56+
PAVecIt end() { return actions.end(); }
57+
int size() { return actions.size(); }
58+
59+
void resize(int cnt)
5460
{
5561
R_ASSERT(!m_bLocked);
5662
actions.resize(cnt);

src/xrParticles/particle_manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class CParticleManager : public IParticleManager
1010
{
1111
// These are static because all threads access the same effects.
1212
// All accesses to these should be locked.
13-
DEFINE_VECTOR(ParticleEffect*, ParticleEffectVec, ParticleEffectVecIt);
14-
DEFINE_VECTOR(ParticleActions*, ParticleActionsVec, ParticleActionsVecIt);
13+
using ParticleEffectVec = xr_vector<ParticleEffect*>;
14+
using ParticleActionsVec = xr_vector<ParticleActions*>;
1515
ParticleEffectVec effect_vec;
1616
ParticleActionsVec m_alist_vec;
1717

src/xrPhysics/PHActorCharacter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ struct TPHCharacterRestrictor : public SPHCharacterRestrictor
7474
}
7575
}
7676
};
77-
DEFINE_VECTOR(SPHCharacterRestrictor*, RESRICTORS_V, RESTRICTOR_I);
77+
using RESRICTORS_V = xr_vector<SPHCharacterRestrictor*>;
78+
using RESTRICTOR_I = RESRICTORS_V::iterator;
79+
7880
// typedef SPHCharacterRestrictor* RESRICTORS_V[2];
7981
// typedef SPHCharacterRestrictor** RESTRICTOR_I;
8082
IC RESTRICTOR_I begin(RESRICTORS_V& v)

0 commit comments

Comments
 (0)