summaryrefslogtreecommitdiff
path: root/src/gui/npcdialog.cpp
diff options
context:
space:
mode:
authorReid <reidyaro@gmail.com>2012-01-25 22:05:36 +0100
committerReid <reidyaro@gmail.com>2012-01-25 22:05:36 +0100
commit8b612abb42853a22c1a9545e2c9280d154646543 (patch)
treef466167087c2b2de4b8aa9e6d1d1986f72f84147 /src/gui/npcdialog.cpp
parenta913dd41df61760de6ece552f941e002251ff54c (diff)
parentd340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff)
downloadmanaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz
manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2
manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz
manaplus-8b612abb42853a22c1a9545e2c9280d154646543.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/gui/npcdialog.cpp')
-rw-r--r--src/gui/npcdialog.cpp49
1 files changed, 41 insertions, 8 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 66a30c8a7..eadd99c21 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -26,6 +26,7 @@
#include "client.h"
#include "gui/setup.h"
+#include "gui/viewport.h"
#include "gui/widgets/browserbox.h"
#include "gui/widgets/button.h"
@@ -48,7 +49,7 @@
#include "debug.h"
-#define CAPTION_WAITING _("Waiting for server")
+#define CAPTION_WAITING _("Stop waiting")
#define CAPTION_NEXT _("Next")
#define CAPTION_CLOSE _("Close")
#define CAPTION_SUBMIT _("Submit")
@@ -62,7 +63,10 @@ NpcDialog::NpcDialog(int npcId) :
mDefaultInt(0),
mInputState(NPC_INPUT_NONE),
mActionState(NPC_ACTION_WAIT),
- mLastNextTime(0)
+ mLastNextTime(0),
+ mCameraMode(-1),
+ mCameraX(0),
+ mCameraY(0)
{
// Basic Window Setup
setWindowName("NpcText");
@@ -220,9 +224,9 @@ void NpcDialog::action(const gcn::ActionEvent &event)
return;
nextDialog();
- addText(_("> Next"), false);
}
- else if (mActionState == NPC_ACTION_CLOSE)
+ else if (mActionState == NPC_ACTION_CLOSE
+ || mActionState == NPC_ACTION_WAIT)
{
closeDialog();
}
@@ -301,6 +305,7 @@ void NpcDialog::nextDialog()
void NpcDialog::closeDialog()
{
+ restoreCamera();
Net::getNpcHandler()->closeDialog(mNpcId);
}
@@ -501,9 +506,37 @@ void NpcDialog::buildLayout()
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
- mButton->setEnabled(mActionState != NPC_ACTION_WAIT);
-
redraw();
mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
-} \ No newline at end of file
+}
+
+void NpcDialog::saveCamera()
+{
+ if (!viewport || mCameraMode >= 0)
+ return;
+
+ mCameraMode = viewport->getCameraMode();
+ mCameraX = viewport->getCameraRelativeX();
+ mCameraY = viewport->getCameraRelativeY();
+}
+
+void NpcDialog::restoreCamera()
+{
+ if (!viewport || mCameraMode == -1)
+ return;
+
+ if (!mCameraMode)
+ {
+ if (viewport->getCameraMode() != mCameraMode)
+ viewport->toggleCameraMode();
+ }
+ else
+ {
+ if (viewport->getCameraMode() != mCameraMode)
+ viewport->toggleCameraMode();
+ viewport->setCameraRelativeX(mCameraX);
+ viewport->setCameraRelativeY(mCameraY);
+ }
+ mCameraMode = -1;
+}