本文整理汇总了C++中map_context类的典型用法代码示例。如果您正苦于以下问题:C++ map_context类的具体用法?C++ map_context怎么用?C++ map_context使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了map_context类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: perform_without_undo
void editor_action_deselect::perform_without_undo(map_context& mc) const
{
for(const map_location& loc : area_) {
mc.map().remove_from_selection(loc);
mc.add_changed_location(loc);
}
}
示例2: perform_without_undo
void editor_action_select::perform_without_undo(map_context& mc) const
{
for (const map_location& loc : area_) {
mc.get_map().add_to_selection(loc);
mc.add_changed_location(loc);
}
}
示例3: perform_without_undo
void editor_action_starting_position::perform_without_undo(map_context& mc) const
{
const std::string* old_id = mc.get_map().is_starting_position(loc_);
if (old_id != nullptr) {
mc.get_map().set_special_location(*old_id, map_location());
}
mc.get_map().set_special_location(loc_id_, loc_);
mc.set_needs_labels_reset();
}
示例4: perform_without_undo
void editor_action_unit_delete::perform_without_undo(map_context& mc) const
{
unit_map& units = mc.get_units();
if (!units.erase(loc_)) {
ERR_ED << "Could not delete unit on " << loc_.x << "/" << loc_.y << std::endl;
} else {
mc.add_changed_location(loc_);
}
}
示例5: perform_without_undo
void editor_action_village_delete::perform_without_undo(map_context& mc) const
{
std::vector<team>& teams = mc.get_teams();
for(std::vector<team>::iterator i = teams.begin(); i != teams.end(); ++i) {
if (i->owns_village(loc_)) {
i->lose_village(loc_);
mc.add_changed_location(loc_);
}
}
}
示例6: map_context_refresher
map_context_refresher(editor_controller& ec, const map_context& other_mc)
: ec_(ec), size_changed_(!ec.get_map().same_size_as(other_mc.get_map())), refreshed_(false)
{
}
示例7: perform_without_undo
void editor_action_label_delete::perform_without_undo(map_context& mc) const
{
mc.get_labels().set_label(loc_, "");
}