Disable gfMoreWind for land objects on turn end only after a fixed-time delay
15s sounds much, but it's the average amount for gfMineStrike mines to settle
naturally. And it would be very confusing to see falling mines suddenly not
caring about gfMoreWind for no apparent reason.
Note this whole thing is a giant hack anyway, to prevent a turn being
blocked by infinitely bouncing mines.
The better solution would be to help gfMoreWind-affected land objects settle
naturally more reliably even under extreme wind.
But this commit is "good enough" for now.
If you don't like the delay, you can always tweak the constant.
#ifndef GAMEVIEW_H
#define GAMEVIEW_H
#include <QQuickItem>
#include <QPointer>
#include <QScopedPointer>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLShaderProgram>
#include "engine_instance.h"
class GameViewRenderer : public QObject, protected QOpenGLFunctions {
Q_OBJECT
public:
explicit GameViewRenderer();
~GameViewRenderer() override;
void tick(quint32 delta);
void setEngineInstance(EngineInstance* engineInstance);
public slots:
void paint();
void onViewportSizeChanged(QQuickWindow* window);
private:
quint32 m_delta;
QPointer<EngineInstance> m_engineInstance;
};
class GameView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(EngineInstance* engineInstance READ engineInstance WRITE
setEngineInstance NOTIFY engineInstanceChanged)
public:
explicit GameView(QQuickItem* parent = nullptr);
Q_INVOKABLE void tick(quint32 delta);
EngineInstance* engineInstance() const;
signals:
void engineInstanceChanged(EngineInstance* engineInstance);
public slots:
void sync();
void cleanup();
void setEngineInstance(EngineInstance* engineInstance);
private slots:
void handleWindowChanged(QQuickWindow* win);
private:
quint32 m_delta;
QScopedPointer<GameViewRenderer> m_renderer;
bool m_windowChanged;
QPointer<EngineInstance> m_engineInstance;
QSize m_viewportSize;
QPoint m_centerPoint;
};
#endif // GAMEVIEW_H