[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth data/translations/english.cfg src/game....

From: Cedric Duval
Subject: [Wesnoth-cvs-commits] wesnoth data/translations/english.cfg src/game....
Date: Sat, 30 Oct 2004 20:37:29 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Changes by:     Cedric Duval <address@hidden>   04/10/31 00:31:59

Modified files:
        data/translations: english.cfg 
        src            : game.cpp titlescreen.cpp titlescreen.hpp 
Added files:
        data           : tips.cfg 

Log message:
        Moved tips of the day from english.cfg to their own tips.cfg file.


Index: wesnoth/data/translations/english.cfg
diff -u wesnoth/data/translations/english.cfg:1.172 
--- wesnoth/data/translations/english.cfg:1.172 Sat Oct 30 22:10:15 2004
+++ wesnoth/data/translations/english.cfg       Sun Oct 31 00:31:59 2004
@@ -144,37 +144,5 @@
 show_next_tip= _ "Next tip"
 tip_of_day= _ "Tip of the Day"
 no_tip_of_day= _ "Do not show tips"
-tip_of_day1= _ "Lawful units fight better at day, and chaotic units fight 
better at night. Neutral units are unaffected by day and night."
-tip_of_day2= _ "In a campaign, you can use veteran units from previous 
scenarios by using the 'recall' option."
-tip_of_day3= _ "There are six types of attacks: pierce, blade, impact, fire, 
cold, and holy. Different units have weaknesses against different types of 
attacks. Right-click on a unit, and then select 'Unit Description', and then 
click 'Resistance' to see how much resistance a unit has against different 
attack types."
-tip_of_day4= _ "The terrain your units are on determines the chance your 
opponents have of hitting them in battle. The defensive rating for the 
currently selected unit in the currently selected terrain is displayed in the 
top-right corner of the screen."
-tip_of_day5= _ "Poisoned units lose 8 hitpoints every turn, but they will not 
die from poison: poison will never reduce them below 1 hitpoint. Poisoned units 
can be cured by moving them to a village, or placing them next to a unit with 
the 'cure' ability."
-tip_of_day6= _ "You can use units from a previous scenario by selecting 
'Recall' by the game menu. By recalling the same units over and over, you can 
build up a powerful and experienced army."
-tip_of_day7= _ "All units have a Zone of Control in each of the hexes next to 
them. If a unit moves into an enemy's Zone of Control, it may not move any 
further that turn."
-tip_of_day8= _ "The chance to hit a unit usually depends on how well that unit 
can defend itself in the terrain it is standing in, however magical attacks 
always have a 70% chance to hit, and marksman attacks have at least 60% chance 
to hit."
-tip_of_day9= _ "Units stationed in villages heal 8 hitpoints at the beginning 
of their turn."
-tip_of_day10= _ "Units that do not move or attack during their turn rest, and 
will recover 2 hitpoints at the beginning of their next turn."
-tip_of_day11= _ "Most foot units defend better in villages and castles than in 
most other terrain, while most mounted units don't get any defensive advantage 
in villages and castles."
-tip_of_day12= _ "Horse based units are generally resistant to attacks with 
bladed or impact weapons, but are vulnerable to attacks with piercing weapons, 
including bows and spears."
-tip_of_day13= _ "Inflicting the killing blow on an enemy unit is the best way 
to gain experience. Units killing an enemy will gain 8 experience for every 
level of the unit they kill."
-tip_of_day14= _ "Elvish units move and fight very well in forest. Dwarvish 
units move and fight very well in hills and mountains."
-tip_of_day15= _ "Patience is often key. Rather than attacking in bad 
conditions, or with few troops, wait for better conditions and then attack."
-tip_of_day16= _ "If you are attacked from several directions, it may be a good 
idea to send expendable units in some directions to delay enemy units."
-tip_of_day17= _ "Do not be afraid to retreat and regroup, it is often the key 
to victory."
-tip_of_day18= _ "In most campaigns you will receive a gold bonus for finishing 
early, depending on the number of villages on the map, and the number of turns 
you finish early. You will always earn more gold this way than through 
capturing villages and waiting for turns to run out."
-tip_of_day19= _ "Your leader can recruit or recall units from any keep inside 
a castle, not just the keep they start on. You can capture a keep from an enemy 
and recruit from there. Also, some of your allies may be willing to make room 
for you on their keep so you can recruit there."
-tip_of_day20= _ "Skeletons are resistant to piercing and bladed attacks, but 
vulnerable to impact, fire, and holy attacks."
-tip_of_day21= _ "Units with leadership ability make lower level adjacent units 
on the same side fight better."
-tip_of_day22= _ "Generally avoid moving next to an unoccupied village. An 
enemy unit may move onto the village and attack you, while enjoying the defense 
and healing of the village."
-tip_of_day23= _ "Holding the mouse cursor on an ability or trait shows a 
description of that ability or trait."
-tip_of_day24= _ "Use lines of units to screen injured units to let them 
-tip_of_day25= _ "Read the hotkeys list in the preferences menu."
-tip_of_day26= _ "If you move a unit, but don't attack or discover any 
additional information, you can undo your move by pressing 'u'."
-tip_of_day27= _ "You can see how far enemy units can move by moving the mouse 
cursor over them."
-tip_of_day28= _ "Use healers to support your attacks - they will win you 
battles without needing to attack anything themselves."
-tip_of_day29= _ "The 'slow' attack ability makes enemy units move slower, but 
it also gives them one less attack than they would normally have. It is thus 
very effective against units that have a few powerful attacks."
-tip_of_day30= _ "Holy attacks are very powerful against undead."
-tip_of_day31= _ "Units are healed when they advance a level. Used wisely, this 
can turn a fight."
-tip_of_day32= _ "Charging units are best used against enemies they can kill 
with a single blow."
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.150 wesnoth/src/game.cpp:1.151
--- wesnoth/src/game.cpp:1.150  Sat Oct 30 17:20:01 2004
+++ wesnoth/src/game.cpp        Sun Oct 31 00:31:59 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.150 2004/10/30 17:20:01 gruikya Exp $ */
+/* $Id: game.cpp,v 1.151 2004/10/31 00:31:59 cedricd Exp $ */
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1481,9 +1481,11 @@
                gui::TITLE_RESULT res = game.is_loading() ? gui::LOAD_GAME : 
                int ntip = -1;
+               config tips_of_day;
                while(res == gui::TITLE_CONTINUE) {
-                       res = gui::show_title(game.disp(),&ntip);
+                       res = gui::show_title(game.disp(),tips_of_day,&ntip);
+               tips_of_day.clear();
                std::cerr << "title screen returned result\n";
                if(res == gui::QUIT_GAME) {
Index: wesnoth/src/titlescreen.cpp
diff -u wesnoth/src/titlescreen.cpp:1.27 wesnoth/src/titlescreen.cpp:1.28
--- wesnoth/src/titlescreen.cpp:1.27    Wed Oct 27 20:42:36 2004
+++ wesnoth/src/titlescreen.cpp Sun Oct 31 00:31:59 2004
@@ -1,3 +1,4 @@
+#include "config.hpp"
 #include "cursor.hpp"
 #include "display.hpp"
 #include "events.hpp"
@@ -81,49 +82,59 @@
        faded_in = true;
-const std::string& get_tip_of_day(int* ntip)
+const std::string& get_tip_of_day(const config& tips,int* ntip)
        static const std::string empty_string;
+       string_map::const_iterator it;
        if(preferences::show_tip_of_day() == false) {
                return empty_string;
-       int ntips = 0;
-       /*
-       It is probably the only part of the code where it makes sense for 
-       to send back an empty string. So let's avoid this problem while the 
"UNTBL" hack
-       is in effect. -- silene
-       while(ntips < 1000 && string_table["tip_of_day" + str_cast(ntips+1)] != 
"") {
-       */
-       while(ntips < 1000 && string_table["tip_of_day" + 
str_cast(ntips+1)].substr(0, 5) != "UNTLB") {
-               ++ntips;
-       }
+       int ntips = tips.values.size();
        if(ntips == 0) {
                return empty_string;
        if(ntip != NULL && *ntip > 0) {
-               if(*ntip > ntips) {
+               if(*ntip >= ntips) {
                        *ntip -= ntips;
-               return string_table["tip_of_day" + str_cast(*ntip)];
+               it = tips.values.begin();
+               for(int i = 0; i < *ntip; i++,it++);
+               return it->second;
-       const int tip = (rand()%ntips) + 1;
+       const int tip = (rand()%ntips);
        if(ntip != NULL) {
                *ntip = tip;
-       return string_table["tip_of_day" + str_cast(tip)];
+       it = tips.values.begin();
+       for(int i = 0; i < tip; i++,it++);
+       return it->second;
+const config get_tips_of_day()
+       config cfg;
+       std::cerr << "Loading tips of day\n";
+       try {
+               cfg.read(preprocess_file("data/tips.cfg"));
+       } catch(config::error& e) {
+               std::cerr << "Could not read tips.cfg\n";
+       }
+       return cfg;
+} //end anonymous namespace
 namespace gui {
-TITLE_RESULT show_title(display& screen, int* ntip)
+TITLE_RESULT show_title(display& screen, config& tips_of_day, int* ntip)
@@ -211,7 +222,10 @@
-       std::string tip_of_day = get_tip_of_day(ntip);
+       if(tips_of_day.empty()) {
+               tips_of_day = get_tips_of_day();
+       }
+       std::string tip_of_day = get_tip_of_day(tips_of_day,ntip);
        if(tip_of_day.empty() == false) {
                tip_of_day = font::word_wrap_text(tip_of_day,font::SIZE_NORMAL,
Index: wesnoth/src/titlescreen.hpp
diff -u wesnoth/src/titlescreen.hpp:1.4 wesnoth/src/titlescreen.hpp:1.5
--- wesnoth/src/titlescreen.hpp:1.4     Mon Jun  7 20:19:27 2004
+++ wesnoth/src/titlescreen.hpp Sun Oct 31 00:31:59 2004
@@ -8,7 +8,7 @@
-TITLE_RESULT show_title(display& screen, int* ntip);
+TITLE_RESULT show_title(display& screen, config& tips_of_day, int* ntip);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]