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:
Mark de Wever 2007-12-25 18:22:32 +00:00
parent 3a05f21efa
commit c9924cf32d
3 changed files with 15 additions and 4 deletions

View file

@ -29,6 +29,8 @@ Version 1.3.12+svn:
* changing the langugage now sets the version number in the title
properly.
* 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:
* new event "last breath" will be triggered when a unit dies, but
before the animation is played

View file

@ -18,8 +18,6 @@
#include "global.hpp"
#include <memory>
#include "game_display.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
@ -36,6 +34,9 @@
#include "serialization/string_utils.hpp"
#include "wml_separators.hpp"
#include <cassert>
#include <memory>
namespace {
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),
user_maps_(),
map_options_(),
map_index_(),
maps_menu_(disp.video(), std::vector<std::string>()),
turns_slider_(disp.video()),
@ -111,13 +113,15 @@ create::create(game_display& disp, const config &cfg, chat& c, config& gamelist)
// Standard maps
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())
|| utils::string_bool((**j)["allow_new_game"],true))
{
menu_help_str = help_sep + ((**j)["name"]);
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) {
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");
if(index < levels.size()) {

View file

@ -122,6 +122,9 @@ private:
std::vector<std::string> user_maps_;
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::slider turns_slider_;