Applied patch 3470 : support for unrenamable units.

Made some units "unrenamable" in HttT, for demonstration. I'll let the
scenario designers apply the changes in their scenarios.
This commit is contained in:
Philippe Plantier 2004-11-01 19:43:06 +00:00
parent 55610c008d
commit e02e3ae0f5
35 changed files with 64 additions and 10 deletions

View file

@ -32,6 +32,7 @@ Defeat:
side=1
canrecruit=1
controller=human
unrenamable=1
[/side]
[side]

View file

@ -72,6 +72,7 @@ Defeat:
[side]
type=Fighter
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -31,6 +31,7 @@ Defeat:
race=Elves
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman

View file

@ -36,6 +36,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
hitpoints=45
experience=0
side=1

View file

@ -27,6 +27,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -66,6 +66,7 @@ Defeat:
type=Commander
description=Konrad
side=1
unrenamable=1
canrecruit=1
controller=human
[/side]

View file

@ -43,6 +43,7 @@ fffffffffffffcffffff"
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -34,6 +34,7 @@ Defeat:
[side]
type=Fighter
description=Konrad
unrenamable=yes
side=1
canrecruit=1
controller=human
@ -42,6 +43,7 @@ Defeat:
team_name=elves
[unit]
description=Delfador
unrenamable=yes
type=Elder Mage
experience=500
side=1

View file

@ -41,6 +41,7 @@
[side]
type=Fighter
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -29,6 +29,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -54,6 +54,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -25,6 +25,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -15,6 +15,7 @@
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -31,6 +31,7 @@ Defeat:
team_name=elves
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -33,6 +33,7 @@ Defeat:
description=Konrad
hitpoints=45
experience=0
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -39,6 +39,7 @@ Defeat:
description=Konrad
hitpoints=45
experience=0
unrenamable=1
side=1
gold=100
canrecruit=1

View file

@ -46,6 +46,7 @@ Defeat:
[side]
description=Konrad
type=Commander
unrenamable=1
side=1
canrecruit=1
recruit=Thug,Poacher,Footpad

View file

@ -30,6 +30,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -29,6 +29,7 @@ Defeat:
race=Elves
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -32,6 +32,7 @@ Defeat:
description=Konrad
hitpoints=45
experience=0
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -24,6 +24,7 @@ Defeat
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -55,6 +55,7 @@ Defeat:
race=Elves
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human
@ -64,6 +65,7 @@ Defeat:
[side]
type=Princess
description=Li'sar
unrenamable=yes
side=2
canrecruit=1
facing=reverse

View file

@ -31,6 +31,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -74,6 +74,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -30,6 +30,7 @@ Defeat
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -30,6 +30,7 @@ Defeat
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -24,6 +24,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -34,6 +34,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human
@ -249,6 +250,7 @@ Defeat:
[unit]
description=Delfador
unrenamable=yes
type=Elder Mage
x=20
y=20
@ -256,6 +258,7 @@ Defeat:
[/unit]
[unit]
description=Kalenz
unrenamable=1
type=Elvish Lord
x=20
y=19

View file

@ -29,6 +29,7 @@ Defeat:
[side]
type=Commander
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -128,6 +128,7 @@ Defeat:
[side]
type=Fighter
description=Konrad
unrenamable=1
side=1
canrecruit=1
controller=human

View file

@ -1,4 +1,5 @@
# French translations for Battle for Wesnoth package.
# vim:set encoding=utf-8:
# Copyright (C) 2004 Wesnoth development team
# This file is distributed under the same license as the Battle for Wesnoth package.
# Automatically generated, 2004.
@ -9,7 +10,7 @@ msgstr ""
"Project-Id-Version: Battle for Wesnoth\n"
"Report-Msgid-Bugs-To: http://bugs.wesnoth.org/\n"
"POT-Creation-Date: 2004-10-31 02:17+0200\n"
"PO-Revision-Date: 2004-10-31 00:40+0200\n"
"PO-Revision-Date: 2004-10-31 22:50+0100\n"
"Last-Translator: Wesnoth French Translation Team <wesnoth@ml.free.fr>\n"
"Language-Team: Language fr\n"
"MIME-Version: 1.0\n"
@ -143,7 +144,7 @@ msgstr "Afficher les déplacements ennemis"
#: src/hotkeys.cpp:151
msgid "Best Possible Enemy Moves"
msgstr "Meilleurs déplacements possibles de l'ennemi"
msgstr "Meilleurs déplacements ennemis"
#: src/hotkeys.cpp:152
msgid "Quit Editor"
@ -211,11 +212,11 @@ msgstr "Afficher le terrain"
#: src/hotkeys.cpp:168
msgid "Delay Shroud Updates"
msgstr "Différer les mises-à-jour du voile"
msgstr "Différer les mises à jour du voile"
#: src/hotkeys.cpp:169
msgid "Update Shroud Now"
msgstr "Mettre-à-jour le voile maintenant"
msgstr "Mettre à jour le voile maintenant"
#: src/hotkeys.cpp:170
msgid "Continue Move"

View file

@ -11,7 +11,7 @@ msgstr ""
"Project-Id-Version: Battle for Wesnoth\n"
"Report-Msgid-Bugs-To: http://bugs.wesnoth.org/\n"
"POT-Creation-Date: 2004-10-31 02:21+0200\n"
"PO-Revision-Date: 2004-10-31 21:21+0100\n"
"PO-Revision-Date: 2004-10-31 22:50+0100\n"
"Last-Translator: Wesnoth French Translation Team <wesnoth@ml.free.fr>\n"
"Language-Team: Language fr\n"
"MIME-Version: 1.0\n"
@ -8768,7 +8768,7 @@ msgstr "Langue"
#: src/titlescreen.cpp:174
msgid "TitleScreen button^Preferences"
msgstr "Preferences"
msgstr "Préférences"
#: src/titlescreen.cpp:176
msgid "TitleScreen button^Quit"

View file

@ -952,7 +952,10 @@ bool turn_info::can_execute_command(hotkey::HOTKEY_COMMAND command) const
return current_unit() != units_.end();
case hotkey::HOTKEY_RENAME_UNIT:
return !commands_disabled && current_unit() != units_.end() && current_unit()->second.side() == gui_.viewing_team()+1;
return !commands_disabled &&
current_unit() != units_.end() &&
!(current_unit()->second.unrenamable()) &&
current_unit()->second.side() == gui_.viewing_team()+1;
case hotkey::HOTKEY_LABEL_TERRAIN:
return !commands_disabled && map_.on_board(last_hex_) && !gui_.shrouded(last_hex_.x,last_hex_.y) && !is_observer();

View file

@ -89,7 +89,8 @@ unit::unit(const unit_type* t, int side, bool use_traits, bool dummy_unit, unit_
backupMaxMovement_(type_->movement()),
recruit_(false), attacks_(type_->attacks()),
backupAttacks_(type_->attacks()),
guardian_(false), upkeep_(UPKEEP_FULL_PRICE)
guardian_(false), upkeep_(UPKEEP_FULL_PRICE),
unrenamable_(false)
{
//dummy units used by the 'move_unit_fake' command don't need to have a side.
if(dummy_unit == false) validate_side(side_);
@ -125,7 +126,8 @@ unit::unit(const unit_type* t, const unit& u) :
attacks_(type_->attacks()), backupAttacks_(type_->attacks()),
modifications_(u.modifications_),
traitsDescription_(u.traitsDescription_),
guardian_(false), upkeep_(u.upkeep_)
guardian_(false), upkeep_(u.upkeep_),
unrenamable_(u.unrenamable_)
{
validate_side(side_);
@ -211,7 +213,9 @@ const std::string& unit::unit_description() const
void unit::rename(const std::string& new_description)
{
description_ = new_description;
if (!unrenamable_) {
description_ = new_description;
}
}
int unit::side() const
@ -229,6 +233,11 @@ void unit::set_side(int new_side)
side_ = new_side;
}
bool unit::unrenamable() const
{
return unrenamable_;
}
double unit::alpha() const
{
return type().alpha();
@ -708,6 +717,7 @@ void unit::read(const game_data& data, const config& cfg)
experience_ = atoi(experience.c_str());
resting_ = (cfg["resting"] == "yes");
unrenamable_ = (cfg["unrenamable"] == "yes");
}
void unit::write(config& cfg) const
@ -775,6 +785,7 @@ void unit::write(config& cfg) const
cfg["moves"] = buf;
cfg["resting"] = resting_ ? "yes" : "no";
cfg["unrenamable"] = unrenamable_ ? "yes" : "no";
}
void unit::assign_role(const std::string& role)

View file

@ -51,6 +51,9 @@ public:
int experience() const;
int max_experience() const;
bool get_experience(int xp);
//the name of this unit is fixed by scenario, it is impossible to
//change it.
bool unrenamable() const;
bool advances() const;
int side() const;
unit_race::GENDER gender() const;
@ -214,6 +217,8 @@ private:
UPKEEP_COST upkeep_;
bool unrenamable_;
void reset_modifications();
void apply_modifications();
void remove_temporary_modifications();