Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conform to C.128, aka: Virtual functions should specify exactly one of virtual, override, or final #5995

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ namespace Background {

// Do the brightness sort on worker threads using the worker's subset
// of stars rather than on the main thread with all stars.
virtual void OnExecute(TaskRange) override
void OnExecute(TaskRange) override
{
PROFILE_SCOPED()
const size_t numStars = stars.pos.size();
Expand Down
14 changes: 7 additions & 7 deletions src/Beam.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ class Beam : public Body {
Beam(Body *parent, const ProjectileData &prData, const vector3d &pos, const vector3d &baseVel, const vector3d &dir);
Beam(const Json &jsonObj, Space *space);
virtual ~Beam();
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override final;
void TimeStepUpdate(const float timeStep) override final;
void StaticUpdate(const float timeStep) override final;
virtual void NotifyRemoved(const Body *const removedBody) override final;
virtual void PostLoadFixup(Space *space) override final;
virtual void UpdateInterpTransform(double alpha) override final;
void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) final;
void TimeStepUpdate(const float timeStep) final;
void StaticUpdate(const float timeStep) final;
void NotifyRemoved(const Body *const removedBody) final;
void PostLoadFixup(Space *space) final;
void UpdateInterpTransform(double alpha) final;

static void FreeModel();

protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override final;
virtual void SaveToJson(Json &jsonObj, Space *space) final;

private:
float GetDamage() const;
Expand Down
4 changes: 2 additions & 2 deletions src/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ enum class AltitudeType { // <enum name=AltitudeType scope='AltitudeType' public
#define OBJDEF(__thisClass, __parentClass, __TYPE) \
static constexpr ObjectType StaticType() { return ObjectType::__TYPE; } \
static constexpr ObjectType SuperType() { return __parentClass::StaticType(); } \
virtual ObjectType GetType() const override { return ObjectType::__TYPE; } \
virtual bool IsType(ObjectType c) const override \
ObjectType GetType() const override { return ObjectType::__TYPE; } \
bool IsType(ObjectType c) const override \
{ \
if (__thisClass::GetType() == (c)) \
return true; \
Expand Down
6 changes: 3 additions & 3 deletions src/BodyComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class BodyComponentDB {
using PoolBase::PoolBase;

// Delete the component and delegate removing it from lua if necessary
virtual void deleteComponent(Body *body) override
void deleteComponent(Body *body) override
{
if (luaInterface)
luaInterface->DeregisterComponent(body);
Expand Down Expand Up @@ -136,12 +136,12 @@ class BodyComponentDB {
{}
Pool<T> *pool;

virtual void toJson(const Body *body, Json &obj, Space *space) override
void toJson(const Body *body, Json &obj, Space *space) override
{
pool->get(body)->SaveToJson(obj, space);
}

virtual void fromJson(Body *body, const Json &obj, Space *space) override
void fromJson(Body *body, const Json &obj, Space *space) override
{
auto *component = pool->newComponent(body);
component->LoadFromJson(obj, space);
Expand Down
10 changes: 5 additions & 5 deletions src/CargoBody.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class CargoBody : public DynamicBody {
CargoBody(const char *modelName, const LuaRef &cargo, float selfdestructTimer = 86400.0f); // default to 24 h lifetime
CargoBody(const Json &jsonObj, Space *space);
LuaRef GetCargoType() const { return m_cargo; }
virtual void SetLabel(const std::string &label) override;
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
virtual void TimeStepUpdate(const float timeStep) override;
virtual bool OnCollision(Body *o, Uint32 flags, double relVel) override;
virtual bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
void SetLabel(const std::string &label) override;
void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
void TimeStepUpdate(const float timeStep) override;
bool OnCollision(Body *o, Uint32 flags, double relVel) override;
bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;

~CargoBody(){};

Expand Down
18 changes: 9 additions & 9 deletions src/DynamicBody.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ class DynamicBody : public ModelBody {
DynamicBody(const Json &jsonObj, Space *space);
virtual ~DynamicBody();

virtual vector3d GetVelocity() const override;
virtual void SetVelocity(const vector3d &v) override;
virtual void SetFrame(FrameId fId) override;
vector3d GetVelocity() const override;
void SetVelocity(const vector3d &v) override;
void SetFrame(FrameId fId) override;
vector3d GetAngVelocity() const override;
void SetAngVelocity(const vector3d &v) override;
virtual bool OnCollision(Body *o, Uint32 flags, double relVel) override;
bool OnCollision(Body *o, Uint32 flags, double relVel) override;
vector3d GetAngularMomentum() const;
double GetAngularInertia() const { return m_angInertia; }
void SetMassDistributionFromModel();
void SetMoving(bool isMoving);
bool IsMoving() const { return m_isMoving; }
virtual double GetMass() const override { return m_mass; } // XXX don't override this
virtual void TimeStepUpdate(const float timeStep) override;
double GetMass() const final { return m_mass; } // XXX don't override this
void TimeStepUpdate(const float timeStep) override;
double CalcAtmosphericDrag(double velSqr, double area, double coeff) const;
void CalcExternalForce();

Expand All @@ -50,9 +50,9 @@ class DynamicBody : public ModelBody {
vector3d GetExternalForce() const { return m_externalForce; }
vector3d GetAtmosForce() const { return m_atmosForce; }
vector3d GetGravityForce() const { return m_gravityForce; }
virtual void UpdateInterpTransform(double alpha) override;
void UpdateInterpTransform(double alpha) override;

virtual void PostLoadFixup(Space *space) override;
void PostLoadFixup(Space *space) override;

Orbit ComputeOrbit() const;

Expand All @@ -78,7 +78,7 @@ class DynamicBody : public ModelBody {
void SetDecelerating(bool decel) { m_decelerating = decel; }

protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override;
void SaveToJson(Json &jsonObj, Space *space) override;

void GetCurrentAtmosphericState(double &pressure, double &density) const;

Expand Down
6 changes: 3 additions & 3 deletions src/FaceParts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ namespace {
prefix(prefix)
{}

virtual void OnRun() override;
virtual void OnFinish() override
void OnRun() override;
void OnFinish() override
{
for (auto &part : cache)
output.push_back(std::move(part));
Expand All @@ -73,7 +73,7 @@ namespace {

struct ScanGenderedPartJob : public ScanPartJob {
using ScanPartJob::ScanPartJob;
virtual void OnRun() override;
void OnRun() override;
};

class PartDb {
Expand Down
12 changes: 6 additions & 6 deletions src/GasGiant.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class GasGiant : public BaseSphere {
GasGiant(const SystemBody *body);
virtual ~GasGiant();

virtual void Update() override;
virtual void Render(Graphics::Renderer *renderer, const matrix4x4d &modelView, vector3d campos, const float radius, const std::vector<Camera::Shadow> &shadows) override;
void Update() override;
void Render(Graphics::Renderer *renderer, const matrix4x4d &modelView, vector3d campos, const float radius, const std::vector<Camera::Shadow> &shadows) override;

virtual double GetHeight(const vector3d &p) const override final { return 0.0; }
double GetHeight(const vector3d &p) const final { return 0.0; }

// in sbody radii
virtual double GetMaxFeatureHeight() const override { return 0.0; }
double GetMaxFeatureHeight() const override { return 0.0; }

virtual void Reset() override;
void Reset() override;

static bool OnAddTextureFaceResult(const SystemPath &path, GasGiantJobs::STextureFaceResult *res);
static bool OnAddGPUGenResult(const SystemPath &path, GasGiantJobs::SGPUGenResult *res);
Expand Down Expand Up @@ -71,7 +71,7 @@ class GasGiant : public BaseSphere {
bool m_hasTempCampos;
vector3d m_tempCampos;

virtual void SetUpMaterials() override;
void SetUpMaterials() override;
RefCountedPtr<Graphics::Texture> m_surfaceTextureSmall;
RefCountedPtr<Graphics::Texture> m_surfaceTexture;
RefCountedPtr<Graphics::Texture> m_builtTexture;
Expand Down
12 changes: 6 additions & 6 deletions src/GeoSphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class GeoSphere : public BaseSphere {
GeoSphere(const SystemBody *body);
virtual ~GeoSphere();

virtual void Update() override;
virtual void Render(Graphics::Renderer *renderer, const matrix4x4d &modelView, vector3d campos, const float radius, const std::vector<Camera::Shadow> &shadows) override;
void Update() override;
void Render(Graphics::Renderer *renderer, const matrix4x4d &modelView, vector3d campos, const float radius, const std::vector<Camera::Shadow> &shadows) override;

virtual double GetHeight(const vector3d &p) const override final
double GetHeight(const vector3d &p) const final
{
const double h = m_terrain->GetHeight(p);
#ifndef NDEBUG
Expand All @@ -58,13 +58,13 @@ class GeoSphere : public BaseSphere {
static bool OnAddQuadSplitResult(const SystemPath &path, SQuadSplitResult *res);
static bool OnAddSingleSplitResult(const SystemPath &path, SSingleSplitResult *res);
// in sbody radii
virtual double GetMaxFeatureHeight() const override final { return m_terrain->GetMaxHeight(); }
double GetMaxFeatureHeight() const final { return m_terrain->GetMaxHeight(); }

bool AddQuadSplitResult(SQuadSplitResult *res);
bool AddSingleSplitResult(SSingleSplitResult *res);
void ProcessSplitResults();

virtual void Reset() override;
void Reset() override;

inline Sint32 GetMaxDepth() const { return m_maxDepth; }

Expand Down Expand Up @@ -101,7 +101,7 @@ class GeoSphere : public BaseSphere {

static RefCountedPtr<GeoPatchContext> s_patchContext;

virtual void SetUpMaterials() override;
void SetUpMaterials() override;
void CreateAtmosphereMaterial();

RefCountedPtr<Graphics::Texture> m_texHi;
Expand Down
14 changes: 7 additions & 7 deletions src/HyperspaceCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ class HyperspaceCloud : public Body {
HyperspaceCloud(Ship *, double dateDue, bool isArrival);
HyperspaceCloud(const Json &jsonObj, Space *space);
virtual ~HyperspaceCloud();
virtual void SetVelocity(const vector3d &v) override { m_vel = v; }
virtual vector3d GetVelocity() const override { return m_vel; }
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
virtual void PostLoadFixup(Space *space) override;
virtual void TimeStepUpdate(const float timeStep) override;
void SetVelocity(const vector3d &v) override { m_vel = v; }
vector3d GetVelocity() const override { return m_vel; }
void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
void PostLoadFixup(Space *space) override;
void TimeStepUpdate(const float timeStep) override;
Ship *GetShip() { return m_ship; }
Ship *EvictShip();
double GetDueDate() const { return m_due; }
void SetIsArrival(bool isArrival);
bool IsArrival() const { return m_isArrival; }
virtual void UpdateInterpTransform(double alpha) override;
void UpdateInterpTransform(double alpha) override;

protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override;
void SaveToJson(Json &jsonObj, Space *space) override;

private:
static void InitGraphics(Graphics::Renderer *renderer);
Expand Down
6 changes: 3 additions & 3 deletions src/JobQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ class SyncJobQueue : public JobQueue {
SyncJobQueue() = default;
virtual ~SyncJobQueue();

virtual Job::Handle Queue(Job *job, JobClient *client = nullptr) override;
virtual void Cancel(Job *job) override;
virtual Uint32 FinishJobs() override;
Job::Handle Queue(Job *job, JobClient *client = nullptr) override;
void Cancel(Job *job) override;
Uint32 FinishJobs() override;

Uint32 RunJobs(Uint32 count = 1);

Expand Down
12 changes: 6 additions & 6 deletions src/Missile.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Missile : public DynamicBody {
virtual ~Missile();
void StaticUpdate(const float timeStep) override;
void TimeStepUpdate(const float timeStep) override;
virtual bool OnCollision(Body *o, Uint32 flags, double relVel) override;
virtual bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
virtual void NotifyRemoved(const Body *const removedBody) override;
virtual void PostLoadFixup(Space *space) override;
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
bool OnCollision(Body *o, Uint32 flags, double relVel) override;
bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
void NotifyRemoved(const Body *const removedBody) override;
void PostLoadFixup(Space *space) override;
void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
void ECMAttack(int power_val);

Body *GetOwner() const { return m_owner; }
Expand All @@ -34,7 +34,7 @@ class Missile : public DynamicBody {
void AIKamikaze(Body *target);

protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override;
void SaveToJson(Json &jsonObj, Space *space) override;

private:
void Explode();
Expand Down
6 changes: 3 additions & 3 deletions src/ModelBody.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ModelBody : public Body {
virtual ~ModelBody();
void SetPosition(const vector3d &p) override;
void SetOrient(const matrix3x3d &r) override;
virtual void SetFrame(FrameId fId) override;
void SetFrame(FrameId fId) override;
// Colliding: geoms are checked against collision space
void SetColliding(bool colliding);
bool IsColliding() const { return m_colliding; }
Expand All @@ -47,10 +47,10 @@ class ModelBody : public Body {

void RenderModel(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform);

virtual void TimeStepUpdate(const float timeStep) override;
void TimeStepUpdate(const float timeStep) override;

protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override;
void SaveToJson(Json &jsonObj, Space *space) override;

private:
void RebuildCollisionMesh();
Expand Down
8 changes: 4 additions & 4 deletions src/ObjectViewerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class SystemBody;
class ObjectViewerView : public View {
public:
ObjectViewerView();
virtual void Update() override;
virtual void Draw3D() override;
void Update() override;
void Draw3D() override;

protected:
virtual void OnSwitchTo() override;
void OnSwitchTo() override;

virtual void DrawPiGui() override;
void DrawPiGui() override;

private:
void ReloadState();
Expand Down
2 changes: 1 addition & 1 deletion src/Planet.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Planet : public TerrainBody {
Planet(SystemBody *);
Planet(const Json &jsonObj, Space *space);

virtual void SubRender(Graphics::Renderer *r, const matrix4x4d &viewTran, const vector3d &camPos) override;
void SubRender(Graphics::Renderer *r, const matrix4x4d &viewTran, const vector3d &camPos) override;

void GetAtmosphericState(double dist, double *outPressure, double *outDensity) const;
double GetAtmosphereRadius() const { return m_atmosphereRadius; }
Expand Down
30 changes: 15 additions & 15 deletions src/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class Player : public Ship {
Player(const Json &jsonObj, Space *space);
Player(const ShipType::Id &shipId);

virtual void SetDockedWith(SpaceStation *, int port) override;
virtual bool DoDamage(float kgDamage) override final; // overloaded to add "crush" audio
virtual bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
virtual bool SetWheelState(bool down) override; // returns success of state change, NOT state itself
virtual Missile *SpawnMissile(ShipType::Id missile_type, int power = -1) override;
virtual void SetAlertState(Ship::AlertState as) override;
virtual void NotifyRemoved(const Body *const removedBody) override;
virtual bool ManualDocking() const override { return !AIIsActive(); }
void SetDockedWith(SpaceStation *, int port) override;
bool DoDamage(float kgDamage) final; // overloaded to add "crush" audio
bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
bool SetWheelState(bool down) override; // returns success of state change, NOT state itself
Missile *SpawnMissile(ShipType::Id missile_type, int power = -1) override;
void SetAlertState(Ship::AlertState as) override;
void NotifyRemoved(const Body *const removedBody) override;
bool ManualDocking() const override { return !AIIsActive(); }

void DoFixspeedTakeoff(SpaceStation *from = nullptr);

virtual void SetShipType(const ShipType::Id &shipId) override;
void SetShipType(const ShipType::Id &shipId) override;

PlayerShipController *GetPlayerController() const;
//XXX temporary things to avoid causing too many changes right now
Expand All @@ -43,23 +43,23 @@ class Player : public Ship {
void SetFollowTarget(Body *const target);
void ChangeCruiseSpeed(double delta);

virtual Ship::HyperjumpStatus InitiateHyperjumpTo(const SystemPath &dest, int warmup_time, double duration, const HyperdriveSoundsTable &sounds, LuaRef checks) override;
virtual void AbortHyperjump() override;
Ship::HyperjumpStatus InitiateHyperjumpTo(const SystemPath &dest, int warmup_time, double duration, const HyperdriveSoundsTable &sounds, LuaRef checks) override;
void AbortHyperjump() override;

// XXX cockpit is here for now because it has a physics component
void InitCockpit();
ShipCockpit *GetCockpit() const { return m_cockpit.get(); }
void OnCockpitActivated();

virtual void StaticUpdate(const float timeStep) override;
void StaticUpdate(const float timeStep) override;
virtual vector3d GetManeuverVelocity() const;
virtual int GetManeuverTime() const;

protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override;
void SaveToJson(Json &jsonObj, Space *space) override;

virtual void OnEnterSystem() override;
virtual void OnEnterHyperspace() override;
void OnEnterSystem() override;
void OnEnterHyperspace() override;

private:
std::unique_ptr<ShipCockpit> m_cockpit;
Expand Down
Loading