Skip to content

Commit

Permalink
use #pragma once instead of #ifndef-#define in xrPhysics
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed Sep 29, 2018
1 parent d6ee7a1 commit e62906c
Show file tree
Hide file tree
Showing 40 changed files with 45 additions and 149 deletions.
6 changes: 2 additions & 4 deletions src/xrPhysics/BlockAllocator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef BLOCK_ALLOCATOR_H
#define BLOCK_ALLOCATOR_H
#pragma once

template <class T, u32 block_size>
class CBlockAllocator
{
Expand Down Expand Up @@ -87,5 +87,3 @@ class CBlockAllocator
//IC void construct(u32 position) { xr_allocator_t<T>().construct(pointer(position)); }
//IC void construct_back() { xr_allocator_t<T>().construct(back_pointer()); }
};

#endif
3 changes: 0 additions & 3 deletions src/xrPhysics/CycleConstStorage.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#pragma once
#ifndef CYCLE_CONST_STORAGE_H
#define CYCLE_CONST_STORAGE_H

template <class T, int size>
class CCycleConstStorage
Expand All @@ -19,4 +17,3 @@ class CCycleConstStorage
IC T& operator[](int i) { return array[position(i)]; }
IC const T& operator[](int i) const { return array[position(i)]; }
};
#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/DisablingParams.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef DISABLING_PARAMS_H
#define DISABLING_PARAMS_H

#include "xrPhysics.h"

// fwd. decl.
Expand Down Expand Up @@ -29,5 +28,3 @@ struct SAllDDWParams
};

extern SAllDDWParams worldDisablingParams;

#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/ElevatorState.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef ELEVATOR_STAETE
#define ELEVATOR_STAETE
#pragma once

#include "IElevatorState.h"
class CPHCharacter;
Expand Down Expand Up @@ -62,5 +61,3 @@ class CElevatorState : public IElevatorState
public:
void NetRelcase(IPhysicsShellHolder* O);
};

#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/ExtendedGeom.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef EXTENDED_GEOM
#define EXTENDED_GEOM
#pragma once

#ifndef dSINGLE
#define dSINGLE
Expand Down Expand Up @@ -276,5 +275,3 @@ IC void dGeomUserDataClearCashedTries(dxGeom* geom)
#ifdef DEBUG
XRPHYSICS_API bool IsCyliderContact(const dContact& c);
#endif

#endif
4 changes: 1 addition & 3 deletions src/xrPhysics/Geometry.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef GEOMETRY_H
#define GEOMETRY_H

#include "PhysicsCommon.h"
#include "ExtendedGeom.h"
#include "MathUtilsOde.h"
Expand Down Expand Up @@ -193,4 +192,3 @@ class CCylinderGeom : public CODEGeom
virtual void dbg_draw(float scale, u32 color, Flags32 flags) const;
#endif
};
#endif // GEOMETRY_H
5 changes: 2 additions & 3 deletions src/xrPhysics/IColisiondamageInfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef I_COLLISION_DAMAGE_INFO_H
#define I_COLLISION_DAMAGE_INFO_H
#pragma once

// struct SCollisionHitCallback;
class ICollisionHitCallback;
class ICollisionDamageInfo
Expand All @@ -24,4 +24,3 @@ class ICollisionDamageInfo
virtual ~ICollisionDamageInfo() {}
#endif
};
#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/MathUtils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef MATH_UTILS_H
#define MATH_UTILS_H

#include "xrCore/_fbox.h"
#include "xrCore/_obb.h"
#include "xrPhysics.h"
Expand Down Expand Up @@ -477,5 +476,3 @@ const float DET_CHECK_FATAL_EPS = 0.8f; // scale -35% !? ;)
#else
#define VERIFY_RMATRIX(M)
#endif

#endif // include guard
4 changes: 1 addition & 3 deletions src/xrPhysics/PHActivationShape.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#ifndef PH_ACTIVATION_SHAPE
#define PH_ACTIVATION_SHAPE
#endif
#pragma once

#include "PHValideValues.h"
#include "PHObject.h"
Expand Down
4 changes: 1 addition & 3 deletions src/xrPhysics/PHBaseBodyEffector.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PH_BASE_BODY_EFFECTOR_H
#define PH_BASE_BODY_EFFECTOR_H
#pragma once

#include <ode/common.h>

Expand All @@ -11,4 +10,3 @@ class CPHBaseBodyEffector
public:
void Init(dBodyID body) { m_body = body; }
};
#endif
3 changes: 0 additions & 3 deletions src/xrPhysics/PHCapture.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#pragma once
#ifndef PH_CAPTURE_H
#define PH_CAPTURE_H

#include "PHUpdateObject.h"

Expand Down Expand Up @@ -72,4 +70,3 @@ class CPHCapture : public CPHUpdateObject, public IPHCapture
virtual void PhTune(dReal step);
virtual void NetRelcase(CPhysicsShell* s);
};
#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/PHCollideValidator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PH_COLLIDE_VALIDATOR
#define PH_COLLIDE_VALIDATOR
#pragma once

#include "ICollideValidator.h"
typedef u32 CLClassBits;
Expand Down Expand Up @@ -86,5 +85,3 @@ class CPHCollideValidator
static _flags<CLClassBits> ClassNCFlags;
static _flags<CLClassBits> NonTypeFlags;
};

#endif
5 changes: 2 additions & 3 deletions src/xrPhysics/PHContactBodyEffector.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PH_CONTACT_BODY_EFFECTOR_H
#define PH_CONTACT_BODY_EFFECTOR_H
#pragma once

#include "PHBaseBodyEffector.h"
#include <ode/contact.h>

Expand All @@ -15,4 +15,3 @@ class CPHContactBodyEffector : public CPHBaseBodyEffector
void Merge(const dContact& contact, SGameMtl* material);
void Apply();
};
#endif // PH_CONTACT_BODY_EFFECTOR_H
5 changes: 1 addition & 4 deletions src/xrPhysics/PHDefs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef PHDEFS_H
#define PHDEFS_H

#include <utility>
#include "xrCommon/xr_vector.h"

Expand All @@ -20,5 +19,3 @@ using PHSHELL_PAIR_VECTOR = xr_vector<shell_root>;
typedef xr_vector<shell_root>::reverse_iterator SHELL_PAIR_RI;

typedef xr_vector<CPHElement*>::reverse_iterator ELEMENT_RI;

#endif
4 changes: 1 addition & 3 deletions src/xrPhysics/PHDisabling.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PHDISABLING_H
#define PHDISABLING_H
#pragma once

#include "DisablingParams.h"
#include <ode/common.h>
Expand Down Expand Up @@ -105,4 +104,3 @@ class CPHDisablingFull : public CPHDisablingTranslational, public CPHDisablingRo
virtual void UpdateL2();
virtual void set_DisableParams(const SAllDDOParams& params);
};
#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/PHDynamicData.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//////////////////////////////////////////////////////////////////////

#pragma once
#ifndef XRPHYSICS_PHDYNAMICDATA_H
#define XRPHYSICS_PHDYNAMICDATA_H

#include "PHInterpolation.h"
#include "MathUtilsOde.h"
#include "xrCore/_matrix33.h"
Expand Down Expand Up @@ -149,5 +148,3 @@ class PHDynamicData
bool SetGeom(dGeomID ageom);
bool SetTransform(dGeomID ageom);
};

#endif // include guard
5 changes: 2 additions & 3 deletions src/xrPhysics/PHElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
////////////////////////////////////////////////////////////////////////////////
///////////////////////////Implemetation//for//CPhysicsElement//////////////////
////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "Geometry.h"
#include "PHDefs.h"
#include "PhysicsCommon.h"
Expand All @@ -11,8 +13,6 @@
#include "PHInterpolation.h"
#include "PHFracture.h"
#include "physics_scripted.h"
#ifndef PH_ELEMENT
#define PH_ELEMENT
class CPHElement;
class CPHShell;

Expand Down Expand Up @@ -295,4 +295,3 @@ IC CPhysicsElement* cast_PhysicsElement(CPHElement* e)
{
return static_cast<CPhysicsElement*>(static_cast<CPHElement*>(e));
}
#endif
7 changes: 1 addition & 6 deletions src/xrPhysics/PHFracture.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
//
#ifndef PH_FRACTURE_H
#define PH_FRACTURE_H
#pragma once

#include "PHDefs.h"
#include "PHImpact.h"
Expand Down Expand Up @@ -123,5 +120,3 @@ IC void sub_diapasones(u16& from1, u16& to1, const u16& from0, const u16& to0)
u16 dip = to0 - from0;
to1 = to1 - dip;
}

#endif PH_FRACTURE_H
6 changes: 2 additions & 4 deletions src/xrPhysics/PHGeometryOwner.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PH_GEOMETRY_OWNER_H
#define PH_GEOMETRY_OWNER_H
#pragma once

#include "Geometry.h"
#include "xrEngine/GameMtlLib.h"

Expand Down Expand Up @@ -131,5 +131,3 @@ void t_get_extensions(
hi_ext = temp_hi_ext;
}
}

#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/PHImpact.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PH_IMPACT_H
#define PH_IMPACT_H
#pragma once

struct SPHImpact
{
Expand All @@ -14,5 +13,3 @@ struct SPHImpact
}
};
using PH_IMPACT_STORAGE = xr_vector<SPHImpact>;

#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/PHInterpolation.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef PHINTERPOLATON_H
#define PHINTERPOLATON_H

#include "CycleConstStorage.h"
#include <ode/common.h>
#include "xrCore/_vector3d.h"
Expand Down Expand Up @@ -28,5 +27,3 @@ class CPHInterpolation
CCycleConstStorage<Fvector, PH_INTERPOLATION_POINTS> qPositions;
CCycleConstStorage<Fquaternion, PH_INTERPOLATION_POINTS> qRotations;
};

#endif
4 changes: 1 addition & 3 deletions src/xrPhysics/PHIsland.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef PH_ISLAND_H
#define PH_ISLAND_H

#include "xrCore/_flags.h"

#pragma warning(push)
Expand Down Expand Up @@ -219,4 +218,3 @@ class CPHIsland : public dxWorld
protected:
private:
};
#endif
4 changes: 0 additions & 4 deletions src/xrPhysics/PHItemList.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#pragma once
#ifndef PH_ITEM_LIST_H
#define PH_ITEM_LIST_H

/*
#define DECLARE_PHLIST_ITEM(class_name) public:\
Expand Down Expand Up @@ -106,5 +104,3 @@ class CPHItemStack : public CPHItemList<T>
#define DEFINE_PHITEM_STACK(T, N, I)\
typedef CPHItemStack<T> N;\
typedef CPHItemStack<T>::iterator I;

#endif // PH_ITEM_LIST_H
7 changes: 2 additions & 5 deletions src/xrPhysics/PHJoint.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
#ifndef PH_JOINT
#define PH_JOINT
#pragma once

#include "PhysicsShell.h"
#include <ode/common.h>
#include "physics_scripted.h"
Expand Down Expand Up @@ -290,4 +288,3 @@ IC void axis_angleA(const Fmatrix& m, const Fvector& axis, float& angle)
// if(angle>M_PI) angle=angle-2.f*M_PI;
// if(angle<-M_PI) angle=angle+2.f*M_PI;
}
#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/PHJointDestroyInfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PHJOINT_DESTROY_INFO_H
#define PHJOINT_DESTROY_INFO_H
#pragma once

#include <ode/common.h>

Expand All @@ -20,5 +19,3 @@ class CPHJointDestroyInfo
IC bool Breaked() { return m_breaked; };
bool Update();
};

#endif PHJOINT_DESTROY_INFO_H
6 changes: 2 additions & 4 deletions src/xrPhysics/PHMoveStorage.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PHMOVESTORAGE_H
#define PHMOVESTORAGE_H
#pragma once

#include "PHGeometryOwner.h"
// DEFINE_VECTOR(dReal *&,POSITIONS_STORAGE,POSITIONS_I);

Expand Down Expand Up @@ -42,5 +42,3 @@ class CPHMoveStorage
void add(CODEGeom* g) { m_trace_geometries.push_back(g); }
void clear() { m_trace_geometries.clear(); }
};

#endif
5 changes: 1 addition & 4 deletions src/xrPhysics/PHObject.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef CPHOBJECT
#define CPHOBJECT

#include "xrCDB/ISpatial.h"
#include "PHItemList.h"
#include "PHIsland.h"
Expand Down Expand Up @@ -123,5 +122,3 @@ class CPHObject : public SpatialBase
};

DEFINE_PHITEM_LIST(CPHObject, PH_OBJECT_STORAGE, PH_OBJECT_I)

#endif // CPHOBJECT
7 changes: 1 addition & 6 deletions src/xrPhysics/PHShell.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
///////////////////////////////////////////////////////////////////////

#ifndef PH_SHELL
#define PH_SHELL
#pragma once

class CPHShell;
class CPHShellSplitterHolder;
Expand Down Expand Up @@ -313,5 +310,3 @@ IC void CPHShell::SetObjVsShellTransform(const Fmatrix& root_transform)
m_object_in_root.invert();
SetNotActivating();
}

#endif
6 changes: 2 additions & 4 deletions src/xrPhysics/PHShellSplitter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PHSHELL_SPLITTER_H
#define PHSHELL_SPLITTER_H
#pragma once

#include "PHDefs.h"

#include "PHFracture.h"
Expand Down Expand Up @@ -70,5 +70,3 @@ class CPHShellSplitterHolder : public CPHUpdateObject // call all Fractures and
void SetBreakable();
bool IsUnbreakable() { return m_unbreakable; }
};

#endif
Loading

0 comments on commit e62906c

Please sign in to comment.