Author: ai0867
Date: Mon Feb 21 02:03:26 2011
New Revision: 48586
URL: http://svn.gna.org/viewcvs/wesnoth?rev=48586&view=rev
Log:
Add [leader] tag to [side]. Which does the exact same thing as if you'd just
place its contents in the [side] by themselves.
Modified:
trunk/changelog
trunk/data/scenario-test.cfg
trunk/src/gamestatus.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=48586&r1=48585&r2=48586&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Mon Feb 21 02:03:26 2011
@@ -36,6 +36,8 @@
* New [allow_end_turn] and [disallow_end_turn] commands to enable/disable
the human players' ability to end their turn from the user interface
(feature request #13141).
+ * [side] tags may now contain [leader] tags to create their leader(s), as
+ opposed to mixing the leader's attributes with the side attributes.
* Miscellaneous and bugfixes:
* Fixed: g++ compiler warnings.
* Added: cmake target to build the gui design pdf.
Modified: trunk/data/scenario-test.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=48586&r1=48585&r2=48586&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Mon Feb 21 02:03:26 2011
@@ -46,16 +46,18 @@
{campaigns/Under_the_Burning_Suns/utils/kaleh-abilities.cfg}
[side]
- name= "Kaleh"
- type=Kaleh
- variation=Youth
- random_gender=yes
- id="test"
+ no_leader=yes
+ [leader]
+ name= "Kaleh"
+ type=Kaleh
+ variation=Youth
+ random_gender=yes
+ id="test"
+ max_hitpoints=90
+ experience=99
+ [/leader]
side=1
- canrecruit=yes
controller=human
- max_hitpoints=90
- experience=99
recruit="Ghost,Troll Whelp,Assassin,Elvish Hero,Elvish Fighter,Elvish
Archer,Horseman,Mage,Elvish Shaman,Red
Mage,Spearman,Swordsman,Duelist,Fencer,Elvish Captain,Elvish Ranger,Elvish
Shyde,Thief,Rogue,White Mage,Mage of Light,Elvish Sharpshooter,Silver
Mage,Vampire Bat,Blood Bat,Dread Bat,Soulless,Walking Corpse"
gold=2000
team_name="1"
Modified: trunk/src/gamestatus.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=48586&r1=48585&r2=48586&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Mon Feb 21 02:03:26 2011
@@ -607,7 +607,7 @@
bool snapshot, const config &starting_pos)
: gold_info_ngold_(0)
, gold_info_add_(false)
- , leader_cfg_()
+ , leader_configs_()
, level_(level)
, map_(map)
, player_cfg_(NULL)
@@ -667,7 +667,7 @@
int gold_info_ngold_;
bool gold_info_add_;
- config leader_cfg_;
+ std::deque<config> leader_configs_;
const config &level_;
gamemap &map_;
const config *player_cfg_;
@@ -743,7 +743,6 @@
unit_configs_.clear();
seen_ids_.clear();
- leader_cfg_ = config();
}
@@ -861,6 +860,18 @@
}
}
+ void handle_leader(const config &leader)
+ {
+ leader_configs_.push_back(leader);
+
+ config::attribute_value &a1 =
leader_configs_.back()["canrecruit"];
+ if (a1.blank()) a1 = true;
+ config::attribute_value &a2 =
leader_configs_.back()["placement"];
+ if (a2.blank()) a2 = "map,leader";
+
+ handle_unit(leader_configs_.back(), "leader_cfg");
+ }
+
void leader()
{
log_step("leader");
@@ -871,16 +882,10 @@
// If this side tag describes the leader of the side
if (!side_cfg_["no_leader"].to_bool() &&
side_cfg_["controller"] != "null") {
- leader_cfg_ = side_cfg_;
-
- config::attribute_value &a1 = leader_cfg_["canrecruit"];
- if (a1.blank()) a1 = true;
- config::attribute_value &a2 = leader_cfg_["placement"];
- if (a2.blank()) a2 = "map,leader";
-
- handle_unit(leader_cfg_,"leader_cfg");
- } else {
- leader_cfg_ = config();
+ handle_leader(side_cfg_);
+ }
+ foreach (const config &l, side_cfg_.child_range("leader")) {
+ handle_leader(l);
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits