[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp multiplayer...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp multiplayer... |
Date: |
Wed, 30 Mar 2005 14:48:17 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/03/30 19:48:17
Modified files:
src : multiplayer_connect.cpp multiplayer_create.cpp
multiplayer_wait.cpp multiplayer_wait.hpp
replay.cpp tstring.cpp
Log message:
* Made era data be transmitted with games, so that clients may join
games even
if they do not have this era on their computer.
* COMMENTED OUT the statistics verification in replay.cpp. Seems that it
completely breaks MP games!
//Disabling because it breaks multiplayer.
//Apparently, statistics::replay_verify_stats
//is only written to in game::load_game() (!)
//Re-enable when fixed / if I am wrong.
//
//By the way, making a "config" object global
//is highly objectable IMO.
//
// --Ayin 30 mar. 2005
//
//if (!game_config::ignore_replay_errors)
// throw replay::error();
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.136&tr2=1.137&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_create.cpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.103&tr2=1.104&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tstring.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.136
wesnoth/src/multiplayer_connect.cpp:1.137
--- wesnoth/src/multiplayer_connect.cpp:1.136 Sun Mar 27 23:06:17 2005
+++ wesnoth/src/multiplayer_connect.cpp Wed Mar 30 19:48:16 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.136 2005/03/27 23:06:17 gruikya Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.137 2005/03/30 19:48:16 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -825,6 +825,7 @@
}
era_sides_ = era_cfg->get_children("multiplayer_side");
+ level_.add_child("era", *era_cfg);
for(std::vector<config*>::const_iterator faction = era_sides_.begin();
faction != era_sides_.end(); ++faction) {
player_factions_.push_back((**faction)["name"]);
Index: wesnoth/src/multiplayer_create.cpp
diff -u wesnoth/src/multiplayer_create.cpp:1.19
wesnoth/src/multiplayer_create.cpp:1.20
--- wesnoth/src/multiplayer_create.cpp:1.19 Sun Mar 27 23:06:17 2005
+++ wesnoth/src/multiplayer_create.cpp Wed Mar 30 19:48:16 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_create.cpp,v 1.19 2005/03/27 23:06:17 gruikya Exp $ */
+/* $Id: multiplayer_create.cpp,v 1.20 2005/03/30 19:48:16 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -123,8 +123,12 @@
}
era_combo_.set_items(eras);
- if (size_t(preferences::era()) < eras.size())
+ if (size_t(preferences::era()) < eras.size()) {
era_combo_.set_selected(preferences::era());
+ } else {
+ era_combo_.set_selected(0);
+ }
+
utils::string_map i18n_symbols;
i18n_symbols["login"] = preferences::login();
Index: wesnoth/src/multiplayer_wait.cpp
diff -u wesnoth/src/multiplayer_wait.cpp:1.22
wesnoth/src/multiplayer_wait.cpp:1.23
--- wesnoth/src/multiplayer_wait.cpp:1.22 Sat Mar 26 17:10:32 2005
+++ wesnoth/src/multiplayer_wait.cpp Wed Mar 30 19:48:17 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_wait.cpp,v 1.22 2005/03/26 17:10:32 silene Exp $ */
+/* $Id: multiplayer_wait.cpp,v 1.23 2005/03/30 19:48:17 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -196,27 +196,6 @@
}
const bool allow_changes =
(*sides_list[side_choice])["allow_changes"] != "no";
- const std::string& era = level_["era"];
- const config* const era_cfg =
game_config().find_child("era","id",era);
- if(era_cfg == NULL) {
- set_result(QUIT);
- throw network::error(_("Era not available"));
- return;
- }
- era_sides_ = *era_cfg;
-
- const config::child_list& possible_sides =
era_cfg->get_children("multiplayer_side");
- if(possible_sides.empty()) {
- set_result(QUIT);
- throw network::error(_("No multiplayer sides found"));
- return;
- }
-
- std::vector<std::string> choices;
- for(config::child_list::const_iterator side =
- possible_sides.begin(); side !=
possible_sides.end(); ++side) {
- choices.push_back((**side)["name"]);
- }
//if the client is allowed to choose their team, instead of
having
//it set by the server, do that here.
@@ -224,17 +203,36 @@
size_t faction_choice = 0;
if(allow_changes) {
+ const config* era = level_.child("era");
+ if(era == NULL)
+ throw network::error(_("Era not available"));
+ const config::child_list& possible_sides =
+ era->get_children("multiplayer_side");
+ if(possible_sides.empty()) {
+ set_result(QUIT);
+ throw network::error(_("No multiplayer sides
found"));
+ return;
+ }
+
+ std::vector<std::string> choices;
+ for(config::child_list::const_iterator side =
+ possible_sides.begin(); side !=
+ possible_sides.end(); ++side) {
+ choices.push_back((**side)["name"]);
+ }
+
std::vector<gui::preview_pane* > preview_panes;
- leader_preview_pane leader_selector(disp(),
&game_data_, possible_sides);
+ leader_preview_pane leader_selector(disp(),
&game_data_,
+ possible_sides);
preview_panes.push_back(&leader_selector);
- faction_choice = size_t(gui::show_dialog(disp(), NULL,
"", _("Choose your side:"),
+ faction_choice = size_t(gui::show_dialog(disp(), NULL,
"",
+ _("Choose your side:"),
gui::OK_ONLY, &choices,
&preview_panes));
leader_choice = leader_selector.get_selected_leader();
- }
- wassert(faction_choice < possible_sides.size());
- //team_ = faction_choice;
+ wassert(faction_choice < possible_sides.size());
+ }
config response;
response["side"] = lexical_cast<std::string>(side_choice + 1);
@@ -270,8 +268,6 @@
}
}
- // FIXME: To be reviewed
-
//any replay data is only temporary and should be removed from
//the level data in case we want to save the game later
config* const replay_data = level_.child("replay");
@@ -368,15 +364,8 @@
std::string description = sd["description"];
const std::string faction_id = sd["id"];
- const config* const faction_cfg =
- era_sides_.find_child("multiplayer_side", "id",
faction_id);
- std::string side_name;
- if (faction_cfg != NULL) {
- side_name = (*faction_cfg)["name"];
- } else {
- side_name = sd["name"];
- }
-
+
+ t_string side_name = sd["name"];
std::string leader_type = sd["type"];
// Hack: if there is a unit which can recruit, use it as a
@@ -405,10 +394,11 @@
if (!leader_image.empty()) {
// Dumps the "image" part of the faction name, if any,
// to replace it by a picture of the actual leader
- if(side_name[0] == font::IMAGE) {
- std::string::size_type p =
side_name.find_first_of(COLUMN_SEPARATOR);
+ if(side_name.str()[0] == font::IMAGE) {
+ std::string::size_type p =
+
side_name.str().find_first_of(COLUMN_SEPARATOR);
if(p != std::string::npos && p <
side_name.size()) {
- side_name = IMAGE_PREFIX + leader_image
+ COLUMN_SEPARATOR + side_name.substr(p+1);
+ side_name = IMAGE_PREFIX + leader_image
+ COLUMN_SEPARATOR + side_name.str().substr(p+1);
}
}
}
Index: wesnoth/src/multiplayer_wait.hpp
diff -u wesnoth/src/multiplayer_wait.hpp:1.3
wesnoth/src/multiplayer_wait.hpp:1.4
--- wesnoth/src/multiplayer_wait.hpp:1.3 Thu Mar 10 22:29:57 2005
+++ wesnoth/src/multiplayer_wait.hpp Wed Mar 30 19:48:17 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_wait.hpp,v 1.3 2005/03/10 22:29:57 ydirson Exp $ */
+/* $Id: multiplayer_wait.hpp,v 1.4 2005/03/30 19:48:17 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -75,8 +75,6 @@
// int team_;
const game_data& game_data_;
- config era_sides_;
-
config level_;
game_state state_;
Index: wesnoth/src/replay.cpp
diff -u wesnoth/src/replay.cpp:1.103 wesnoth/src/replay.cpp:1.104
--- wesnoth/src/replay.cpp:1.103 Mon Mar 28 19:34:09 2005
+++ wesnoth/src/replay.cpp Wed Mar 30 19:48:17 2005
@@ -1,4 +1,4 @@
-/* $Id: replay.cpp,v 1.103 2005/03/28 19:34:09 gruikya Exp $ */
+/* $Id: replay.cpp,v 1.104 2005/03/30 19:48:17 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -610,7 +610,18 @@
const config current_stats = statistics::write_stats();
if(current_stats != statistics::replay_verify_stats) {
ERR_NW << "replay statistics verification
failed\n";
- if (!game_config::ignore_replay_errors) throw
replay::error();
+ //Disabling because it breaks multiplayer.
+ //Apparently, statistics::replay_verify_stats
+ //is only written to in game::load_game() (!)
+ //Re-enable when fixed / if I am wrong.
+ //
+ //By the way, making a "config" object global
+ //is highly objectable IMO.
+ //
+ // --Ayin 30 mar. 2005
+ //
+ //if (!game_config::ignore_replay_errors)
+ // throw replay::error();
}
return false;
}
Index: wesnoth/src/tstring.cpp
diff -u wesnoth/src/tstring.cpp:1.2 wesnoth/src/tstring.cpp:1.3
--- wesnoth/src/tstring.cpp:1.2 Tue Mar 29 20:19:33 2005
+++ wesnoth/src/tstring.cpp Wed Mar 30 19:48:17 2005
@@ -1,4 +1,4 @@
-/* $Id: tstring.cpp,v 1.2 2005/03/29 20:19:33 gruikya Exp $ */
+/* $Id: tstring.cpp,v 1.3 2005/03/30 19:48:17 gruikya Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -15,7 +15,6 @@
#include <map>
#include "tstring.hpp"
-#include "wassert.hpp"
#include "gettext.hpp"
#include "filesystem.hpp"
#include "log.hpp"
@@ -27,6 +26,7 @@
const char UNTRANSLATABLE_PART = 0x02;
const char TEXTDOMAIN_SEPARATOR = 0x03;
const char ID_TRANSLATABLE_PART = 0x04;
+ const char UNTRANSLATABLE_STRING = 0x05;
std::vector<std::string> id_to_textdomain;
std::map<std::string, unsigned int> textdomain_to_id;