Author: jhinrichs
Date: Thu Feb 11 00:00:19 2010
New Revision: 41151
URL: http://svn.gna.org/viewcvs/wesnoth?rev=41151&view=rev
Log:
Fixes players to get different colours for their side in a mp campaign,
depending on the side number. Now the side colour is made persistent and
carried over to the next scenario.
Modified:
trunk/src/gamestatus.cpp
trunk/src/playsingle_controller.cpp
trunk/src/team.hpp
Modified: trunk/src/gamestatus.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=41151&r1=41150&r2=41151&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Thu Feb 11 00:00:19 2010
@@ -220,6 +220,7 @@
(*scenario_side)["previous_recruits"] = (*carryover_side)["can_recruit"];
}
(*scenario_side)["name"] =
(*carryover_side)["name"];
+ (*scenario_side)["colour"] =
(*carryover_side)["colour"];
//add recallable units
foreach (const config* u,
carryover_side->get_children("unit")) {
scenario_side->add_child("unit", *u);
@@ -592,7 +593,6 @@
: gold_info_ngold_(0)
, gold_info_add_(false)
, leader_cfg_()
- , leader_pos_()
, level_(level)
, map_(map)
, player_cfg_(NULL)
@@ -602,7 +602,6 @@
, side_(0)
, side_cfg_(side_cfg)
, snapshot_(snapshot)
- , start_pos_()
, starting_pos_(starting_pos)
, t_(NULL)
, teams_(teams)
@@ -648,7 +647,6 @@
int gold_info_ngold_;
bool gold_info_add_;
config leader_cfg_;
- map_location leader_pos_;
const config &level_;
gamemap &map_;
const config *player_cfg_;
@@ -658,7 +656,6 @@
int side_;
const config &side_cfg_;
bool snapshot_;
- map_location start_pos_;
const config &starting_pos_;
team *t_;
std::vector<team> &teams_;
@@ -719,9 +716,7 @@
DBG_NG_TC << "player_exists: "<< (player_exists_ ? "true" :
"false") <<std::endl;
unit_configs_.clear();
- start_pos_= map_location::null_location;
seen_ids_.clear();
- leader_pos_= map_location::null_location;
leader_cfg_ = config();
}
@@ -862,17 +857,18 @@
// there was a hack: if this side tag describes the leader of
the side,
// we may replace the leader with someone from recall list who
can recruit, but take positioning from [side]
// this hack shall be removed, since it messes up with
'multiple leaders'
-
+
// If this side tag describes the leader of the side
if(!utils::string_bool(side_cfg_["no_leader"]) &&
side_cfg_["controller"] != "null") {
- // we must ensure that the 1st unit has 'canrecruit=yes'
leader_cfg_ = side_cfg_;
- if (!leader_cfg_.has_attribute("canrecruit")) {
+
+ if (!leader_cfg_.has_attribute("canrecruit")){
leader_cfg_["canrecruit"] = "yes";
}
- if (!leader_cfg_.has_attribute("placement")) {
+ if (!leader_cfg_.has_attribute("placement")){
leader_cfg_["placement"] = "map,leader";
}
+
handle_unit(leader_cfg_,"leader_cfg");
} else {
leader_cfg_ = config();
Modified: trunk/src/playsingle_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=41151&r1=41150&r2=41151&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Thu Feb 11 00:00:19 2010
@@ -904,6 +904,7 @@
if ((*side_it)["save_id"] == t.save_id()) {
(*side_it)["gold"] =
str_cast<int>(carryover_gold);
(*side_it)["gold_add"] =
end_level.carryover_add ? "yes" : "no";
+ (*side_it)["colour"] = t.colour();
break;
}
++side_it;
@@ -915,6 +916,7 @@
new_side["save_id"] = t.save_id();
new_side["gold"] =
str_cast<int>(carryover_gold);
new_side["gold_add"] = end_level.carryover_add
? "yes" : "no";
+ new_side["colour"] = t.colour();
}
// Only show the report for ourselves.
Modified: trunk/src/team.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.hpp?rev=41151&r1=41150&r2=41151&view=diff
==============================================================================
--- trunk/src/team.hpp (original)
+++ trunk/src/team.hpp Thu Feb 11 00:00:19 2010
@@ -193,6 +193,7 @@
}
team_info::CONTROLLER controller() const { return info_.controller; }
+ const std::string& colour() const { return info_.colour; }
bool is_human() const { return info_.controller == team_info::HUMAN; }
bool is_human_ai() const { return info_.controller ==
team_info::HUMAN_AI; }
bool is_network_human() const { return info_.controller ==
team_info::NETWORK; }
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits