Commit 29e4c0e3 authored by sm's avatar sm

Please cppcheck

parent 99301eb1
...@@ -34,7 +34,7 @@ namespace stmg ...@@ -34,7 +34,7 @@ namespace stmg
class BackgroundThAniFactory : public StdThemeAnimationFactory class BackgroundThAniFactory : public StdThemeAnimationFactory
{ {
public: public:
BackgroundThAniFactory(StdTheme* p1Owner); explicit BackgroundThAniFactory(StdTheme* p1Owner);
bool supports(const shared_ptr<LevelAnimation>& refLevelAnimation) override; bool supports(const shared_ptr<LevelAnimation>& refLevelAnimation) override;
shared_ptr<ThemeAnimation> create(const shared_ptr<StdThemeContext>& refThemeContext, const shared_ptr<LevelAnimation>& refLevelAnimation) override; shared_ptr<ThemeAnimation> create(const shared_ptr<StdThemeContext>& refThemeContext, const shared_ptr<LevelAnimation>& refLevelAnimation) override;
...@@ -45,7 +45,6 @@ private: ...@@ -45,7 +45,6 @@ private:
public: public:
BackgroundThAni() = default; BackgroundThAni() = default;
void reInit() {} void reInit() {}
// NRect getRect(int32_t nViewTick, int32_t nTotViewTicks) override;
int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override; int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override; bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override; bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override;
......
...@@ -46,7 +46,6 @@ private: ...@@ -46,7 +46,6 @@ private:
public: public:
ImageSeqThAni() = default; ImageSeqThAni() = default;
void reInit() {} void reInit() {}
// NRect getRect(int32_t nViewTick, int32_t nTotViewTicks) override;
int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override; int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override; bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override; bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override;
......
...@@ -47,7 +47,6 @@ private: ...@@ -47,7 +47,6 @@ private:
public: public:
PlainTextThAni() = default; PlainTextThAni() = default;
void reInit() {} void reInit() {}
// NRect getRect(int32_t nViewTick, int32_t nTotViewTicks) override;
int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override; int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override; bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override; bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override;
......
...@@ -44,7 +44,6 @@ private: ...@@ -44,7 +44,6 @@ private:
public: public:
StaticGridThAni() = default; StaticGridThAni() = default;
void reInit() {} void reInit() {}
// NRect getRect(int32_t nViewTick, int32_t nTotViewTicks) override;
int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override; int32_t getZ(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override; bool isStarted(int32_t nViewTick, int32_t nTotViewTicks) override;
bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override; bool isDone(int32_t nViewTick, int32_t nTotViewTicks) override;
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
/** Constructor. /** Constructor.
* @param p1Owner The theme. Cannot be null. * @param p1Owner The theme. Cannot be null.
*/ */
ContainerModifier(StdTheme* p1Owner); explicit ContainerModifier(StdTheme* p1Owner);
/** Add sub modifiers to this container. /** Add sub modifiers to this container.
* @param aModifier The modifiers. Cannot be null. * @param aModifier The modifiers. Cannot be null.
*/ */
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
/** Image from a file constructor. /** Image from a file constructor.
* @param oImageFile The file. Must be defined. * @param oImageFile The file. Must be defined.
*/ */
Image(const File& oImageFile); explicit Image(const File& oImageFile);
/** Sub-image of another image constructor. /** Sub-image of another image constructor.
* @param refImage The master image. Cannot be null. * @param refImage The master image. Cannot be null.
* @param oSubRect The rectangle within the master image in pixels. Width and height must be positive numbers. * @param oSubRect The rectangle within the master image in pixels. Width and height must be positive numbers.
......
...@@ -30,7 +30,7 @@ class StdTheme; ...@@ -30,7 +30,7 @@ class StdTheme;
class AlphaModifier : public ContainerModifier class AlphaModifier : public ContainerModifier
{ {
public: public:
AlphaModifier(StdTheme* p1Owner); explicit AlphaModifier(StdTheme* p1Owner);
FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc
, const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override; , const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override;
private: private:
......
...@@ -30,7 +30,7 @@ class StdTheme; ...@@ -30,7 +30,7 @@ class StdTheme;
class FillModifier : public StdThemeModifier class FillModifier : public StdThemeModifier
{ {
public: public:
FillModifier(StdTheme* p1Owner); explicit FillModifier(StdTheme* p1Owner);
FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc
, const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override; , const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override;
private: private:
......
...@@ -34,7 +34,7 @@ class StdTheme; ...@@ -34,7 +34,7 @@ class StdTheme;
class IfElseModifier : public ContainerModifier //StdThemeModifier , protected MultiContainerModifier class IfElseModifier : public ContainerModifier //StdThemeModifier , protected MultiContainerModifier
{ {
public: public:
IfElseModifier(StdTheme* p1Owner); explicit IfElseModifier(StdTheme* p1Owner);
void addCondition(unique_ptr<TileSelector> refSelect, std::vector< unique_ptr<StdThemeModifier> > aModifiers); void addCondition(unique_ptr<TileSelector> refSelect, std::vector< unique_ptr<StdThemeModifier> > aModifiers);
void setElse(std::vector< unique_ptr<StdThemeModifier> > aModifier); void setElse(std::vector< unique_ptr<StdThemeModifier> > aModifier);
FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc
......
...@@ -33,7 +33,7 @@ class StdTheme; ...@@ -33,7 +33,7 @@ class StdTheme;
class SelectCaseModifier : public ContainerModifier //StdThemeModifier, protected MultiContainerModifier class SelectCaseModifier : public ContainerModifier //StdThemeModifier, protected MultiContainerModifier
{ {
public: public:
SelectCaseModifier(StdTheme* p1Owner); explicit SelectCaseModifier(StdTheme* p1Owner);
void addCase(int32_t nIdAss, std::vector< unique_ptr<StdThemeModifier> > aModifiers); void addCase(int32_t nIdAss, std::vector< unique_ptr<StdThemeModifier> > aModifiers);
void setDefault(std::vector< unique_ptr<StdThemeModifier> > aModifiers); void setDefault(std::vector< unique_ptr<StdThemeModifier> > aModifiers);
FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc
......
...@@ -30,7 +30,7 @@ class StdTheme; ...@@ -30,7 +30,7 @@ class StdTheme;
class SelectedImageModifier : public StdThemeModifier class SelectedImageModifier : public StdThemeModifier
{ {
public: public:
SelectedImageModifier(StdTheme* p1Owner); explicit SelectedImageModifier(StdTheme* p1Owner);
FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc
, const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override; , const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override;
private: private:
......
...@@ -30,7 +30,7 @@ class StdTheme; ...@@ -30,7 +30,7 @@ class StdTheme;
class StopModifier : public StdThemeModifier class StopModifier : public StdThemeModifier
{ {
public: public:
StopModifier(StdTheme* p1Owner); explicit StopModifier(StdTheme* p1Owner);
FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc FLOW_CONTROL drawTile(const Cairo::RefPtr<Cairo::Context>& refCc, StdThemeDrawingContext& oDc
, const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override; , const Tile& oTile, int32_t nPlayer, const std::vector<double>& aAniElapsed) override;
private: private:
......
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
void dump() const { dump(0); } void dump() const { dump(0); }
#endif //NDEBUG #endif //NDEBUG
private: private:
SegmentedFunction(bool bCreateZeroSegment) explicit SegmentedFunction(bool bCreateZeroSegment)
{ {
if (bCreateZeroSegment) { if (bCreateZeroSegment) {
m_aSegments.emplace_back(0.0, 0.0, 0.0); m_aSegments.emplace_back(0.0, 0.0, 0.0);
......
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
/** Constructor. /** Constructor.
* @param p1Owner The owner theme. Cannot be null. * @param p1Owner The owner theme. Cannot be null.
*/ */
StdThemeAnimationFactory(StdTheme* p1Owner); explicit StdThemeAnimationFactory(StdTheme* p1Owner);
virtual ~StdThemeAnimationFactory() = default; virtual ~StdThemeAnimationFactory() = default;
/** Tells whether the factory supports the model animation. /** Tells whether the factory supports the model animation.
......
...@@ -79,7 +79,7 @@ protected: ...@@ -79,7 +79,7 @@ protected:
/** Constructor. /** Constructor.
* @param p1Owner The theme. Cannot be null. * @param p1Owner The theme. Cannot be null.
*/ */
StdThemeModifier(StdTheme* p1Owner); explicit StdThemeModifier(StdTheme* p1Owner);
/** The theme. /** The theme.
* @return The theme. Is not null. * @return The theme. Is not null.
*/ */
......
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
/** Constructor. /** Constructor.
* @param p1Owner The owner. Cannot be null. * @param p1Owner The owner. Cannot be null.
*/ */
StdThemeWidgetFactory(StdTheme* p1Owner); explicit StdThemeWidgetFactory(StdTheme* p1Owner);
virtual ~StdThemeWidgetFactory() = default; virtual ~StdThemeWidgetFactory() = default;
/** Creates a theme widget for a game widget. /** Creates a theme widget for a game widget.
* @param refGameWidget The model. Cannot be null. * @param refGameWidget The model. Cannot be null.
...@@ -90,7 +90,7 @@ template< class TW > ...@@ -90,7 +90,7 @@ template< class TW >
class StdLeafThemeWidget class StdLeafThemeWidget
{ {
public: public:
StdLeafThemeWidget(TW* p0TW); explicit StdLeafThemeWidget(TW* p0TW);
void reInit(double fTileWHRatio); void reInit(double fTileWHRatio);
/** Default implementation of canChange(). /** Default implementation of canChange().
...@@ -164,7 +164,7 @@ template< class TW > ...@@ -164,7 +164,7 @@ template< class TW >
class StdRelSizedThemeWidget : public StdLeafThemeWidget<TW> class StdRelSizedThemeWidget : public StdLeafThemeWidget<TW>
{ {
public: public:
StdRelSizedThemeWidget(TW* p0TW); explicit StdRelSizedThemeWidget(TW* p0TW);
void reInit(RelSizedGameWidget* p0RelSizedGameWidget, double fTileWHRatio); void reInit(RelSizedGameWidget* p0RelSizedGameWidget, double fTileWHRatio);
...@@ -189,6 +189,7 @@ StdLeafThemeWidget<TW>::StdLeafThemeWidget(TW* p0TW) ...@@ -189,6 +189,7 @@ StdLeafThemeWidget<TW>::StdLeafThemeWidget(TW* p0TW)
, m_nPixW(0) , m_nPixW(0)
, m_nPixH(0) , m_nPixH(0)
, m_bParentCanChange(false) , m_bParentCanChange(false)
, m_bCacheInvalid(true)
{ {
static_assert(std::is_base_of<ThemeWidget, TW>::value, "Must derive from ThemeWidget"); static_assert(std::is_base_of<ThemeWidget, TW>::value, "Must derive from ThemeWidget");
assert(p0TW != nullptr); assert(p0TW != nullptr);
...@@ -203,8 +204,8 @@ void StdLeafThemeWidget<TW>::reInit(double fTileWHRatio) ...@@ -203,8 +204,8 @@ void StdLeafThemeWidget<TW>::reInit(double fTileWHRatio)
m_nPixY = std::numeric_limits<int32_t>::min(); m_nPixY = std::numeric_limits<int32_t>::min();
m_nPixW = 0; m_nPixW = 0;
m_nPixH = 0; m_nPixH = 0;
m_bCacheInvalid = true;
m_bParentCanChange = false; m_bParentCanChange = false;
m_bCacheInvalid = true;
} }
#ifndef NDEBUG #ifndef NDEBUG
template< class TW > template< class TW >
......
...@@ -163,7 +163,7 @@ protected: ...@@ -163,7 +163,7 @@ protected:
/** Constructs the theme widget. /** Constructs the theme widget.
* @param refModel The model. Cannot be null. * @param refModel The model. Cannot be null.
*/ */
ThemeWidget(const shared_ptr<GameWidget>& refModel) explicit ThemeWidget(const shared_ptr<GameWidget>& refModel)
: m_p0Parent(nullptr) : m_p0Parent(nullptr)
, m_bIsContainer(false) , m_bIsContainer(false)
, m_p0ThemeLayout(nullptr) , m_p0ThemeLayout(nullptr)
...@@ -221,7 +221,7 @@ protected: ...@@ -221,7 +221,7 @@ protected:
/** Constructor. /** Constructor.
* @param refModel The model. Cannot be null. * @param refModel The model. Cannot be null.
*/ */
ThemeContainerWidget(const shared_ptr<GameWidget>& refModel) explicit ThemeContainerWidget(const shared_ptr<GameWidget>& refModel)
: ThemeWidget(refModel) : ThemeWidget(refModel)
{ {
ThemeWidget::m_bIsContainer = true; ThemeWidget::m_bIsContainer = true;
......
...@@ -38,7 +38,7 @@ using std::shared_ptr; ...@@ -38,7 +38,7 @@ using std::shared_ptr;
class BackgroundThWidgetFactory : public StdThemeWidgetFactory class BackgroundThWidgetFactory : public StdThemeWidgetFactory
{ {
public: public:
BackgroundThWidgetFactory(StdTheme* p1Owner); explicit BackgroundThWidgetFactory(StdTheme* p1Owner);
shared_ptr<ThemeWidget> create(const shared_ptr<GameWidget>& refGameWidget shared_ptr<ThemeWidget> create(const shared_ptr<GameWidget>& refGameWidget
, double fTileWHRatio, const Glib::RefPtr<Pango::Layout>& refFontLayout) override; , double fTileWHRatio, const Glib::RefPtr<Pango::Layout>& refFontLayout) override;
private: private:
......
...@@ -31,7 +31,7 @@ namespace stmg ...@@ -31,7 +31,7 @@ namespace stmg
class TransparentThWidgetFactory : public StdThemeWidgetFactory class TransparentThWidgetFactory : public StdThemeWidgetFactory
{ {
public: public:
TransparentThWidgetFactory(StdTheme* p1Owner); explicit TransparentThWidgetFactory(StdTheme* p1Owner);
shared_ptr<ThemeWidget> create(const shared_ptr<GameWidget>& refGameWidget shared_ptr<ThemeWidget> create(const shared_ptr<GameWidget>& refGameWidget
, double fTileWHRatio, const Glib::RefPtr<Pango::Layout>& refFontLayout) override; , double fTileWHRatio, const Glib::RefPtr<Pango::Layout>& refFontLayout) override;
......
...@@ -241,15 +241,11 @@ void GameWindow::onWindowRealize() ...@@ -241,15 +241,11 @@ void GameWindow::onWindowRealize()
} }
void GameWindow::setUp() //TODO tearDown() ???? void GameWindow::setUp() //TODO tearDown() ????
{ {
// m_bWaitingForDrawingAreaSizeAllocate = true;
// Gtk::Allocation oAllocation;
// onDrawingAreaSizeAllocate(oAllocation);
changeScreen(STATUS_MENU, s_nScreenMain); changeScreen(STATUS_MENU, s_nScreenMain);
onChangedGame(); onChangedGame();
onChangedPlayers(); onChangedPlayers();
//onChangedTheme(); onChangedTheme();
m_p0ButtonMainNewGame->grab_focus(); m_p0ButtonMainNewGame->grab_focus();
......
...@@ -59,7 +59,7 @@ protected: ...@@ -59,7 +59,7 @@ protected:
/** Constructor. /** Constructor.
* @param oMainWindowData The initialization data. * @param oMainWindowData The initialization data.
*/ */
GameWindow(MainWindowData&& oMainWindowData); explicit GameWindow(MainWindowData&& oMainWindowData);
/** Initialization. /** Initialization.
* @return Error string or empty if successful. * @return Error string or empty if successful.
......
...@@ -536,12 +536,12 @@ void PlayersDialog::onIntOptionChanged(OwnerType eOptionOwner, IntOption* p0IntO ...@@ -536,12 +536,12 @@ void PlayersDialog::onIntOptionChanged(OwnerType eOptionOwner, IntOption* p0IntO
{ {
const double fValue = p0SB->get_value(); const double fValue = p0SB->get_value();
const int32_t nValue = std::round<int32_t>(fValue); const int32_t nValue = std::round<int32_t>(fValue);
setOptionValue(eOptionOwner, p0IntOption->getName(), nValue); setOptionValue(eOptionOwner, p0IntOption->getName(), Variant{nValue});
} }
void PlayersDialog::onBoolOptionChanged(OwnerType eOptionOwner, BoolOption* p0BoolOption, Gtk::CheckButton* p0CB) void PlayersDialog::onBoolOptionChanged(OwnerType eOptionOwner, BoolOption* p0BoolOption, Gtk::CheckButton* p0CB)
{ {
const bool bValue = p0CB->get_active(); const bool bValue = p0CB->get_active();
setOptionValue(eOptionOwner, p0BoolOption->getName(), bValue); setOptionValue(eOptionOwner, p0BoolOption->getName(), Variant{bValue});
} }
void PlayersDialog::onEnumOptionChanged(OwnerType eOptionOwner, EnumOption* p0EnumOption, Gtk::RadioButton* p0RB, int32_t nEnumIdx) void PlayersDialog::onEnumOptionChanged(OwnerType eOptionOwner, EnumOption* p0EnumOption, Gtk::RadioButton* p0RB, int32_t nEnumIdx)
{ {
...@@ -551,7 +551,7 @@ void PlayersDialog::onEnumOptionChanged(OwnerType eOptionOwner, EnumOption* p0En ...@@ -551,7 +551,7 @@ void PlayersDialog::onEnumOptionChanged(OwnerType eOptionOwner, EnumOption* p0En
return; //-------------------------------------------------------------- return; //--------------------------------------------------------------
} }
int32_t nValue = p0EnumOption->getEnum(nEnumIdx); int32_t nValue = p0EnumOption->getEnum(nEnumIdx);
setOptionValue(eOptionOwner, p0EnumOption->getName(), nValue); setOptionValue(eOptionOwner, p0EnumOption->getName(), Variant{nValue});
} }
void PlayersDialog::setOptionValue(OwnerType eOptionOwner, const std::string& sOptionName, const Variant& oVar) void PlayersDialog::setOptionValue(OwnerType eOptionOwner, const std::string& sOptionName, const Variant& oVar)
{ {
......
...@@ -34,7 +34,7 @@ using std::shared_ptr; ...@@ -34,7 +34,7 @@ using std::shared_ptr;
class PlayersDialog : public Gtk::Dialog class PlayersDialog : public Gtk::Dialog
{ {
public: public:
PlayersDialog(const shared_ptr<StdConfig>& refStdConfig); explicit PlayersDialog(const shared_ptr<StdConfig>& refStdConfig);
void reInit(shared_ptr<StdPreferences>& refPrefs); void reInit(shared_ptr<StdPreferences>& refPrefs);
...@@ -104,7 +104,7 @@ private: ...@@ -104,7 +104,7 @@ private:
{ {
public: public:
KeysNotebook() = delete; KeysNotebook() = delete;
KeysNotebook(PlayersDialog* p0Dialog) explicit KeysNotebook(PlayersDialog* p0Dialog)
: Gtk::Notebook() : Gtk::Notebook()
, m_p0Dialog(p0Dialog) , m_p0Dialog(p0Dialog)
{ {
......
...@@ -370,7 +370,7 @@ bool StdView::handleXYEvent(const shared_ptr<stmi::Event>& refXYEvent, stmi::XYE ...@@ -370,7 +370,7 @@ bool StdView::handleXYEvent(const shared_ptr<stmi::Event>& refXYEvent, stmi::XYE
} }
return refITW->handleXYInput(refXYEvent, nResTeam, nResMate); return refITW->handleXYInput(refXYEvent, nResTeam, nResMate);
} }
bool StdView::isReady() bool StdView::isReady() const
{ {
return m_refTheme.operator bool(); return m_refTheme.operator bool();
} }
......
...@@ -114,7 +114,7 @@ private: ...@@ -114,7 +114,7 @@ private:
const Glib::RefPtr<Pango::Layout>& getFontLayout() { return m_refFontLayout; } const Glib::RefPtr<Pango::Layout>& getFontLayout() { return m_refFontLayout; }
// The view was initialized // The view was initialized
bool isReady(); bool isReady() const;
NRect setSize(NSize oPixSize, bool bInit); NRect setSize(NSize oPixSize, bool bInit);
...@@ -163,7 +163,7 @@ private: ...@@ -163,7 +163,7 @@ private:
struct OpenSequence struct OpenSequence
{ {
OpenSequence(int32_t nCapabilityId) explicit OpenSequence(int32_t nCapabilityId)
: m_nCapabilityId(nCapabilityId) : m_nCapabilityId(nCapabilityId)
, m_nGrabId(-1) , m_nGrabId(-1)
, m_nInteractiveIdx(-1) , m_nInteractiveIdx(-1)
......
...@@ -33,16 +33,16 @@ namespace stmg ...@@ -33,16 +33,16 @@ namespace stmg
class GameInfoCtx : public ConditionalCtx class GameInfoCtx : public ConditionalCtx
{ {
public: public:
GameInfoCtx(const shared_ptr<AppConfig>& refAppConfig, File oGameFile, XmlConditionalParser& oXmlConditionalParser) GameInfoCtx(const shared_ptr<AppConfig>& refAppConfig, const File& oGameFile, XmlConditionalParser& oXmlConditionalParser)
: ConditionalCtx(refAppConfig, s_oDummy, oXmlConditionalParser) : ConditionalCtx(refAppConfig, s_oDummy, oXmlConditionalParser)
{ {
m_oGameInfo.m_oGameFile = std::move(oGameFile); m_oGameInfo.m_oGameFile = oGameFile;
s_oDummy.clear(); s_oDummy.clear();
} }
GameInfoCtx(const shared_ptr<AppPreferences>& refAppPreferences, Named& oNamed, File oGameFile, XmlConditionalParser& oXmlConditionalParser) GameInfoCtx(const shared_ptr<AppPreferences>& refAppPreferences, Named& oNamed, const File& oGameFile, XmlConditionalParser& oXmlConditionalParser)
: ConditionalCtx(refAppPreferences, oNamed, oXmlConditionalParser) : ConditionalCtx(refAppPreferences, oNamed, oXmlConditionalParser)
{ {
m_oGameInfo.m_oGameFile = std::move(oGameFile); m_oGameInfo.m_oGameFile = oGameFile;
} }
const GameConstraints& getGameConstraints() const { return m_oGameInfo.m_oGameConstraints; } const GameConstraints& getGameConstraints() const { return m_oGameInfo.m_oGameConstraints; }
......
...@@ -32,8 +32,8 @@ namespace stmg ...@@ -32,8 +32,8 @@ namespace stmg
class LayoutCtx : public GameInfoCtx class LayoutCtx : public GameInfoCtx
{ {
public: public:
LayoutCtx(const shared_ptr<AppPreferences>& refAppPreferences, Named& oNamed, File oFile, XmlConditionalParser& oXmlConditionalParser) LayoutCtx(const shared_ptr<AppPreferences>& refAppPreferences, Named& oNamed, const File& oFile, XmlConditionalParser& oXmlConditionalParser)
: GameInfoCtx(refAppPreferences, oNamed, std::move(oFile), oXmlConditionalParser) : GameInfoCtx(refAppPreferences, oNamed, oFile, oXmlConditionalParser)
, m_nTeam(-1) , m_nTeam(-1)
, m_nMate(-1) , m_nMate(-1)
{ {
......
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
#define STMG_XML_GAME_LOADER_H #define STMG_XML_GAME_LOADER_H
#include <stmm-games-gtk/gameloader.h> #include <stmm-games-gtk/gameloader.h>
//#include <stmm-games/apppreferences.h>
//#include <stmm-games-gtk/gameconstraints.h>
#include <stmm-games-gtk/gameloader.h> #include <stmm-games-gtk/gameloader.h>
#include <vector> #include <vector>
...@@ -48,8 +46,6 @@ public: ...@@ -48,8 +46,6 @@ public:
void addXmlEventParser(unique_ptr<XmlEventParser> refXmlEventParser); void addXmlEventParser(unique_ptr<XmlEventParser> refXmlEventParser);
void addXmlGameWidgetParser(unique_ptr<XmlGameWidgetParser> refXmlGameWidgetParser); void addXmlGameWidgetParser(unique_ptr<XmlGameWidgetParser> refXmlGameWidgetParser);
// shared_ptr<XmlGameParser>& getParser() { return m_refGameParser; };
const std::vector<std::string>& getGameNames() override; const std::vector<std::string>& getGameNames() override;
std::vector<std::string> getGameNames(const AppPreferences& oAppPreferences) override; std::vector<std::string> getGameNames(const AppPreferences& oAppPreferences) override;
const GameInfo& getGameInfo(const std::string& sGameName) override; const GameInfo& getGameInfo(const std::string& sGameName) override;
......
...@@ -32,8 +32,8 @@ namespace stmg ...@@ -32,8 +32,8 @@ namespace stmg
class GameInitCtx : public LayoutCtx class GameInitCtx : public LayoutCtx
{ {
public: public:
GameInitCtx(const shared_ptr<AppPreferences>& refAppPreferences, Named& oNamed, File oFile, XmlConditionalParser& oXmlConditionalParser) GameInitCtx(const shared_ptr<AppPreferences>& refAppPreferences, Named& oNamed, const File& oFile, XmlConditionalParser& oXmlConditionalParser)
: LayoutCtx(refAppPreferences, oNamed, std::move(oFile), oXmlConditionalParser) : LayoutCtx(refAppPreferences, oNamed, oFile, oXmlConditionalParser)
{ {
} }
void setName(const std::string& sGameName) void setName(const std::string& sGameName)
......
...@@ -45,7 +45,7 @@ protected: ...@@ -45,7 +45,7 @@ protected:
/** Constructor for subclasses. /** Constructor for subclasses.
* @param sGameWidgetName The game widget element name. Cannot be empty. * @param sGameWidgetName The game widget element name. Cannot be empty.
*/ */
XmlBoxWidgetParser(const std::string& sGameWidgetName); explicit XmlBoxWidgetParser(const std::string& sGameWidgetName);
/** See parseBoxWidget with additional aSkipChildNames parameter. */ /** See parseBoxWidget with additional aSkipChildNames parameter. */
void parseBoxWidget(BoxWidget::Init& oInit, LayoutCtx& oCtx, const xmlpp::Element* p0WidgetElement); void parseBoxWidget(BoxWidget::Init& oInit, LayoutCtx& oCtx, const xmlpp::Element* p0WidgetElement);
/** Parse box widget for subclasses. /** Parse box widget for subclasses.
......
...@@ -37,7 +37,7 @@ namespace stmg ...@@ -37,7 +37,7 @@ namespace stmg
class XmlBlockParser //: private XmlCommonParser class XmlBlockParser //: private XmlCommonParser
{ {
public: public:
XmlBlockParser(XmlTraitsParser& oXmlTraitsParser) explicit XmlBlockParser(XmlTraitsParser& oXmlTraitsParser)
: m_oXmlTraitsParser(oXmlTraitsParser) : m_oXmlTraitsParser(oXmlTraitsParser)
, m_oXmlConditionalParser(oXmlTraitsParser.getXmlConditionalParser()) , m_oXmlConditionalParser(oXmlTraitsParser.getXmlConditionalParser())
{ {
......
...@@ -272,15 +272,15 @@ void XmlGameInfoParser::parseGameConstraints(ParserCtx& oCtx, const xmlpp::Eleme ...@@ -272,15 +272,15 @@ void XmlGameInfoParser::parseGameConstraints(ParserCtx& oCtx, const xmlpp::Eleme
//assert(oGameConstraints.m_nTeamsMax > 1); //assert(oGameConstraints.m_nTeamsMax > 1);
if (bTeamsPerLevelDefined && bLevelsDefined) { if (bTeamsPerLevelDefined && bLevelsDefined) {
// 1 team games considered "All teams in one level" // 1 team games considered "All teams in one level"
bATIOLDefined = true; //bATIOLDefined = true;
bATIOL = true; bATIOL = true;
} else if (bTeamsPerLevelDefined) { } else if (bTeamsPerLevelDefined) {
//assert(oGameConstraints.m_nTeamsPerLevelMax == 1); //assert(oGameConstraints.m_nTeamsPerLevelMax == 1);
bATIOLDefined = true; //bATIOLDefined = true;
bATIOL = false; bATIOL = false;
} else if (bLevelsDefined) { } else if (bLevelsDefined) {
//assert(oGameConstraints.m_nLevelsMax == 1); //assert(oGameConstraints.m_nLevelsMax == 1);
bATIOLDefined = true;