[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src multiplayer.cpp multiplayer_connect...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src multiplayer.cpp multiplayer_connect... |
Date: |
Sat, 19 Mar 2005 11:21:03 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/03/19 16:21:02
Modified files:
src : multiplayer.cpp multiplayer_connect.cpp
multiplayer_connect.hpp multiplayer_lobby.cpp
multiplayer_lobby.hpp multiplayer_ui.cpp
multiplayer_ui.hpp multiplayer_wait.cpp
Log message:
* Fixed bug #12207: bell ringing when changing multiplayer screen
* Fixed userlist not being correctly reset when creating a multiplayer
game
* Fixed the multiplayer lobby not existing on network error
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.147&tr2=1.148&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.126&tr2=1.127&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.68&tr2=1.69&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.hpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
Patches:
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.147 wesnoth/src/multiplayer.cpp:1.148
--- wesnoth/src/multiplayer.cpp:1.147 Thu Mar 10 21:42:04 2005
+++ wesnoth/src/multiplayer.cpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.147 2005/03/10 21:42:04 ydirson Exp $ */
+/* $Id: multiplayer.cpp,v 1.148 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -189,6 +189,8 @@
game_state state;
network_game_manager m;
+ gamelist.clear();
+
{
mp::wait ui(disp, game_config, data, chat, gamelist);
@@ -229,6 +231,8 @@
network::server_manager::NO_SERVER);
network_game_manager m;
+ gamelist.clear();
+
{
mp::connect ui(disp, game_config, data, chat, gamelist, params,
default_controller);
run_lobby_loop(disp, ui);
@@ -302,6 +306,8 @@
} catch(network::error& error) {
if (!error.message.empty())
gui::show_error_message(disp,
error.message);
+ // Exit the lobby on network errors
+ return;
}
break;
case mp::ui::QUIT:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.126
wesnoth/src/multiplayer_connect.cpp:1.127
--- wesnoth/src/multiplayer_connect.cpp:1.126 Sat Mar 19 15:44:39 2005
+++ wesnoth/src/multiplayer_connect.cpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.126 2005/03/19 15:44:39 gruikya Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.127 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -497,7 +497,7 @@
// Updates the "level_" variable, now that sides are loaded
update_level();
- gamelist_updated();
+ gamelist_updated(true);
// If we are connected, send data to the connected host
network::send_data(level_);
@@ -606,9 +606,9 @@
cancel_.hide(hide);
}
-void connect::gamelist_updated()
+void connect::gamelist_updated(bool silent)
{
- update_playerlist_state();
+ update_playerlist_state(silent);
}
void connect::process_network_data(const config& data, const
network::connection sock)
@@ -983,7 +983,7 @@
return false;
}
-void connect::update_playerlist_state()
+void connect::update_playerlist_state(bool silent)
{
waiting_label_.set_text(sides_available() ? _("Waiting for players to
join...") : "");
launch_.enable(!sides_available());
@@ -991,7 +991,7 @@
// If the "gamelist_" variable has users, use it. Else, extracts the
// user list from the actual player list.
if (gamelist().child("user") != NULL) {
- ui::gamelist_updated();
+ ui::gamelist_updated(silent);
} else {
// Updates the player list
std::vector<std::string> playerlist;
@@ -999,7 +999,7 @@
++itor) {
playerlist.push_back(itor->name);
}
- set_user_list(playerlist);
+ set_user_list(playerlist, silent);
}
}
Index: wesnoth/src/multiplayer_connect.hpp
diff -u wesnoth/src/multiplayer_connect.hpp:1.33
wesnoth/src/multiplayer_connect.hpp:1.34
--- wesnoth/src/multiplayer_connect.hpp:1.33 Thu Mar 10 22:29:57 2005
+++ wesnoth/src/multiplayer_connect.hpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.hpp,v 1.33 2005/03/10 22:29:57 ydirson Exp $ */
+/* $Id: multiplayer_connect.hpp,v 1.34 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -156,7 +156,7 @@
virtual void hide_children(bool hide=true);
- virtual void gamelist_updated();
+ virtual void gamelist_updated(bool silent=true);
private:
// Those 2 functions are actually the steps of the (complex)
// construction of this class.
@@ -174,7 +174,7 @@
// Updates the state of the player list, the launch button and of the
// start game label, to reflect the actual state.
- void update_playerlist_state();
+ void update_playerlist_state(bool silent=true);
// Returns the index of a player, from its id, or -1 if the player was
not found
connected_user_list::iterator find_player(const std::string& id);
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.68
wesnoth/src/multiplayer_lobby.cpp:1.69
--- wesnoth/src/multiplayer_lobby.cpp:1.68 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/multiplayer_lobby.cpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.cpp,v 1.68 2005/03/18 21:21:48 ydirson Exp $ */
+/* $Id: multiplayer_lobby.cpp,v 1.69 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -58,9 +58,9 @@
games_menu_.set_location(xscale(12),yscale(42));
}
-void lobby::gamelist_updated()
+void lobby::gamelist_updated(bool silent)
{
- ui::gamelist_updated();
+ ui::gamelist_updated(silent);
std::vector<std::string> game_strings;
const config* list = gamelist().child("gamelist");
Index: wesnoth/src/multiplayer_lobby.hpp
diff -u wesnoth/src/multiplayer_lobby.hpp:1.9
wesnoth/src/multiplayer_lobby.hpp:1.10
--- wesnoth/src/multiplayer_lobby.hpp:1.9 Sun Feb 20 22:30:27 2005
+++ wesnoth/src/multiplayer_lobby.hpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.hpp,v 1.9 2005/02/20 22:30:27 gruikya Exp $ */
+/* $Id: multiplayer_lobby.hpp,v 1.10 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -36,7 +36,7 @@
virtual void layout_children(const SDL_Rect& rect);
virtual void process_network_data(const config& data, const
network::connection sock);
- virtual void gamelist_updated();
+ virtual void gamelist_updated(bool silent=true);
private:
std::vector<bool> game_vacant_slots_;
Index: wesnoth/src/multiplayer_ui.cpp
diff -u wesnoth/src/multiplayer_ui.cpp:1.13 wesnoth/src/multiplayer_ui.cpp:1.14
--- wesnoth/src/multiplayer_ui.cpp:1.13 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/multiplayer_ui.cpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_ui.cpp,v 1.13 2005/03/18 21:21:48 ydirson Exp $ */
+/* $Id: multiplayer_ui.cpp,v 1.14 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -239,10 +239,10 @@
if(data.child("gamelist")) {
gamelist_ = data;
- gamelist_updated();
+ gamelist_updated(false);
} else if(data.child("gamelist_diff")) {
gamelist_.apply_diff(*data.child("gamelist_diff"));
- gamelist_updated();
+ gamelist_updated(false);
}
}
}
@@ -277,7 +277,7 @@
entry_textbox_.set_width(xscale(833) - 8);
}
-void ui::gamelist_updated()
+void ui::gamelist_updated(bool silent)
{
std::vector<std::string> user_strings;
config::child_list users = gamelist_.get_children("user");
@@ -286,19 +286,21 @@
const std::string prefix = (**user)["available"] == "no" ? "#"
: "";
user_strings.push_back(prefix + (**user)["name"]);
}
- set_user_list(user_strings);
+ set_user_list(user_strings, silent);
}
-void ui::set_user_list(const std::vector<std::string>& list)
+void ui::set_user_list(const std::vector<std::string>& list, bool silent)
{
const int old_users = user_list_.size();
user_list_ = list;
const int new_users = user_list_.size();
- if(new_users < old_users) {
- sound::play_sound(game_config::sounds::user_leave);
- } else if(new_users > old_users) {
- sound::play_sound(game_config::sounds::user_arrive);
+ if(!silent) {
+ if(new_users < old_users) {
+ sound::play_sound(game_config::sounds::user_leave);
+ } else if(new_users > old_users) {
+ sound::play_sound(game_config::sounds::user_arrive);
+ }
}
users_menu_.set_items(user_list_);
Index: wesnoth/src/multiplayer_ui.hpp
diff -u wesnoth/src/multiplayer_ui.hpp:1.5 wesnoth/src/multiplayer_ui.hpp:1.6
--- wesnoth/src/multiplayer_ui.hpp:1.5 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/multiplayer_ui.hpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_ui.hpp,v 1.5 2005/03/18 21:21:48 ydirson Exp $ */
+/* $Id: multiplayer_ui.hpp,v 1.6 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -131,10 +131,10 @@
// Called each time the gamelist_ variable is updated. May be
// overridden by child classes to add custom gamelist behaviour.
- virtual void gamelist_updated();
+ virtual void gamelist_updated(bool silent=true);
// Sets the user list
- void set_user_list(const std::vector<std::string>&);
+ void set_user_list(const std::vector<std::string>&, bool silent);
// Returns the current gamelist
config& gamelist() { return gamelist_; };
Index: wesnoth/src/multiplayer_wait.cpp
diff -u wesnoth/src/multiplayer_wait.cpp:1.15
wesnoth/src/multiplayer_wait.cpp:1.16
--- wesnoth/src/multiplayer_wait.cpp:1.15 Sat Mar 19 15:44:39 2005
+++ wesnoth/src/multiplayer_wait.cpp Sat Mar 19 16:21:02 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_wait.cpp,v 1.15 2005/03/19 15:44:39 gruikya Exp $ */
+/* $Id: multiplayer_wait.cpp,v 1.16 2005/03/19 16:21:02 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -408,7 +408,7 @@
// Uses the actual connected player list if we do not have any
// "gamelist" user data
if (gamelist().child("user") != NULL)
- set_user_list(playerlist);
+ set_user_list(playerlist, true);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src multiplayer.cpp multiplayer_connect...,
Philippe Plantier <=