MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / setMapSize

Method setMapSize

source/game/Seat.cpp:476–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476void Seat::setMapSize(int x, int y)
477{
478 if(mPlayer == nullptr)
479 return;
480 if(!mPlayer->getIsHuman())
481 return;
482
483 mTilesStates = std::vector<std::vector<TileStateNotified>>(x, std::vector<TileStateNotified>(y));
484 // By default, we know that rock (ground & full) will be set as rock full tiles,
485 // gold (ground & full) will be set as gold full tiles,
486 // other tiles will be set as dirt full tiles
487 for(int xxx = 0; xxx < x; ++xxx)
488 {
489 for(int yyy = 0; yyy < y; ++yyy)
490 {
491 Tile* tile = mGameMap->getTile(xxx, yyy);
492 if(tile == nullptr)
493 continue;
494
495 if(tile->getType() == TileType::gold)
496 {
497 mTilesStates[xxx][yyy].mTileVisual = TileVisual::goldFull;
498 continue;
499 }
500
501 if(tile->getType() == TileType::rock)
502 {
503 mTilesStates[xxx][yyy].mTileVisual = TileVisual::rockFull;
504 continue;
505 }
506
507 mTilesStates[xxx][yyy].mTileVisual = TileVisual::dirtFull;
508 }
509 }
510}
511
512unsigned int Seat::checkAllGoals()
513{

Callers 1

Calls 3

getIsHumanMethod · 0.80
getTileMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected