1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00
Changes were reviewed manually
This commit is contained in:
Alexander Wilms
2024-06-24 03:23:26 +02:00
parent 820b1b446e
commit 02e429e973
277 changed files with 815 additions and 815 deletions

View File

@@ -82,7 +82,7 @@ const Player * CGameInfoCallback::getPlayer(PlayerColor color) const
const PlayerState * CGameInfoCallback::getPlayerState(PlayerColor color, bool verbose) const
{
//funtion written from scratch since it's accessed A LOT by AI
//function written from scratch since it's accessed A LOT by AI
if(!color.isValidPlayer())
{
@@ -624,7 +624,7 @@ EBuildingState CGameInfoCallback::canBuildStructure( const CGTownInstance *t, Bu
if (!t->genBuildingRequirements(ID).test(buildTest))
return EBuildingState::PREREQUIRES;
if(t->builded >= VLC->settings()->getInteger(EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP))
if(t->built >= VLC->settings()->getInteger(EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP))
return EBuildingState::CANT_BUILD_TODAY; //building limit
//checking resources
@@ -715,7 +715,7 @@ bool CGameInfoCallback::isOwnedOrVisited(const CGObjectInstance *obj) const
return true;
const TerrainTile *t = getTile(obj->visitablePos()); //get entrance tile
const CGObjectInstance *visitor = t->visitableObjects.back(); //visitong hero if present or the obejct itself at last
const CGObjectInstance *visitor = t->visitableObjects.back(); //visitong hero if present or the object itself at last
return visitor->ID == Obj::HERO && canGetFullInfo(visitor); //owned or allied hero is a visitor
}
@@ -781,12 +781,12 @@ int CPlayerSpecificInfoCallback::getHeroSerial(const CGHeroInstance * hero, bool
size_t index = 0;
auto & heroes = gs->players[*getPlayerID()].heroes;
for (auto & heroe : heroes)
for (auto & hero : heroes)
{
if (includeGarrisoned || !(heroe)->inTownGarrison)
if (includeGarrisoned || !(hero)->inTownGarrison)
index++;
if (heroe == hero)
if (hero == hero)
return static_cast<int>(index);
}
return -1;
@@ -984,7 +984,7 @@ std::vector<ObjectInstanceID> CGameInfoCallback::getVisibleTeleportObjects(std::
return ids;
}
std::vector<ObjectInstanceID> CGameInfoCallback::getTeleportChannelEntraces(TeleportChannelID id, PlayerColor player) const
std::vector<ObjectInstanceID> CGameInfoCallback::getTeleportChannelEntrances(TeleportChannelID id, PlayerColor player) const
{
return getVisibleTeleportObjects(gs->map->teleportChannels[id]->entrances, player);
}
@@ -996,7 +996,7 @@ std::vector<ObjectInstanceID> CGameInfoCallback::getTeleportChannelExits(Telepor
ETeleportChannelType CGameInfoCallback::getTeleportChannelType(TeleportChannelID id, PlayerColor player) const
{
std::vector<ObjectInstanceID> entrances = getTeleportChannelEntraces(id, player);
std::vector<ObjectInstanceID> entrances = getTeleportChannelEntrances(id, player);
std::vector<ObjectInstanceID> exits = getTeleportChannelExits(id, player);
if((entrances.empty() || exits.empty()) // impassable if exits or entrances list are empty
|| (entrances.size() == 1 && entrances == exits)) // impassable if only entrance and only exit is same object. e.g bidirectional monolith