summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-20 00:56:23 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-20 00:56:23 +0000
commit01591924a4f33d5a5e4a86db6c256c8ce797a820 (patch)
treea1fe33f8a28a19fddd9f4ccdf7816f85636c4bcb /src/gui
parent0841d65d15e4c318ad8f5fe4b7e257d963ef7841 (diff)
downloadmana-01591924a4f33d5a5e4a86db6c256c8ce797a820.tar.gz
mana-01591924a4f33d5a5e4a86db6c256c8ce797a820.tar.bz2
mana-01591924a4f33d5a5e4a86db6c256c8ce797a820.tar.xz
mana-01591924a4f33d5a5e4a86db6c256c8ce797a820.zip
The Network can now connect to the three servers and affected methods now take
the server type as a parameter. The MessageOut gained a convenience constructor (same as was added server side). The game states during login sequence have been renamed and redone in order to ensure no communication is attempted to unconnected servers. This allowed the removal of the outgoing message queue. Connecting to the account server has been moved before the login/register phase (dialogs will still need to be updated). Quite a few things are expected to be broken since I'm rather tired at the moment. I've left many TODO entries in the code.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp8
-rw-r--r--src/gui/connection.cpp4
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/login.cpp7
-rw-r--r--src/gui/register.cpp4
-rw-r--r--src/gui/updatewindow.cpp6
6 files changed, 16 insertions, 15 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 775ecc6f..2fa6c68e 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -139,7 +139,7 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
}
else if (eventId == "cancel")
{
- state = EXIT_STATE;
+ state = STATE_EXIT;
}
else if (eventId == "new")
{
@@ -208,7 +208,7 @@ void CharSelectDialog::attemptCharDelete()
msg.writeShort(PAMSG_CHAR_DELETE);
// TODO: Send the selected slot
msg.writeByte(0);
- network->send(msg);
+ network->send(Network::ACCOUNT, msg);
mCharInfo->lock();
}
@@ -218,7 +218,7 @@ void CharSelectDialog::attemptCharSelect()
MessageOut msg;
msg.writeShort(PAMSG_CHAR_SELECT);
msg.writeByte(mCharInfo->getPos());
- network->send(msg);
+ network->send(Network::ACCOUNT, msg);
mCharInfo->lock();
}
@@ -337,5 +337,5 @@ void CharCreateDialog::attemptCharCreate()
outMsg.writeShort(10); // INT
outMsg.writeShort(10); // DEX
outMsg.writeShort(10); // LUK
- network->send(outMsg);
+ network->send(Network::ACCOUNT, outMsg);
}
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index f7fdaca6..a29008c3 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -35,7 +35,9 @@
namespace {
struct ConnectionActionListener : public gcn::ActionListener
{
- void action(const std::string &eventId, gcn::Widget *widget) { state = EXIT_STATE; }
+ void action(const std::string &eventId, gcn::Widget *widget) {
+ state = STATE_EXIT;
+ }
} listener;
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 026f24bd..0e200db3 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -234,7 +234,7 @@ Gui::mousePress(int mx, int my, int button)
// Mouse pressed on window container (basically, the map)
// Are we in-game yet?
- if (state != GAME_STATE)
+ if (state != STATE_GAME)
return;
// Check if we are alive and kickin'
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 2f646bd1..cb16dcb4 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -147,18 +147,17 @@ LoginDialog::action(const std::string &eventId, gcn::Widget *widget)
mLoginData->remember = mKeepCheck->isMarked();
mOkButton->setEnabled(false);
- //mCancelButton->setEnabled(false);
mRegisterButton->setEnabled(false);
- state = ACCOUNT_STATE;
+ state = STATE_LOGIN_ATTEMPT;
}
}
else if (eventId == "cancel")
{
- state = EXIT_STATE;
+ state = STATE_EXIT;
}
else if (eventId == "register")
{
- state = REGISTER_STATE;
+ state = STATE_REGISTER;
}
}
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 49da10b6..52833aea 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -119,7 +119,7 @@ RegisterDialog::action(const std::string &eventId, gcn::Widget *widget)
{
if (eventId == "cancel")
{
- state = EXIT_STATE;
+ state = STATE_EXIT;
}
else if (eventId == "register")
{
@@ -205,7 +205,7 @@ RegisterDialog::action(const std::string &eventId, gcn::Widget *widget)
mLoginData->password = mPasswordField->getText();
mLoginData->email = mEmailField->getText();
- state = REGISTER_ACCOUNT_STATE;
+ state = STATE_REGISTER_ATTEMPT;
}
}
}
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 8c69d3ef..77a026fe 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -136,7 +136,7 @@ void UpdaterWindow::action(const std::string &eventId, gcn::Widget *widget)
// Skip the updating process
if (mDownloadStatus == UPDATE_COMPLETE)
{
- state = EXIT_STATE;
+ state = STATE_EXIT;
}
else
{
@@ -145,7 +145,7 @@ void UpdaterWindow::action(const std::string &eventId, gcn::Widget *widget)
}
else if (eventId == "play")
{
- state = LOGIN_STATE;
+ state = STATE_LOGIN;
}
}
@@ -198,7 +198,7 @@ int UpdaterWindow::updateProgress(void *ptr,
uw->mCurrentFile + " (" + toString((int)progress * 100) + "%)");
uw->setProgress(progress);
- if (state != UPDATE_STATE || uw->mDownloadStatus == UPDATE_ERROR)
+ if (state != STATE_UPDATE || uw->mDownloadStatus == UPDATE_ERROR)
{
// If the action was canceled return an error code to stop the mThread
return -1;