Skip to content

Commit

Permalink
Refactor MCForceGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
juzzlin committed Apr 22, 2021
1 parent 272e464 commit b38ebb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
24 changes: 10 additions & 14 deletions src/game/MiniCore/src/Physics/mcforcegenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,31 @@

#include "mcforcegenerator.hh"

class MCForceGeneratorImpl
struct MCForceGenerator::Impl
{
MCForceGeneratorImpl();
Impl()
: enabled(true)
{
}

bool enabled;

friend class MCForceGenerator;
};

MCForceGeneratorImpl::MCForceGeneratorImpl()
: enabled(true)
{
}

MCForceGenerator::MCForceGenerator()
: m_pImpl(new MCForceGeneratorImpl)
: m_impl(std::make_unique<Impl>())
{
}

void MCForceGenerator::enable(bool status)
{
m_pImpl->enabled = status;
m_impl->enabled = status;
}

bool MCForceGenerator::enabled() const
{
return m_pImpl->enabled;
return m_impl->enabled;
}

MCForceGenerator::~MCForceGenerator()
{
delete m_pImpl;
}
MCForceGenerator::~MCForceGenerator() = default;
4 changes: 2 additions & 2 deletions src/game/MiniCore/src/Physics/mcforcegenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <memory>

class MCObject;
class MCForceGeneratorImpl;

//! Abstract base class for different force generators
class MCForceGenerator
Expand All @@ -50,7 +49,8 @@ private:
DISABLE_COPY(MCForceGenerator);
DISABLE_ASSI(MCForceGenerator);

MCForceGeneratorImpl * const m_pImpl;
struct Impl;
std::unique_ptr<Impl> m_impl;
};

typedef std::shared_ptr<MCForceGenerator> MCForceGeneratorPtr;
Expand Down

0 comments on commit b38ebb2

Please sign in to comment.