本文整理汇总了C++中Corner::get_altitude方法的典型用法代码示例。如果您正苦于以下问题:C++ Corner::get_altitude方法的具体用法?C++ Corner::get_altitude怎么用?C++ Corner::get_altitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corner
的用法示例。
在下文中一共展示了Corner::get_altitude方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_map
//.........这里部分代码省略.........
// ##### end Gilbert 2/11 #####//
case MAP_MODE_SPOT:
{ // traversal of location in MapMatrix
int pixelX = (image_x1 + image_x2 + 1) / 2;
int pixelY = image_y1;
int xLoc, yLoc;
int writePtrInc = vga_back.buf_pitch() + 1;
for( yLoc = 0; yLoc < max_y_loc; (yLoc&1?++pixelY:--pixelX) , ++yLoc )
{
short* writePtr = vga_back.buf_ptr(pixelX, pixelY);
xLoc = 0;
Location* locPtr = get_loc( xLoc, yLoc );
for( ; xLoc < max_x_loc; (xLoc += 2), (locPtr +=2), (writePtr += writePtrInc) )
{
if( locPtr->explored() )
{
*writePtr = mapModeColor;
}
}
}
}
break;
case MAP_MODE_POWER:
{
int pixelX = (image_x1 + image_x2 + 1) / 2;
int pixelY = image_y1;
int xLoc, yLoc;
int writePtrInc = vga_back.buf_pitch() + 1;
for( yLoc = 0; yLoc < max_y_loc; (yLoc&1?++pixelY:--pixelX) , ++yLoc )
{
short* writePtr = vga_back.buf_ptr(pixelX, pixelY);
xLoc = 0;
Location *locPtr = get_loc( xLoc, yLoc );
for( xLoc = 0; xLoc < max_x_loc; (xLoc += 2), (locPtr +=2), (writePtr += writePtrInc) )
{
if( locPtr->explored() )
{
// ####### begin Gilbert 10/2 #########//
if( filter_object_flag || filter_nation_flag ) // do not anything except filtered objects when filters are on
*writePtr = mapModeColor;
else if( locPtr->sailable() )
// ####### end Gilbert 10/2 #########//
*writePtr = seaColor;
else if( locPtr->is_rock() || locPtr[1].is_rock() )
*writePtr = rockColor;
/* else if( locPtr->has_dirt() )
{
Rock *dirtPtr = dirt_array[locPtr->dirt_recno()];
RockInfo *dirtInfo = rock_res.get_rock_info(dirtPtr->rock_recno);
if (dirtInfo->rock_type == 'P')
*writePtr = seaColor;
else
*writePtr = rockColor;
}
else if( locPtr->is_plant() || xLoc+1<max_x_loc && locPtr[1].is_plant() )
*writePtr = plantColor;
*/ else
// ###### begin Gilbert 21/12 ########//
{
if( power_mode )
*writePtr = nationColorArray[locPtr->power_nation_recno];
else
*writePtr = nationColorArray[0];
}
// ###### end Gilbert 21/12 ########//
}
}
}
}
break;
case MAP_MODE_ALTITUDE:
{
int pixelX = (image_x1 + image_x2 + 1) / 2;
int pixelY = image_y1;
int xLoc, yLoc;
int writePtrInc = vga_back.buf_pitch() + 1;
for( yLoc = 0; yLoc < max_y_loc; (yLoc&1?++pixelY:--pixelX) , ++yLoc )
{
short* writePtr = vga_back.buf_ptr(pixelX, pixelY);
xLoc = 0;
for( xLoc = 0; xLoc < max_x_loc; (xLoc += 2), (writePtr += writePtrInc) )
{
Corner *cornerPtr = get_corner( xLoc, yLoc );
short alt = cornerPtr->get_altitude();
if( alt > 255 )
alt = 255;
else if( alt < 0 )
alt = 0;
*writePtr = vga.make_pixel((BYTE)alt, 128, 32);
}
}
}
break;
}
sys.yield();
}