Skip to content

Commit

Permalink
Fix issue with non-template derived member variables
Browse files Browse the repository at this point in the history
It must be stated somewhere that these seemingly nondependent names are
in the parent template class.
See:
https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-types
  • Loading branch information
Zegeri committed Sep 16, 2018
1 parent 2e5ee9c commit d0989ff
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/xrGame/ai/monsters/bloodsucker/bloodsucker_attack_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ template <typename _Object>
class CBloodsuckerStateAttack : public CStateMonsterAttack<_Object>
{
typedef CStateMonsterAttack<_Object> inherited_attack;
using inherited = typename inherited_attack::inherited;
using inherited::prev_substate;
using inherited::current_substate;
using inherited::m_time_start_check_behinder;
using inherited::object;

u32 m_time_stop_invis;
Fvector m_dir_point;
Expand Down Expand Up @@ -32,6 +37,7 @@ template <typename _Object>
class CStateMonsterBackstubEnemy : public CState<_Object>
{
typedef CState<_Object> inherited;
using inherited::object;

public:
struct StateParams : SStateDataMoveToPointEx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ bool CBloodsuckerStateAttackAbstract::check_hiding()
TEMPLATE_SPECIALIZATION
void CBloodsuckerStateAttackAbstract::setup_substates()
{
state_ptr state = get_state_current();
typename inherited::state_ptr state = get_state_current();

if (current_substate == eStateAttack_Hide)
{
Expand Down
4 changes: 4 additions & 0 deletions src/xrGame/ai/monsters/bloodsucker/bloodsucker_predator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class CStateBloodsuckerPredator : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;
using inherited::prev_substate;
using inherited::time_state_started;
using inherited::current_substate;

u32 m_target_node;
u32 m_time_start_camp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class CStateCaptureJumpBloodsucker : public CState<_Object>
protected:
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::prev_substate;
using inherited::current_substate;

public:
CStateCaptureJumpBloodsucker(_Object* obj);
Expand Down
3 changes: 3 additions & 0 deletions src/xrGame/ai/monsters/bloodsucker/bloodsucker_vampire.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class CStateBloodsuckerVampire : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;
using inherited::current_substate;
using inherited::prev_substate;

const CEntityAlive* enemy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ template <typename _Object>
class CStateBloodsuckerVampireApproach : public CState<_Object>
{
typedef CState<_Object> inherited;
using inherited::object;

public:
CStateBloodsuckerVampireApproach(_Object* obj);
Expand Down
3 changes: 3 additions & 0 deletions src/xrGame/ai/monsters/bloodsucker/bloodsucker_vampire_hide.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class CStateBloodsuckerVampireHide : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;
using inherited::prev_substate;
using inherited::current_substate;

public:
CStateBloodsuckerVampireHide(_Object* obj);
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ai/monsters/chimera/chimera_state_threaten.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class CStateChimeraThreaten : public CState<_Object>
protected:
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;
using inherited::prev_substate;

enum
{
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ai/monsters/chimera/chimera_state_threaten_roar.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ template <typename _Object>
class CStateChimeraThreatenRoar : public CState<_Object>
{
typedef CState<_Object> inherited;
using inherited::object;
using inherited::time_state_started;

public:
IC CStateChimeraThreatenRoar(_Object* obj) : inherited(obj) {}
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ai/monsters/chimera/chimera_state_threaten_steal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ template <typename _Object>
class CStateChimeraThreatenSteal : public CStateMonsterMoveToPointEx<_Object>
{
typedef CStateMonsterMoveToPointEx<_Object> inherited;
using inherited::object;
using inherited::data;

public:
IC CStateChimeraThreatenSteal(_Object* obj) : inherited(obj) {}
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ai/monsters/chimera/chimera_state_threaten_walk.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ template <typename _Object>
class CStateChimeraThreatenWalk : public CStateMonsterMoveToPointEx<_Object>
{
typedef CStateMonsterMoveToPointEx<_Object> inherited;
using inherited::object;
using inherited::data;

public:
IC CStateChimeraThreatenWalk(_Object* obj) : inherited(obj) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ template <typename _Object>
class CStateControlCamp : public CState<_Object>
{
typedef CState<_Object> inherited;
using inherited::object;
using inherited::time_state_started;

float m_angle_from;
float m_angle_to;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ template <typename _Object>
class CStateControlFire : public CState<_Object>
{
typedef CState<_Object> inherited;
using inherited::object;

u32 m_time_started;
u32 m_time_state_last_execute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CStateControlHideLite : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;

struct
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class CStateControlMoveOut : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;
using inherited::time_state_started;

Fvector m_look_point;

Expand Down
1 change: 1 addition & 0 deletions src/xrGame/ai/monsters/controller/controller_tube.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ template <typename _Object>
class CStateControllerTube : public CState<_Object>
{
typedef CState<_Object> inherited;
using inherited::object;

public:
CStateControllerTube(_Object* obj) : inherited(obj) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class CStateGroupAttackMoveToHomePoint : public CState<_Object>
protected:
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;
using inherited::prev_substate;
using inherited::current_substate;

u32 m_target_node;
bool m_skip_camp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class CStatePsyDogHide : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;

struct
{
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/ai/monsters/states/monster_state_attack.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class CStateMonsterAttack : public CState<_Object>
protected:
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;

u32 m_time_next_run_away;
u32 m_time_start_check_behinder;
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/ai/monsters/states/state_test_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CStateMonsterTestState : public CState<_Object>
{
typedef CState<_Object> inherited;
typedef CState<_Object>* state_ptr;
using inherited::object;

public:
CStateMonsterTestState(_Object* obj);
Expand Down
6 changes: 6 additions & 0 deletions src/xrGame/level_location_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class CBaseLocationSelector<CLevelGraph, _VertexEvaluator, _vertex_id_type>
typedef CLevelGraph _Graph;
typedef CAbstractLocationSelector<_Graph, _VertexEvaluator, _vertex_id_type> inherited;

// Needed for template-derived-classes.
using inherited::m_evaluator;
using inherited::m_graph;
using inherited::m_path;
using inherited::m_restricted_object;

public:
IC CBaseLocationSelector(CRestrictedObject* object);

Expand Down

0 comments on commit d0989ff

Please sign in to comment.