Fixed segfault, although random map generation does not work

This commit is contained in:
Kristoffer Erlandsson 2004-06-20 21:25:11 +00:00
parent 322343d44d
commit 6408b1f246
3 changed files with 12 additions and 9 deletions

View file

@ -95,12 +95,6 @@ map_editor::map_editor(display &gui, gamemap &map, config &theme, config &game_c
// Set size specs.
adjust_sizes(gui_, size_specs_);
gui_.invalidate_game_status();
gui_.begin_game();
gui_.invalidate_all();
gui_.draw();
palette_.adjust_size();
brush_.adjust_size();
if (first_time_created_) {
// Perform some initializations that should only be performed
// the first time the editor object is created.
@ -132,6 +126,8 @@ map_editor::map_editor(display &gui, gamemap &map, config &theme, config &game_c
gui_.begin_game();
gui_.invalidate_all();
gui_.draw();
palette_.adjust_size();
brush_.adjust_size();
events::raise_draw_event();
}

View file

@ -123,9 +123,15 @@ std::string new_map_dialog(display& disp, gamemap::TERRAIN fill_terrain,
if (random_map_generator == NULL) {
// Initialize the map generator if this is the first call,
// otherwise keep the settings and such.
const config* const cfg =
game_config.find_child("multiplayer","id","ranmap")->child("generator");
random_map_generator.assign(create_map_generator("", cfg));
const config* const toplevel_cfg = game_config.find_child("multiplayer","id","ranmap");
const config* const cfg = toplevel_cfg == NULL ? NULL : toplevel_cfg->child("generator");
if (cfg == NULL) {
config dummy_cfg("");
random_map_generator.assign(create_map_generator("", &dummy_cfg));
}
else {
random_map_generator.assign(create_map_generator("", cfg));
}
}
for(bool draw = true;; draw = false) {

View file

@ -73,6 +73,7 @@ void terrain_palette::adjust_size() {
top_button_.set_dirty();
bot_button_.set_dirty();
bg_backup();
gui_.invalidate_all();
set_dirty();
}