editor: don't write tod unless explicitly set

This commit is contained in:
gfgtdf 2020-09-12 00:44:38 +02:00
parent 6157603ed9
commit 301c9aea96
3 changed files with 8 additions and 5 deletions

View file

@ -945,7 +945,7 @@ void context_manager::revert_map()
void context_manager::new_map(int width, int height, const t_translation::terrain_code& fill, bool new_context)
{
const config& default_schedule = game_config_.find_child("editor_times", "id", "default");
const config& default_schedule = game_config_.find_child("editor_times", "id", "empty");
editor_map m(game_config_, width, height, fill);
if(new_context) {
@ -958,7 +958,7 @@ void context_manager::new_map(int width, int height, const t_translation::terrai
void context_manager::new_scenario(int width, int height, const t_translation::terrain_code& fill, bool new_context)
{
const config& default_schedule = game_config_.find_child("editor_times", "id", "default");
const config& default_schedule = game_config_.find_child("editor_times", "id", "empty");
editor_map m(game_config_, width, height, fill);
if(new_context) {
@ -1009,7 +1009,7 @@ void context_manager::create_default_context()
t_translation::terrain_code default_terrain =
t_translation::read_terrain_code(game_config::default_terrain);
const config& default_schedule = game_config_.find_child("editor_times", "id", "default");
const config& default_schedule = game_config_.find_child("editor_times", "id", "empty");
add_map_context(editor_map(game_config_, 44, 33, default_terrain), true, default_schedule);
} else {
for(const std::string& filename : saved_windows_) {

View file

@ -111,7 +111,7 @@ map_context::map_context(const game_config_view& game_config, const std::string&
, labels_(nullptr)
, units_()
, teams_()
, tod_manager_(new tod_manager(game_config.find_child("editor_times", "id", "default")))
, tod_manager_(new tod_manager(game_config.find_child("editor_times", "id", "empty")))
, mp_settings_()
, game_classification_()
, music_tracks_()

View file

@ -110,7 +110,10 @@ custom_tod::custom_tod(const std::vector<time_of_day>& times, int current_time)
, color_field_g_(register_integer("tod_green", true))
, color_field_b_(register_integer("tod_blue", true))
{
assert(!times_.empty());
if(times_.empty())
{
times_.push_back(time_of_day());
}
}
void custom_tod::pre_show(window& window)