# HG changeset patch
# User martin_bede
# Date 1357147939 -3600
# Node ID 2831c1403666fdc36c1a55ef9e877536dc96eacd
# Parent 082ccf48bc0614bcd9e6a588de797f3fb6186640
Tips are now loaded from an xml file.
diff -r 082ccf48bc06 -r 2831c1403666 QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Thu Jan 03 10:43:40 2013 +0100
+++ b/QTfrontend/hedgewars.qrc Wed Jan 02 18:32:19 2013 +0100
@@ -148,5 +148,6 @@
res/chat/ingame.png
res/splash.png
res/html/about.html
+ res/xml/tips.xml
diff -r 082ccf48bc06 -r 2831c1403666 QTfrontend/res/xml/tips.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/res/xml/tips.xml Wed Jan 02 18:32:19 2013 +0100
@@ -0,0 +1,61 @@
+# This is not xml actually, but it looks and behaves like it.
+# Including an xml library would need too much resources.
+# Tips between the platform specific tags are shown only on those platforms.
+# Do not escape characters or use the CDATA tag.
+
+ Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.
+ Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.
+ If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!
+ Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!
+ If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.
+ You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.
+ By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.
+ Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!
+ Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!
+ Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!
+ Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!
+ From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.
+ Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!
+ Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.
+ Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.
+ Connect one or more gamepads before starting the game to be able to assign their controls to your teams.
+ Create an account on http://www.hedgewars.org/ to keep others from using your most favourite nickname while playing on the official server.
+ While playing you should give yourself a short break at least once an hour.
+ If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.
+ If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.
+ We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!
+ Especially while playing online be polite and always remember there might be some minors playing with or against you as well!
+ Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!
+ The Windows version of Hedgewars supports Xfire. Make sure to add Hedgewars to its game list so your friends can see you playing.
+ You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!
+ Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.
+ No hedgehogs were harmed in making this game.
+ There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.
+ Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.
+ Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.
+ Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.
+ The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.
+ The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.
+ The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.
+ Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.
+ The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.
+ If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.
+ The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.
+ The Flame Thrower is a weapon but it can be used for tunnel digging as well.
+ Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.
+ Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.
+ Like Hedgewars? Become a fan on Facebook or follow us on Twitter
+ Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.
+ Keep your video card drivers up to date to avoid issues playing the game.
+ You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.
+
+ You can find your Hedgewars configuration files under "My Documents\Hedgewars". Create backups or take the files with you, but don't edit them by hand.
+
+
+ You can find your Hedgewars configuration files under "Library/Application Support/Hedgewars" in your home directory. Create backups or take the files with you, but don't edit them by hand.
+
+
+ lintip
+ You can find your Hedgewars configuration files under ".hedgewars" in your home directory. Create backups or take the files with you, but don't edit them by hand.
+
+
diff -r 082ccf48bc06 -r 2831c1403666 QTfrontend/ui/page/pagemain.cpp
--- a/QTfrontend/ui/page/pagemain.cpp Thu Jan 03 10:43:40 2013 +0100
+++ b/QTfrontend/ui/page/pagemain.cpp Wed Jan 02 18:32:19 2013 +0100
@@ -149,64 +149,41 @@
QString PageMain::randomTip() const
{
+#ifdef _WIN32
+ int platform = 1;
+#elif defined __APPLE__
+ int platform = 2;
+#else
+ int platform = 3;
+#endif
QStringList Tips;
- Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips");
- Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips");
- Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips");
- Tips << tr("Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips");
- Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips");
- Tips << tr("You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.", "Tips");
- Tips << tr("By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.", "Tips");
- Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!", "Tips");
- Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!", "Tips");
- Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!", "Tips");
- Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!", "Tips");
- Tips << tr("From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.", "Tips");
- Tips << tr("Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!", "Tips");
- Tips << tr("Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.", "Tips");
- Tips << tr("Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.", "Tips");
- Tips << tr("Connect one or more gamepads before starting the game to be able to assign their controls to your teams.", "Tips");
- Tips << tr("Create an account on %1 to keep others from using your most favourite nickname while playing on the official server.", "Tips").arg("http://www.hedgewars.org/");
- Tips << tr("While playing you should give yourself a short break at least once an hour.", "Tips");
- Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.", "Tips");
- Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.", "Tips");
- Tips << tr("We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!", "Tips");
- Tips << tr("Especially while playing online be polite and always remember there might be some minors playing with or against you as well!", "Tips");
- Tips << tr("Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!", "Tips");
- Tips << tr("The Windows version of Hedgewars supports Xfire. Make sure to add Hedgewars to its game list so your friends can see you playing.", "Tips");
- Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips");
- Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips");
- Tips << tr("No hedgehogs were harmed in making this game.", "Tips");
- Tips << tr("There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.", "Tips");
- Tips << tr("Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.", "Tips");
- Tips << tr("Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.", "Tips");
- Tips << tr("Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.", "Tips");
- Tips << tr("The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.", "Tips");
- Tips << tr("The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.", "Tips");
- Tips << tr("The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.", "Tips");
- Tips << tr("Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.", "Tips");
- Tips << tr("The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.", "Tips");
- Tips << tr("If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.", "Tips");
- Tips << tr("The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.", "Tips");
- Tips << tr("The Flame Thrower is a weapon but it can be used for tunnel digging as well.", "Tips");
- Tips << tr("Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.", "Tips");
- Tips << tr("Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.", "Tips");
- Tips << tr("Like Hedgewars? Become a fan on %1 or follow us on %2!", "Tips").arg("Facebook").arg("Twitter");
- Tips << tr("Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.", "Tips");
- Tips << tr("Really want to wear a specific hat? Donate to us and receive an exclusive hat of your choice!", "Tips");
+ QFile file(":/res/xml/tips.xml");
+ file.open(QIODevice::ReadOnly);
+ QTextStream in(&file);
+ QString line = in.readLine();
+ int tip_platform = 0;
+ while (!line.isNull()) {
+ if(line.contains("", Qt::CaseSensitive))
+ tip_platform = 1;
+ if(line.contains("", Qt::CaseSensitive))
+ tip_platform = 2;
+ if(line.contains("", Qt::CaseSensitive))
+ tip_platform = 3;
+ if(line.contains("", Qt::CaseSensitive) ||
+ line.contains("", Qt::CaseSensitive) ||
+ line.contains("", Qt::CaseSensitive)) {
+ tip_platform = 0;
+ }
+ QStringList split_string = line.split(QRegExp("?tip>"));
+ if((tip_platform == platform || tip_platform == 0) && split_string.size() != 1)
+ Tips << tr(split_string[1].toLatin1().data(), "Tips");
+ line = in.readLine();
+ }
// The following tip will require links to app store entries first.
//Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg("");
// the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866
- Tips << tr("Keep your video card drivers up to date to avoid issues playing the game.", "Tips");
- Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips");
-#ifdef _WIN32
- Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips");
-#elif defined __APPLE__
- Tips << tr("You can find your Hedgewars configuration files under \"Library/Application Support/Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips");
-#else
- Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips");
-#endif
+ file.close();
return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
}