summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-21 20:40:07 +0100
committerChuck Miller <shadowmil@gmail.com>2010-02-21 17:05:40 -0500
commitc8b0d1e56f27c3141895d28b2fc768afffe7bb2d (patch)
tree0a03458836badee3e1b0da13a0721c9261e7fa86 /src/gui/updatewindow.cpp
parent204a14c91bbe4436eb3b26bebf30cbe5669bdd1a (diff)
downloadmana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.tar.gz
mana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.tar.bz2
mana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.tar.xz
mana-c8b0d1e56f27c3141895d28b2fc768afffe7bb2d.zip
Made tick counter and framerate limiter work during login sequence
Much code was moved from main() to the new Client::exec(). This new event loop now integrates with the Game class, so that the tick counter and framerate limiter apply universally. The Client class is also responsible for some things that used to be global variables. Mantis-issue: ...
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 1d5f001a..743f3936 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -21,9 +21,9 @@
#include "gui/updatewindow.h"
+#include "client.h"
#include "configuration.h"
#include "log.h"
-#include "main.h"
#include "gui/sdlinput.h"
@@ -223,7 +223,7 @@ void UpdaterWindow::action(const gcn::ActionEvent &event)
}
else if (event.getId() == "play")
{
- state = STATE_LOAD_DATA;
+ Client::setState(STATE_LOAD_DATA);
}
}
@@ -234,7 +234,7 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
if (key.getValue() == Key::ESCAPE)
{
action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
- state = STATE_WORLD_SELECT;
+ Client::setState(STATE_WORLD_SELECT);
}
else if (key.getValue() == Key::ENTER)
{
@@ -296,15 +296,18 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status,
float progress = (float) dn / dt;
- if (progress != progress) progress = 0.0f; // check for NaN
- if (progress < 0.0f) progress = 0.0f; // no idea how this could ever happen, but why not check for it anyway.
- if (progress > 1.0f) progress = 1.0f;
+ if (progress != progress)
+ progress = 0.0f; // check for NaN
+ if (progress < 0.0f)
+ progress = 0.0f; // no idea how this could ever happen, but why not check for it anyway.
+ if (progress > 1.0f)
+ progress = 1.0f;
uw->setLabel(
uw->mCurrentFile + " (" + toString((int) (progress * 100)) + "%)");
uw->setProgress(progress);
- if (state != STATE_UPDATE || uw->mDownloadStatus == UPDATE_ERROR)
+ if (Client::getState() != STATE_UPDATE || uw->mDownloadStatus == UPDATE_ERROR)
{
// If the action was canceled return an error code to stop the mThread
return -1;