Added the "generate_description" variable in the [unit] tag.
If set to yes, this tag automatically generates a user_description for a unit. Fixed scenarios so they do not include translatable user_descriptions corresponding to the unit descriptions, but instead use a generated description.
This commit is contained in:
parent
048729c065
commit
0200f44e86
10 changed files with 44 additions and 36 deletions
|
@ -112,6 +112,11 @@ name=moveto
|
|||
gold=40
|
||||
income=10
|
||||
enemy=1
|
||||
[unit]
|
||||
x,y=12,13
|
||||
type=Orcish Archer
|
||||
generate_description=yes
|
||||
[/unit]
|
||||
[/side]
|
||||
|
||||
[item]
|
||||
|
@ -123,6 +128,7 @@ name=moveto
|
|||
id=northerners_unleashed
|
||||
text="Northerners unleashed!"
|
||||
[/label]
|
||||
|
||||
[event]
|
||||
name=moveto
|
||||
first_time_only=no
|
||||
|
@ -140,8 +146,13 @@ name=moveto
|
|||
{VARIABLE_OP xx1 random 10..20}
|
||||
{VARIABLE_OP yy1 random 10..17}
|
||||
|
||||
#{UNIT (Orcish Warlord) (Bozo) ( "Orcish bozo" ) 2 $xx1 $yy1}
|
||||
{UNIT (Orcish Warlord) (Bozo) ( "Orcish bozo" ) 2 10 10}
|
||||
[unit]
|
||||
side=1
|
||||
x,y=$xx1,$yy1
|
||||
type=Orcish Warlord
|
||||
description=Bozo
|
||||
generate_description=yes
|
||||
[/unit]
|
||||
|
||||
[message]
|
||||
speaker=Bozo
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
[/message]
|
||||
[unit]
|
||||
description=Royal Guard
|
||||
user_description= _ "Royal Guard"
|
||||
generate_description=yes
|
||||
type=Royal Guard
|
||||
x=10
|
||||
y=18
|
||||
|
|
|
@ -225,7 +225,7 @@ SE - Fort Tahn"
|
|||
[/filter]
|
||||
[unit]
|
||||
description=Orcish Archer
|
||||
user_description= _ "Orcish Archer"
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
@ -236,7 +236,7 @@ SE - Fort Tahn"
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Orcish Grunt
|
||||
user_description= _ "Orcish Grunt"
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
@ -248,7 +248,7 @@ SE - Fort Tahn"
|
|||
#ifdef HARD
|
||||
[unit]
|
||||
description=Orcish Archer
|
||||
user_description= _ "Orcish Archer"
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
@ -285,7 +285,7 @@ SE - Fort Tahn"
|
|||
[/filter]
|
||||
[unit]
|
||||
description=Wolf Rider
|
||||
user_description= _ "Wolf Rider"
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
@ -296,7 +296,7 @@ SE - Fort Tahn"
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Troll Whelp
|
||||
user_description= _ "Troll Whelp"
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
@ -307,7 +307,7 @@ SE - Fort Tahn"
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Orcish Archer
|
||||
user_description= _ "Orcish Archer"
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
@ -319,7 +319,7 @@ SE - Fort Tahn"
|
|||
#ifdef HARD
|
||||
[unit]
|
||||
description=Troll Whelp
|
||||
user_description= _ "Troll Whelp"
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
[unit]
|
||||
type=Royal Guard
|
||||
description=Royal Guard
|
||||
user_description= _ "Royal Guard"
|
||||
generate_description=yes
|
||||
ai_special=guardian
|
||||
x={X}
|
||||
y={Y}
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
[unit]
|
||||
type=Royal Guard
|
||||
description=Royal Guard
|
||||
user_description= _ "Royal Guard"
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=11
|
||||
y=18
|
||||
|
@ -150,7 +150,7 @@
|
|||
[unit]
|
||||
type=Royal Guard
|
||||
description=Royal Guard
|
||||
user_description= _ "Royal Guard"
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=11
|
||||
y=19
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
|
||||
[unit]
|
||||
description=Dwarvish Guardsman
|
||||
user_description= _ "Dwarvish Guardsman"
|
||||
generate_description=yes
|
||||
type=Dwarvish Guardsman
|
||||
x=15
|
||||
y=22
|
||||
|
@ -131,7 +131,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Fighter
|
||||
user_description= _ "Dwarvish Fighter"
|
||||
generate_description=yes
|
||||
type=Dwarvish Fighter
|
||||
x=10
|
||||
y=22
|
||||
|
@ -143,7 +143,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Guardsman
|
||||
user_description= _ "Dwarvish Guardsman"
|
||||
generate_description=yes
|
||||
type=Dwarvish Guardsman
|
||||
x=13
|
||||
y=20
|
||||
|
@ -155,7 +155,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Fighter
|
||||
user_description= _ "Dwarvish Fighter"
|
||||
generate_description=yes
|
||||
type=Dwarvish Fighter
|
||||
x=11
|
||||
y=20
|
||||
|
@ -167,7 +167,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Guardsman
|
||||
user_description= _ "Dwarvish Guardsman"
|
||||
generate_description=yes
|
||||
type=Dwarvish Guardsman
|
||||
x=13
|
||||
y=19
|
||||
|
@ -179,7 +179,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Fighter
|
||||
user_description= _ "Dwarvish Fighter"
|
||||
generate_description=yes
|
||||
type=Dwarvish Fighter
|
||||
x=11
|
||||
y=19
|
||||
|
@ -191,7 +191,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Guardsman
|
||||
user_description= _ "Dwarvish Guardsman"
|
||||
generate_description=yes
|
||||
type=Dwarvish Guardsman
|
||||
x=8
|
||||
y=20
|
||||
|
@ -203,7 +203,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Fighter
|
||||
user_description= _ "Dwarvish Fighter"
|
||||
generate_description=yes
|
||||
type=Dwarvish Fighter
|
||||
x=17
|
||||
y=19
|
||||
|
@ -215,7 +215,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Guardsman
|
||||
user_description= _ "Dwarvish Guardsman"
|
||||
generate_description=yes
|
||||
type=Dwarvish Guardsman
|
||||
x=15
|
||||
y=16
|
||||
|
@ -227,7 +227,7 @@
|
|||
[/unit]
|
||||
[unit]
|
||||
description=Dwarvish Fighter
|
||||
user_description= _ "Dwarvish Fighter"
|
||||
generate_description=yes
|
||||
type=Dwarvish Fighter
|
||||
x=9
|
||||
y=16
|
||||
|
|
|
@ -212,7 +212,7 @@ mhhhghggggghghghghgvggghhhhhm
|
|||
#define STONE_GRUNT X Y
|
||||
[unit]
|
||||
description=Orcish Grunt
|
||||
user_description= _ "Orcish Grunt"
|
||||
generate_description=yes
|
||||
side=4
|
||||
type=Orcish Grunt
|
||||
x={X}
|
||||
|
@ -229,7 +229,7 @@ mhhhghggggghghghghgvggghhhhhm
|
|||
#define STONE_GOBLIN_KNIGHT X Y
|
||||
[unit]
|
||||
description=Goblin Knight
|
||||
user_description= _ "Goblin Knight"
|
||||
generate_description=yes
|
||||
side=4
|
||||
type=Goblin Knight
|
||||
x={X}
|
||||
|
@ -246,7 +246,7 @@ mhhhghggggghghghghgvggghhhhhm
|
|||
#define STONE_TROLL X Y
|
||||
[unit]
|
||||
description=Troll
|
||||
user_description= _ "Troll"
|
||||
generate_description=yes
|
||||
side=4
|
||||
type=Troll
|
||||
x={X}
|
||||
|
|
|
@ -926,7 +926,7 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
|||
|
||||
//if we should spawn a new unit on the map somewhere
|
||||
else if(cmd == "unit") {
|
||||
unit new_unit(*game_data_ptr, cfg.get_parsed_config(), true);
|
||||
unit new_unit(*game_data_ptr, cfg.get_parsed_config());
|
||||
preferences::encountered_units().insert(new_unit.type().id());
|
||||
gamemap::location loc = cfg_to_loc(cfg);
|
||||
|
||||
|
|
|
@ -55,14 +55,14 @@ bool compare_unit_values::operator()(const unit& a, const unit& b) const
|
|||
}
|
||||
|
||||
//constructor for reading a unit
|
||||
unit::unit(const game_data& data, const config& cfg, bool generate_description) :
|
||||
unit::unit(const game_data& data, const config& cfg) :
|
||||
state_(STATE_NORMAL),
|
||||
moves_(0), user_end_turn_(false), facingLeft_(true),
|
||||
resting_(false),
|
||||
recruit_(false),
|
||||
guardian_(false), upkeep_(UPKEEP_FREE)
|
||||
{
|
||||
read(data,cfg, generate_description);
|
||||
read(data,cfg);
|
||||
}
|
||||
|
||||
unit_race::GENDER unit::generate_gender(const unit_type& type, bool gen)
|
||||
|
@ -596,7 +596,7 @@ const std::vector<std::string>& unit::overlays() const
|
|||
return overlays_;
|
||||
}
|
||||
|
||||
void unit::read(const game_data& data, const config& cfg, bool generate_description)
|
||||
void unit::read(const game_data& data, const config& cfg)
|
||||
{
|
||||
std::map<std::string,unit_type>::const_iterator i = data.unit_types.find(cfg["type"]);
|
||||
if(i != data.unit_types.end())
|
||||
|
@ -635,7 +635,7 @@ void unit::read(const game_data& data, const config& cfg, bool generate_descript
|
|||
validate_side(side_);
|
||||
|
||||
description_ = cfg["user_description"];
|
||||
if(description_.empty() && generate_description)
|
||||
if(cfg["generate_description"] == "yes")
|
||||
description_ = type_->generate_description();
|
||||
|
||||
underlying_description_ = cfg["description"];
|
||||
|
|
|
@ -32,7 +32,7 @@ class unit
|
|||
public:
|
||||
friend struct unit_movement_resetter;
|
||||
|
||||
unit(const game_data& data, const config& cfg, bool generate_description=false);
|
||||
unit(const game_data& data, const config& cfg);
|
||||
unit(const unit_type* t, int side, bool use_traits=false, bool dummy_unit=false, unit_race::GENDER gender=unit_race::MALE);
|
||||
|
||||
//a constructor used when advancing a unit
|
||||
|
@ -105,11 +105,8 @@ public:
|
|||
*
|
||||
* \param data The global game_data object
|
||||
* \param cfg Configuration object from which to read the unit
|
||||
* \param generate_description If set to true, will try to generate a
|
||||
* name from the unit if the cfg object does not specify
|
||||
* one.
|
||||
*/
|
||||
void read(const game_data& data, const config& cfg, bool generate_description=false);
|
||||
void read(const game_data& data, const config& cfg);
|
||||
|
||||
void write(config& cfg) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue