1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

Enabled & fixed -Woverloaded-virtual warning from gcc/cland

- fixed almost all instances of overloaded-virtual warning
- cleared up inheritance & method overrides in code affected by warning
This commit is contained in:
Ivan Savenko
2022-12-07 21:50:45 +02:00
parent 65802d958b
commit 2855606a88
34 changed files with 120 additions and 88 deletions

View File

@ -1957,7 +1957,16 @@ BattleField CGameState::battleGetBattlefieldType(int3 tile, CRandomGenerator & r
*RandomGeneratorUtil::nextItem(t.terType->battleFields, rand));
}
UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack)
void CGameState::getUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const
{
assert(obj);
assert(obj->hasStackAtSlot(stackPos));
out = getUpgradeInfo(obj->getStack(stackPos));
}
UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack) const
{
UpgradeInfo ret;
const CCreature *base = stack.type;
@ -2021,7 +2030,7 @@ UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack)
return ret;
}
PlayerRelations::PlayerRelations CGameState::getPlayerRelations( PlayerColor color1, PlayerColor color2 )
PlayerRelations::PlayerRelations CGameState::getPlayerRelations( PlayerColor color1, PlayerColor color2 ) const
{
if ( color1 == color2 )
return PlayerRelations::SAME_PLAYER;
@ -2042,8 +2051,7 @@ void CGameState::apply(CPack *pack)
void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out)
{
CPathfinder pathfinder(out, this, hero);
pathfinder.calculatePaths();
calculatePaths(std::make_shared<SingleHeroPathfinderConfig>(out, this, hero));
}
void CGameState::calculatePaths(std::shared_ptr<PathfinderConfig> config)
@ -2187,17 +2195,21 @@ void CGameState::updateRumor()
while(!rumor.update(rumorId, rumorExtra));
}
bool CGameState::isVisible(int3 pos, PlayerColor player)
bool CGameState::isVisible(int3 pos, boost::optional<PlayerColor> player) const
{
if (!map->isInTheMap(pos))
return false;
if (!player)
return true;
if(player == PlayerColor::NEUTRAL)
return false;
if(player.isSpectator())
if(player->isSpectator())
return true;
return (*getPlayerTeam(player)->fogOfWarMap)[pos.z][pos.x][pos.y];
return (*getPlayerTeam(*player)->fogOfWarMap)[pos.z][pos.x][pos.y];
}
bool CGameState::isVisible( const CGObjectInstance *obj, boost::optional<PlayerColor> player )
bool CGameState::isVisible( const CGObjectInstance *obj, boost::optional<PlayerColor> player ) const
{
if(!player)
return true;