Fixed a problem where the hotkeys from the game would appear in the editor.

This commit is contained in:
Kristoffer Erlandsson 2004-05-30 16:15:26 +00:00
parent e5fe430e90
commit 770f14661d
3 changed files with 8 additions and 2 deletions

View file

@ -78,6 +78,7 @@ namespace map_editor {
bool map_editor::first_time_created_ = true;
int map_editor::num_operations_since_save_ = 0;
config map_editor::prefs_;
config map_editor::hotkeys_;
map_editor::map_editor(display &gui, gamemap &map, config &theme, config &game_config)
: gui_(gui), map_(map), abort_(DONT_ABORT),
@ -107,7 +108,10 @@ map_editor::map_editor(display &gui, gamemap &map, config &theme, config &game_c
hotkey::add_hotkeys(prefs_, true);
first_time_created_ = false;
}
else {
hotkey::get_hotkeys().clear();
hotkey::add_hotkeys(hotkeys_, true);
}
recalculate_starting_pos_labels();
gui_.begin_game();
gui_.invalidate_all();
@ -116,6 +120,8 @@ map_editor::map_editor(display &gui, gamemap &map, config &theme, config &game_c
}
map_editor::~map_editor() {
// Save the hotkeys so that they are remembered if the editor is recreated.
hotkey::save_hotkeys(hotkeys_);
try {
write_file(prefs_filename, prefs_.write());
}

View file

@ -271,6 +271,7 @@ private:
bool mouse_moved_;
const preferences::display_manager prefs_disp_manager_;
static config prefs_;
static config hotkeys_;
static bool first_time_created_;
bool all_hexes_selected_;

View file

@ -153,7 +153,6 @@ int main(int argc, char** argv)
std::cerr << "Using theme cfg: " << std::endl << theme_cfg->write() << std::endl;
display gui(units, video, map, status, teams,
*theme_cfg, cfg);
gui.set_grid(preferences::grid());
map_editor::map_editor editor(gui, map, *theme_cfg, cfg);
editor.set_file_to_save_as(filename);