Commit forcemstr patch #3654,
http://savannah.nongnu.org/patch/?func=detailitem&item_id=3654
This commit is contained in:
parent
211212c183
commit
4a9da17a81
3 changed files with 23 additions and 8 deletions
|
@ -72,11 +72,13 @@ void receive_gamelist(display& disp, config& data)
|
|||
class wait_for_start : public lobby::dialog
|
||||
{
|
||||
public:
|
||||
wait_for_start(display& disp, config& cfg, const game_data& data, int team_num,
|
||||
const std::string& team_name, const std::string& team_leader)
|
||||
wait_for_start(display& disp, const config& game_config, config& cfg,
|
||||
const game_data& data, int team_num, const std::string& team_name,
|
||||
const std::string& team_leader)
|
||||
: status(START_GAME), got_side(false), team(team_num),
|
||||
name(team_name), leader(team_leader), disp_(disp), sides_(cfg),
|
||||
units_data_(data), cancel_button_(NULL), menu_(NULL)
|
||||
name(team_name), leader(team_leader), disp_(disp),
|
||||
game_config_(game_config), sides_(cfg), units_data_(data),
|
||||
cancel_button_(NULL), menu_(NULL)
|
||||
{
|
||||
SDL_Rect empty_rect = {0,0,0,0};
|
||||
area_ = empty_rect;
|
||||
|
@ -89,13 +91,14 @@ public:
|
|||
}
|
||||
|
||||
std::vector<std::string> details;
|
||||
const config* const era_cfg = game_config_.find_child("era","id",sides_["era"]);
|
||||
|
||||
const config::child_list& sides = sides_.get_children("side");
|
||||
for(config::child_list::const_iterator s = sides.begin(); s != sides.end(); ++s) {
|
||||
const config& sd = **s;
|
||||
|
||||
std::string description = sd["description"];
|
||||
std::string side_name = sd["name"];
|
||||
std::string side_name = (*(era_cfg->find_child("multiplayer_side", "id", sd["id"])))["name"];
|
||||
std::string leader_type = sd["type"];
|
||||
|
||||
if(first && (s - sides.begin() == size_t(team-1))) {
|
||||
|
@ -224,7 +227,7 @@ private:
|
|||
display& disp_;
|
||||
config& sides_;
|
||||
const game_data& units_data_;
|
||||
|
||||
const config& game_config_;
|
||||
util::scoped_ptr<gui::button> cancel_button_;
|
||||
util::scoped_ptr<gui::menu> menu_;
|
||||
std::deque<config> data_;
|
||||
|
@ -489,6 +492,7 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
|
|||
wassert(choice < possible_sides.size());
|
||||
|
||||
const config& chosen_side = *possible_sides[choice];
|
||||
response["id"] = chosen_side["id"];
|
||||
team_name = response["name"] = chosen_side["name"];
|
||||
if(leader.empty()) {
|
||||
team_leader = response["type"] = chosen_side["type"];
|
||||
|
@ -502,7 +506,7 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
|
|||
network::send_data(response);
|
||||
}
|
||||
|
||||
wait_for_start waiter(disp,sides,units_data,team_num,team_name,team_leader);
|
||||
wait_for_start waiter(disp,cfg,sides,units_data,team_num,team_name,team_leader);
|
||||
std::vector<std::string> messages;
|
||||
config game_data;
|
||||
lobby::RESULT dialog_res = lobby::CONTINUE;
|
||||
|
|
|
@ -218,6 +218,9 @@ int mp_connect::load_map(const std::string& era, config& scenario_data, int num_
|
|||
if(side["share_view"].empty())
|
||||
side["share_view"] = share_view ? "yes" : "no";
|
||||
|
||||
if(side["id"].empty())
|
||||
side["id"] = (*possible_sides.front())["id"];
|
||||
|
||||
if(side["name"].empty())
|
||||
side["name"] = (*possible_sides.front())["name"];
|
||||
|
||||
|
@ -282,6 +285,7 @@ void mp_connect::lists_init()
|
|||
|
||||
for(std::vector<config*>::const_iterator race = possible_sides.begin(); race != possible_sides.end(); ++race) {
|
||||
player_races_.push_back((**race)["name"]);
|
||||
possible_faction_ids_.push_back((**race)["id"]);
|
||||
}
|
||||
|
||||
//Teams
|
||||
|
@ -515,6 +519,7 @@ void mp_connect::clear_area()
|
|||
combos_color_.clear();
|
||||
sliders_gold_.clear();
|
||||
labels_gold_.clear();
|
||||
possible_faction_ids_.clear();
|
||||
|
||||
ai_.hide();
|
||||
launch_.hide();
|
||||
|
@ -572,7 +577,7 @@ void mp_connect::gui_update()
|
|||
|
||||
//Player Faction
|
||||
for (size_t m = 0; m != player_races_.size(); ++m) {
|
||||
if (side["name"] == player_races_[m]) {
|
||||
if (side["id"] == possible_faction_ids_[m]) {
|
||||
if (combos_race_[n].selected() != m) {
|
||||
combos_race_[n].set_selected(m);
|
||||
|
||||
|
@ -751,6 +756,7 @@ lobby::RESULT mp_connect::process()
|
|||
while((**side)["random_faction"] == "yes" && ntry < 1000) {
|
||||
const int choice = rand()%real_sides.size();
|
||||
|
||||
(**side)["id"] = (*real_sides[choice])["id"];
|
||||
(**side)["name"] = (*real_sides[choice])["name"];
|
||||
(**side)["random_faction"] = (*real_sides[choice])["random_faction"];
|
||||
|
||||
|
@ -987,6 +993,10 @@ void mp_connect::update_network()
|
|||
pos->first->values["description"] = cfg["description"];
|
||||
}
|
||||
|
||||
if(cfg["id"].empty() == false) {
|
||||
pos->first->values["id"] = cfg["id"];
|
||||
}
|
||||
|
||||
if(cfg["name"].empty() == false) {
|
||||
pos->first->values["name"] = cfg["name"];
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ private:
|
|||
|
||||
//std::vector<std::vector<std::string> > player_leaders_;
|
||||
std::vector<leader_list_manager> player_leaders_;
|
||||
std::vector<std::string> possible_faction_ids_;
|
||||
|
||||
std::vector<std::string> team_names_;
|
||||
std::vector<int> team_indices_;
|
||||
|
|
Loading…
Add table
Reference in a new issue