mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 15:14:16 +00:00
a multiplayer map with allow_new_game...
...causes the selection of a map to show the wrong minimap (bug #9425)
This commit is contained in:
parent
3a05f21efa
commit
c9924cf32d
@ -29,6 +29,8 @@ Version 1.3.12+svn:
|
|||||||
* changing the langugage now sets the version number in the title
|
* changing the langugage now sets the version number in the title
|
||||||
properly.
|
properly.
|
||||||
* show 'back to round xxx' also in 800 x 600 resolution
|
* show 'back to round xxx' also in 800 x 600 resolution
|
||||||
|
* a multiplayer map with allow_new_game causes the selection of a map to
|
||||||
|
show the wrong minimap (bug #9425)
|
||||||
* WML engine:
|
* WML engine:
|
||||||
* new event "last breath" will be triggered when a unit dies, but
|
* new event "last breath" will be triggered when a unit dies, but
|
||||||
before the animation is played
|
before the animation is played
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
#include "global.hpp"
|
#include "global.hpp"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "game_display.hpp"
|
#include "game_display.hpp"
|
||||||
#include "game_preferences.hpp"
|
#include "game_preferences.hpp"
|
||||||
#include "gettext.hpp"
|
#include "gettext.hpp"
|
||||||
@ -36,6 +34,9 @@
|
|||||||
#include "serialization/string_utils.hpp"
|
#include "serialization/string_utils.hpp"
|
||||||
#include "wml_separators.hpp"
|
#include "wml_separators.hpp"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const SDL_Rect null_rect = {0, 0, 0, 0};
|
const SDL_Rect null_rect = {0, 0, 0, 0};
|
||||||
}
|
}
|
||||||
@ -51,6 +52,7 @@ create::create(game_display& disp, const config &cfg, chat& c, config& gamelist)
|
|||||||
mp_countdown_reservoir_time_(330),
|
mp_countdown_reservoir_time_(330),
|
||||||
user_maps_(),
|
user_maps_(),
|
||||||
map_options_(),
|
map_options_(),
|
||||||
|
map_index_(),
|
||||||
|
|
||||||
maps_menu_(disp.video(), std::vector<std::string>()),
|
maps_menu_(disp.video(), std::vector<std::string>()),
|
||||||
turns_slider_(disp.video()),
|
turns_slider_(disp.video()),
|
||||||
@ -111,13 +113,15 @@ create::create(game_display& disp, const config &cfg, chat& c, config& gamelist)
|
|||||||
|
|
||||||
// Standard maps
|
// Standard maps
|
||||||
const config::child_list& levels = cfg.get_children("multiplayer");
|
const config::child_list& levels = cfg.get_children("multiplayer");
|
||||||
for(config::child_list::const_iterator j = levels.begin(); j != levels.end(); ++j)
|
size_t i = 0;
|
||||||
|
for(config::child_list::const_iterator j = levels.begin(); j != levels.end(); ++j, ++i)
|
||||||
{
|
{
|
||||||
if ( ((*j)->values.find("allow_new_game") == (*j)->values.end())
|
if ( ((*j)->values.find("allow_new_game") == (*j)->values.end())
|
||||||
|| utils::string_bool((**j)["allow_new_game"],true))
|
|| utils::string_bool((**j)["allow_new_game"],true))
|
||||||
{
|
{
|
||||||
menu_help_str = help_sep + ((**j)["name"]);
|
menu_help_str = help_sep + ((**j)["name"]);
|
||||||
map_options_.push_back(((**j)["name"]) + menu_help_str);
|
map_options_.push_back(((**j)["name"]) + menu_help_str);
|
||||||
|
map_index_.push_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +417,9 @@ void create::process_event()
|
|||||||
|
|
||||||
} else if(select > user_maps_.size() && select <= maps_menu_.nitems()-1) {
|
} else if(select > user_maps_.size() && select <= maps_menu_.nitems()-1) {
|
||||||
parameters_.saved_game = false;
|
parameters_.saved_game = false;
|
||||||
const size_t index = select - user_maps_.size() - 1;
|
size_t index = select - user_maps_.size() - 1;
|
||||||
|
assert(index < map_index_.size());
|
||||||
|
index = map_index_[index];
|
||||||
const config::child_list& levels = game_config().get_children("multiplayer");
|
const config::child_list& levels = game_config().get_children("multiplayer");
|
||||||
|
|
||||||
if(index < levels.size()) {
|
if(index < levels.size()) {
|
||||||
|
@ -122,6 +122,9 @@ private:
|
|||||||
|
|
||||||
std::vector<std::string> user_maps_;
|
std::vector<std::string> user_maps_;
|
||||||
std::vector<std::string> map_options_;
|
std::vector<std::string> map_options_;
|
||||||
|
//! Due to maps not available the index of the selected map and
|
||||||
|
//! mp scenarios is not 1:1 so we use a lookup table.
|
||||||
|
std::vector<size_t> map_index_;
|
||||||
|
|
||||||
gui::menu maps_menu_;
|
gui::menu maps_menu_;
|
||||||
gui::slider turns_slider_;
|
gui::slider turns_slider_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user