本文整理汇总了C++中map_location::wml_x方法的典型用法代码示例。如果您正苦于以下问题:C++ map_location::wml_x方法的具体用法?C++ map_location::wml_x怎么用?C++ map_location::wml_x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map_location
的用法示例。
在下文中一共展示了map_location::wml_x方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shrouded
bool team::shrouded(const map_location& loc) const
{
if(!resources::gameboard)
return shroud_.value(loc.wml_x(),loc.wml_y());
return shroud_.shared_value(ally_shroud(resources::gameboard->teams()),loc.wml_x(),loc.wml_y());
}
示例2: fogged
bool team::fogged(const map_location& loc) const
{
if(shrouded(loc)) return true;
// Check for an override of fog.
if ( fog_clearer_.count(loc) > 0 )
return false;
if(!resources::gameboard)
return fog_.value(loc.wml_x(),loc.wml_y());
return fog_.shared_value(ally_fog(resources::gameboard->teams()),loc.wml_x(),loc.wml_y());
}
示例3: luaW_pushlocation
void luaW_pushlocation(lua_State *L, const map_location& ml)
{
lua_createtable(L, 2, 0);
lua_pushinteger(L, ml.wml_x());
lua_rawseti(L, -2, 1);
lua_pushinteger(L, ml.wml_y());
lua_rawseti(L, -2, 2);
}
示例4: overlay_impl
void gamemap::overlay_impl(
// const but changed via set_terrain
const t_translation::ter_map& m1,
starting_positions& m1_st,
const t_translation::ter_map& m2,
const starting_positions& m2_st,
std::function<void (const map_location&, const t_translation::terrain_code&, terrain_type_data::merge_mode, bool)> set_terrain,
map_location loc,
const std::vector<overlay_rule>& rules,
bool m_is_odd,
bool ignore_special_locations)
{
int xpos = loc.wml_x();
int ypos = loc.wml_y();
const int xstart = std::max<int>(0, -xpos);
const int xend = std::min<int>(m2.w, m1.w -xpos);
const int xoffset = xpos;
const int ystart_even = std::max<int>(0, -ypos);
const int yend_even = std::min<int>(m2.h, m1.h - ypos);
const int yoffset_even = ypos;
const int ystart_odd = std::max<int>(0, -ypos +(xpos & 1) -(m_is_odd ? 1 : 0));
const int yend_odd = std::min<int>(m2.h, m1.h - ypos +(xpos & 1) -(m_is_odd ? 1 : 0));
const int yoffset_odd = ypos -(xpos & 1) + (m_is_odd ? 1 : 0);
for(int x1 = xstart; x1 != xend; ++x1) {
int ystart, yend, yoffset;
if(x1 & 1) {
ystart = ystart_odd , yend = yend_odd , yoffset = yoffset_odd;
}
else {
ystart = ystart_even, yend = yend_even, yoffset = yoffset_even;
}
for(int y1 = ystart; y1 != yend; ++y1) {
const int x2 = x1 + xoffset;
const int y2 = y1 + yoffset;
const t_translation::terrain_code t = m2.get(x1,y1);
const t_translation::terrain_code current = m1.get(x2, y2);
if(t == t_translation::FOGGED || t == t_translation::VOID_TERRAIN) {
continue;
}
// See if there is a matching rule
const overlay_rule* rule = nullptr;
for(const overlay_rule& current_rule : rules)
{
if(!current_rule.old_.empty() && !t_translation::terrain_matches(current, current_rule.old_)) {
continue;
}
if(!current_rule.new_.empty() && !t_translation::terrain_matches(t, current_rule.new_)) {
continue;
}
rule = ¤t_rule;
break;
}
if (!rule) {
set_terrain(map_location(x2, y2, wml_loc()), t, terrain_type_data::BOTH, false);
}
else if(!rule->use_old_) {
set_terrain(map_location(x2, y2, wml_loc()), rule->terrain_ ? *rule->terrain_ : t , rule->mode_, rule->replace_if_failed_);
}
}
}
if (!ignore_special_locations) {
for(auto& pair : m2_st.left) {
int x = pair.second.wml_x();
int y = pair.second.wml_y();
if(x & 1) {
if(x < xstart || x >= xend || y < ystart_odd || y >= yend_odd) {
continue;
}
}
else {
if(x < xstart || x >= xend || y < ystart_even || y >= yend_even) {
continue;
}
}
int x_new = x + xoffset;
int y_new = y + ((x & 1 ) ? yoffset_odd : yoffset_even);
map_location pos_new = map_location(x_new, y_new, wml_loc());
m1_st.left.erase(pair.first);
m1_st.insert(starting_positions::value_type(pair.first, t_translation::coordinate(pos_new.x, pos_new.y)));
}
}
}
示例5: on_map_noborder
bool on_map_noborder(const map_location& loc) const
{
return loc.wml_x() > 0 && loc.wml_x() < total_width() - 1 && loc.wml_y() > 0 && loc.wml_y() < total_height() - 1;
}
示例6: on_map
bool on_map(const map_location& loc) const
{
return loc.wml_x() >= 0 && loc.wml_x() < total_width() && loc.wml_y() >= 0 && loc.wml_y() < total_height();
}