--- a/ChangeLog.txt Tue Mar 06 15:21:36 2018 -0500
+++ b/ChangeLog.txt Wed Mar 07 10:44:30 2018 +0100
@@ -18,6 +18,7 @@
Frontend:
+ Schemes are now stored in separate files under Schemes
+ + Lead player to training missions when starting Hedgewars the first time
* Fix broken preview of team hats (e.g. cap_team)
Content:
--- a/QTfrontend/hwform.cpp Tue Mar 06 15:21:36 2018 -0500
+++ b/QTfrontend/hwform.cpp Wed Mar 07 10:44:30 2018 +0100
@@ -646,6 +646,11 @@
GoToPage(ID_PAGE_VIDEOS);
}
+void HWForm::GoToTraining()
+{
+ GoToPage(ID_PAGE_TRAINING);
+}
+
//TODO: maybe find a better place for this?
QString HWForm::stringifyPageId(quint32 id)
{
--- a/QTfrontend/hwform.h Tue Mar 06 15:21:36 2018 -0500
+++ b/QTfrontend/hwform.h Wed Mar 07 10:44:30 2018 +0100
@@ -66,6 +66,7 @@
void setButtonDescription(QString desc);
void backDescription();
void GoToVideos();
+ void GoToTraining();
void NetConnectQuick(const QString & host, quint16 port);
void PlayDemoQuick(const QString & demofilename);
--- a/QTfrontend/main.cpp Tue Mar 06 15:21:36 2018 -0500
+++ b/QTfrontend/main.cpp Wed Mar 07 10:44:30 2018 +0100
@@ -51,6 +51,8 @@
#include <QSplashScreen>
#endif
+#include <QMessageBox>
+
// Program resources
#ifdef __APPLE__
static CocoaInitializer * cocoaInit = NULL;
@@ -311,6 +313,8 @@
return 1;
}
+ bool isProbablyNewPlayer = false;
+
// setup PhysFS
engine = new FileEngineHandler(argv[0]);
engine->mount(datadir->absolutePath());
@@ -325,6 +329,23 @@
QSettings settings(DataManager::instance().settingsFileName(), QSettings::IniFormat);
settings.setIniCodec("UTF-8");
+ // Heuristic to figure out if the user is (probably) a first-time player.
+ // If nickname is not set, then probably yes.
+ // The hidden setting firstLaunch is, if present, used to force HW to
+ // treat iself as if it were launched the first time.
+ QString nick = settings.value("net/nick", QString()).toString();
+ if (settings.contains("frontend/firstLaunch"))
+ {
+ isProbablyNewPlayer = settings.value("frontend/firstLaunch").toBool();
+ }
+ else
+ {
+ isProbablyNewPlayer = nick.isNull();
+ }
+
+ // Set firstLaunch to false to make sure we remember we have been launched before.
+ settings.setValue("frontend/firstLaunch", false);
+
QString cc = settings.value("misc/locale", QString()).toString();
if (cc.isEmpty())
{
@@ -398,6 +419,23 @@
#endif
app.form->show();
+ // Show welcome message for (suspected) first-time player and
+ // point towards the Training menu.
+ if(isProbablyNewPlayer) {
+ QMessageBox questionTutorialMsg(app.form);
+ questionTutorialMsg.setIcon(QMessageBox::Question);
+ questionTutorialMsg.setWindowTitle(QMessageBox::tr("Welcome to Hedgewars"));
+ questionTutorialMsg.setText(QMessageBox::tr("Welcome to Hedgewars!\n\nYou seem to be new around here. Would you like to play some training missions first to learn the basics of Hedgewars?"));
+ questionTutorialMsg.setWindowModality(Qt::WindowModal);
+ questionTutorialMsg.addButton(QMessageBox::Yes);
+ questionTutorialMsg.addButton(QMessageBox::No);
+
+ int answer = questionTutorialMsg.exec();
+ if (answer == QMessageBox::Yes) {
+ app.form->GoToTraining();
+ }
+ }
+
if (app.urlString)
app.fakeEvent();
return app.exec();