Commit eb046f9e authored by sm's avatar sm

New version 0.10

- Fix theme and game dialog bugs
- Reduce code bloat by adding noexpect to methods
- Reorganize and split files
parent 155a45b9
stmm-games (0.10) unstable; urgency=low
* Fix theme and game dialog bugs
* Reduce code bloat by adding noexpect to methods
* Increase minor version
-- Stefano Marsili <efanomars@gmx.ch> Thu, 04 Jul 2019 19:29:39 +0100
stmm-games (0.9) unstable; urgency=low
* Improve drawing API and performance
......
......@@ -54,49 +54,49 @@ public:
/** Constructor.
* @param oInit The initialization data.
*/
DumbBlockEvent(Init&& oInit);
DumbBlockEvent(Init&& oInit) noexcept;
protected:
/** Reinitialization.
* @param oInit The initialization data.
*/
void reInit(Init&& oInit);
void reInit(Init&& oInit) noexcept;
void onAdded() override;
void onAdded() noexcept override;
public:
void trigger(int32_t nMsg, int32_t nValue, Event* p0TriggeringEvent) override;
void trigger(int32_t nMsg, int32_t nValue, Event* p0TriggeringEvent) noexcept override;
int32_t blockPosZ() const override { return s_nZObjectZDumbBlockEvent; }
int32_t blockPosZ() const noexcept override { return s_nZObjectZDumbBlockEvent; }
// void handleKeyActionInput(const shared_ptr<stmi::Event>& refKeyActionEvent) {}
// void handleXYInput(const shared_ptr<stmi::Event>& refXYEvent) {}
void handleInput(const shared_ptr<stmi::Event>& /*refEvent*/) override {}
void handleTimer() override;
void fall() override;
bool remove() override;
bool destroy() override;
bool freeze() override;
bool fuseTo(LevelBlock& oLevelBlock) override;
bool removeBrick(int32_t nBrickId) override;
bool destroyBrick(int32_t nBrickId) override;
LevelBlock::QUERY_ATTACK_TYPE queryAttack(LevelBlock& oAttacker, int32_t nBoardX, int32_t nBoardY, const Tile& oTile) const override;
bool attack(LevelBlock& oAttacker, int32_t nBoardX, int32_t nBoardY, const Tile& oTile) override;
void handleInput(const shared_ptr<stmi::Event>& /*refEvent*/) noexcept override {}
void handleTimer() noexcept override;
void fall() noexcept override;
bool remove() noexcept override;
bool destroy() noexcept override;
bool freeze() noexcept override;
bool fuseTo(LevelBlock& oLevelBlock) noexcept override;
bool removeBrick(int32_t nBrickId) noexcept override;
bool destroyBrick(int32_t nBrickId) noexcept override;
LevelBlock::QUERY_ATTACK_TYPE queryAttack(LevelBlock& oAttacker, int32_t nBoardX, int32_t nBoardY, const Tile& oTile) const noexcept override;
bool attack(LevelBlock& oAttacker, int32_t nBoardX, int32_t nBoardY, const Tile& oTile) noexcept override;
// BoardListener
void boabloPreFreeze(LevelBlock& oBlock) override;
void boabloPostFreeze(const Coords& oCoords) override;
void boabloPreUnfreeze(const Coords& oCoords) override;
void boabloPostUnfreeze(LevelBlock& oBlock) override;
void boardPreScroll(Direction::VALUE eDir, const shared_ptr<TileRect>& refTiles) override;
void boardPostScroll(Direction::VALUE eDir) override;
void boardPreInsert(Direction::VALUE eDir, NRect oRect, const shared_ptr<TileRect>& refTiles) override;
void boardPostInsert(Direction::VALUE eDir, NRect oRect) override;
void boardPreDestroy(const Coords& oCoords) override;
void boardPostDestroy(const Coords& oCoords) override;
void boardPreModify(const TileCoords& oTileCoords) override;
void boardPostModify(const Coords& oCoords) override;
void boabloPreFreeze(LevelBlock& oBlock) noexcept override;
void boabloPostFreeze(const Coords& oCoords) noexcept override;
void boabloPreUnfreeze(const Coords& oCoords) noexcept override;
void boabloPostUnfreeze(LevelBlock& oBlock) noexcept override;
void boardPreScroll(Direction::VALUE eDir, const shared_ptr<TileRect>& refTiles) noexcept override;
void boardPostScroll(Direction::VALUE eDir) noexcept override;
void boardPreInsert(Direction::VALUE eDir, NRect oRect, const shared_ptr<TileRect>& refTiles) noexcept override;
void boardPostInsert(Direction::VALUE eDir, NRect oRect) noexcept override;
void boardPreDestroy(const Coords& oCoords) noexcept override;
void boardPostDestroy(const Coords& oCoords) noexcept override;
void boardPreModify(const TileCoords& oTileCoords) noexcept override;
void boardPostModify(const Coords& oCoords) noexcept override;
enum {
LISTENER_GROUP_CANNOT_PLACE = 10
......@@ -118,16 +118,16 @@ private:
DUMB_BLK_EVENT_STATE_ZOMBIE = 4
};
bool validBlock() const;
bool validBlock() const noexcept;
void privateOnFreeze();
void boardPreDeleteDown(int32_t nY, int32_t nX, int32_t nW);
void boardPreInsertUp(int32_t nY, int32_t nX, int32_t nW, const shared_ptr<TileBuffer>& refBuffer);
bool canMove(Direction::VALUE eDir, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH);
bool canMove(Direction::VALUE eDir);
bool move(Direction::VALUE eDir);
void privateOnFreeze() noexcept;
void boardPreDeleteDown(int32_t nY, int32_t nX, int32_t nW) noexcept;
void boardPreInsertUp(int32_t nY, int32_t nX, int32_t nW, const shared_ptr<TileBuffer>& refBuffer) noexcept;
bool canMove(Direction::VALUE eDir, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH) noexcept;
bool canMove(Direction::VALUE eDir) noexcept;
bool move(Direction::VALUE eDir) noexcept;
bool move(Direction::VALUE eDir, bool bDoMove
, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH);
, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH) noexcept;
private:
LocalInit m_oData;
......
......@@ -46,69 +46,69 @@ using std::tuple;
class FakeLevelView : public LevelView
{
public:
FakeLevelView(Game* p0Game, Level* p0Level);
FakeLevelView(Game* p0Game, Level* p0Level) noexcept;
class Called
{
public:
virtual ~Called() = default;
virtual ~Called() noexcept = default;
};
struct BoardAnimateTiles : public Called
{
NRect m_oArea;
};
void boardAnimateTiles(NRect oArea) override;
void boardAnimateTile(NPoint oXY) override;
void boardAnimateTiles(NRect oArea) noexcept override;
void boardAnimateTile(NPoint oXY) noexcept override;
struct AnimationCreate : public Called
{
shared_ptr<LevelAnimation> m_refLevelAnimation;
};
bool animationCreate(const shared_ptr<LevelAnimation>& refLevelAnimation) override;
bool animationCreate(const shared_ptr<LevelAnimation>& refLevelAnimation) noexcept override;
struct AnimationRemove : public Called
{
shared_ptr<LevelAnimation> m_refLevelAnimation;
};
bool animationRemove(const shared_ptr<LevelAnimation>& refLevelAnimation) override;
bool animationRemove(const shared_ptr<LevelAnimation>& refLevelAnimation) noexcept override;
struct BoardPreScroll : public Called
{
Direction::VALUE m_eDir;
shared_ptr<TileRect> m_refTiles;
};
void boardPreScroll(Direction::VALUE eDir, const shared_ptr<TileRect>& refTiles) override;
void boardPreScroll(Direction::VALUE eDir, const shared_ptr<TileRect>& refTiles) noexcept override;
struct BoardPostScroll : public Called
{
Direction::VALUE m_eDir;
};
void boardPostScroll(Direction::VALUE eDir) override;
void boardPostScroll(Direction::VALUE eDir) noexcept override;
struct BoabloPreFreeze : public Called
{
LevelBlock* m_p0Block;
};
void boabloPreFreeze(LevelBlock& oBlock) override;
void boabloPreFreeze(LevelBlock& oBlock) noexcept override;
struct BoabloPostFreeze : public Called
{
Coords m_oCoords;
};
void boabloPostFreeze(const Coords& oCoords) override;
void boabloPostFreeze(const Coords& oCoords) noexcept override;
struct BoabloPreUnfreeze : public Called
{
Coords m_oCoords;
};
void boabloPreUnfreeze(const Coords& oCoords) override;
void boabloPreUnfreeze(const Coords& oCoords) noexcept override;
struct BoabloPostUnfreeze : public Called
{
LevelBlock* m_p0Block;
};
void boabloPostUnfreeze(LevelBlock& oBlock) override;
void boabloPostUnfreeze(LevelBlock& oBlock) noexcept override;
struct BoardPreInsert : public Called
{
......@@ -116,81 +116,81 @@ public:
NRect m_oArea;
shared_ptr<TileRect> m_refTiles;
};
void boardPreInsert(Direction::VALUE eDir, NRect oArea, const shared_ptr<TileRect>& refTiles) override;
void boardPreInsert(Direction::VALUE eDir, NRect oArea, const shared_ptr<TileRect>& refTiles) noexcept override;
struct BoardPostInsert : public Called
{
Direction::VALUE m_eDir;
NRect m_oArea;
};
void boardPostInsert(Direction::VALUE eDir, NRect oArea) override;
void boardPostInsert(Direction::VALUE eDir, NRect oArea) noexcept override;
struct BoardPreDestroy : public Called
{
Coords m_oCoords;
};
void boardPreDestroy(const Coords& oCoords) override;
void boardPreDestroy(const Coords& oCoords) noexcept override;
struct BoardPostDestroy : public Called
{
Coords m_oCoords;
};
void boardPostDestroy(const Coords& oCoords) override;
void boardPostDestroy(const Coords& oCoords) noexcept override;
struct BoardPreModify : public Called
{
TileCoords m_oTileCoords;
};
void boardPreModify(const TileCoords& oTileCoords) override;
void boardPreModify(const TileCoords& oTileCoords) noexcept override;
struct BoardPostModify : public Called
{
Coords m_oCoords;
};
void boardPostModify(const Coords& oCoords) override;
void boardPostModify(const Coords& oCoords) noexcept override;
struct BlockPreAdd : public Called
{
LevelBlock const * m_p0Block;
};
void blockPreAdd(const LevelBlock& oBlock) override;
void blockPreAdd(const LevelBlock& oBlock) noexcept override;
struct BlockPostAdd : public Called
{
LevelBlock const * m_p0Block;
};
void blockPostAdd(LevelBlock& oBlock) override;
void blockPostAdd(LevelBlock& oBlock) noexcept override;
struct BlockPreRemove : public Called
{
LevelBlock const * m_p0Block;
};
void blockPreRemove(LevelBlock& oBlock) override;
void blockPreRemove(LevelBlock& oBlock) noexcept override;
struct BlockPostRemove : public Called
{
LevelBlock const * m_p0Block;
};
void blockPostRemove(const LevelBlock& oBlock) override;
void blockPostRemove(const LevelBlock& oBlock) noexcept override;
struct BlockPreDestroy : public Called
{
LevelBlock const * m_p0Block;
};
void blockPreDestroy(LevelBlock& oBlock) override;
void blockPreDestroy(LevelBlock& oBlock) noexcept override;
struct BlockPostDestroy : public Called
{
LevelBlock const * m_p0Block;
};
void blockPostDestroy(const LevelBlock& oBlock) override;
void blockPostDestroy(const LevelBlock& oBlock) noexcept override;
struct BlockPreFuse : public Called
{
LevelBlock* m_p0FusedToBlock;
LevelBlock* m_p0FusedBlock;
};
void blockPreFuse(LevelBlock& oFusedToBlock, LevelBlock& oFusedBlock) override;
void blockPreFuse(LevelBlock& oFusedToBlock, LevelBlock& oFusedBlock) noexcept override;
struct BlockPostFuse : public Called
{
......@@ -201,12 +201,12 @@ public:
};
void blockPostFuse(LevelBlock& oResBlock, const LevelBlock& oFusedBlock
, const std::unordered_map<int32_t, int32_t>& oFusedToBrickIds
, const std::unordered_map<int32_t, int32_t>& oFusedBrickIds) override;
, const std::unordered_map<int32_t, int32_t>& oFusedBrickIds) noexcept override;
const std::vector<unique_ptr<Called>>& getAllCalled();
const std::vector<unique_ptr<Called>>& getAllCalled() noexcept;
// Use the following like this: getCalled<BlockPreDestroy>()
template<typename T>
const std::vector<T*> getCalled()
const std::vector<T*> getCalled() noexcept
{
std::vector<T*> aRes;
for (const auto& refCalled : m_oAllCalls) {
......@@ -218,7 +218,7 @@ public:
return aRes;
}
private:
int32_t totCalled(const shared_ptr<LevelAnimation>& refLevelAnimation);
int32_t totCalled(const shared_ptr<LevelAnimation>& refLevelAnimation) noexcept;
private:
std::vector<unique_ptr<Called>> m_oAllCalls;
......
......@@ -80,7 +80,7 @@ protected:
public:
shared_ptr<Level> createLevel(Game* p0Game, int32_t nLevel
, const shared_ptr<AppPreferences>& refPreferences
, const Level::Init& oInit) override
, const Level::Init& oInit) noexcept override
{
assert(p0Game != nullptr);
return std::make_shared<Level>(p0Game, nLevel, refPreferences, oInit);
......
......@@ -40,44 +40,44 @@ namespace testing
class GameOwnerFixture : public GameOwner
{
public:
int32_t gameEndedCount() const
int32_t gameEndedCount() const noexcept
{
return m_nGameEndedCount;
}
int32_t gamePauseCount() const
int32_t gamePauseCount() const noexcept
{
return m_nGamePauseCount;
}
int32_t gameAbortCount() const
int32_t gameAbortCount() const noexcept
{
return m_nGameAbortCount;
}
int32_t gameAbortAskCount() const
int32_t gameAbortAskCount() const noexcept
{
return m_nGameAbortAskCount;
}
int32_t gameQuitCount() const
int32_t gameQuitCount() const noexcept
{
return m_nGameQuitCount;
}
int32_t gameQuitAskCount() const
int32_t gameQuitAskCount() const noexcept
{
return m_nGameQuitAskCount;
}
int32_t gameRestartCount() const
int32_t gameRestartCount() const noexcept
{
return m_nGameRestartCount;
}
int32_t gameRestartAskCount() const
int32_t gameRestartAskCount() const noexcept
{
return m_nGameRestartAskCount;
}
void gameEnded() override
void gameEnded() noexcept override
{
++m_nGameEndedCount;
}
void gameInterrupt(GameProxy::INTERRUPT_TYPE eInterruptType) override
void gameInterrupt(GameProxy::INTERRUPT_TYPE eInterruptType) noexcept override
{
if (eInterruptType == GameProxy::INTERRUPT_ABORT) {
++m_nGameAbortCount;
......@@ -106,7 +106,7 @@ protected:
{
resetGameOwner();
}
void resetGameOwner()
void resetGameOwner() noexcept
{
m_nGameEndedCount = 0;
m_nGamePauseCount = 0;
......
......@@ -25,6 +25,10 @@
#include "fixturevariantPlayers.h"
#include "options/booloption.h"
#include "options/enumoption.h"
#include "options/intoption.h"
#ifdef STMG_TESTING_COPY_FROM_FAKE
#include "stdconfig.h"
#else
......
......@@ -41,25 +41,25 @@ public:
/** Constructor.
* @param oInit The initialization data.
*/
MockEvent(Init&& oInit);
MockEvent(Init&& oInit) noexcept;
protected:
/** Reinitialization.
* @param oInit The initialization data.
*/
void reInit(Init&& oInit);
void reInit(Init&& oInit) noexcept;
public:
/** Set the value the trigger function should send.
* @param nGroup The group that should be triggered.
* @param nValue The value passed.
* @param nSkipTicks How many ticks to the triggering.
*/
void setTriggerValue(int32_t nGroup, int32_t nValue, int32_t nSkipTicks);
void setTriggerValue(int32_t nGroup, int32_t nValue, int32_t nSkipTicks) noexcept;
/** The common triggering function.
* Triggers the group and value set in setTriggerValue().
* Note that if this event is triggered by another event it won't do anything.
*/
void trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0TriggeringEvent) override;
void trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0TriggeringEvent) noexcept override;
private:
int32_t m_bTriggerValuesSet;
......
......@@ -28,7 +28,7 @@ namespace stmg
const int32_t DumbBlockEvent::s_nZObjectZDumbBlockEvent = 10;
DumbBlockEvent::DumbBlockEvent(Init&& oInit)
DumbBlockEvent::DumbBlockEvent(Init&& oInit) noexcept
: Event(std::move(oInit))
, LevelBlock(true)
, m_oData(std::move(oInit))
......@@ -39,7 +39,7 @@ DumbBlockEvent::DumbBlockEvent(Init&& oInit)
blockInitialSet(m_oData.m_oBlock, 0, m_oData.m_oInitPos, false, -1);
}
void DumbBlockEvent::reInit(Init&& oInit)
void DumbBlockEvent::reInit(Init&& oInit) noexcept
{
Event::reInit(std::move(oInit));
m_oData = std::move(oInit);
......@@ -48,11 +48,11 @@ void DumbBlockEvent::reInit(Init&& oInit)
m_eState = DUMB_BLK_EVENT_STATE_ACTIVATE;
blockInitialSet(m_oData.m_oBlock, 0, m_oData.m_oInitPos, false, -1);
}
bool DumbBlockEvent::validBlock() const
bool DumbBlockEvent::validBlock() const noexcept
{
return !m_oData.m_oBlock.isEmpty();
}
void DumbBlockEvent::trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0TriggeringEvent)
void DumbBlockEvent::trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0TriggeringEvent) noexcept
{
// ACTIVATE activate event
// INIT calc initial position, reset attempts to place it
......@@ -116,26 +116,27 @@ void DumbBlockEvent::trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0Trig
break;
}
}
void DumbBlockEvent::onAdded()
void DumbBlockEvent::onAdded() noexcept
{
//std::cout << "DumbBlockEvent(" << blockGetId() << ")::onAdded" << '\n';
}
void DumbBlockEvent::handleTimer()
void DumbBlockEvent::handleTimer() noexcept
{
}
bool DumbBlockEvent::canMove(Direction::VALUE eDir)
bool DumbBlockEvent::canMove(Direction::VALUE eDir) noexcept
{
return move(eDir, false, 0,0,0,0);
}
bool DumbBlockEvent::canMove(Direction::VALUE eDir, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH)
bool DumbBlockEvent::canMove(Direction::VALUE eDir, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH) noexcept
{
return move(eDir, false, nClipX, nClipY, nClipW, nClipH);
}
bool DumbBlockEvent::move(Direction::VALUE eDir) {
bool DumbBlockEvent::move(Direction::VALUE eDir) noexcept
{
return move(eDir, true, 0,0,0,0);
}
bool DumbBlockEvent::move(Direction::VALUE eDir, bool bDoMove
, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH)
, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH) noexcept
{
Level& oLevel = level();
assert((static_cast<int32_t>(eDir) >= 0) && (static_cast<int32_t>(eDir) < 4));
......@@ -178,26 +179,26 @@ bool DumbBlockEvent::move(Direction::VALUE eDir, bool bDoMove
return true;
}
void DumbBlockEvent::fall()
void DumbBlockEvent::fall() noexcept
{
}
void DumbBlockEvent::privateOnFreeze()
void DumbBlockEvent::privateOnFreeze() noexcept
{
level().boardRemoveListener(this);
//if (m_p0Parent != nullptr) {
// m_p0Parent->trigger(m_nTriggerFinishedMsg, m_nId, m_p0Parent);
//}