diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-11-08 06:15:08 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-11-08 06:15:08 +0000 |
| commit | 8bad37e82371bd41864903ac0d6f49808ad119bf (patch) | |
| tree | 77f0cb46059654cefb357d6eb4064c5740edf3d4 /sigbattle | |
| parent | c127c0dae65a7600e0ab30b634f25d4915c61d16 (diff) | |
| download | sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.tar.gz sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.tar.xz sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.zip | |
[FIX] No more asserts in sigmod
[FIX] Moved to using *ById instead of *Index methods in sigmod
[FIX] Tilemaps are now collaged (not completely done on the editing side yet)
[FIX] Removed the resource files (drawn natively instead)
[FIX] ATBTimer now uses the built-in QTimer in a QObject
[FIX] Coordinates are now edited on the map for warps, trainers, and effects
[FIX] Tiles are now completely scripted
[FIX] Config is now thread-safe
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@308 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigbattle')
| -rw-r--r-- | sigbattle/ATBTimer.cpp | 16 | ||||
| -rw-r--r-- | sigbattle/ATBTimer.h | 8 |
2 files changed, 9 insertions, 15 deletions
diff --git a/sigbattle/ATBTimer.cpp b/sigbattle/ATBTimer.cpp index d41b9db6..d6ae6106 100644 --- a/sigbattle/ATBTimer.cpp +++ b/sigbattle/ATBTimer.cpp @@ -31,7 +31,7 @@ #include <QtCore/QtConcurrentMap> #include <QtCore/QFuture> #include <QtCore/QMultiMap> -#include <QtCore/QTimer> +#include <QtCore/QTimerEvent> bool Sigbattle::compareTimers(TeamMember* const & member1, TeamMember* const & member2) { @@ -53,25 +53,23 @@ bool Sigbattle::isOverflowed(const TeamMember* teamMember) Sigbattle::ATBTimer::ATBTimer(ATBArena* arena, ActionQueue& actions) : QThread(arena), m_arena(arena), - m_actions(actions), - m_timer(new QTimer) + m_actions(actions) { - connect(m_timer, SIGNAL(timeout()), this, SLOT(update())); } Sigbattle::ATBTimer::~ATBTimer() { - delete m_timer; } void Sigbattle::ATBTimer::run() { - m_timer->start(50); + startTimer(50); exec(); } -void Sigbattle::ATBTimer::update() +void Sigbattle::ATBTimer::timerEvent(QTimerEvent* event) { + Q_UNUSED(event) const QList<TeamMember*> active = m_arena->active(); QList<TeamMember::RequestedAction> actions; QtConcurrent::blockingMap(active, increaseMeter); @@ -86,9 +84,9 @@ void Sigbattle::ATBTimer::update() } if (m_arena->sigmod()->rules()->pausedATB()) { - m_timer->stop(); + killTimer(event->timerId()); for (QMutableListIterator<TeamMember::RequestedAction> i(actions); i.hasNext(); i.next()) i.value().second.waitForFinished(); - m_timer->start(50); + startTimer(50); } } diff --git a/sigbattle/ATBTimer.h b/sigbattle/ATBTimer.h index 4b0fb929..5053741e 100644 --- a/sigbattle/ATBTimer.h +++ b/sigbattle/ATBTimer.h @@ -24,9 +24,6 @@ // Qt includes #include <QtCore/QThread> -// Forward declarations -class QTimer; - namespace Sigbattle { class ActionQueue; @@ -43,12 +40,11 @@ class SIGBATTLE_EXPORT ATBTimer : public QThread ~ATBTimer(); protected: void run(); - protected slots: - void update(); + + void timerEvent(QTimerEvent* event); private: ATBArena* m_arena; ActionQueue& m_actions; - QTimer* m_timer; }; SIGBATTLE_EXPORT bool compareTimers(TeamMember* const & member1, TeamMember* const & member2); |
