Lift more code to use only the basemap fields and methods.

This commit is contained in:
Eric S. Raymond 2007-07-01 07:01:07 +00:00
parent 9feb3c2dcc
commit a87b19c15b
2 changed files with 28 additions and 28 deletions

View file

@ -29,21 +29,21 @@ map_undo_action::map_undo_action() {
starting_locations_set_ = false;
}
const std::map<gamemap::location, t_translation::t_letter>& map_undo_action::undo_terrains() const
const std::map<basemap::location, t_translation::t_letter>& map_undo_action::undo_terrains() const
{
return old_terrain_;
}
const std::map<gamemap::location, t_translation::t_letter>& map_undo_action::redo_terrains() const
const std::map<basemap::location, t_translation::t_letter>& map_undo_action::redo_terrains() const
{
return new_terrain_;
}
const std::set<gamemap::location> map_undo_action::undo_selection() const {
const std::set<basemap::location> map_undo_action::undo_selection() const {
return old_selection_;
}
const std::set<gamemap::location> map_undo_action::redo_selection() const {
const std::set<basemap::location> map_undo_action::redo_selection() const {
return new_selection_;
}
@ -55,17 +55,17 @@ std::string map_undo_action::new_map_data() const {
return new_map_data_;
}
const std::map<gamemap::location, int>& map_undo_action::undo_starting_locations() const {
const std::map<basemap::location, int>& map_undo_action::undo_starting_locations() const {
return old_starting_locations_;
}
const std::map<gamemap::location, int>& map_undo_action::redo_starting_locations() const {
const std::map<basemap::location, int>& map_undo_action::redo_starting_locations() const {
return new_starting_locations_;
}
void map_undo_action::add_terrain(const t_translation::t_letter& old_tr,
const t_translation::t_letter& new_tr,
const gamemap::location& lc)
const basemap::location& lc)
{
old_terrain_[lc] = old_tr;
new_terrain_[lc] = new_tr;
@ -76,8 +76,8 @@ bool map_undo_action::terrain_set() const {
return terrain_set_;
}
void map_undo_action::set_selection(const std::set<gamemap::location> &old_selection,
const std::set<gamemap::location> &new_selection) {
void map_undo_action::set_selection(const std::set<basemap::location> &old_selection,
const std::set<basemap::location> &new_selection) {
old_selection_ = old_selection;
new_selection_ = new_selection;
selection_set_ = true;
@ -99,8 +99,8 @@ bool map_undo_action::map_data_set() const {
}
void map_undo_action::add_starting_location(const int old_side, const int new_side,
const gamemap::location &old_loc,
const gamemap::location &new_loc) {
const basemap::location &old_loc,
const basemap::location &new_loc) {
old_starting_locations_[old_loc] = old_side;
new_starting_locations_[new_loc] = new_side;
starting_locations_set_ = true;

View file

@ -32,28 +32,28 @@ class map_undo_action {
public:
map_undo_action();
const std::map<gamemap::location, t_translation::t_letter>& undo_terrains() const;
const std::map<gamemap::location, t_translation::t_letter>& redo_terrains() const;
const std::map<basemap::location, t_translation::t_letter>& undo_terrains() const;
const std::map<basemap::location, t_translation::t_letter>& redo_terrains() const;
const std::set<gamemap::location> undo_selection() const;
const std::set<gamemap::location> redo_selection() const;
const std::set<basemap::location> undo_selection() const;
const std::set<basemap::location> redo_selection() const;
std::string new_map_data() const;
std::string old_map_data() const;
const std::map<gamemap::location, int>& undo_starting_locations() const;
const std::map<gamemap::location, int>& redo_starting_locations() const;
const std::map<basemap::location, int>& undo_starting_locations() const;
const std::map<basemap::location, int>& redo_starting_locations() const;
void add_terrain(const t_translation::t_letter& old_tr,
const t_translation::t_letter& new_tr,
const gamemap::location& lc);
const basemap::location& lc);
/// Return true if a terrain change has been saved in this undo
/// action.
bool terrain_set() const;
void set_selection(const std::set<gamemap::location> &old_selection,
const std::set<gamemap::location> &new_selection);
void set_selection(const std::set<basemap::location> &old_selection,
const std::set<basemap::location> &new_selection);
/// Return true if a selection change has been saved in this undo
/// action.
@ -67,25 +67,25 @@ public:
bool map_data_set() const;
void add_starting_location(const int old_side, const int new_side,
const gamemap::location &old_loc,
const gamemap::location &new_loc);
const basemap::location &old_loc,
const basemap::location &new_loc);
/// Return true if starting locations have been saved in this undo
/// action.
bool starting_location_set() const;
private:
std::map<gamemap::location, t_translation::t_letter> old_terrain_;
std::map<gamemap::location, t_translation::t_letter> new_terrain_;
std::map<basemap::location, t_translation::t_letter> old_terrain_;
std::map<basemap::location, t_translation::t_letter> new_terrain_;
bool terrain_set_;
std::set<gamemap::location> old_selection_;
std::set<gamemap::location> new_selection_;
std::set<basemap::location> old_selection_;
std::set<basemap::location> new_selection_;
bool selection_set_;
std::string old_map_data_;
std::string new_map_data_;
bool map_data_set_;
std::map<gamemap::location,int> old_starting_locations_;
std::map<gamemap::location,int> new_starting_locations_;
std::map<basemap::location,int> old_starting_locations_;
std::map<basemap::location,int> new_starting_locations_;
bool starting_locations_set_;
};