summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-30 07:55:47 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-30 07:55:47 -0600
commitd5d10a30ceb4a9d6bbb19fe8cbcf878cd841cd53 (patch)
treeab809df771094d860c5f2b4f1ad0f1083c6a4dca /src/main.cpp
parent1c0ee2fc301d88c5c696392d9959e82e2acd0086 (diff)
downloadmana-d5d10a30ceb4a9d6bbb19fe8cbcf878cd841cd53.tar.gz
mana-d5d10a30ceb4a9d6bbb19fe8cbcf878cd841cd53.tar.bz2
mana-d5d10a30ceb4a9d6bbb19fe8cbcf878cd841cd53.tar.xz
mana-d5d10a30ceb4a9d6bbb19fe8cbcf878cd841cd53.zip
Support switching characters under eAthena
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp60
1 files changed, 37 insertions, 23 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 994ccc62..b8dc9f9b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -808,19 +808,9 @@ int main(int argc, char *argv[])
setupWindow = new Setup;
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
- Desktop *desktop = new Desktop;
- top->add(desktop);
- ProgressBar *progressBar = new ProgressBar(0.0f, 100, 20,
- gcn::Color(168, 116, 31));
- progressBar->setSmoothProgress(false);
- gcn::Label *progressLabel = new Label;
- top->add(progressBar, 5, top->getHeight() - 5 - progressBar->getHeight());
- top->add(progressLabel, 15 + progressBar->getWidth(),
- progressBar->getY() + 4);
- progressBar->setVisible(false);
- gcn::Button *setupButton = new Button(_("Setup"), "Setup", &listener);
- setupButton->setPosition(top->getWidth() - setupButton->getWidth() - 3, 3);
- top->add(setupButton);
+ Desktop *desktop;
+ ProgressBar *progressBar;
+ Button *setupButton;
sound.playMusic(branding.getValue("loginMusic", "Magick - Real.ogg"));
@@ -845,12 +835,6 @@ int main(int argc, char *argv[])
loginData.username = config.getValue("username", "");
}
- int screenWidth = (int) config.getValue("screenwidth", defaultScreenWidth);
- int screenHeight = static_cast<int>(config.getValue("screenheight",
- defaultScreenHeight));
-
- desktop->setSize(screenWidth, screenHeight);
-
if (state != STATE_ERROR)
state = STATE_CHOOSE_SERVER;
State oldstate = STATE_START; // We start with a status change
@@ -876,7 +860,7 @@ int main(int argc, char *argv[])
if (event.key.keysym.sym == SDLK_ESCAPE)
{
if (!quitDialog)
- quitDialog = new QuitDialog(NULL, &quitDialog);
+ quitDialog = new QuitDialog(&quitDialog);
else
quitDialog->requestMoveToTop();
}
@@ -922,6 +906,36 @@ int main(int argc, char *argv[])
Net::getCharHandler()->setCharInfo(&charInfo);
state = STATE_LOGIN;
}
+ else if (oldstate == STATE_START || oldstate == STATE_GAME)
+ {
+ desktop = new Desktop;
+ top->add(desktop);
+ progressBar = new ProgressBar(0.0f, 100, 20,
+ gcn::Color(168, 116, 31));
+ progressBar->setSmoothProgress(false);
+ Label *progressLabel = new Label;
+ top->add(progressBar, 5, top->getHeight() - 5 -
+ progressBar->getHeight());
+ top->add(progressLabel, 15 + progressBar->getWidth(),
+ progressBar->getY() + 4);
+ progressBar->setVisible(false);
+ setupButton = new Button(_("Setup"), "Setup", &listener);
+ setupButton->setPosition(top->getWidth() - setupButton->getWidth()
+ - 3, 3);
+ top->add(setupButton);
+
+ int screenWidth = (int) config.getValue("screenwidth",
+ defaultScreenWidth);
+ int screenHeight = (int) config.getValue("screenheight",
+ defaultScreenHeight);
+
+ desktop->setSize(screenWidth, screenHeight);
+ }
+
+ if (state == STATE_SWITCH_LOGIN && oldstate == STATE_GAME)
+ {
+ Net::getGameHandler()->clear();
+ }
if (state != oldstate)
{
@@ -1135,9 +1149,8 @@ int main(int argc, char *argv[])
delete game;
game = 0;
- state = STATE_EXIT;
-
- Net::getGeneralHandler()->unload();
+ if (state == STATE_GAME)
+ state = STATE_EXIT;
break;
@@ -1271,6 +1284,7 @@ int main(int argc, char *argv[])
case STATE_EXIT:
logger->log("State: EXIT");
+ Net::getGeneralHandler()->unload();
break;
case STATE_FORCE_QUIT: