当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerCityPtr::setBorderInfo方法代码示例

本文整理汇总了C++中PlayerCityPtr::setBorderInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCityPtr::setBorderInfo方法的具体用法?C++ PlayerCityPtr::setBorderInfo怎么用?C++ PlayerCityPtr::setBorderInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerCityPtr的用法示例。


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

示例1: TilePos

void C3Sav::Impl::initEntryExit(std::fstream &f, PlayerCityPtr ioCity)
{
    unsigned int size = ioCity->tilemap().size();

    const unsigned int savePos = f.tellg();

    // init road entry/exit point
    unsigned short int i = 0;
    unsigned short int j = 0;
    f.seekg(1236, std::ios::cur);
    f.read((char*)&i, 2);
    f.read((char*)&j, 2);

    BorderInfo borderInfo;

    borderInfo.roadEntry = TilePos( i, size - j - 1 );

    f.read((char*)&i, 2);
    f.read((char*)&j, 2);
    borderInfo.roadExit = TilePos( i, size - j - 1 );

    // init boat entry/exit point
    f.seekg(savePos, std::ios::beg);
    f.seekg(1276, std::ios::cur);
    f.read((char*)&i, 2);
    f.read((char*)&j, 2);
    borderInfo.boatEntry = TilePos( i, size - j - 1 );

    f.read((char*)&i, 2);
    f.read((char*)&j, 2);
    borderInfo.boatExit = TilePos( i, size - j - 1);

    ioCity->setBorderInfo( borderInfo );

    f.seekg(savePos, std::ios::beg);
}
开发者ID:KSLcom,项目名称:caesaria-game,代码行数:36,代码来源:loader_sav.cpp

示例2: TilePos

void C3Map::Impl::initEntryExit(std::fstream &f, PlayerCityPtr ioCity)
{
  unsigned int size = ioCity->tilemap().size();

  // init road entry/exit point
  unsigned short int i = 0;
  unsigned short int j = 0;
  f.seekg(kRoadEntry, std::ios::beg);
  f.read((char*)&i, 2);
  f.read((char*)&j, 2);

  BorderInfo borderInfo;

  borderInfo.roadEntry = TilePos( i, size - j - 1 );

  f.read((char*)&i, 2);
  f.read((char*)&j, 2);
  borderInfo.roadExit = TilePos( i, size - j - 1 );

  // init boat entry/exit point
  f.seekg(kBoatEntry, std::ios::beg);
  f.read((char*)&i, 2);
  f.read((char*)&j, 2);
  borderInfo.boatEntry = TilePos( i, size - j - 1 );

  f.read((char*)&i, 2);
  f.read((char*)&j, 2);
  borderInfo.boatExit = TilePos( i, size - j - 1);

  ioCity->setBorderInfo( borderInfo );

  //std::cout << "road entry at:" << ioCity.getRoadEntryI() << "," << ioCity.getRoadEntryJ() << std::endl;
  //std::cout << "road exit at:"  << ioCity.getRoadExitI()  << "," << ioCity.getRoadExitJ()  << std::endl;
  //std::cout << "boat entry at:" << ioCity.getBoatEntryI() << "," << ioCity.getBoatEntryJ() << std::endl;
  //std::cout << "boat exit at:"  << ioCity.getBoatExitI()  << "," << ioCity.getBoatExitJ()  << std::endl;
}
开发者ID:Ecordonnier,项目名称:caesaria-game,代码行数:36,代码来源:loader_map.cpp


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