Merge branch 'master' of github.com:wesnoth/wesnoth

This commit is contained in:
Ignacio R. Morelle 2015-07-15 20:15:14 -04:00
commit ce5f9dfa38
13 changed files with 217 additions and 97 deletions

View file

@ -1,4 +1,32 @@
#include "winuser.h"
#include "windows.h"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "wesnoth.exe.manifest"
WESNOTH_ICON ICON "wesnoth-icon.ico"
//TODO: figure out the best way to get actual version numbers
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,0
PRODUCTVERSION 0,0,0,0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "Wesnoth\0"
VALUE "FileVersion", "0, 0, 0, 0\0"
VALUE "InternalName", "Wesnoth\0"
VALUE "LegalCopyright", "Copyright (C) 2003 - 2015 David White\0"
VALUE "OriginalFilename", "wesnoth.exe\0"
VALUE "ProductName", "Battle for Wesnoth\0"
VALUE "ProductVersion", "0, 0, 0, 0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -8544,62 +8544,6 @@
RelativePath="..\..\src\gui\dialogs\game_load.hpp"
>
</File>
<File
RelativePath="..\..\src\gui\dialogs\game_paths.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_with_VLD|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Test_Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Test_Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="ReleaseDEBUG|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\gui\dialogs\game_paths.hpp"
>
</File>
<File
RelativePath="..\..\src\gui\dialogs\game_save.cpp"
>
@ -8656,6 +8600,62 @@
RelativePath="..\..\src\gui\dialogs\game_save.hpp"
>
</File>
<File
RelativePath="..\..\src\gui\dialogs\game_version.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_with_VLD|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Test_Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="Test_Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
<FileConfiguration
Name="ReleaseDEBUG|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Gui\Dialogs\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\gui\dialogs\game_version.hpp"
>
</File>
<File
RelativePath="..\..\src\gui\dialogs\gamestate_inspector.cpp"
>
@ -22839,6 +22839,62 @@
RelativePath="..\..\src\desktop\open.hpp"
>
</File>
<File
RelativePath="..\..\src\desktop\version.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Desktop\"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Desktop\"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug_with_VLD|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Desktop\"
/>
</FileConfiguration>
<FileConfiguration
Name="Test_Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Desktop\"
/>
</FileConfiguration>
<FileConfiguration
Name="Test_Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Desktop\"
/>
</FileConfiguration>
<FileConfiguration
Name="ReleaseDEBUG|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Desktop\"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\desktop\version.hpp"
>
</File>
<File
RelativePath="..\..\src\desktop\windows_console.cpp"
>

View file

@ -373,6 +373,14 @@
RelativePath="..\..\src\about.hpp"
>
</File>
<File
RelativePath="..\..\src\build_info.cpp"
>
</File>
<File
RelativePath="..\..\src\build_info.hpp"
>
</File>
<File
RelativePath="..\..\src\color_range.cpp"
>

View file

@ -18,7 +18,6 @@
#define GAME_DISPLAY_H_INCLUDED
class config;
class display_chat_manager;
class tod_manager;
class team;
class unit_map;
@ -27,6 +26,7 @@ class game_board;
#include "animated.hpp"
#include "chat_events.hpp"
#include "display.hpp"
#include "display_chat_manager.hpp"
#include "pathfind/pathfind.hpp"
#include <deque>
@ -60,6 +60,7 @@ public:
*/
void new_turn();
const std::set<std::string>& observers() const { return chat_man_->observers(); }
/**
* Scrolls to the leader of a certain side.
*

View file

@ -151,6 +151,7 @@ wml_menu_item::wml_menu_item(const std::string& id, const vconfig & definition,
default_hotkey_(original.default_hotkey_),
use_hotkey_(original.use_hotkey_),
use_wml_menu_(original.use_wml_menu_),
is_synced_(original.is_synced_),
my_manager_(original.my_manager_)
{
// Apply WML.

View file

@ -76,7 +76,7 @@ const std::string attributes_to_trim[] = {
namespace ng {
connect_engine::connect_engine(saved_game& state,
const bool local_players_only, const bool first_scenario) :
const bool local_players_only, const bool first_scenario, const std::set<std::string>& players) :
level_(),
state_(state),
params_(state.mp_settings()),
@ -89,7 +89,7 @@ connect_engine::connect_engine(saved_game& state,
team_names_(),
user_team_names_(),
player_teams_(),
connected_users_()
connected_users_(players)
{
// Initial level config from the mp_game_settings.
level_ = mp::initial_level_config(state_);
@ -185,11 +185,16 @@ connect_engine::connect_engine(saved_game& state,
index++;
}
// Load reserved players information into the sides.
load_previous_sides_users(RESERVE_USERS);
// Add host to the connected users list.
import_user(preferences::login(), false);
if(first_scenario_) {
// Add host to the connected users list.
import_user(preferences::login(), false);
}
else {
// Add host but don't assign a side to him.
import_user(preferences::login(), true);
// Load reserved players information into the sides.
load_previous_sides_users();
}
//actualy only updates the sides in the level.
update_level();
@ -375,7 +380,7 @@ void side_engine::set_side_children(std::multimap<std::string, config> children)
}
void connect_engine::start_game(LOAD_USERS load_users)
void connect_engine::start_game()
{
DBG_MP << "starting a new game" << std::endl;
@ -454,8 +459,6 @@ void connect_engine::start_game(LOAD_USERS load_users)
config lock("stop_updates");
network::send_data(lock, 0);
load_previous_sides_users(load_users);
update_and_send_diff(true);
save_reserved_sides_information();
@ -799,25 +802,29 @@ void connect_engine::save_reserved_sides_information()
level_.child("multiplayer")["side_users"] = utils::join_map(side_users);
}
void connect_engine::load_previous_sides_users(LOAD_USERS load_users)
void connect_engine::load_previous_sides_users()
{
if (load_users == NO_LOAD || first_scenario_) {
return;
}
std::map<std::string, std::string> side_users =
utils::map_split(level_.child("multiplayer")["side_users"]);
std::set<std::string> names;
BOOST_FOREACH(side_engine_ptr side, side_engines_) {
const std::string& save_id = side->previous_save_id();
if (side_users.find(save_id) != side_users.end()) {
side->set_reserved_for(side_users[save_id]);
if (load_users == RESERVE_USERS && side->controller() != CNTR_COMPUTER) {
side->update_controller_options();
if (side->controller() != CNTR_COMPUTER) {
side->set_controller(CNTR_RESERVED);
} else if (load_users == FORCE_IMPORT_USERS) {
import_user(side_users[save_id], false);
names.insert(side_users[save_id]);
}
side->update_controller_options();
}
}
//Do this in an extra loop to make sure we import each user only once.
BOOST_FOREACH(const std::string& name, names)
{
if (connected_users_.find(name) != connected_users_.end()) {
import_user(name, false);
}
}
}

View file

@ -21,6 +21,7 @@
#include "multiplayer_ui.hpp"
#include "saved_game.hpp"
#include <boost/scoped_ptr.hpp>
#include <set>
namespace rand_rng { class mt_rng; }
@ -45,13 +46,14 @@ typedef std::pair<ng::controller, std::string> controller_option;
class connect_engine
{
public:
/// @param players the player which are already connected to the current game.
/// This is always empty unless we advance form a previous scenario.
connect_engine(saved_game& state,
const bool local_players_only,
const bool first_scenario);
const bool first_scenario,
const std::set<std::string>& players = std::set<std::string>());
~connect_engine();
enum LOAD_USERS { NO_LOAD, RESERVE_USERS, FORCE_IMPORT_USERS };
config* current_config();
void import_user(const std::string& name, const bool observer,
@ -68,7 +70,7 @@ public:
void update_and_send_diff(bool update_time_of_day = false);
bool can_start_game() const;
void start_game(LOAD_USERS load_users = NO_LOAD);
void start_game();
void start_game_commandline(const commandline_options& cmdline_opts);
// Return pair first element specifies whether to leave the game
@ -110,7 +112,7 @@ private:
void send_level_data(const network::connection sock) const;
void save_reserved_sides_information();
void load_previous_sides_users(LOAD_USERS load_users);
void load_previous_sides_users();
void update_side_controller_options();

View file

@ -241,7 +241,7 @@ void wait::join_game(bool observe)
DBG_MP << "mp wait: could not download level data, quitting...";
set_result(QUIT);
return;
} else if (!get_scenario()["allow_new_game"].to_bool(true) && !level_.child_or_empty("multiplayer")["savegame"].to_bool(false)) {
} else if (level_["started"].to_bool()) {
set_result(PLAY);
return;
}
@ -326,6 +326,12 @@ void wait::join_game(bool observe)
break; // found the preferred one
}
}
if (sd["player_id"] == preferences::login())
{
//We already own a side in this game.
generate_menu();
return;
}
++nb_sides;
}
if (!side_choice) {

View file

@ -216,7 +216,7 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
const tdata_cache & tdata,
display& disp, saved_game& state_of_game,
const config::const_child_itors &story, bool skip_replay,
bool blindfold_replay, io_type_t& io_type, end_level_data &end_level)
std::set<std::string>& mp_players, bool blindfold_replay, io_type_t& io_type, end_level_data &end_level)
{
const int ticks = SDL_GetTicks();
@ -246,6 +246,7 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
playcontroller.maybe_linger();
}
playcontroller.update_savegame_snapshot();
mp_players = playcontroller.all_players();
return res;
}
@ -264,7 +265,7 @@ LEVEL_RESULT play_game(game_display& disp, saved_game& gamestate,
{
LEVEL_RESULT res = LEVEL_RESULT::VICTORY;
end_level_data end_level;
std::set<std::string> mp_players;
try {
gamestate.expand_random_scenario();
@ -285,7 +286,7 @@ LEVEL_RESULT play_game(game_display& disp, saved_game& gamestate,
} else
#endif
{
res = playmp_scenario(game_config, tdata, disp, gamestate, story, skip_replay, blindfold_replay, io_type, end_level);
res = playmp_scenario(game_config, tdata, disp, gamestate, story, skip_replay, mp_players, blindfold_replay, io_type, end_level);
}
} catch(game::load_game_failed& e) {
gui2::show_error_message(disp.video(), _("The game could not be loaded: ") + e.message);
@ -371,14 +372,10 @@ LEVEL_RESULT play_game(game_display& disp, saved_game& gamestate,
gamestate.mp_settings().use_map_settings = starting_pos["force_lock_settings"].to_bool();
ng::connect_engine_ptr
connect_engine(new ng::connect_engine(gamestate,
!network_game, false));
connect_engine(new ng::connect_engine(gamestate, !network_game, false, mp_players));
if (starting_pos["allow_new_game"].to_bool(gamestate.mp_settings().show_connect)
|| (game_config::debug && network::nconnections() == 0 && game_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER)) {
// Opens mp::connect dialog to allow users to
// make an adjustments for scenario.
// TODO: Fix this so that it works when network::nconnections() > 0 as well.
if (!connect_engine->can_start_game() || (game_config::debug && game_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER)) {
// Opens mp::connect dialog to allow users to make an adjustments for scenario.
mp::ui::result connect_res = mp::goto_mp_connect(disp,
*connect_engine, game_config, gamestate.mp_settings().name);
if (connect_res == mp::ui::QUIT) {
@ -386,8 +383,7 @@ LEVEL_RESULT play_game(game_display& disp, saved_game& gamestate,
}
} else {
// Start the next scenario immediately.
connect_engine->
start_game(ng::connect_engine::FORCE_IMPORT_USERS);
connect_engine->start_game();
}
}
}

View file

@ -112,6 +112,9 @@ tgame_version::tgame_version()
deplist_entry e;
e[0] = game_config::library_name(lib);
if(e[0].empty()) {
continue;
}
e[1] = game_config::library_build_version(lib);
e[2] = game_config::library_runtime_version(lib);
deps_.push_back(e);

View file

@ -1049,3 +1049,13 @@ bool play_controller::can_use_synced_wml_menu() const
const team& viewing_team = get_teams_const()[gui_->viewing_team()];
return gui_->viewing_team() == gui_->playing_team() && !events::commands_disabled && viewing_team.is_local_human() && !is_lingering() && !is_browsing();
}
std::set<std::string> play_controller::all_players() const
{
std::set<std::string> res = gui_->observers();
BOOST_FOREACH(const team& t, get_teams_const())
{
res.insert(t.current_player());
}
return res;
}

View file

@ -30,6 +30,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <set>
class game_display;
class game_data;
@ -213,6 +214,7 @@ public:
const team& current_team() const;
bool can_use_synced_wml_menu() const;
std::set<std::string> all_players() const;
protected:
void play_slice_catch();
game_display& get_display();

View file

@ -1412,7 +1412,7 @@ void game::load_next_scenario(const player_map::const_iterator user) {
simple_wml::document cfg_scenario;
simple_wml::node & next_scen = cfg_scenario.root().add_child("next_scenario");
level_.root().copy_into(next_scen);
next_scen.set_attr("started", started_ ? "yes" : "no");
const simple_wml::node::child_list & sides = starting_pos(next_scen)->children("side");
DBG_GAME << "****\n loading next scenario for a client. sides info = " << std::endl;