summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-02-04 16:54:35 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-02-04 16:54:35 +0000
commit2d12043f225263004b91e256e4b0d14c4842236e (patch)
tree6dda6785e9d8853badaaa7b22f87d5ac159626e5 /src/gui
parent9dc99e1888de6194c7ce555c33245e6bff586b3d (diff)
downloadmana-client-2d12043f225263004b91e256e4b0d14c4842236e.tar.gz
mana-client-2d12043f225263004b91e256e4b0d14c4842236e.tar.bz2
mana-client-2d12043f225263004b91e256e4b0d14c4842236e.tar.xz
mana-client-2d12043f225263004b91e256e4b0d14c4842236e.zip
Unify the various login dialogs to use LoginData.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/char_server.cpp26
-rw-r--r--src/gui/char_server.h22
3 files changed, 24 insertions, 26 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index c54481f4..621dc461 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -222,7 +222,7 @@ void CharSelectDialog::attemptCharDelete()
// Request character deletion
MessageOut outMsg(mNetwork);
outMsg.writeInt16(0x0068);
- outMsg.writeInt32(mCharInfo->getEntry()->mLoginId);
+ outMsg.writeInt32(mCharInfo->getEntry()->mCharId);
outMsg.writeString("a@a.com", 40);
mCharInfo->lock();
}
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index c66d4436..876bcd0e 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -29,13 +29,27 @@
#include "listbox.h"
#include "scrollarea.h"
+#include "../logindata.h"
#include "../main.h"
#include "../serverinfo.h"
+#include "../net/network.h" // TODO this is just for iptostring, move that?
+
extern SERVER_INFO **server_info;
-ServerSelectDialog::ServerSelectDialog():
- Window("Select Server")
+/**
+ * The list model for the server list.
+ */
+class ServerListModel : public gcn::ListModel {
+ public:
+ virtual ~ServerListModel() {};
+
+ int getNumberOfElements();
+ std::string getElementAt(int i);
+};
+
+ServerSelectDialog::ServerSelectDialog(LoginData *loginData):
+ Window("Select Server"), mLoginData(loginData)
{
serverListModel = new ServerListModel();
serverList = new ListBox(serverListModel);
@@ -91,6 +105,9 @@ ServerSelectDialog::action(const std::string& eventId)
{
if (eventId == "ok") {
okButton->setEnabled(false);
+ const SERVER_INFO *si = server_info[serverList->getSelected()];
+ mLoginData->hostname = iptostring(si->address);
+ mLoginData->port = si->port;
state = CHAR_CONNECT_STATE;
}
else if (eventId == "cancel") {
@@ -98,11 +115,6 @@ ServerSelectDialog::action(const std::string& eventId)
}
}
-SERVER_INFO* ServerSelectDialog::getServerInfo()
-{
- return server_info[serverList->getSelected()];
-}
-
int
ServerListModel::getNumberOfElements()
{
diff --git a/src/gui/char_server.h b/src/gui/char_server.h
index ed6e4c14..b4112d75 100644
--- a/src/gui/char_server.h
+++ b/src/gui/char_server.h
@@ -31,18 +31,8 @@
#include "../guichanfwd.h"
-class SERVER_INFO;
-
-/**
- * The list model for the server list.
- */
-class ServerListModel : public gcn::ListModel {
- public:
- virtual ~ServerListModel() {};
-
- int getNumberOfElements();
- std::string getElementAt(int i);
-};
+class LoginData;
+class ServerListModel;
/**
* The server select dialog.
@@ -56,7 +46,7 @@ class ServerSelectDialog : public Window, public gcn::ActionListener {
*
* @see Window::Window
*/
- ServerSelectDialog();
+ ServerSelectDialog(LoginData *loginData);
/**
* Destructor.
@@ -68,12 +58,8 @@ class ServerSelectDialog : public Window, public gcn::ActionListener {
*/
void action(const std::string& eventId);
- /**
- * Returns the index of the selected server
- */
- SERVER_INFO* getServerInfo();
-
private:
+ LoginData *mLoginData;
ServerListModel *serverListModel;
gcn::ListBox *serverList;
gcn::Button *okButton;