本文整理汇总了C++中PlayerCityPtr::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCityPtr::setName方法的具体用法?C++ PlayerCityPtr::setName怎么用?C++ PlayerCityPtr::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCityPtr
的用法示例。
在下文中一共展示了PlayerCityPtr::setName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: THROW
void C3Map::Impl::loadCity(std::fstream& f, PlayerCityPtr oCity)
{
Tilemap& oTilemap = oCity->tilemap();
/* get number of city */
f.seekg(kLocation, std::ios::beg);
unsigned int location=0;
f.read((char*)&location, 1);
Logger::warning( "C3MapLoader: location of city is %d", (int)(location) );
std::string cityName = LoaderHelper::getDefaultCityName( location );
oCity->setName( cityName );
f.seekg(kSize, std::ios::beg);
int map_size; // 32bits
int size_2;
f.read((char*)&map_size, 4);
f.read((char*)&size_2, 4);
Logger::warning( "C3MapLoader: map size is %d", map_size );
if (map_size != size_2)
{
THROW("Horizontal and vertical map sizes are different!");
}
oCity->resize(map_size);
// need to rewrite better
ScopedArrayPtr<short> pGraphicGrid( new short[tilemap::c3mapSizeSq] );
ScopedArrayPtr<unsigned char> pEdgeGrid( new unsigned char[tilemap::c3mapSizeSq] );
ScopedArrayPtr<short> pTerrainGrid( new short[tilemap::c3mapSizeSq] );
ScopedArrayPtr<unsigned char> pRndmTerGrid( new unsigned char[tilemap::c3mapSizeSq] );
ScopedArrayPtr<unsigned char> pRandomGrid( new unsigned char[tilemap::c3mapSizeSq] );
ScopedArrayPtr<unsigned char> pElevationGrid( new unsigned char[tilemap::c3mapSizeSq] );
if( pGraphicGrid.isNull() || pEdgeGrid.isNull() || pTerrainGrid.isNull() ||
pRndmTerGrid.isNull() || pRandomGrid.isNull() || pElevationGrid.isNull() )
{
THROW("NOT ENOUGH MEMORY!!!! FATAL");
}
// here also make copy of original arrays in memory
f.seekg(kGraphicGrid, std::ios::beg);
f.read((char*)pGraphicGrid.data(), tilemap::c3mapSizeSq*2);
f.seekg(kEdgeGrid, std::ios::beg);
f.read((char*)pEdgeGrid.data(), tilemap::c3mapSizeSq);
f.seekg(kTerrainGrid, std::ios::beg);
f.read((char*)pTerrainGrid.data(), tilemap::c3mapSizeSq*2);
f.seekg(kRndmTerGrid, std::ios::beg);
f.read((char*)pRndmTerGrid.data(), tilemap::c3mapSizeSq);
f.seekg(kRandomGrid, std::ios::beg);
f.read((char*)pRandomGrid.data(), tilemap::c3mapSizeSq);
f.seekg(kElevationGrid, std::ios::beg);
f.read((char*)pElevationGrid.data(), tilemap::c3mapSizeSq);
std::map< int, std::map< int, unsigned char > > edgeData;
// loads the graphics map
int border_size = (gfx::tilemap::c3mapSize - map_size) / 2;
for (int itA = 0; itA < map_size; ++itA)
{
for (int itB = 0; itB < map_size; ++itB)
{
int i = itB;
int j = map_size - itA - 1;
int index = gfx::tilemap::c3mapSize * (border_size + itA) + border_size + itB;
Tile& tile = oTilemap.at(i, j);
tile.setPicture( imgid::toResource( pGraphicGrid.data()[index] ) );
tile.setOriginalImgId( pGraphicGrid.data()[index] );
//tile.setHeight( pElevationGrid.data()[ index ] );
edgeData[ i ][ j ] = pEdgeGrid.data()[index];
tile::decode( tile, pTerrainGrid.data()[index] );
tile::fixPlateauFlags( tile );
}
}
for (int i = 0; i < map_size; ++i)
{
for (int j = 0; j < map_size; ++j)
{
unsigned char ed = edgeData[ i ][ j ];
if( ed == 0x00)
{
int size = 1;
{
int dj;
try
{
// find size, 5 is maximal size for building
for (dj = 0; dj < gfx::tilemap::c3bldSize; ++dj)
{
int edd = edgeData[ i ][ j - dj ];
//.........这里部分代码省略.........