summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9e7c91c0..a7032fb1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -437,16 +437,18 @@ void init_engine(const Options &options)
state = LOGIN_STATE; /**< Initial game state */
// Initialize sound engine
- try {
- if (config.getValue("sound", 0) == 1) {
+ try
+ {
+ if (config.getValue("sound", 0) == 1)
sound.init();
- }
+
sound.setSfxVolume((int) config.getValue("sfxVolume",
defaultSfxVolume));
sound.setMusicVolume((int) config.getValue("musicVolume",
defaultMusicVolume));
}
- catch (const char *err) {
+ catch (const char *err)
+ {
state = ERROR_STATE;
errorMessage = err;
logger->log("Warning: %s", err);
@@ -830,17 +832,18 @@ int main(int argc, char *argv[])
while (state != EXIT_STATE)
{
// Handle SDL events
- while (SDL_PollEvent(&event)) {
- switch (event.type) {
+ while (SDL_PollEvent(&event))
+ {
+ switch (event.type)
+ {
case SDL_QUIT:
state = EXIT_STATE;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_ESCAPE)
- {
state = EXIT_STATE;
- }
+
break;
}
@@ -855,11 +858,10 @@ int main(int argc, char *argv[])
{
state = ERROR_STATE;
- if (!network->getError().empty()) {
+ if (!network->getError().empty())
errorMessage = network->getError();
- } else {
+ else
errorMessage = _("Got disconnected from server!");
- }
}
if (progressBar->isVisible())
@@ -882,7 +884,8 @@ int main(int argc, char *argv[])
gui->draw();
graphics->updateScreen();
- if (state != oldstate) {
+ if (state != oldstate)
+ {
switch (oldstate)
{
case UPDATE_STATE:
@@ -913,12 +916,14 @@ int main(int argc, char *argv[])
oldstate = state;
if (currentDialog && state != ACCOUNT_STATE &&
- state != CHAR_CONNECT_STATE) {
+ state != CHAR_CONNECT_STATE)
+ {
delete currentDialog;
currentDialog = NULL;
}
- switch (state) {
+ switch (state)
+ {
case LOADDATA_STATE:
logger->log("State: LOADDATA");
@@ -941,10 +946,13 @@ int main(int argc, char *argv[])
case LOGIN_STATE:
logger->log("State: LOGIN");
- if (!loginData.password.empty()) {
+ if (!loginData.password.empty())
+ {
loginData.registerLogin = false;
state = ACCOUNT_STATE;
- } else {
+ }
+ else
+ {
currentDialog = new LoginDialog(&loginData);
positionDialog(currentDialog, screenWidth,
screenHeight);
@@ -1029,9 +1037,12 @@ int main(int argc, char *argv[])
break;
case UPDATE_STATE:
- if (options.skipUpdate) {
+ if (options.skipUpdate)
+ {
state = LOADDATA_STATE;
- } else {
+ }
+ else
+ {
// Determine which source to use for the update host
if (!options.updateHost.empty())
updateHost = options.updateHost;
@@ -1109,9 +1120,8 @@ int main(int argc, char *argv[])
SDLNet_Quit();
if (nullFile)
- {
fclose(nullFile);
- }
+
logger->log("State: EXIT");
exit_engine();
PHYSFS_deinit();
@@ -1123,16 +1133,12 @@ void SetupListener::action(const gcn::ActionEvent &event)
Window *window = NULL;
if (event.getId() == "Setup")
- {
window = setupWindow;
- }
if (window)
{
window->setVisible(!window->isVisible());
if (window->isVisible())
- {
window->requestMoveToTop();
- }
}
}