Skip to content

Commit 7912112

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

File tree

150 files changed

+537
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+537
-579
lines changed

src/xrGame/AI_PhraseDialogManager.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
class CAI_PhraseDialogManager : public CPhraseDialogManager
1313
{
14-
private:
1514
typedef CPhraseDialogManager inherited;
1615

1716
public:
@@ -33,7 +32,7 @@ class CAI_PhraseDialogManager : public CPhraseDialogManager
3332
shared_str m_sStartDialog;
3433
shared_str m_sDefaultStartDialog;
3534

36-
DEFINE_VECTOR(DIALOG_SHARED_PTR, DIALOG_SHARED_VECTOR, DIALOG_SHARED_IT);
35+
using DIALOG_SHARED_VECTOR = xr_vector<DIALOG_SHARED_PTR>;
3736
//список диалогов, на которые нужно ответить
3837
DIALOG_SHARED_VECTOR m_PendingDialogs;
3938
};

src/xrGame/Actor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ class CActor : public CEntityAlive,
522522
Fvector IPosS, IPosH, IPosL; //положение актера после интерполяции Бизье, Эрмита, линейной
523523

524524
#ifdef DEBUG
525-
DEF_DEQUE(VIS_POSITION, Fvector);
525+
using VIS_POSITION = xr_deque<Fvector>;
526526

527527
VIS_POSITION LastPosS;
528528
VIS_POSITION LastPosH;
@@ -544,7 +544,7 @@ class CActor : public CEntityAlive,
544544
u32 m_dwILastUpdateTime;
545545

546546
//---------------------------------------------
547-
DEF_DEQUE(PH_STATES, SPHNetState);
547+
using PH_STATES = xr_deque<SPHNetState>;
548548
PH_STATES m_States;
549549
u16 m_u16NumBones;
550550
void net_ExportDeadBody(NET_Packet& P);

src/xrGame/Actor_Network.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ void CActor::OnRender_Network()
16751675
if (!pLastPos->empty())
16761676
{
16771677
Fvector Pos1, Pos2;
1678-
VIS_POSITION_it It = pLastPos->begin();
1678+
auto It = pLastPos->begin();
16791679
Pos1 = *It;
16801680
for (; It != pLastPos->end(); It++)
16811681
{

src/xrGame/BastArtifact.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
struct SGameMtl;
1313
struct dContact;
1414

15-
DEFINE_VECTOR(CEntityAlive*, ALIVE_LIST, ALIVE_LIST_it);
15+
using ALIVE_LIST = xr_vector<CEntityAlive*>;
1616

1717
class CBastArtefact : public CArtefact, public Feel::Touch
1818
{

src/xrGame/BlackGraviArtifact.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void CBlackGraviArtefact::net_Relcase(IGameObject* O)
6666
{
6767
inherited::net_Relcase(O);
6868
// for vector
69-
GAME_OBJECT_LIST_it I =
69+
auto I =
7070
std::remove_if(m_GameObjectList.begin(), m_GameObjectList.end(), SRP(smart_cast<CPhysicsShellHolder*>(O)));
7171
m_GameObjectList.erase(I, m_GameObjectList.end());
7272
// for list
@@ -166,7 +166,7 @@ void CBlackGraviArtefact::GraviStrike()
166166

167167
rq_storage.r_clear();
168168

169-
for (GAME_OBJECT_LIST_it it = m_GameObjectList.begin(); m_GameObjectList.end() != it; ++it)
169+
for (auto it = m_GameObjectList.begin(); m_GameObjectList.end() != it; ++it)
170170
{
171171
CPhysicsShellHolder* pGameObject = *it;
172172

src/xrGame/BlackGraviArtifact.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "GraviArtifact.h"
99
#include "xrEngine/feel_touch.h"
1010
#include "PhysicsShellHolder.h"
11-
DEFINE_VECTOR(CPhysicsShellHolder*, GAME_OBJECT_LIST, GAME_OBJECT_LIST_it);
11+
using GAME_OBJECT_LIST = xr_vector<CPhysicsShellHolder*>;
1212

1313
class CBlackGraviArtefact : public CGraviArtefact, public Feel::Touch
1414
{

src/xrGame/Car.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ IC void CCar::fill_wheel_vector(LPCSTR S, xr_vector<T>& type_wheels)
18271827
type_wheels.push_back(T());
18281828
T& twheel = type_wheels.back();
18291829

1830-
BONE_P_PAIR_IT J = bone_map.find(bone_id);
1830+
auto J = bone_map.find(bone_id);
18311831
if (J == bone_map.end())
18321832
{
18331833
bone_map.insert(std::make_pair(bone_id, physicsBone()));
@@ -1861,11 +1861,9 @@ IC void CCar::fill_exhaust_vector(LPCSTR S, xr_vector<SExhaust>& exhausts)
18611861
SExhaust& exhaust = exhausts.back();
18621862
exhaust.bone_id = bone_id;
18631863

1864-
BONE_P_PAIR_IT J = bone_map.find(bone_id);
1864+
auto J = bone_map.find(bone_id);
18651865
if (J == bone_map.end())
1866-
{
18671866
bone_map.insert(std::make_pair(bone_id, physicsBone()));
1868-
}
18691867
}
18701868
}
18711869

@@ -1882,11 +1880,9 @@ IC void CCar::fill_doors_map(LPCSTR S, xr_map<u16, SDoor>& doors)
18821880
SDoor door(this);
18831881
door.bone_id = bone_id;
18841882
doors.insert(std::make_pair(bone_id, door));
1885-
BONE_P_PAIR_IT J = bone_map.find(bone_id);
1883+
auto J = bone_map.find(bone_id);
18861884
if (J == bone_map.end())
1887-
{
18881885
bone_map.insert(std::make_pair(bone_id, physicsBone()));
1889-
}
18901886
}
18911887
}
18921888

@@ -1908,8 +1904,8 @@ u16 CCar::Initiator()
19081904
return ID();
19091905
}
19101906

1911-
float CCar::RefWheelMaxSpeed() { return m_max_rpm / m_current_gear_ratio; }
1912-
float CCar::EngineCurTorque() { return m_current_engine_power / m_current_rpm; }
1907+
float CCar::RefWheelMaxSpeed() const { return m_max_rpm / m_current_gear_ratio; }
1908+
float CCar::EngineCurTorque() const { return m_current_engine_power / m_current_rpm; }
19131909
float CCar::RefWheelCurTorque()
19141910
{
19151911
if (b_transmission_switching)

src/xrGame/Car.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ class CCar : public CEntity,
452452
void ResetKeys();
453453

454454
////////////////////////////////////////////////////////////////////////////
455-
float RefWheelMaxSpeed();
456-
float EngineCurTorque();
455+
float RefWheelMaxSpeed() const;
456+
float EngineCurTorque() const;
457457
float RefWheelCurTorque();
458458
float EnginePower();
459459
float EngineDriveSpeed();

src/xrGame/CarDamageParticles.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void CCarDamageParticles::Play1(CCar* car)
4747
{
4848
if (*m_car_damage_particles1)
4949
{
50-
BIDS_I i = bones1.begin(), e = bones1.end();
50+
auto i = bones1.begin(), e = bones1.end();
5151
for (; e != i; ++i)
5252
car->StartParticles(m_car_damage_particles1, *i, Fvector().set(0, 1, 0), car->ID());
5353
}
@@ -58,20 +58,20 @@ void CCarDamageParticles::Play2(CCar* car)
5858
VERIFY(!physics_world()->Processing());
5959
if (*m_car_damage_particles2)
6060
{
61-
BIDS_I i = bones2.begin(), e = bones2.end();
61+
auto i = bones2.begin(), e = bones2.end();
6262
for (; e != i; ++i)
6363
car->StartParticles(m_car_damage_particles2, *i, Fvector().set(0, 1, 0), car->ID());
6464
}
6565
}
6666

67-
void CCarDamageParticles::PlayWheel1(CCar* car, u16 bone_id)
67+
void CCarDamageParticles::PlayWheel1(CCar* car, u16 bone_id) const
6868
{
6969
VERIFY(!physics_world()->Processing());
7070
if (*m_wheels_damage_particles1)
7171
car->StartParticles(m_wheels_damage_particles1, bone_id, Fvector().set(0, 1, 0), car->ID());
7272
}
7373

74-
void CCarDamageParticles::PlayWheel2(CCar* car, u16 bone_id)
74+
void CCarDamageParticles::PlayWheel2(CCar* car, u16 bone_id) const
7575
{
7676
VERIFY(!physics_world()->Processing());
7777
if (*m_wheels_damage_particles2)

src/xrGame/CarDamageParticles.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
2+
23
class CCar;
3-
DEFINE_VECTOR(u16, BIDS, BIDS_I);
4+
using BIDS = xr_vector<u16>;
5+
46
struct CCarDamageParticles
57
{
68
BIDS bones1;
@@ -15,6 +17,6 @@ struct CCarDamageParticles
1517
void Clear();
1618
void Play1(CCar* car);
1719
void Play2(CCar* car);
18-
void PlayWheel1(CCar* car, u16 bone_id);
19-
void PlayWheel2(CCar* car, u16 bone_id);
20+
void PlayWheel1(CCar* car, u16 bone_id) const;
21+
void PlayWheel2(CCar* car, u16 bone_id) const;
2022
};

0 commit comments

Comments
 (0)