[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src game.cpp multiplayer.cpp multiplaye...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src game.cpp multiplayer.cpp multiplaye... |
Date: |
Sat, 09 Oct 2004 17:21:59 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 04/10/09 21:14:47
Modified files:
src : game.cpp multiplayer.cpp multiplayer.hpp
multiplayer_connect.cpp multiplayer_connect.hpp
playturn.cpp
src/widgets : menu.cpp
Log message:
added scrollbar to map selection in multiplayer
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.145&tr2=1.146&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.121&tr2=1.122&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.hpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.78&tr2=1.79&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.276&tr2=1.277&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.145 wesnoth/src/game.cpp:1.146
--- wesnoth/src/game.cpp:1.145 Thu Oct 7 21:00:31 2004
+++ wesnoth/src/game.cpp Sat Oct 9 21:14:47 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.145 2004/10/07 21:00:31 cedricd Exp $ */
+/* $Id: game.cpp,v 1.146 2004/10/09 21:14:47 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1189,7 +1189,9 @@
const std::string sep(1,gui::menu::HELP_STRING_SEPERATOR);
host_or_join.push_back(std::string("&icons/icon-server.png,") + _("Join
Official Server") + sep + _("Log on to the official Wesnoth multiplayer
server"));
host_or_join.push_back(std::string("&icons/icon-serverother.png,") +
_("Join Game") + sep + _("Join a server or hosted game"));
- host_or_join.push_back(std::string("&icons/icon-hostgame.png,") +
_("Host Multiplayer Game") + sep + _("Host a game without using a server"));
+ host_or_join.push_back(std::string("&icons/icon-hostgame.png,") +
_("Host Networked Game") + sep + _("Host a game without using a server"));
+ host_or_join.push_back(std::string(",") + _("Hotseat Game") + sep +
_("Play a multiplayer game sharing the same machine"));
+ host_or_join.push_back(std::string(",") + _("Human vs AI") + sep +
_("Play a game against AI opponents"));
std::string login = preferences::login();
const int res =
gui::show_dialog(disp(),NULL,_("Multiplayer"),"",gui::OK_CANCEL,&host_or_join,NULL,_("Login")
+ std::string(": "),&login);
@@ -1204,10 +1206,14 @@
config game_config;
read_game_cfg(defines_map_,line_src,game_config,use_caching_);
- if(res == 2) {
+ if(res >= 2) {
std::vector<std::string> chat;
config game_data;
- multiplayer_game_setup_dialog
mp_dialog(disp(),units_data_,game_config,state_,true);
+
+ const std::string controller = (res == 2 ? "network" :
(res == 3 ? "human" : "ai"));
+ const bool is_server = res == 2;
+
+ multiplayer_game_setup_dialog
mp_dialog(disp(),units_data_,game_config,state_,is_server,controller);
lobby::RESULT res = lobby::CONTINUE;
while(res == lobby::CONTINUE) {
res =
lobby::enter(disp(),game_data,game_config,&mp_dialog,chat);
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.121 wesnoth/src/multiplayer.cpp:1.122
--- wesnoth/src/multiplayer.cpp:1.121 Thu Oct 7 01:47:33 2004
+++ wesnoth/src/multiplayer.cpp Sat Oct 9 21:14:47 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.121 2004/10/07 01:47:33 Sirp Exp $ */
+/* $Id: multiplayer.cpp,v 1.122 2004/10/09 21:14:47 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -55,12 +55,12 @@
multiplayer_game_setup_dialog::multiplayer_game_setup_dialog(
display& disp, game_data& units_data,
- const config& cfg, game_state& state, bool
server)
+ const config& cfg, game_state& state, bool
server, const std::string& controller)
: disp_(disp), units_data_(units_data), cfg_(cfg), state_(state),
server_(server), level_(NULL), map_selection_(-1),
maps_menu_(NULL), turns_slider_(NULL),
village_gold_slider_(NULL), xp_modifier_slider_(NULL),
fog_game_(NULL), shroud_game_(NULL), observers_game_(NULL),
cancel_game_(NULL), launch_game_(NULL), regenerate_map_(NULL),
generator_settings_(NULL),
- era_combo_(NULL), vision_combo_(NULL), name_entry_(NULL),
generator_(NULL)
+ era_combo_(NULL), vision_combo_(NULL), name_entry_(NULL),
generator_(NULL), controller_(controller)
{
std::cerr << "setup dialog ctor\n";
@@ -74,18 +74,18 @@
//build the list of scenarios to play
get_files_in_dir(get_user_data_dir() +
"/editor/maps",&user_maps_,NULL,FILE_NAME_ONLY);
- std::vector<std::string> options = user_maps_;
+ map_options_ = user_maps_;
const config::child_list& levels = cfg.get_children("multiplayer");
for(config::child_list::const_iterator j = levels.begin(); j !=
levels.end(); ++j){
- options.push_back((**j)["name"]);
+ map_options_.push_back((**j)["name"]);
}
//add the 'load game' option
- options.push_back(_("Load Game") + std::string("..."));
+ map_options_.push_back(_("Load Game") + std::string("..."));
//create the scenarios menu
- maps_menu_.assign(new gui::menu(disp_,options));
+ maps_menu_.assign(new gui::menu(disp_,map_options_));
maps_menu_->set_numeric_keypress_selection(false);
SDL_Rect rect = {0,0,0,0};
@@ -191,6 +191,9 @@
const int map_label_height =
font::draw_text(&disp_,disp_.screen_area(),font::SIZE_SMALL,font::GOOD_COLOUR,
_("Map to play") +
std::string(":"),xpos + minimap_width + border_size,ypos).h;
+ maps_menu_->set_max_width(area.x + area.w - (xpos + minimap_width) -
250);
+ maps_menu_->set_max_height(area.y + area.h - (ypos + map_label_height));
+ maps_menu_->set_items(map_options_);
maps_menu_->set_loc(xpos + minimap_width + border_size,ypos +
map_label_height + border_size);
maps_menu_->set_dirty();
@@ -509,7 +512,7 @@
std::cerr << "loading connector...\n";
//Connector
- mp_connect connector(disp_, name_entry_->text(), cfg_, units_data_,
state_);
+ mp_connect connector(disp_, name_entry_->text(), cfg_, units_data_,
state_, false, controller_);
std::cerr << "done loading connector...\n";
Index: wesnoth/src/multiplayer.hpp
diff -u wesnoth/src/multiplayer.hpp:1.22 wesnoth/src/multiplayer.hpp:1.23
--- wesnoth/src/multiplayer.hpp:1.22 Tue Jun 8 22:36:37 2004
+++ wesnoth/src/multiplayer.hpp Sat Oct 9 21:14:47 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.hpp,v 1.22 2004/06/08 22:36:37 Sirp Exp $ */
+/* $Id: multiplayer.hpp,v 1.23 2004/10/09 21:14:47 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -40,7 +40,7 @@
{
public:
multiplayer_game_setup_dialog(display& disp, game_data& units_data,
- const config& cfg, game_state& state, bool server=false);
+ const config& cfg, game_state& state, bool server=false,
const std::string& controller="ai");
void set_area(const SDL_Rect& area);
lobby::RESULT process();
@@ -59,7 +59,7 @@
int map_selection_;
- std::vector<std::string> user_maps_;
+ std::vector<std::string> user_maps_, map_options_;
config scenario_data_;
util::scoped_ptr<gui::menu> maps_menu_;
@@ -75,6 +75,8 @@
surface_restorer turns_restorer_, village_gold_restorer_, xp_restorer_,
playernum_restorer_,
minimap_restorer_;
+
+ const std::string controller_;
};
//function to host a multiplayer game. If server is true, then the
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.78
wesnoth/src/multiplayer_connect.cpp:1.79
--- wesnoth/src/multiplayer_connect.cpp:1.78 Thu Oct 7 01:47:33 2004
+++ wesnoth/src/multiplayer_connect.cpp Sat Oct 9 21:14:47 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.78 2004/10/07 01:47:33 Sirp Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.79 2004/10/09 21:14:47 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -39,7 +39,7 @@
mp_connect::mp_connect(display& disp, std::string game_name,
const config &cfg, game_data& data, game_state& state,
- bool join) :
+ bool join, const std::string& default_controller) :
disp_(&disp), cfg_(&cfg), data_(&data), state_(&state),
show_replay_(false), save_(false), join_(join),
player_types_(), player_races_(), player_teams_(),
@@ -48,7 +48,7 @@
ai_(gui::button(disp, _(" Computer vs Computer "))),
launch_(gui::button(disp, _("I'm Ready"))),
cancel_(gui::button(disp, _("Cancel"))),
- message_full_(true)
+ message_full_(true), default_controller_(default_controller)
{
// Send Initial information
config response;
@@ -205,7 +205,7 @@
(**sd)["description"] = preferences::login();
first = false;
} else {
- (**sd)["controller"] = "ai";
+ (**sd)["controller"] = default_controller_;
(**sd)["description"] = "";
}
}
Index: wesnoth/src/multiplayer_connect.hpp
diff -u wesnoth/src/multiplayer_connect.hpp:1.18
wesnoth/src/multiplayer_connect.hpp:1.19
--- wesnoth/src/multiplayer_connect.hpp:1.18 Sat Sep 18 18:52:20 2004
+++ wesnoth/src/multiplayer_connect.hpp Sat Oct 9 21:14:47 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.hpp,v 1.18 2004/09/18 18:52:20 gruikya Exp $ */
+/* $Id: multiplayer_connect.hpp,v 1.19 2004/10/09 21:14:47 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -34,7 +34,8 @@
public:
mp_connect(display& disp, std::string game_name,
const config &cfg, game_data& units_data,
- game_state& state, bool join = false);
+ game_state& state, bool join = false,
+ const std::string& default_controller="ai");
~mp_connect();
int load_map(const std::string& era, config& scenario, int num_turns,
int village_gold, int xpmodifier,
@@ -102,6 +103,8 @@
bool message_full_;
std::deque<config> network_data_;
+
+ const std::string default_controller_;
};
#endif
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.276 wesnoth/src/playturn.cpp:1.277
--- wesnoth/src/playturn.cpp:1.276 Sun Oct 3 19:23:10 2004
+++ wesnoth/src/playturn.cpp Sat Oct 9 21:14:47 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.276 2004/10/03 19:23:10 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.277 2004/10/09 21:14:47 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1603,7 +1603,6 @@
std::vector<std::string> items;
const std::set<std::string>& recruits = current_team.recruits();
for(std::set<std::string>::const_iterator it = recruits.begin(); it !=
recruits.end(); ++it) {
- item_keys.push_back(*it);
const std::map<std::string,unit_type>::const_iterator
u_type = gameinfo_.unit_types.find(*it);
if(u_type == gameinfo_.unit_types.end()) {
@@ -1611,6 +1610,8 @@
return;
}
+ item_keys.push_back(*it);
+
const unit_type& type = u_type->second;
//display units that we can't afford to recruit in red
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.63 wesnoth/src/widgets/menu.cpp:1.64
--- wesnoth/src/widgets/menu.cpp:1.63 Tue Oct 5 21:50:48 2004
+++ wesnoth/src/widgets/menu.cpp Sat Oct 9 21:14:47 2004
@@ -128,6 +128,11 @@
width_ += scrollbar_.get_max_width();
}
}
+
+ if(max_width_ > 0 && width_ > max_width_) {
+ width_ = max_width_;
+ }
+
return width_;
}
@@ -149,7 +154,7 @@
buffer_.assign(get_surface_portion(screen, portion));
if(show_scrollbar()) {
- const int menu_width = width() - scrollbar_.get_max_width();
+ const int menu_width = w - scrollbar_.get_max_width();
scrollbar_.enable(true);
int scr_width = scrollbar_.get_width();
- [Wesnoth-cvs-commits] wesnoth/src game.cpp multiplayer.cpp multiplaye...,
David White <=