This closes bug #9532.

* When use 'map settings' is selected, map settings can no longer be
  changed, if not defined in the map the general default is chosen.

* When cancelling the MP create the changed preferences are no longer
  saved.

* When the MP create is accepted with 'use map settings' the map setting
  parameters are no longer stored as the new preference.

* There need to be some more cleanups in the GUI and already started to 
  discuss those with Uso and Soliton but they will follow later.
This commit is contained in:
Mark de Wever 2007-08-19 12:59:03 +00:00
parent af277b1b58
commit e83075fe26
6 changed files with 72 additions and 13 deletions

View file

@ -38,6 +38,12 @@ Version 1.3.6+svn:
* multiplayer lobby: tab completion works for all player names now,
not only for those which are not in a game (bug #9350)
* enable "teamchat" for observers
* when use 'map settings' is selected, map settings can no longer be
changed, if not defined in the map the general default is chosen
* when cancelling the MP create the changed preferences are no longer
saved
* when the MP create is accepted with 'use map settings' the map setting
parameters are no longer stored as the new preference
* graphics
* fixed a glitch with the undo of recruit or recall on high places.
* Improve rendering of "black stripes": don't hide footsteps or fog,

View file

@ -21,7 +21,6 @@
controller=human
team_name=north
user_team_name= _ "teamname^North"
fog=yes
[/side]
[side]
[ai]

View file

@ -36,6 +36,12 @@ Version 1.3.6+svn:
* The "Soul Shooter" is now renamed to "Banebow".
* The players in the selected game in the server lobby are highlighted now.
* Observers can now chat as a "team" (without disturbing the players).
* When use 'map settings' is selected, map settings can no longer be
changed, if not defined in the map the general default is chosen.
* When cancelling the MP create the changed preferences are no longer
saved.
* When the MP create is accepted with 'use map settings' the map setting
parameters are no longer stored as the new preference.
* Sounds and music
* New or improved sounds: bat hit.

View file

@ -21,6 +21,7 @@
#include "gettext.hpp"
#include "image.hpp"
#include "construct_dialog.hpp"
#include "settings.hpp"
#include "show_dialog.hpp"
#include "map_create.hpp"
#include "minimap.hpp"
@ -30,6 +31,7 @@
#include "video.hpp"
#include "serialization/string_utils.hpp"
#include "wml_separators.hpp"
#include "wassert.hpp"
namespace {
const SDL_Rect null_rect = {0, 0, 0, 0};
@ -212,25 +214,35 @@ create::create(game_display& disp, const config &cfg, chat& c, config& gamelist)
create::~create()
{
// only save the settings if 'accepted' the dialog
if(get_result() != CREATE) {
return;
}
// Retrieve values
get_parameters();
//Save values for next game
// Save values for next game
preferences::set_allow_observers(parameters_.allow_observers);
preferences::set_use_map_settings(parameters_.use_map_settings);
preferences::set_random_start_time(parameters_.random_start_time);
preferences::set_fog(parameters_.fog_game);
preferences::set_shroud(parameters_.shroud_game);
preferences::set_turns(parameters_.num_turns);
preferences::set_countdown(parameters_.mp_countdown);
preferences::set_countdown_init_time(parameters_.mp_countdown_init_time);
preferences::set_countdown_turn_bonus(parameters_.mp_countdown_turn_bonus);
preferences::set_countdown_reservoir_time(parameters_.mp_countdown_reservoir_time);
preferences::set_countdown_action_bonus(parameters_.mp_countdown_action_bonus);
preferences::set_village_gold(parameters_.village_gold);
preferences::set_xp_modifier(parameters_.xp_modifier);
preferences::set_era(era_combo_.selected()); // FIXME: may be broken if new eras are added
preferences::set_map(map_selection_);
preferences::set_turns(turns_slider_.value());
// When using map settings, the following variables are determined by the map
// so don't store them as the new preferences.
if(!parameters_.use_map_settings) {
preferences::set_random_start_time(parameters_.random_start_time);
preferences::set_fog(parameters_.fog_game);
preferences::set_shroud(parameters_.shroud_game);
preferences::set_turns(parameters_.num_turns);
preferences::set_xp_modifier(parameters_.xp_modifier);
}
}
create::parameters& create::get_parameters()
@ -500,12 +512,44 @@ void create::process_event()
}
num_players_label_.set_text(players.str());
map_size_label_.set_text(map_size.str());
}
if(use_map_settings_.checked()) {
xp_modifier_slider_.set_value(lexical_cast_default<int>(
parameters_.scenario_data["experience_modifier"],
preferences::xp_modifier()));
}
if(map_changed || use_map_settings_.pressed()) {
const bool map_settings = use_map_settings_.checked();
// if the map settings are wanted use them if not properly defined
// fall back to the default settings
turns_slider_.set_value(map_settings ?
settings::get_turns(parameters_.scenario_data["turns"]) :
preferences::turns());
xp_modifier_slider_.set_value(map_settings ?
settings::get_xp_modifier(parameters_.scenario_data["experience_modifier"]) :
preferences::xp_modifier());
random_start_time_.set_check(map_settings ?
settings::use_random_start_time(parameters_.scenario_data["random_start_time"]) :
preferences::random_start_time());
// These are per player, always show of player 1 this might not be 100% correct,
// but at the moment it's not possible to show the fog and shroud per player.
// This might change in the future.
wassert(parameters_.scenario_data.get_children("side").size());
fog_game_.set_check(map_settings ?
settings::use_fog((*parameters_.scenario_data.get_children("side").front())["fog"]) :
preferences::fog());
shroud_game_.set_check(map_settings ?
settings::use_shroud((*parameters_.scenario_data.get_children("side").front())["shroud"]) :
preferences::shroud());
// set the widget states
turns_slider_.enable(!map_settings);
xp_modifier_slider_.enable(!map_settings);
random_start_time_.enable(!map_settings);
fog_game_.enable(!map_settings);
shroud_game_.enable(!map_settings);
}
}

View file

@ -14,6 +14,8 @@
#include "global.hpp"
#include "settings.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"

View file

@ -15,6 +15,8 @@
#ifndef SETTINGS_HPP_INCLUDED
#define SETTINGS_HPP_INCLUDED
#include <string>
/**
* Contains the general settings which have a default. These values
* can be used to initialize the preferences but also to set map