Skip to content

Commit

Permalink
Replace DEFINE_* macro with inplace type alias (Part 3)
Browse files Browse the repository at this point in the history
Thank to Im-Dex.
From commit:
Im-dex/xray-162@9107297
  • Loading branch information
Xottab-DUTY committed Aug 10, 2017
1 parent 892f9ff commit 7912112
Show file tree
Hide file tree
Showing 150 changed files with 537 additions and 579 deletions.
3 changes: 1 addition & 2 deletions src/xrGame/AI_PhraseDialogManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class CAI_PhraseDialogManager : public CPhraseDialogManager
{
private:
typedef CPhraseDialogManager inherited;

public:
Expand All @@ -33,7 +32,7 @@ class CAI_PhraseDialogManager : public CPhraseDialogManager
shared_str m_sStartDialog;
shared_str m_sDefaultStartDialog;

DEFINE_VECTOR(DIALOG_SHARED_PTR, DIALOG_SHARED_VECTOR, DIALOG_SHARED_IT);
using DIALOG_SHARED_VECTOR = xr_vector<DIALOG_SHARED_PTR>;
//список диалогов, на которые нужно ответить
DIALOG_SHARED_VECTOR m_PendingDialogs;
};
4 changes: 2 additions & 2 deletions src/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ class CActor : public CEntityAlive,
Fvector IPosS, IPosH, IPosL; //положение актера после интерполяции Бизье, Эрмита, линейной

#ifdef DEBUG
DEF_DEQUE(VIS_POSITION, Fvector);
using VIS_POSITION = xr_deque<Fvector>;

VIS_POSITION LastPosS;
VIS_POSITION LastPosH;
Expand All @@ -544,7 +544,7 @@ class CActor : public CEntityAlive,
u32 m_dwILastUpdateTime;

//---------------------------------------------
DEF_DEQUE(PH_STATES, SPHNetState);
using PH_STATES = xr_deque<SPHNetState>;
PH_STATES m_States;
u16 m_u16NumBones;
void net_ExportDeadBody(NET_Packet& P);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Actor_Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ void CActor::OnRender_Network()
if (!pLastPos->empty())
{
Fvector Pos1, Pos2;
VIS_POSITION_it It = pLastPos->begin();
auto It = pLastPos->begin();
Pos1 = *It;
for (; It != pLastPos->end(); It++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/BastArtifact.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
struct SGameMtl;
struct dContact;

DEFINE_VECTOR(CEntityAlive*, ALIVE_LIST, ALIVE_LIST_it);
using ALIVE_LIST = xr_vector<CEntityAlive*>;

class CBastArtefact : public CArtefact, public Feel::Touch
{
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/BlackGraviArtifact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void CBlackGraviArtefact::net_Relcase(IGameObject* O)
{
inherited::net_Relcase(O);
// for vector
GAME_OBJECT_LIST_it I =
auto I =
std::remove_if(m_GameObjectList.begin(), m_GameObjectList.end(), SRP(smart_cast<CPhysicsShellHolder*>(O)));
m_GameObjectList.erase(I, m_GameObjectList.end());
// for list
Expand Down Expand Up @@ -166,7 +166,7 @@ void CBlackGraviArtefact::GraviStrike()

rq_storage.r_clear();

for (GAME_OBJECT_LIST_it it = m_GameObjectList.begin(); m_GameObjectList.end() != it; ++it)
for (auto it = m_GameObjectList.begin(); m_GameObjectList.end() != it; ++it)
{
CPhysicsShellHolder* pGameObject = *it;

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/BlackGraviArtifact.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "GraviArtifact.h"
#include "xrEngine/feel_touch.h"
#include "PhysicsShellHolder.h"
DEFINE_VECTOR(CPhysicsShellHolder*, GAME_OBJECT_LIST, GAME_OBJECT_LIST_it);
using GAME_OBJECT_LIST = xr_vector<CPhysicsShellHolder*>;

class CBlackGraviArtefact : public CGraviArtefact, public Feel::Touch
{
Expand Down
14 changes: 5 additions & 9 deletions src/xrGame/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ IC void CCar::fill_wheel_vector(LPCSTR S, xr_vector<T>& type_wheels)
type_wheels.push_back(T());
T& twheel = type_wheels.back();

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

BONE_P_PAIR_IT J = bone_map.find(bone_id);
auto J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(std::make_pair(bone_id, physicsBone()));
}
}
}

Expand All @@ -1882,11 +1880,9 @@ IC void CCar::fill_doors_map(LPCSTR S, xr_map<u16, SDoor>& doors)
SDoor door(this);
door.bone_id = bone_id;
doors.insert(std::make_pair(bone_id, door));
BONE_P_PAIR_IT J = bone_map.find(bone_id);
auto J = bone_map.find(bone_id);
if (J == bone_map.end())
{
bone_map.insert(std::make_pair(bone_id, physicsBone()));
}
}
}

Expand All @@ -1908,8 +1904,8 @@ u16 CCar::Initiator()
return ID();
}

float CCar::RefWheelMaxSpeed() { return m_max_rpm / m_current_gear_ratio; }
float CCar::EngineCurTorque() { return m_current_engine_power / m_current_rpm; }
float CCar::RefWheelMaxSpeed() const { return m_max_rpm / m_current_gear_ratio; }
float CCar::EngineCurTorque() const { return m_current_engine_power / m_current_rpm; }
float CCar::RefWheelCurTorque()
{
if (b_transmission_switching)
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/Car.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ class CCar : public CEntity,
void ResetKeys();

////////////////////////////////////////////////////////////////////////////
float RefWheelMaxSpeed();
float EngineCurTorque();
float RefWheelMaxSpeed() const;
float EngineCurTorque() const;
float RefWheelCurTorque();
float EnginePower();
float EngineDriveSpeed();
Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/CarDamageParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void CCarDamageParticles::Play1(CCar* car)
{
if (*m_car_damage_particles1)
{
BIDS_I i = bones1.begin(), e = bones1.end();
auto i = bones1.begin(), e = bones1.end();
for (; e != i; ++i)
car->StartParticles(m_car_damage_particles1, *i, Fvector().set(0, 1, 0), car->ID());
}
Expand All @@ -58,20 +58,20 @@ void CCarDamageParticles::Play2(CCar* car)
VERIFY(!physics_world()->Processing());
if (*m_car_damage_particles2)
{
BIDS_I i = bones2.begin(), e = bones2.end();
auto i = bones2.begin(), e = bones2.end();
for (; e != i; ++i)
car->StartParticles(m_car_damage_particles2, *i, Fvector().set(0, 1, 0), car->ID());
}
}

void CCarDamageParticles::PlayWheel1(CCar* car, u16 bone_id)
void CCarDamageParticles::PlayWheel1(CCar* car, u16 bone_id) const
{
VERIFY(!physics_world()->Processing());
if (*m_wheels_damage_particles1)
car->StartParticles(m_wheels_damage_particles1, bone_id, Fvector().set(0, 1, 0), car->ID());
}

void CCarDamageParticles::PlayWheel2(CCar* car, u16 bone_id)
void CCarDamageParticles::PlayWheel2(CCar* car, u16 bone_id) const
{
VERIFY(!physics_world()->Processing());
if (*m_wheels_damage_particles2)
Expand Down
8 changes: 5 additions & 3 deletions src/xrGame/CarDamageParticles.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

class CCar;
DEFINE_VECTOR(u16, BIDS, BIDS_I);
using BIDS = xr_vector<u16>;

struct CCarDamageParticles
{
BIDS bones1;
Expand All @@ -15,6 +17,6 @@ struct CCarDamageParticles
void Clear();
void Play1(CCar* car);
void Play2(CCar* car);
void PlayWheel1(CCar* car, u16 bone_id);
void PlayWheel2(CCar* car, u16 bone_id);
void PlayWheel1(CCar* car, u16 bone_id) const;
void PlayWheel2(CCar* car, u16 bone_id) const;
};
22 changes: 11 additions & 11 deletions src/xrGame/CarLights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

SCarLight::SCarLight()
{
light_render = NULL;
glow_render = NULL;
light_render = nullptr;
glow_render = nullptr;
bone_id = BI_NONE;
m_holder = NULL;
m_holder = nullptr;
}

SCarLight::~SCarLight()
Expand Down Expand Up @@ -143,51 +143,51 @@ void CCarLights::ParseDefinitions()
void CCarLights::Update()
{
VERIFY(!physics_world()->Processing());
LIGHTS_I i = m_lights.begin(), e = m_lights.end();
auto i = m_lights.begin(), e = m_lights.end();
for (; i != e; ++i)
(*i)->Update();
}

void CCarLights::SwitchHeadLights()
{
VERIFY(!physics_world()->Processing());
LIGHTS_I i = m_lights.begin(), e = m_lights.end();
auto i = m_lights.begin(), e = m_lights.end();
for (; i != e; ++i)
(*i)->Switch();
}

void CCarLights::TurnOnHeadLights()
{
VERIFY(!physics_world()->Processing());
LIGHTS_I i = m_lights.begin(), e = m_lights.end();
auto i = m_lights.begin(), e = m_lights.end();
for (; i != e; ++i)
(*i)->TurnOn();
}
void CCarLights::TurnOffHeadLights()
{
VERIFY(!physics_world()->Processing());
LIGHTS_I i = m_lights.begin(), e = m_lights.end();
auto i = m_lights.begin(), e = m_lights.end();
for (; i != e; ++i)
(*i)->TurnOff();
}

bool CCarLights::IsLight(u16 bone_id)
{
SCarLight* light = NULL;
SCarLight* light = nullptr;
return findLight(bone_id, light);
}
bool CCarLights::findLight(u16 bone_id, SCarLight*& light)
{
LIGHTS_I i, e = m_lights.end();
auto e = m_lights.end();
SCarLight find_light;
find_light.bone_id = bone_id;
i = std::find_if(m_lights.begin(), e, SFindLightPredicate(&find_light));
auto i = std::find_if(m_lights.begin(), e, SFindLightPredicate(&find_light));
light = *i;
return i != e;
}
CCarLights::~CCarLights()
{
LIGHTS_I i = m_lights.begin(), e = m_lights.end();
auto i = m_lights.begin(), e = m_lights.end();
for (; i != e; ++i)
xr_delete(*i);
m_lights.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/CarLights.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct SCarLight
void ParseDefinitions(LPCSTR section);
};

DEFINE_VECTOR(SCarLight*, LIGHTS_STORAGE, LIGHTS_I)
using LIGHTS_STORAGE = xr_vector<SCarLight*>;
class CCarLights
{
public:
Expand Down
25 changes: 11 additions & 14 deletions src/xrGame/CustomZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ void CCustomZone::net_Destroy()
if (m_actor_effector)
m_actor_effector->Stop();

OBJECT_INFO_VEC_IT i = m_ObjectInfoMap.begin();
OBJECT_INFO_VEC_IT e = m_ObjectInfoMap.end();
auto i = m_ObjectInfoMap.begin();
auto e = m_ObjectInfoMap.end();
for (; e != i; ++i)
exit_Zone(*i);
m_ObjectInfoMap.clear();
Expand Down Expand Up @@ -492,7 +492,7 @@ void CCustomZone::shedule_Update(u32 dt)

//пройтись по всем объектам в зоне
//и проверить их состояние
for (OBJECT_INFO_VEC_IT it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
for (auto it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
{
CGameObject* pObject = (*it).object;
if (!pObject)
Expand Down Expand Up @@ -599,7 +599,7 @@ void CCustomZone::feel_touch_delete(IGameObject* O)
StopObjectIdleParticles(pGameObject);
}

OBJECT_INFO_VEC_IT it = std::find(m_ObjectInfoMap.begin(), m_ObjectInfoMap.end(), pGameObject);
auto it = std::find(m_ObjectInfoMap.begin(), m_ObjectInfoMap.end(), pGameObject);
if (it != m_ObjectInfoMap.end())
{
exit_Zone(*it);
Expand Down Expand Up @@ -928,7 +928,7 @@ void CCustomZone::StopObjectIdleParticles(CGameObject* pObject)
if (!PP)
return;

OBJECT_INFO_VEC_IT it = std::find(m_ObjectInfoMap.begin(), m_ObjectInfoMap.end(), pObject);
auto it = std::find(m_ObjectInfoMap.begin(), m_ObjectInfoMap.end(), pObject);
if (m_ObjectInfoMap.end() == it)
return;

Expand Down Expand Up @@ -1015,8 +1015,7 @@ void CCustomZone::AffectObjects()
if (Device.dwPrecacheFrame)
return;

OBJECT_INFO_VEC_IT it;
for (it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
for (auto it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
{
if (!(*it).object->getDestroy())
Affect(&(*it));
Expand All @@ -1041,9 +1040,7 @@ void CCustomZone::UpdateBlowout()
UpdateWind();

if (m_dwBlowoutExplosionTime >= (u32)m_iPreviousStateTime && m_dwBlowoutExplosionTime < (u32)m_iStateTime)
{
AffectObjects();
}
}

void CCustomZone::OnMove()
Expand Down Expand Up @@ -1132,7 +1129,7 @@ bool CCustomZone::Enable()

o_switch_2_fast();

for (OBJECT_INFO_VEC_IT it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
for (auto it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
{
CGameObject* pObject = (*it).object;
if (!pObject)
Expand All @@ -1150,7 +1147,7 @@ bool CCustomZone::Disable()
return false;
o_switch_2_slow();

for (OBJECT_INFO_VEC_IT it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
for (auto it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it)
{
CGameObject* pObject = (*it).object;
if (!pObject)
Expand Down Expand Up @@ -1242,7 +1239,7 @@ void CCustomZone::CreateHit(u16 id_to, u16 id_from, const Fvector& hit_dir, floa
void CCustomZone::net_Relcase(IGameObject* O)
{
CGameObject* GO = smart_cast<CGameObject*>(O);
OBJECT_INFO_VEC_IT it = std::find(m_ObjectInfoMap.begin(), m_ObjectInfoMap.end(), GO);
auto it = std::find(m_ObjectInfoMap.begin(), m_ObjectInfoMap.end(), GO);
if (it != m_ObjectInfoMap.end())
{
exit_Zone(*it);
Expand Down Expand Up @@ -1344,8 +1341,8 @@ void CCustomZone::GoDisabledState()
P.w_u8(u8(eZoneStateDisabled));
u_EventSend(P);

OBJECT_INFO_VEC_IT it = m_ObjectInfoMap.begin();
OBJECT_INFO_VEC_IT it_e = m_ObjectInfoMap.end();
auto it = m_ObjectInfoMap.begin();
auto it_e = m_ObjectInfoMap.end();

for (; it != it_e; ++it)
exit_Zone(*it);
Expand Down
4 changes: 1 addition & 3 deletions src/xrGame/CustomZone.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ struct SZoneObjectInfo

class CCustomZone : public CSpaceRestrictor, public Feel::Touch
{
private:
typedef CSpaceRestrictor inherited;

public:
CZoneEffector* m_actor_effector;

public:
CCustomZone();
virtual ~CCustomZone();

Expand Down Expand Up @@ -260,7 +258,7 @@ class CCustomZone : public CSpaceRestrictor, public Feel::Touch
void UpdateBlowoutLight();

//список партиклов для объетов внутри зоны
DEFINE_VECTOR(SZoneObjectInfo, OBJECT_INFO_VEC, OBJECT_INFO_VEC_IT);
using OBJECT_INFO_VEC = xr_vector<SZoneObjectInfo>;
OBJECT_INFO_VEC m_ObjectInfoMap;

void CreateHit(u16 id_to, u16 id_from, const Fvector& hit_dir, float hit_power, s16 bone_id,
Expand Down
Loading

0 comments on commit 7912112

Please sign in to comment.