[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp multiplayer_l...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp multiplayer_l... |
Date: |
Sat, 17 Sep 2005 11:03:34 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/09/17 15:03:34
Modified files:
src : multiplayer_lobby.cpp multiplayer_lobby.hpp
Log message:
fixed crash in new lobby when clicking on 'join game'
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.89&tr2=1.90&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.hpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
Patches:
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.89
wesnoth/src/multiplayer_lobby.cpp:1.90
--- wesnoth/src/multiplayer_lobby.cpp:1.89 Tue Sep 13 14:15:26 2005
+++ wesnoth/src/multiplayer_lobby.cpp Sat Sep 17 15:03:33 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.cpp,v 1.89 2005/09/13 14:15:26 j_daniel Exp $ */
+/* $Id: multiplayer_lobby.cpp,v 1.90 2005/09/17 15:03:33 Sirp Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -464,10 +464,15 @@
const bool join = join_game_.pressed() || (games_menu_.selected() >= 0
&& games_menu_.selection_is_joinable());
if(join || observe) {
- const config* game = gamelist().child("gamelist");
- if (game != NULL) {
- const config::const_child_itors i =
game->child_range("game");
- const std::string& id = (**(i.first +
games_menu_.selected()))["id"];
+ const config* game = gamelist().child("gamelist");
+
+ const int selected = games_menu_.selection();
+ if(game != NULL && selected >= 0) {
+ const config::const_child_itors i =
game->child_range("game");
+ wassert(i.first + selected < i.second);
+
+ const config& game_cfg = **(i.first + selected);
+ const std::string& id = game_cfg["id"];
config response;
config& join = response.add_child("join");
Index: wesnoth/src/multiplayer_lobby.hpp
diff -u wesnoth/src/multiplayer_lobby.hpp:1.16
wesnoth/src/multiplayer_lobby.hpp:1.17
--- wesnoth/src/multiplayer_lobby.hpp:1.16 Tue Sep 13 13:36:24 2005
+++ wesnoth/src/multiplayer_lobby.hpp Sat Sep 17 15:03:33 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.hpp,v 1.16 2005/09/13 13:36:24 j_daniel Exp $ */
+/* $Id: multiplayer_lobby.hpp,v 1.17 2005/09/17 15:03:33 Sirp Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -55,7 +55,8 @@
bool empty() const { return games_.empty(); }
bool selection_is_joinable() const { return empty() ? false :
games_[selected_].vacant_slots; }
bool selection_is_observable() const { return empty() ? false :
games_[selected_].observers; }
- int selected() { return double_clicked_ && !empty() ?
static_cast<int>(selected_) : -1; }
+ int selected() const { return double_clicked_ && !empty() ?
static_cast<int>(selected_) : -1; }
+ int selection() const { return selected_; }
protected:
private:
image::locator gold_icon_locator_;