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

Method hasVisionOnTile

source/game/Seat.cpp:330–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330bool Seat::hasVisionOnTile(Tile* tile)
331{
332 if(!mGameMap->isServerGameMap())
333 {
334 // On client side, we check only for the local player
335 if(this != mGameMap->getLocalPlayer()->getSeat())
336 return false;
337
338 return tile->getLocalPlayerHasVision();
339 }
340
341 // AI players have vision on every tile
342 if(mPlayer == nullptr)
343 return true;
344 if(!mPlayer->getIsHuman())
345 return true;
346
347 if(tile->getX() >= static_cast<int>(mTilesStates.size()))
348 {
349 OD_LOG_ERR("Tile=" + Tile::displayAsString(tile));
350 return false;
351 }
352 if(tile->getY() >= static_cast<int>(mTilesStates[tile->getX()].size()))
353 {
354 OD_LOG_ERR("Tile=" + Tile::displayAsString(tile));
355 return false;
356 }
357
358 TileStateNotified& stateTile = mTilesStates[tile->getX()][tile->getY()];
359
360 return stateTile.mVisionTurnCurrent;
361}
362
363void Seat::initSeat()
364{

Callers 11

buildTrapDefaultMethod · 0.80
sellTrapTilesMethod · 0.80
sellTrapTilesEditorMethod · 0.80
buildRoomDefaultMethod · 0.80
sellRoomTilesMethod · 0.80
sellRoomTilesEditorMethod · 0.80
buildRoomMethod · 0.80
tryDropMethod · 0.80
fireDropEntityMethod · 0.80
tryDropMethod · 0.80
tryDropMethod · 0.80

Calls 7

isServerGameMapMethod · 0.80
getLocalPlayerMethod · 0.80
getIsHumanMethod · 0.80
getSeatMethod · 0.45
getXMethod · 0.45
getYMethod · 0.45

Tested by

no test coverage detected