Address FR in bug #10363.

Campaigns can now declare an abbrev attribute that will be used as a
prefix to game state labels for scenarios from them.
This commit is contained in:
Eric S. Raymond 2007-11-21 02:03:24 +00:00
parent 416ad66b4b
commit 11efdbe595
15 changed files with 25 additions and 4 deletions

View file

@ -6,7 +6,8 @@
id="orcish_incursion"
icon="elves-wood/lord.png~TC(1,magenta)"
image="../data/campaigns/An_Orcish_Incursion/images/portraits/Erlornas.png"
name=_"An Orcish Incursion"
name= _" An Orcish Incursion"
abbrev= _ "AOI"
rank=15
first_scenario="1_Defend_the_Forest"
difficulties="EASY,NORMAL,HARD"

View file

@ -7,7 +7,8 @@
rank=210
#textdomain wesnoth-did
icon=units/undead-necromancers/dark-sorcerer.png~RC(magenta>black)
name=_ "Descent Into Darkness"
name= _ "Descent Into Darkness"
abbrev= _ "DID"
define=CAMPAIGN_DESCENT
first_scenario=Saving_Parthyn
difficulties=EASY,NORMAL,HARD

View file

@ -7,6 +7,7 @@
#textdomain wesnoth-ei
icon=units/human-loyalists/general.png~RC(magenta>red)
name= _ "The Eastern Invasion"
abbrev= _ "EI"
define=CAMPAIGN_EASTERN_INVASION
first_scenario=The_Outpost
difficulties=EASY,NORMAL,HARD

View file

@ -7,6 +7,7 @@
#textdomain wesnoth-httt
icon=../data/campaigns/Heir_To_The_Throne/images/units/konrad-lord-leading.png
name= _ "Heir to the Throne"
abbrev= _ "HttT:"
define=CAMPAIGN_HEIR_TO_THE_THRONE
first_scenario=01_The_Elves_Besieged
difficulties=EASY,NORMAL,HARD

View file

@ -7,6 +7,7 @@
#textdomain wesnoth-l
id=liberty
name= _ "Liberty"
abbrev= _ "Liberty"
rank=110
first_scenario=the_raid

View file

@ -6,6 +6,7 @@
#textdomain wesnoth-nr
id=northern_rebirth
name= _ "Northern Rebirth"
abbrev= _ "NR"
rank=240
first_scenario=chain_break
define=CAMPAIGN_NORTHERN_REBIRTH

View file

@ -6,6 +6,7 @@
#textdomain wesnoth-sof
icon="items/sceptre-of-fire.png"
name= _ "The Sceptre of Fire"
abbrev= _ "SoF"
rank=215
define="CAMPAIGN_SCEPTRE_FIRE"
first_scenario="1_A_Bargain_is_Struck"

View file

@ -5,6 +5,7 @@
[campaign]
#textdomain wesnoth-sotbe
name= _ "Son of the Black-Eye"
abbrev= _ "SotBE"
rank=220
first_scenario=End_Of_Peace
define=CAMPAIGN_SON_OF_THE_BLACK_EYE

View file

@ -6,6 +6,7 @@
rank=120
#textdomain wesnoth-trow
name= _ "The Rise of Wesnoth"
abbrev= _ "TRoW"
define=CAMPAIGN_THE_RISE_OF_WESNOTH
extra_defines=USE_L3_OUTLAWS,DISABLE_GRAND_MARSHAL
first_scenario=A_Summer_of_Storms

View file

@ -7,6 +7,7 @@
id=The_South_Guard
name= _ "The South Guard"
abbrev= _ "TSG"
define=CAMPAIGN_THE_SOUTH_GUARD
rank=20

View file

@ -9,6 +9,7 @@
icon="units/human-loyalists/knight.png~RC(magenta>red)"
image=../data/campaigns/Two_Brothers/images/campaign_image.png
name= _ "A Tale Of Two Brothers"
abbrev= _ "AToTB"
define="CAMPAIGN_TWO_BROTHERS"
first_scenario="1_Rooting_Out_A_Mage"
difficulties=EASY,HARD

View file

@ -11,6 +11,7 @@
#textdomain wesnoth-utbs
icon=../data/campaigns/Under_the_Burning_Suns/images/units/elves-desert/kaleh.png
name= _ "Under the Burning Suns"
abbrev= _ "UtBS"
rank=250
define=CAMPAIGN_DESERT
first_scenario=1_The_Morning_After

View file

@ -850,6 +850,7 @@ bool game_controller::new_campaign()
const config& campaign = *campaigns[cmenu.result()];
state_.campaign = campaign["id"];
state_.abbrev = campaign["abbrev"];
state_.scenario = campaign["first_scenario"];
const std::string difficulty_descriptions = campaign["difficulty_descriptions"];

View file

@ -108,6 +108,7 @@ public:
std::vector<std::string> campaign_xtra_defines; // more customization of data
std::string campaign; //!< the campaign being played
std::string abbrev; //!< the campaign abbreviation
std::string scenario; //!< the scenario being played
std::string completion; //!< running. victory, or defeat

View file

@ -322,8 +322,15 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
try {
// Preserve old label eg. replay
if (gamestate.label.empty())
gamestate.label = (*scenario)["name"];
if (gamestate.label.empty()) {
if (gamestate.abbrev.empty())
gamestate.label = (*scenario)["name"];
else {
gamestate.label = gamestate.abbrev;
gamestate.label += "-";
gamestate.label += (*scenario)["name"];
}
}
// If the entire scenario should be randomly generated
if((*scenario)["scenario_generation"] != "") {