summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-12 09:58:33 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-12 09:58:33 -0600
commitfbbd2edd6f33628b6e9257cf876670759f454017 (patch)
treebd9bdb358c5970786efa9f78df938170f35bd685 /src/main.cpp
parente41371d866d403260f713a06c877d24eb43ad7b3 (diff)
downloadmana-client-fbbd2edd6f33628b6e9257cf876670759f454017.tar.gz
mana-client-fbbd2edd6f33628b6e9257cf876670759f454017.tar.bz2
mana-client-fbbd2edd6f33628b6e9257cf876670759f454017.tar.xz
mana-client-fbbd2edd6f33628b6e9257cf876670759f454017.zip
Merge version strings, add version to setup, etc
All instances of version strings should now use the same text. The version label was moved from main.cpp to Desktop. A new version label was added to SetupDialog to make it easier to get the version if you are already in game.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d10403b5..a42e8b82 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -164,6 +164,20 @@ Graphics *graphics;
unsigned char state;
std::string errorMessage;
+namespace Main {
+#ifdef PACKAGE_VERSION
+#ifdef TMWSERV_SUPPORT
+const std::string version = strprintf("v%s (tmwserv)", PACKAGE_VERSION);
+#else
+const std::string version = strprintf("v%s (eAthena)", PACKAGE_VERSION);
+#endif
+#else
+const std::string version = _("Unknown Version");
+#endif
+}
+
+Desktop *desktop;
+
Sound sound;
Music *bgm;
@@ -580,10 +594,10 @@ static void printHelp()
static void printVersion()
{
#ifdef PACKAGE_VERSION
- std::cout << _("The Mana World version ") << PACKAGE_VERSION << std::endl;
+ std::cout << _("The Mana World version ") << Main::version << std::endl;
#else
- std::cout << _("The Mana World version ") <<
- _("(local build?, PACKAGE_VERSION is not defined)") << std::endl;
+ std::cout << _("The Mana World version ") << Main::version <<
+ _("(local build?)") << std::endl;
#endif
}
@@ -896,17 +910,7 @@ int main(int argc, char *argv[])
logger->setLogFile(homeDir + std::string("/tmw.log"));
// Log the tmw version
- logger->log("The Mana World %s (%s)",
-#ifdef PACKAGE_VERSION
- "v" PACKAGE_VERSION,
-#else
- "- version not defined",
-#endif
-#ifdef TMWSERV_SUPPORT
- "tmwserv");
-#else
- "eAthena");
-#endif
+ logger->log("The Mana World %s", Main::version.c_str());
initConfiguration(options);
logger->setLogToStandardOut(config.getValue("logToStandardOut", 0));
@@ -924,16 +928,8 @@ int main(int argc, char *argv[])
setupWindow = new Setup;
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
- Desktop *desktop = new Desktop;
+ desktop = new Desktop;
top->add(desktop);
-#ifdef PACKAGE_VERSION
-#ifdef TMWSERV_SUPPORT
- gcn::Label *versionLabel = new Label(strprintf("%s (tmwserv)", PACKAGE_VERSION));
-#else
- gcn::Label *versionLabel = new Label(strprintf("%s (eAthena)", PACKAGE_VERSION));
-#endif
- top->add(versionLabel, 25, 2);
-#endif
ProgressBar *progressBar = new ProgressBar(0.0f, 100, 20, 168, 116, 31);
gcn::Label *progressLabel = new Label;
top->add(progressBar, 5, top->getHeight() - 5 - progressBar->getHeight());
@@ -1477,10 +1473,6 @@ int main(int argc, char *argv[])
case STATE_GAME:
sound.fadeOutMusic(1000);
-#ifdef PACKAGE_VERSION
- delete versionLabel;
- versionLabel = NULL;
-#endif
delete progressBar;
delete progressLabel;
delete setupButton;
@@ -1571,8 +1563,8 @@ int main(int argc, char *argv[])
}
delete guiPalette;
-
- //delete Net::getGeneralHandler();
+ top->remove(desktop);
+ delete desktop;
logger->log("Quitting");
exitEngine();