Skip to content

Commit

Permalink
Fix some includes, template issues and other stuff when DEBUG is on
Browse files Browse the repository at this point in the history
  • Loading branch information
Zegeri authored and q4a committed Sep 27, 2018
1 parent e05f7bd commit d6ee7a1
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 47 deletions.
10 changes: 4 additions & 6 deletions src/xrAICore/Components/problem_solver_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ IC void CProblemSolverAbstract::add_operator(const _operator_id_type& operator_i
TEMPLATE_SPECIALIZATION
IC void CProblemSolverAbstract::validate_properties(const CState& conditions) const
{
xr_vector<_operator_condition>::const_iterator I = conditions.conditions().begin();
xr_vector<_operator_condition>::const_iterator E = conditions.conditions().end();
for (; I != E; ++I)
for (const auto& cond : conditions.conditions())
{
if (evaluators().find((*I).condition()) == evaluators().end())
if (evaluators().find(cond.condition()) == evaluators().end())
{
Msg("! cannot find corresponding evaluator to the property with id %d", (*I).condition());
THROW(evaluators().find((*I).condition()) != evaluators().end());
Msg("! cannot find corresponding evaluator to the property with id %d", cond.condition());
THROW(evaluators().find(cond.condition()) != evaluators().end());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrCDB/ISpatial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "xrEngine/Render.h"
#ifdef DEBUG
#include "xrEngine/xr_object.h"
#include "xrEngine/PS_Instance.h"
#include "xrEngine/PS_instance.h"
#endif
#include "xrEngine/device.h"
#include "xrEngine/GameFont.h"
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/LocatorAPI_auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void CLocatorAPI::auth_runtime(void* params)
{
string64 c_auth_code;
sscanf(strstr(Core.Params, "asdf ") + 5, "%[^ ] ", c_auth_code);
m_auth_code = _atoi64(c_auth_code);
m_auth_code = atoll(c_auth_code);
}
#endif // DEBUG
xr_delete(_o);
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xr_collide_form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ IC float DET(const Fmatrix& a)
return ((a._11 * (a._22 * a._33 - a._23 * a._32) - a._12 * (a._21 * a._33 - a._23 * a._31) +
a._13 * (a._21 * a._32 - a._22 * a._31)));
}
#include "objectdump.h"
#include "ObjectDump.h"
#endif
using namespace collide;
//----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ElevatorState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "MathUtils.h"
#include "xrPhysics/PHWorld.h"
#ifdef DEBUG
#include "../xrEngine/Statgraph.h"
#include "../xrEngine/StatGraph.h"
#include "PHDebug.h"
#endif
static const float getting_on_dist = 0.3f;
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/PHDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "Include/xrRender/Kinematics.h"
#include "Include/xrRender/KinematicsAnimated.h"
#include "xrCore/Animation/Bone.hpp"
#include "xrEngine/iphdebug.h"
#include "xrEngine/IPHdebug.h"
#include "xrCore/xr_token.h"
#include "xrEngine/GameFont.h"

Expand Down Expand Up @@ -707,8 +707,8 @@ static LPCSTR name_bool(BOOL v)

static LPCSTR name_blend_type(CBlend::ECurvature blend)
{
static xr_token token_blend[] = {{"eFREE_SLOT", CBlend::eFREE_SLOT}, {"eAccrue", CBlend::eAccrue},
{"eFalloff", CBlend::eFalloff}, {"eFORCEDWORD", CBlend::eFORCEDWORD}};
static xr_token token_blend[] = {{"eFREE_SLOT", int(CBlend::eFREE_SLOT)}, {"eAccrue", int(CBlend::eAccrue)},
{"eFalloff", int(CBlend::eFalloff)}, {"eFORCEDWORD", int(CBlend::eFORCEDWORD)}};
return get_token_name(token_blend, blend);
}
/*
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/PhysicObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "xrPhysics/ExtendedGeom.h"
#ifdef DEBUG
#include "PHDebug.h"
#include "xrEngine/objectdump.h"
#include "xrEngine/ObjectDump.h"
#endif
BOOL dbg_draw_doors = false;
CPhysicObject::CPhysicObject(void)
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/PhysicsShellHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "PHCollisionDamageReceiver.h"
#include "xrEngine/IPhysicsShell.h"
#ifdef DEBUG
#include "xrEngine/objectdump.h"
#include "xrEngine/ObjectDump.h"
#endif
CPhysicsShellHolder::CPhysicsShellHolder() { init(); }
CPhysicsShellHolder::~CPhysicsShellHolder()
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/WeaponMagazined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void CWeaponMagazined::switch2_Idle()
}

#ifdef DEBUG
#include "ai\stalker\ai_stalker.h"
#include "ai/stalker/ai_stalker.h"
#include "object_handler_planner.h"
#endif
void CWeaponMagazined::switch2_Fire()
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/ai/monsters/basemonster/base_monster.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class CBaseMonster : public CCustomMonster, public CStepManager
#ifdef DEBUG

template <class Type>
bool get_debug_var(pcstr var_name, OUT Type& result);
bool get_debug_var(pcstr var_name, Type& result);

public:
struct SDebugInfo
Expand Down Expand Up @@ -593,7 +593,7 @@ class CBaseMonster : public CCustomMonster, public CStepManager

#ifdef DEBUG
template <class Type>
bool CBaseMonster::get_debug_var(pcstr var_name, OUT Type& result)
bool CBaseMonster::get_debug_var(pcstr var_name, Type& result)
{
char* full_var_name;
STRCONCAT(full_var_name, get_monster_class_name(), "_", var_name);
Expand Down
10 changes: 5 additions & 5 deletions src/xrGame/ai/monsters/state_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ void CStateAbstract::add_debug_info(debug::text_tree& root_s)
}
else
{
for (SubStates::const_iterator i = substates.begin(), e = substates.end(); i != e; ++i)
for (const auto& [id, substate] : substates)
{
TextTree& current_state_s = root_s.add_line(EMonsterState((*i).first));
if (current_substate == (*i).first)
TextTree& current_state_s = root_s.add_line(EMonsterState(id));
if (current_substate == id)
{
if ((*i).second)
if (substate)
{
(*i).second->add_debug_info(current_state_s);
substate->add_debug_info(current_state_s);
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/ai/stalker/ai_stalker_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
#include "cover_point.h"
#include "xrEngine/CameraBase.h"
#include "mt_config.h"
#include "weaponmagazined.h"
#include "WeaponMagazined.h"
#include "object_handler_space.h"
#include "debug_renderer.h"
#include "CharacterPhysicsSupport.h"
#include "smart_cover_animation_selector.h"
#include "animation_movement_controller.h"
#include "phdebug.h"
#include "PHDebug.h"
#include "game_object_space.h"
#include "aimers_weapon.h"
#include "aimers_bone.h"
Expand Down Expand Up @@ -166,7 +166,7 @@ void draw_planner(const planner_type& brain, LPCSTR start_indent, LPCSTR indent,
for (; I != E; ++I)
{
const auto J = std::lower_bound(brain.current_state().conditions().cbegin(), brain.current_state().conditions().cend(),
planner_type::CWorldProperty((*I).first, false));
typename planner_type::CWorldProperty((*I).first, false));
char temp = '?';
if ((J != brain.current_state().conditions().end()) && ((*J).condition() == (*I).first))
{
Expand All @@ -181,7 +181,7 @@ void draw_planner(const planner_type& brain, LPCSTR start_indent, LPCSTR indent,
for (; I != E; ++I)
{
const auto J = std::lower_bound(brain.target_state().conditions().cbegin(), brain.target_state().conditions().cend(),
planner_type::CWorldProperty((*I).first, false));
typename planner_type::CWorldProperty((*I).first, false));
char temp = '?';
if ((J != brain.target_state().conditions().end()) && ((*J).condition() == (*I).first))
{
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/debug_text_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ void log_text_tree(text_tree& tree);
#include "debug_text_tree_inline.h"

} // namespace debug

#endif // defined(AI_DEBUG_TEXT_TREE_H_INCLUDED)
4 changes: 2 additions & 2 deletions src/xrGame/level_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class CLevelDebug
std::sort(m_data.begin(), m_data.end(), sort_id_pred());
}
IC void clear() { m_data.clear(); }
template <class T>
IC void process(T& process_pred)
template <class H>
IC void process(H& process_pred)
{
for (ITEM_STORAGE_VEC_IT it = m_data.begin(); it != m_data.end(); ++it)
{
Expand Down
22 changes: 9 additions & 13 deletions src/xrGame/static_cast_checked.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@ struct value
template <typename source_type, typename destination_type>
struct helper
{
template <bool is_polymrphic>
template <bool is_polymorphic>
inline static void check(source_type source)
{
value<destination_type>::check(source);
}

template <>
inline static void check<false>(source_type source)
{
if constexpr (is_polymorphic)
value<destination_type>::check(source);
}
};

Expand All @@ -55,23 +51,23 @@ struct helper
template <typename destination_type, typename source_type>
inline destination_type static_cast_checked(source_type const& source)
{
typedef object_type_traits::remove_pointer<source_type>::type pointerless_type;
typedef object_type_traits::remove_reference<pointerless_type>::type pure_source_type;
using pointerless_type = typename object_type_traits::remove_pointer<source_type>::type;
using pure_source_type = typename object_type_traits::remove_reference<pointerless_type>::type;

debug::detail::static_cast_checked::helper<source_type const&,
destination_type>::check<std::is_polymorphic<pure_source_type>::value>(source);
destination_type>::template check<std::is_polymorphic<pure_source_type>::value>(source);

return (static_cast<destination_type>(source));
}

template <typename destination_type, typename source_type>
inline destination_type static_cast_checked(source_type& source)
{
typedef object_type_traits::remove_pointer<source_type>::type pointerless_type;
typedef object_type_traits::remove_reference<pointerless_type>::type pure_source_type;
using pointerless_type = typename object_type_traits::remove_pointer<source_type>::type;
using pure_source_type = typename object_type_traits::remove_reference<pointerless_type>::type;

debug::detail::static_cast_checked::helper<source_type&,
destination_type>::check<std::is_polymorphic<pure_source_type>::value>(source);
destination_type>::template check<std::is_polymorphic<pure_source_type>::value>(source);

return (static_cast<destination_type>(source));
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ui/UIKeyBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void CUIKeyBinding::FillUpList(CUIXml& xml_doc_ui, LPCSTR path_ui)
void CUIKeyBinding::CheckStructure(CUIXml& xml_doc)
{
bool first = true;
CUITextWnd* pItem = false;
CUITextWnd* pItem = nullptr;

for (int i = 0; true; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrPhysics/ElevatorState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "PHWorld.h"
#include "xrEngine/device.h"
#ifdef DEBUG
#include "xrEngine/Statgraph.h"
#include "xrEngine/StatGraph.h"
#include "debug_output.h"
#endif
static const float getting_on_dist = 0.3f;
Expand Down
2 changes: 1 addition & 1 deletion src/xrPhysics/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "xrPhysics.h"

#ifdef DEBUG
#if defined(DEBUG) && defined(WINDOWS)
#include <d3d9types.h>
#endif

Expand Down
3 changes: 1 addition & 2 deletions src/xrScriptEngine/LuaStudio/Defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
STATIC_CHECK(false, CS_STRING_CONCAT_or_CS_STRING_CONCAT_HELPER_or_CS_STRING_CONCAT4_macro_already_defined);
#endif // #if defined(CS_STRING_CONCAT) || defined(CS_STRING_CONCAT_HELPER)

#define CS_STRING_CONCAT_HELPER(a, b) a##b
#define CS_STRING_CONCAT(a, b) CS_STRING_CONCAT_HELPER(a, b)
#define CS_STRING_CONCAT(a, b) (a"" b)

// CS_MAKE_STRING macro
#if defined(CS_MAKE_STRING) || defined(CS_MAKE_STRING_HELPER)
Expand Down

0 comments on commit d6ee7a1

Please sign in to comment.