您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ADT_file类代码示例

51自学网 2021-06-03 12:03:29
  C++
这篇教程C++ ADT_file类代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ADT_file的典型用法代码示例。如果您正苦于以下问题:C++ ADT_file类的具体用法?C++ ADT_file怎么用?C++ ADT_file使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

在下文中一共展示了ADT_file类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ConvertADT

bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build){    ADT_file adt;    if (!adt.loadFile(filename, false))        return false;    memset(liquid_show, 0, sizeof(liquid_show));    memset(liquid_type, 0, sizeof(liquid_type));    // Prepare map header    map_fileheader map;    map.mapMagic = *(uint32 const*)MAP_MAGIC;    map.versionMagic = *(uint32 const*)MAP_VERSION_MAGIC;    map.buildMagic = build;    // Get area flags data    for (int i=0; i<ADT_CELLS_PER_GRID; i++)    {        for(int j=0; j<ADT_CELLS_PER_GRID; j++)        {            adt_MCNK * cell = adt.cells[i][j];            uint32 areaid = cell->areaid;            if(areaid && areaid <= maxAreaId)            {                if(areas[areaid] != 0xffff)                {                    area_flags[i][j] = areas[areaid];                    continue;                }                printf("File: %s/nCan't find area flag for areaid %u [%d, %d]./n", filename, areaid, cell->ix, cell->iy);            }            area_flags[i][j] = 0xffff;        }    }    //============================================    // Try pack area data    //============================================    bool fullAreaData = false;    uint32 areaflag = area_flags[0][0];    for (int y=0; y<ADT_CELLS_PER_GRID; y++)    {        for(int x=0; x<ADT_CELLS_PER_GRID; x++)        {            if(area_flags[y][x]!=areaflag)            {                fullAreaData = true;                break;            }        }    }    map.areaMapOffset = sizeof(map);    map.areaMapSize   = sizeof(map_areaHeader);    map_areaHeader areaHeader;    areaHeader.fourcc = *(uint32 const*)MAP_AREA_MAGIC;    areaHeader.flags = 0;    if (fullAreaData)    {        areaHeader.gridArea = 0;        map.areaMapSize+=sizeof(area_flags);    }    else    {        areaHeader.flags |= MAP_AREA_NO_AREA;        areaHeader.gridArea = (uint16)areaflag;    }    //    // Get Height map from grid    //    for (int i=0; i<ADT_CELLS_PER_GRID; i++)    {        for(int j=0; j<ADT_CELLS_PER_GRID; j++)        {            adt_MCNK * cell = adt.cells[i][j];            if (!cell)                continue;            // Height values for triangles stored in order:            // 1     2     3     4     5     6     7     8     9            //    10    11    12    13    14    15    16    17            // 18    19    20    21    22    23    24    25    26            //    27    28    29    30    31    32    33    34            // . . . . . . . .            // For better get height values merge it to V9 and V8 map            // V9 height map:            // 1     2     3     4     5     6     7     8     9            // 18    19    20    21    22    23    24    25    26            // . . . . . . . .            // V8 height map:            //    10    11    12    13    14    15    16    17            //    27    28    29    30    31    32    33    34            // . . . . . . . .            // Set map height as grid height            for (int y=0; y <= ADT_CELL_SIZE; y++)            {                int cy = i*ADT_CELL_SIZE + y;                for (int x=0; x <= ADT_CELL_SIZE; x++)//.........这里部分代码省略.........
开发者ID:Erotix8210,项目名称:StrawberryCore,代码行数:101,


示例2: ConvertADT

bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build){    ADT_file adt;    if (!adt.loadFile(WorldMpq, filename))        return false;    memset(liquid_show, 0, sizeof(liquid_show));    memset(liquid_flags, 0, sizeof(liquid_flags));    memset(liquid_entry, 0, sizeof(liquid_entry));    // Prepare map header    map_fileheader map;    map.mapMagic = *(uint32 const*)MAP_MAGIC;    map.versionMagic = *(uint32 const*)MAP_VERSION_MAGIC;    map.buildMagic = build;    // Get area flags data    for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)    {        for (int j = 0; j < ADT_CELLS_PER_GRID; ++j)        {            adt_MCNK* cell = adt.cells[i][j];            uint32 areaid = cell->areaid;            if (areaid && areaid <= maxAreaId)            {                if (areas[areaid] != 0xFFFF)                {                    area_flags[i][j] = areas[areaid];                    continue;                }                printf("File: %s/nCan't find area flag for areaid %u [%d, %d]./n", filename, areaid, cell->ix, cell->iy);            }            area_flags[i][j] = 0xffff;        }    }    //============================================    // Try pack area data    //============================================    bool fullAreaData = false;    uint32 areaflag = area_flags[0][0];    for (int y=0;y<ADT_CELLS_PER_GRID;y++)    {        for(int x=0;x<ADT_CELLS_PER_GRID;x++)        {            if(area_flags[y][x]!=areaflag)            {                fullAreaData = true;                break;            }        }    }    map.areaMapOffset = sizeof(map);    map.areaMapSize   = sizeof(map_areaHeader);    map_areaHeader areaHeader;    areaHeader.fourcc = *(uint32 const*)MAP_AREA_MAGIC;    areaHeader.flags = 0;    if (fullAreaData)    {        areaHeader.gridArea = 0;        map.areaMapSize+=sizeof(area_flags);    }    else    {        areaHeader.flags |= MAP_AREA_NO_AREA;        areaHeader.gridArea = (uint16)areaflag;    }    //    // Get Height map from grid    //    for (int i=0;i<ADT_CELLS_PER_GRID;i++)    {        for(int j=0;j<ADT_CELLS_PER_GRID;j++)        {            adt_MCNK * cell = adt.cells[i][j];            if (!cell)                continue;            // Height values for triangles stored in order:            // 1     2     3     4     5     6     7     8     9            //    10    11    12    13    14    15    16    17            // 18    19    20    21    22    23    24    25    26            //    27    28    29    30    31    32    33    34            // . . . . . . . .            // For better get height values merge it to V9 and V8 map            // V9 height map:            // 1     2     3     4     5     6     7     8     9            // 18    19    20    21    22    23    24    25    26            // . . . . . . . .            // V8 height map:            //    10    11    12    13    14    15    16    17            //    27    28    29    30    31    32    33    34            // . . . . . . . .            // Set map height as grid height//.........这里部分代码省略.........
开发者ID:FirstCore,项目名称:PandaCore,代码行数:101,


示例3: ConvertADT

bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int /*cell_y*/, int /*cell_x*/, uint32 build){    ADT_file adt;    if (!adt.loadFile(inputPath))        return false;    adt_MCIN *cells = adt.a_grid->getMCIN();    if (!cells)    {        printf("Can't find cells in '%s'/n", inputPath.c_str());        return false;    }    memset(liquid_show, 0, sizeof(liquid_show));    memset(liquid_flags, 0, sizeof(liquid_flags));    memset(liquid_entry, 0, sizeof(liquid_entry));    // Prepare map header    map_fileheader map;    map.mapMagic = *reinterpret_cast<uint32 const*>(MAP_MAGIC);    map.versionMagic = *reinterpret_cast<uint32 const*>(MAP_VERSION_MAGIC);    map.buildMagic = build;    // Get area flags data    for (int i = 0; i < ADT_CELLS_PER_GRID; i++)        for (int j = 0; j < ADT_CELLS_PER_GRID; j++)            area_ids[i][j] = cells->getMCNK(i, j)->areaid;    //============================================    // Try pack area data    //============================================    bool fullAreaData = false;    uint32 areaId = area_ids[0][0];    for (int y = 0; y < ADT_CELLS_PER_GRID; ++y)    {        for (int x = 0; x < ADT_CELLS_PER_GRID; ++x)        {            if (area_ids[y][x] != areaId)            {                fullAreaData = true;                break;            }        }    }    map.areaMapOffset = sizeof(map);    map.areaMapSize   = sizeof(map_areaHeader);    map_areaHeader areaHeader;    areaHeader.fourcc = *reinterpret_cast<uint32 const*>(MAP_AREA_MAGIC);    areaHeader.flags = 0;    if (fullAreaData)    {        areaHeader.gridArea = 0;        map.areaMapSize += sizeof(area_ids);    }    else    {        areaHeader.flags |= MAP_AREA_NO_AREA;        areaHeader.gridArea = static_cast<uint16>(areaId);    }    //    // Get Height map from grid    //    for (int i=0;i<ADT_CELLS_PER_GRID;i++)    {        for(int j=0;j<ADT_CELLS_PER_GRID;j++)        {            adt_MCNK * cell = cells->getMCNK(i,j);            if (!cell)                continue;            // Height values for triangles stored in order:            // 1     2     3     4     5     6     7     8     9            //    10    11    12    13    14    15    16    17            // 18    19    20    21    22    23    24    25    26            //    27    28    29    30    31    32    33    34            // . . . . . . . .            // For better get height values merge it to V9 and V8 map            // V9 height map:            // 1     2     3     4     5     6     7     8     9            // 18    19    20    21    22    23    24    25    26            // . . . . . . . .            // V8 height map:            //    10    11    12    13    14    15    16    17            //    27    28    29    30    31    32    33    34            // . . . . . . . .            // Set map height as grid height            for (int y=0; y <= ADT_CELL_SIZE; y++)            {                int cy = i*ADT_CELL_SIZE + y;                for (int x=0; x <= ADT_CELL_SIZE; x++)                {                    int cx = j*ADT_CELL_SIZE + x;                    V9[cy][cx]=cell->ypos;                }            }            for (int y=0; y < ADT_CELL_SIZE; y++)//.........这里部分代码省略.........
开发者ID:martial69320,项目名称:cerberus,代码行数:101,



注:本文中的ADT_file类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ADXL362类代码示例
C++ ADDONDEPS类代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。