1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Fix sonar warnings, convert spaces -> tabs

This commit is contained in:
Ivan Savenko
2025-07-02 18:23:02 +03:00
parent 5caf43a63c
commit e12765dca0
45 changed files with 448 additions and 461 deletions

View File

@@ -19,72 +19,72 @@
std::vector<Component> UIHelper::getArtifactsComponents(const CArtifactSet & artSet, const std::vector<MoveArtifactInfo> & movedPack)
{
std::vector<Component> components;
for(const auto & artMoveInfo : movedPack)
{
const auto art = artSet.getArt(artMoveInfo.dstPos);
assert(art);
std::vector<Component> components;
for(const auto & artMoveInfo : movedPack)
{
const auto art = artSet.getArt(artMoveInfo.dstPos);
assert(art);
if(art->isScroll())
components.emplace_back(ComponentType::SPELL_SCROLL, art->getScrollSpellID());
else
components.emplace_back(ComponentType::ARTIFACT, art->getTypeId());
}
return components;
if(art->isScroll())
components.emplace_back(ComponentType::SPELL_SCROLL, art->getScrollSpellID());
else
components.emplace_back(ComponentType::ARTIFACT, art->getTypeId());
}
return components;
}
std::vector<Component> UIHelper::getSpellsComponents(const std::set<SpellID> & spells)
{
std::vector<Component> components;
for(const auto & spell : spells)
components.emplace_back(ComponentType::SPELL, spell);
return components;
std::vector<Component> components;
for(const auto & spell : spells)
components.emplace_back(ComponentType::SPELL, spell);
return components;
}
soundBase::soundID UIHelper::getNecromancyInfoWindowSound()
{
return soundBase::soundID(soundBase::pickup01 + CRandomGenerator::getDefault().nextInt(6));
return soundBase::soundID(soundBase::pickup01 + CRandomGenerator::getDefault().nextInt(6));
}
std::string UIHelper::getNecromancyInfoWindowText(const CStackBasicDescriptor & stack)
{
MetaString text;
if(stack.getCount() > 1) // Practicing the dark arts of necromancy, ... (plural)
{
text.appendLocalString(EMetaText::GENERAL_TXT, 145);
text.replaceNumber(stack.getCount());
}
else // Practicing the dark arts of necromancy, ... (singular)
{
text.appendLocalString(EMetaText::GENERAL_TXT, 146);
}
text.replaceName(stack);
return text.toString();
MetaString text;
if(stack.getCount() > 1) // Practicing the dark arts of necromancy, ... (plural)
{
text.appendLocalString(EMetaText::GENERAL_TXT, 145);
text.replaceNumber(stack.getCount());
}
else // Practicing the dark arts of necromancy, ... (singular)
{
text.appendLocalString(EMetaText::GENERAL_TXT, 146);
}
text.replaceName(stack);
return text.toString();
}
std::string UIHelper::getArtifactsInfoWindowText()
{
MetaString text;
text.appendLocalString(EMetaText::GENERAL_TXT, 30);
return text.toString();
MetaString text;
text.appendLocalString(EMetaText::GENERAL_TXT, 30);
return text.toString();
}
std::string UIHelper::getEagleEyeInfoWindowText(const CGHeroInstance & hero, const std::set<SpellID> & spells)
{
MetaString text;
text.appendLocalString(EMetaText::GENERAL_TXT, 221); // Through eagle-eyed observation, %s is able to learn %s
text.replaceRawString(hero.getNameTranslated());
MetaString text;
text.appendLocalString(EMetaText::GENERAL_TXT, 221); // Through eagle-eyed observation, %s is able to learn %s
text.replaceRawString(hero.getNameTranslated());
auto curSpell = spells.begin();
text.replaceName(*curSpell++);
for(int i = 1; i < spells.size(); i++, curSpell++)
{
if(i + 1 == spells.size())
text.appendLocalString(EMetaText::GENERAL_TXT, 141); // " and "
else
text.appendRawString(", ");
text.appendName(*curSpell);
}
text.appendRawString(".");
return text.toString();
auto curSpell = spells.begin();
text.replaceName(*curSpell++);
for(int i = 1; i < spells.size(); i++, curSpell++)
{
if(i + 1 == spells.size())
text.appendLocalString(EMetaText::GENERAL_TXT, 141); // " and "
else
text.appendRawString(", ");
text.appendName(*curSpell);
}
text.appendRawString(".");
return text.toString();
}

View File

@@ -366,10 +366,10 @@ void InputSourceTouch::emitPinchEvent(const SDL_TouchFingerEvent & tfinger)
void InputSourceTouch::hapticFeedback() {
if(params.hapticFeedbackEnabled) {
#if defined(VCMI_ANDROID)
CAndroidVMHelper vmHelper;
vmHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "hapticFeedback");
CAndroidVMHelper vmHelper;
vmHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "hapticFeedback");
#elif defined(VCMI_IOS)
iOS_utils::hapticFeedback();
iOS_utils::hapticFeedback();
#endif
}
}

View File

@@ -48,8 +48,8 @@ CreditsScreen::CreditsScreen(Rect rect)
size_t firstQuote = text.find('\"') + 1;
text = text.substr(firstQuote, text.find('\"', firstQuote) - firstQuote);
auto translateCredits = [&text](std::map<std::string, std::string> replacements){
for(auto & item : replacements)
const auto & translateCredits = [&text](const std::map<std::string, std::string> & replacements){
for(const auto & item : replacements)
boost::replace_first(text, "{" + item.second + ":}", "{" + LIBRARY->generaltexth->translate(item.first) + ":}");
};
translateCredits({

View File

@@ -470,7 +470,7 @@ std::shared_ptr<CAnimation> MapRendererObjects::getOverlayAnimation(const CGObje
return nullptr;
}
std::shared_ptr<IImage> MapRendererObjects::getImageToRender(IMapRendererContext & context, const CGObjectInstance * obj, const std::shared_ptr<CAnimation>& animation) const
std::shared_ptr<IImage> MapRendererObjects::getImageToRender(const IMapRendererContext & context, const CGObjectInstance * obj, const std::shared_ptr<CAnimation>& animation) const
{
if(!animation)
return nullptr;

View File

@@ -82,7 +82,7 @@ class MapRendererObjects
std::shared_ptr<CAnimation> getAnimation(const AnimationPath & filename, bool generateMovementGroups, bool enableOverlay);
std::shared_ptr<IImage> getImage(const ImagePath & filename) const;
std::shared_ptr<IImage> getImageToRender(IMapRendererContext & context, const CGObjectInstance * obj, const std::shared_ptr<CAnimation> & animation) const;
std::shared_ptr<IImage> getImageToRender(const IMapRendererContext & context, const CGObjectInstance * obj, const std::shared_ptr<CAnimation> & animation) const;
void renderImage(IMapRendererContext & context, Canvas & target, const int3 & coordinates, const CGObjectInstance * object, const std::shared_ptr<IImage> & image);
void renderObject(IMapRendererContext & context, Canvas & target, const int3 & coordinates, const CGObjectInstance * obj);

View File

@@ -92,7 +92,7 @@ int MapRendererBaseContext::attackedMonsterDirection(const CGObjectInstance * wa
if(wanderingMonster->ID != Obj::MONSTER)
return -1;
for(auto & battle : GAME->interface()->cb->getActiveBattles())
for(const auto & battle : GAME->interface()->cb->getActiveBattles())
if(wanderingMonster->pos == battle.second->getBattle()->getLocation())
return battle.second->getBattle()->getSideHero(BattleSide::ATTACKER)->moveDir;

View File

@@ -47,10 +47,10 @@ static Sint64 impl_seek(SDL_RWops* context, Sint64 offset, int whence)
static std::size_t impl_read(SDL_RWops* context, void *ptr, size_t size, size_t maxnum)
{
auto stream = get_stream(context);
auto oldpos = stream->tell();
auto stream = get_stream(context);
auto oldpos = stream->tell();
auto count = stream->read(static_cast<ui8*>(ptr), size*maxnum);
auto count = stream->read(static_cast<ui8*>(ptr), size*maxnum);
if (count != 0 && count != size*maxnum)
{
@@ -58,7 +58,7 @@ static std::size_t impl_read(SDL_RWops* context, void *ptr, size_t size, size_t
stream->seek(oldpos + size * (count / size));
}
return count / size;
return count / size;
}
static std::size_t impl_write(SDL_RWops* context, const void *ptr, size_t size, size_t num)
@@ -72,9 +72,9 @@ static int impl_close(SDL_RWops* context)
if (context == nullptr)
return 0;
delete get_stream(context);
SDL_FreeRW(context);
return 0;
delete get_stream(context);
SDL_FreeRW(context);
return 0;
}

View File

@@ -38,12 +38,12 @@ CHeroOverview::CHeroOverview(const HeroTypeID & h)
{
OBJECT_CONSTRUCTION;
heroIdx = hero.getNum();
heroIdx = hero.getNum();
pos = Rect(0, 0, 600, 485);
genBackground();
genControls();
genControls();
center();
}
@@ -56,191 +56,191 @@ void CHeroOverview::genBackground()
void CHeroOverview::genControls()
{
Rect r = Rect();
Rect r = Rect();
labelTitle = std::make_shared<CLabel>(pos.w / 2 + 8, 21, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, LIBRARY->generaltexth->allTexts[77]);
// hero image
r = Rect(borderOffset, borderOffset + yOffset, 58, 64);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
// hero image
r = Rect(borderOffset, borderOffset + yOffset, 58, 64);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
imageHero = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), (*LIBRARY->heroh)[heroIdx]->imageIndex, 0, r.x, r.y);
// hero name
r = Rect(64 + borderOffset, borderOffset + yOffset, 220, 64);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
// hero name
r = Rect(64 + borderOffset, borderOffset + yOffset, 220, 64);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelHeroName = std::make_shared<CLabel>(r.x + 110, r.y + 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, (*LIBRARY->heroh)[heroIdx]->getNameTranslated());
labelHeroClass = std::make_shared<CLabel>(r.x + 110, r.y + 45, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, (*LIBRARY->heroh)[heroIdx]->heroClass->getNameTranslated());
// vertical line
backgroundLines.push_back(std::make_shared<SimpleLine>(Point(295, borderOffset + yOffset - 1), Point(295, borderOffset + yOffset - 2 + 439), borderColor));
// skills header
r = Rect(borderOffset, 2 * borderOffset + yOffset + 64, 284, 20);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
for(int i = 0; i < 4; i++)
labelSkillHeader.push_back(std::make_shared<CLabel>((r.w / 4) * i + 42, r.y + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->jktexts[1 + i]));
// vertical line
backgroundLines.push_back(std::make_shared<SimpleLine>(Point(295, borderOffset + yOffset - 1), Point(295, borderOffset + yOffset - 2 + 439), borderColor));
// skill
const int tmp[] = {0, 1, 2, 5};
for(int i = 0; i < 4; i++)
{
r = Rect((284 / 4) * i + 21, 3 * borderOffset + yOffset + 85, 42, 42);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
imageSkill.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("PSKIL42"), tmp[i], 0, r.x, r.y));
}
// skills header
r = Rect(borderOffset, 2 * borderOffset + yOffset + 64, 284, 20);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
for(int i = 0; i < 4; i++)
labelSkillHeader.push_back(std::make_shared<CLabel>((r.w / 4) * i + 42, r.y + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->jktexts[1 + i]));
// skills footer
r = Rect(borderOffset, 4 * borderOffset + yOffset + 128, 284, 20);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
for(int i = 0; i < 4; i++)
{
r = Rect((284 / 4) * i + 42, r.y, r.w, r.h);
labelSkillFooter.push_back(std::make_shared<CLabel>(r.x, r.y + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string((*LIBRARY->heroh)[heroIdx]->heroClass->primarySkillInitial[i])));
}
// skill
const int tmp[] = {0, 1, 2, 5};
for(int i = 0; i < 4; i++)
{
r = Rect((284 / 4) * i + 21, 3 * borderOffset + yOffset + 85, 42, 42);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
imageSkill.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("PSKIL42"), tmp[i], 0, r.x, r.y));
}
// hero biography
r = Rect(borderOffset, 5 * borderOffset + yOffset + 148, 284, 130);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelHeroBiography = std::make_shared<CTextBox>((*LIBRARY->heroh)[heroIdx]->getBiographyTranslated(), r.resize(-borderOffset), CSlider::EStyle::BROWN, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
if(labelHeroBiography->slider && ENGINE->input().getCurrentInputMode() != InputMode::TOUCH)
labelHeroBiography->slider->clearScrollBounds();
// skills footer
r = Rect(borderOffset, 4 * borderOffset + yOffset + 128, 284, 20);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
for(int i = 0; i < 4; i++)
{
r = Rect((284 / 4) * i + 42, r.y, r.w, r.h);
labelSkillFooter.push_back(std::make_shared<CLabel>(r.x, r.y + 10, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string((*LIBRARY->heroh)[heroIdx]->heroClass->primarySkillInitial[i])));
}
// speciality name
r = Rect(2 * borderOffset + 44, 6 * borderOffset + yOffset + 278, 235, 44);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
// hero biography
r = Rect(borderOffset, 5 * borderOffset + yOffset + 148, 284, 130);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelHeroBiography = std::make_shared<CTextBox>((*LIBRARY->heroh)[heroIdx]->getBiographyTranslated(), r.resize(-borderOffset), CSlider::EStyle::BROWN, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
if(labelHeroBiography->slider && ENGINE->input().getCurrentInputMode() != InputMode::TOUCH)
labelHeroBiography->slider->clearScrollBounds();
// speciality name
r = Rect(2 * borderOffset + 44, 6 * borderOffset + yOffset + 278, 235, 44);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelHeroSpeciality = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->allTexts[78]);
labelSpecialityName = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 20, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*LIBRARY->heroh)[heroIdx]->getSpecialtyNameTranslated());
// speciality image
r = Rect(borderOffset, 6 * borderOffset + yOffset + 278, 44, 44);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
imageSpeciality = std::make_shared<CAnimImage>(AnimationPath::builtin("UN44"), (*LIBRARY->heroh)[heroIdx]->imageIndex, 0, r.x, r.y);
// speciality image
r = Rect(borderOffset, 6 * borderOffset + yOffset + 278, 44, 44);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
imageSpeciality = std::make_shared<CAnimImage>(AnimationPath::builtin("UN44"), (*LIBRARY->heroh)[heroIdx]->imageIndex, 0, r.x, r.y);
// speciality description
r = Rect(borderOffset, 7 * borderOffset + yOffset + 322, 284, 85);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
// speciality description
r = Rect(borderOffset, 7 * borderOffset + yOffset + 322, 284, 85);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelSpecialityDescription = std::make_shared<CTextBox>((*LIBRARY->heroh)[heroIdx]->getSpecialtyDescriptionTranslated(), r.resize(-borderOffset), CSlider::EStyle::BROWN, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE);
if(labelSpecialityDescription->slider && ENGINE->input().getCurrentInputMode() != InputMode::TOUCH)
labelSpecialityDescription->slider->clearScrollBounds();
if(labelSpecialityDescription->slider && ENGINE->input().getCurrentInputMode() != InputMode::TOUCH)
labelSpecialityDescription->slider->clearScrollBounds();
// army title
r = Rect(302, borderOffset + yOffset, 292, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelArmyTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.startingArmy"));
// army title
r = Rect(302, borderOffset + yOffset, 292, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelArmyTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.startingArmy"));
// army numbers
r = Rect(302, 3 * borderOffset + yOffset + 62, 292, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
// army numbers
r = Rect(302, 3 * borderOffset + yOffset + 62, 292, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
auto stacksCountChances = LIBRARY->engineSettings()->getVector(EGameSettings::HEROES_STARTING_STACKS_CHANCES);
auto stacksCountChances = LIBRARY->engineSettings()->getVector(EGameSettings::HEROES_STARTING_STACKS_CHANCES);
// army
int space = (260 - 7 * 32) / 6;
for(int i = 0; i < 7; i++)
{
r = Rect(318 + i * (32 + space), 2 * borderOffset + yOffset + 30, 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
int i = 0;
int iStack = 0;
for(auto & army : (*LIBRARY->heroh)[heroIdx]->initialArmy)
{
if((*LIBRARY->creh)[army.creature]->warMachine == ArtifactID::NONE)
{
imageArmy.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("CPRSMALL"), (*LIBRARY->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 2 * borderOffset + yOffset + 30));
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 32, 3 * borderOffset + yOffset + 72, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (army.minAmount == army.maxAmount) ? std::to_string(army.minAmount) : std::to_string(army.minAmount) + "-" + std::to_string(army.maxAmount)));
if(iStack<stacksCountChances.size())
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 32, 3 * borderOffset + yOffset + 86, FONT_SMALL, ETextAlignment::CENTER, grayedColor, std::to_string(stacksCountChances[iStack]) + "%"));
i++;
}
iStack++;
}
// army
int space = (260 - 7 * 32) / 6;
for(int i = 0; i < 7; i++)
{
r = Rect(318 + i * (32 + space), 2 * borderOffset + yOffset + 30, 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
int i = 0;
int iStack = 0;
for(auto & army : (*LIBRARY->heroh)[heroIdx]->initialArmy)
{
if((*LIBRARY->creh)[army.creature]->warMachine == ArtifactID::NONE)
{
imageArmy.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("CPRSMALL"), (*LIBRARY->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 2 * borderOffset + yOffset + 30));
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 32, 3 * borderOffset + yOffset + 72, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, (army.minAmount == army.maxAmount) ? std::to_string(army.minAmount) : std::to_string(army.minAmount) + "-" + std::to_string(army.maxAmount)));
if(iStack<stacksCountChances.size())
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 32, 3 * borderOffset + yOffset + 86, FONT_SMALL, ETextAlignment::CENTER, grayedColor, std::to_string(stacksCountChances[iStack]) + "%"));
i++;
}
iStack++;
}
// war machine title
r = Rect(302, 4 * borderOffset + yOffset + 94, 292, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelWarMachineTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.warMachine"));
// war machine title
r = Rect(302, 4 * borderOffset + yOffset + 94, 292, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelWarMachineTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.warMachine"));
// war machine
space = (260 - 4 * 32) / 3;
for(int i = 0; i < 4; i++)
{
r = Rect(318 + i * (32 + space), 5 * borderOffset + yOffset + 124, 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
i = 0;
iStack = 0;
for(auto & army : (*LIBRARY->heroh)[heroIdx]->initialArmy)
{
if(i == 0)
{
imageWarMachine.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("CPRSMALL"), (*LIBRARY->creh)[army.creature.CATAPULT]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 124));
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 51, 5 * borderOffset + yOffset + 144, FONT_SMALL, ETextAlignment::TOPLEFT, grayedColor, "100%"));
i++;
}
if((*LIBRARY->creh)[army.creature]->warMachine != ArtifactID::NONE)
{
imageWarMachine.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("CPRSMALL"), (*LIBRARY->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 124));
if(iStack<stacksCountChances.size())
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 51, 5 * borderOffset + yOffset + 144, FONT_SMALL, ETextAlignment::TOPLEFT, grayedColor, std::to_string(stacksCountChances[iStack]) + "%"));
i++;
}
iStack++;
}
// war machine
space = (260 - 4 * 32) / 3;
for(int i = 0; i < 4; i++)
{
r = Rect(318 + i * (32 + space), 5 * borderOffset + yOffset + 124, 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
i = 0;
iStack = 0;
for(auto & army : (*LIBRARY->heroh)[heroIdx]->initialArmy)
{
if(i == 0)
{
imageWarMachine.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("CPRSMALL"), (*LIBRARY->creh)[army.creature.CATAPULT]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 124));
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 51, 5 * borderOffset + yOffset + 144, FONT_SMALL, ETextAlignment::TOPLEFT, grayedColor, "100%"));
i++;
}
if((*LIBRARY->creh)[army.creature]->warMachine != ArtifactID::NONE)
{
imageWarMachine.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("CPRSMALL"), (*LIBRARY->creh)[army.creature]->getIconIndex(), 0, 302 + i * (32 + space) + 16, 5 * borderOffset + yOffset + 124));
if(iStack<stacksCountChances.size())
labelArmyCount.push_back(std::make_shared<CLabel>(302 + i * (32 + space) + 51, 5 * borderOffset + yOffset + 144, FONT_SMALL, ETextAlignment::TOPLEFT, grayedColor, std::to_string(stacksCountChances[iStack]) + "%"));
i++;
}
iStack++;
}
// secskill title
r = Rect(302, 6 * borderOffset + yOffset + 156, (292 / 2) - 2 * borderOffset, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelSecSkillTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.secondarySkills"));
// secskill title
r = Rect(302, 6 * borderOffset + yOffset + 156, (292 / 2) - 2 * borderOffset, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelSecSkillTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.secondarySkills"));
// vertical line
backgroundLines.push_back(std::make_shared<SimpleLine>(Point(302 + (292 / 2), 6 * borderOffset + yOffset + 156 - 1), Point(302 + (292 / 2), 6 * borderOffset + yOffset + 156 - 2 + 254), borderColor));
// vertical line
backgroundLines.push_back(std::make_shared<SimpleLine>(Point(302 + (292 / 2), 6 * borderOffset + yOffset + 156 - 1), Point(302 + (292 / 2), 6 * borderOffset + yOffset + 156 - 2 + 254), borderColor));
// spell title
r = Rect(302 + (292 / 2) + 2 * borderOffset, 6 * borderOffset + yOffset + 156, (292 / 2) - 2 * borderOffset, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelSpellTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.spells"));
// spell title
r = Rect(302 + (292 / 2) + 2 * borderOffset, 6 * borderOffset + yOffset + 156, (292 / 2) - 2 * borderOffset, 30);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
labelSpellTitle = std::make_shared<CLabel>(r.x + borderOffset, r.y + borderOffset + 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.heroOverview.spells"));
// secskill
for(int i = 0; i < 6; i++)
{
r = Rect(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
r = Rect(r.x + 32 + borderOffset, r.y, (292 / 2) - 32 - 3 * borderOffset, r.h);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
i = 0;
for(auto & skill : (*LIBRARY->heroh)[heroIdx]->secSkillsInit)
{
secSkills.push_back(std::make_shared<CSecSkillPlace>(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)),
CSecSkillPlace::ImageSize::SMALL, skill.first, skill.second));
labelSecSkillsNames.push_back(std::make_shared<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, LIBRARY->generaltexth->levels[skill.second - 1]));
labelSecSkillsNames.push_back(std::make_shared<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*LIBRARY->skillh)[skill.first]->getNameTranslated()));
i++;
}
// secskill
for(int i = 0; i < 6; i++)
{
r = Rect(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
r = Rect(r.x + 32 + borderOffset, r.y, (292 / 2) - 32 - 3 * borderOffset, r.h);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
i = 0;
for(auto & skill : (*LIBRARY->heroh)[heroIdx]->secSkillsInit)
{
secSkills.push_back(std::make_shared<CSecSkillPlace>(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)),
CSecSkillPlace::ImageSize::SMALL, skill.first, skill.second));
labelSecSkillsNames.push_back(std::make_shared<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, LIBRARY->generaltexth->levels[skill.second - 1]));
labelSecSkillsNames.push_back(std::make_shared<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*LIBRARY->skillh)[skill.first]->getNameTranslated()));
i++;
}
// spell
for(int i = 0; i < 6; i++)
{
r = Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
r = Rect(r.x + 32 + borderOffset, r.y, (292 / 2) - 32 - 3 * borderOffset, r.h);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
i = 0;
for(auto & spell : (*LIBRARY->heroh)[heroIdx]->spells)
{
if(i == 0)
{
if((*LIBRARY->heroh)[heroIdx]->haveSpellBook)
{
imageSpells.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("ARTIFACT"), 0, Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32), 0));
}
i++;
}
// spell
for(int i = 0; i < 6; i++)
{
r = Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
r = Rect(r.x + 32 + borderOffset, r.y, (292 / 2) - 32 - 3 * borderOffset, r.h);
backgroundRectangles.push_back(std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor));
}
i = 0;
for(auto & spell : (*LIBRARY->heroh)[heroIdx]->spells)
{
if(i == 0)
{
if((*LIBRARY->heroh)[heroIdx]->haveSpellBook)
{
imageSpells.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("ARTIFACT"), 0, Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32), 0));
}
i++;
}
imageSpells.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("SPELLBON"), (*LIBRARY->spellh)[spell]->getIconIndex(), Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32), 0));
labelSpellsNames.push_back(std::make_shared<CLabel>(302 + (292 / 2) + 3 * borderOffset + 32 + borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 3, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*LIBRARY->spellh)[spell]->getNameTranslated()));
i++;
}
imageSpells.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("SPELLBON"), (*LIBRARY->spellh)[spell]->getIconIndex(), Rect(302 + (292 / 2) + 2 * borderOffset, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset), 32, 32), 0));
labelSpellsNames.push_back(std::make_shared<CLabel>(302 + (292 / 2) + 3 * borderOffset + 32 + borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 3, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*LIBRARY->spellh)[spell]->getNameTranslated()));
i++;
}
}

View File

@@ -161,7 +161,7 @@ CHeroWindow::CHeroWindow(const CGHeroInstance * hero)
for(int i = 0; i < std::min<size_t>(hero->secSkills.size(), 8u); ++i)
{
bool isSmallBox = (secSkillSlider && i%2 == 1);
Rect r = Rect(i%2 == 0 ? 18 : 162, 276 + 48 * (i/2), isSmallBox ? 120 : 136, 42);
Rect r(i%2 == 0 ? 18 : 162, 276 + 48 * (i/2), isSmallBox ? 120 : 136, 42);
secSkills.emplace_back(std::make_shared<CSecSkillPlace>(r.topLeft(), CSecSkillPlace::ImageSize::MEDIUM));
int x = (i % 2) ? 212 : 68;

View File

@@ -72,7 +72,7 @@ bool isLegacySpellSchool(SpellSchool school)
return getAnimFrameFromSchool(school) != -1;
}
CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, std::function<void()> funcL, int helpTextId, CSpellWindow * _owner)
CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, const std::function<void()> & funcL, int helpTextId, CSpellWindow * _owner)
{
addUsedEvents(LCLICK | SHOW_POPUP | HOVER);
pos = myRect;
@@ -82,7 +82,7 @@ CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, std::functio
owner = _owner;
}
CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, std::function<void()> funcL, std::string textId, CSpellWindow * _owner)
CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, const std::function<void()> & funcL, std::string textId, CSpellWindow * _owner)
{
addUsedEvents(LCLICK | SHOW_POPUP | HOVER);
pos = myRect;
@@ -632,7 +632,7 @@ void CSpellWindow::keyPressed(EShortcut key)
case EShortcut::MOVE_DOWN:
{
bool down = key == EShortcut::MOVE_DOWN;
static const SpellSchool schoolsOrder[] = { SpellSchool::AIR, SpellSchool::EARTH, SpellSchool::FIRE, SpellSchool::WATER, SpellSchool::ANY };
static const std::array schoolsOrder = { SpellSchool::AIR, SpellSchool::EARTH, SpellSchool::FIRE, SpellSchool::WATER, SpellSchool::ANY };
int index = -1;
while(schoolsOrder[++index] != selectedTab);
index += (down ? 1 : -1);

View File

@@ -66,8 +66,8 @@ class CSpellWindow : public CWindowObject, public IVideoHolder
void showPopupWindow(const Point & cursorPosition) override;
void hover(bool on) override;
InteractiveArea(const Rect &myRect, std::function<void()> funcL, int helpTextId, CSpellWindow * _owner);
InteractiveArea(const Rect &myRect, std::function<void()> funcL, std::string textId, CSpellWindow * _owner);
InteractiveArea(const Rect &myRect, const std::function<void()> & funcL, int helpTextId, CSpellWindow * _owner);
InteractiveArea(const Rect &myRect, const std::function<void()> & funcL, std::string textId, CSpellWindow * _owner);
};
std::shared_ptr<CPicture> leftCorner;

View File

@@ -121,8 +121,8 @@ void ChroniclesExtractor::createBaseMod() const
};
QFile jsonFile(dir.filePath("mod.json"));
jsonFile.open(QFile::WriteOnly);
jsonFile.write(QJsonDocument(mod).toJson());
jsonFile.open(QFile::WriteOnly);
jsonFile.write(QJsonDocument(mod).toJson());
for(auto & dataPath : VCMIDirs::get().dataPaths())
{
@@ -157,8 +157,8 @@ void ChroniclesExtractor::createChronicleMod(int no)
};
QFile jsonFile(dir.filePath("mod.json"));
jsonFile.open(QFile::WriteOnly);
jsonFile.write(QJsonDocument(mod).toJson());
jsonFile.open(QFile::WriteOnly);
jsonFile.write(QJsonDocument(mod).toJson());
dir.cd("content");

View File

@@ -236,7 +236,7 @@ bool ModStateController::doInstallMod(QString modname, QString archivePath)
// Remove .github folder from installed mod
QDir githubDir(extractedDir.filePath(".github"));
if (githubDir.exists())
githubDir.removeRecursively();
githubDir.removeRecursively();
//there are possible excessive files - remove them
QString upperLevel = modDirName.section('/', 0, 0);

View File

@@ -222,12 +222,12 @@ void CConsoleHandler::setColor(EConsoleTextColor color)
break;
}
#ifdef VCMI_WINDOWS
SetConsoleTextAttribute(handleOut, colorCode);
SetConsoleTextAttribute(handleOut, colorCode);
if (color == EConsoleTextColor::DEFAULT)
colorCode = defErrColor;
SetConsoleTextAttribute(handleErr, colorCode);
#else
std::cout << colorCode;
std::cout << colorCode;
#endif
}

View File

@@ -504,10 +504,10 @@ void CCreatureHandler::loadCommanders()
++level;
}
for (auto ability : config["abilityRequirements"].Vector())
for (const auto & abilityRequirements : config["abilityRequirements"].Vector())
{
std::pair <std::vector<std::shared_ptr<Bonus> >, std::pair <ui8, ui8> > a;
JsonNode & abilities = ability["ability"];
const JsonNode & abilities = abilityRequirements["ability"];
if (abilities[0].isString()) // old format with single bonus
{
@@ -519,8 +519,8 @@ void CCreatureHandler::loadCommanders()
a.first.push_back(parseBonusWithCompatibility(ability));
}
a.second.first = static_cast<ui8>(ability["skills"][0].Float());
a.second.second = static_cast<ui8>(ability["skills"][1].Float());
a.second.first = static_cast<ui8>(abilityRequirements["skills"][0].Float());
a.second.second = static_cast<ui8>(abilityRequirements["skills"][1].Float());
skillRequirements.push_back (a);
}
}

View File

@@ -166,7 +166,7 @@ void PoolImpl::serializeState(const bool saving, JsonNode & data)
{
if(saving)
{
for(auto & scriptAndContext : cache)
for(auto & scriptAndContext : cache)
{
const auto * script = scriptAndContext.first;
auto context = scriptAndContext.second;

View File

@@ -66,7 +66,7 @@ void IVCMIDirs::init()
#ifdef VCMI_WINDOWS
#ifdef __MINGW32__
#define _WIN32_IE 0x0500
#define _WIN32_IE 0x0500
#ifndef CSIDL_MYDOCUMENTS
#define CSIDL_MYDOCUMENTS CSIDL_PERSONAL

View File

@@ -313,7 +313,7 @@ BattleSide CBattleInfoEssentials::playerToSide(const PlayerColor & player) const
PlayerColor CBattleInfoEssentials::sideToPlayer(BattleSide side) const
{
RETURN_IF_NOT_BATTLE(PlayerColor::CANNOT_DETERMINE);
return getBattle()->getSidePlayer(side);
return getBattle()->getSidePlayer(side);
}
BattleSide CBattleInfoEssentials::otherSide(BattleSide side)

View File

@@ -183,8 +183,8 @@ void SpellCreatedObstacle::fromInfo(const ObstacleChanges & info)
if(info.operation != ObstacleChanges::EOperation::ADD && info.operation != ObstacleChanges::EOperation::UPDATE)
logGlobal->error("ADD or UPDATE operation expected");
JsonDeserializer deser(nullptr, info.data);
deser.serializeStruct("obstacle", *this);
JsonDeserializer deser(nullptr, info.data);
deser.serializeStruct("obstacle", *this);
}
void SpellCreatedObstacle::serializeJson(JsonSerializeFormat & handler)
@@ -266,4 +266,4 @@ int SpellCreatedObstacle::getAnimationYOffset(int imageHeight) const
return offset;
}
VCMI_LIB_NAMESPACE_END
VCMI_LIB_NAMESPACE_END

View File

@@ -32,14 +32,14 @@ DamageRange DamageCalculator::getBaseDamageSingle() const
minDmg = info.attacker->getMinDamage(info.shooting);
maxDmg = info.attacker->getMaxDamage(info.shooting);
if(minDmg > maxDmg)
{
if(minDmg > maxDmg)
{
const auto & creatureName = info.attacker->creatureId().toEntity(LIBRARY)->getNamePluralTranslated();
logGlobal->error("Creature %s: min damage %lld exceeds max damage %lld.", creatureName, minDmg, maxDmg);
logGlobal->error("This may lead to unexpected results, please report it to the mod's creator.");
// to avoid an RNG crash and make bless and curse spells work as expected
std::swap(minDmg, maxDmg);
}
logGlobal->error("This may lead to unexpected results, please report it to the mod's creator.");
// to avoid an RNG crash and make bless and curse spells work as expected
std::swap(minDmg, maxDmg);
}
if(info.attacker->creatureIndex() == CreatureID::ARROW_TOWERS)
{

View File

@@ -243,8 +243,8 @@ void UnitInfo::save(JsonNode & data)
void UnitInfo::load(uint32_t id_, const JsonNode & data)
{
id = id_;
JsonDeserializer deser(nullptr, data);
deser.serializeStruct("newUnitInfo", *this);
JsonDeserializer deser(nullptr, data);
deser.serializeStruct("newUnitInfo", *this);
}
}

View File

@@ -851,7 +851,7 @@ void CGameInfoCallback::getTilesInRange(std::unordered_set<int3> & tiles,
}
}
void CGameInfoCallback::getAllTiles(std::unordered_set<int3> & tiles, std::optional<PlayerColor> Player, int level, std::function<bool(const TerrainTile *)> filter) const
void CGameInfoCallback::getAllTiles(std::unordered_set<int3> & tiles, std::optional<PlayerColor> Player, int level, const std::function<bool(const TerrainTile *)> & filter) const
{
if(Player.has_value() && !Player->isValidPlayer())
{

View File

@@ -104,7 +104,7 @@ public:
//used for random spawns
void getFreeTiles(std::vector<int3> &tiles) const;
void getTilesInRange(std::unordered_set<int3> & tiles, const int3 & pos, int radius, ETileVisibility mode, std::optional<PlayerColor> player = std::optional<PlayerColor>(), int3::EDistanceFormula formula = int3::DIST_2D) const override;
void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter) const override;
void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, const std::function<bool(const TerrainTile *)> & filter) const override;
void getAllowedSpells(std::vector<SpellID> &out, std::optional<ui16> level = std::nullopt) const;

View File

@@ -27,9 +27,9 @@ EditorCallback::EditorCallback(const CMap * map)
: map(map)
{}
void EditorCallback::setMap(const CMap * map)
void EditorCallback::setMap(const CMap * newMap)
{
this->map = map;
map = newMap;
}
CGameState & EditorCallback::gameState()
@@ -97,7 +97,7 @@ void EditorCallback::getTilesInRange(std::unordered_set<int3> &, const int3 &, i
THROW_EDITOR_UNSUPPORTED;
}
void EditorCallback::getAllTiles(std::unordered_set<int3> &, std::optional<PlayerColor>, int, std::function<bool(const TerrainTile *)>) const
void EditorCallback::getAllTiles(std::unordered_set<int3> &, std::optional<PlayerColor>, int, const std::function<bool(const TerrainTile *)> &) const
{
THROW_EDITOR_UNSUPPORTED;
}

View File

@@ -40,7 +40,7 @@ public:
std::vector<const CGObjectInstance*> getGuardingCreatures(int3 pos) const override;
void getTilesInRange(std::unordered_set<int3> & tiles, const int3 & pos, int radius, ETileVisibility mode, std::optional<PlayerColor> player, int3::EDistanceFormula formula) const override;
void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter) const override;
void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, const std::function<bool(const TerrainTile *)> & filter) const override;
std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const override;
std::vector<ObjectInstanceID> getTeleportChannelEntrances(TeleportChannelID id, PlayerColor player) const override;

View File

@@ -152,7 +152,7 @@ public:
virtual void getTilesInRange(std::unordered_set<int3> & tiles, const int3 & pos, int radius, ETileVisibility mode, std::optional<PlayerColor> player = std::optional<PlayerColor>(), int3::EDistanceFormula formula = int3::DIST_2D) const = 0;
/// returns all tiles on given level (-1 - both levels, otherwise number of level)
virtual void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter) const = 0;
virtual void getAllTiles(std::unordered_set<int3> &tiles, std::optional<PlayerColor> player, int level, const std::function<bool(const TerrainTile *)> & filter) const = 0;
virtual std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const = 0;
virtual std::vector<ObjectInstanceID> getTeleportChannelEntrances(TeleportChannelID id, PlayerColor Player = PlayerColor::UNFLAGGABLE) const = 0;

View File

@@ -83,7 +83,7 @@ inline int streamProxyClose(voidpf opaque, voidpf stream)
actualStream->seek(0);
return 0;
return 0;
}
///CDefaultIOApi
@@ -222,7 +222,7 @@ int ZCALLBACK CProxyIOApi::closeFileProxy(voidpf opaque, voidpf stream)
int ZCALLBACK CProxyIOApi::errorFileProxy(voidpf opaque, voidpf stream)
{
return 0;
return 0;
}
CInputOutputStream * CProxyIOApi::openFile(const boost::filesystem::path & filename, int mode)

View File

@@ -332,14 +332,11 @@ ui64 CCreatureSet::getArmyStrength(int fortLevel) const
for(const auto & elem : stacks)
{
ui64 powerToAdd = elem.second->getPower();
if(fortLevel > 0)
if(fortLevel > 0 && !elem.second->hasBonusOfType(BonusType::FLYING))
{
if(!elem.second->hasBonusOfType(BonusType::FLYING))
{
powerToAdd /= fortLevel;
if(!elem.second->hasBonusOfType(BonusType::SHOOTER))
powerToAdd /= fortLevel;
if(!elem.second->hasBonusOfType(BonusType::SHOOTER))
powerToAdd /= fortLevel;
}
}
ret += powerToAdd;
}
@@ -365,12 +362,12 @@ std::string CCreatureSet::getRoughAmount(const SlotID & slot, int mode) const
/// "Pack" - 0, "A pack of" - 1, "a pack of" - 2
CCreature::CreatureQuantityId quantity = CCreature::getQuantityID(getStackCount(slot));
if((int)quantity)
if(static_cast<int>(quantity) != 0)
{
if(settings["gameTweaks"]["numericCreaturesQuantities"].Bool())
return CCreature::getQuantityRangeStringForId(quantity);
return LIBRARY->generaltexth->arraytxt[(174 + mode) + 3 * (int)quantity];
return LIBRARY->generaltexth->arraytxt[(174 + mode) + 3 * static_cast<int>(quantity)];
}
return "";
}
@@ -546,7 +543,6 @@ std::unique_ptr<CStackInstance> CCreatureSet::detachStack(const SlotID & slot)
assert(hasStackAtSlot(slot));
std::unique_ptr<CStackInstance> ret = std::move(stacks[slot]);
//if(CArmedInstance *armedObj = castToArmyObj())
if(ret)
{
ret->setArmy(nullptr); //detaches from current armyobj

View File

@@ -202,12 +202,12 @@ std::string CStackInstance::getQuantityTXT(bool capitalized) const
{
CCreature::CreatureQuantityId quantity = getQuantityID();
if((int)quantity)
if(static_cast<int>(quantity))
{
if(settings["gameTweaks"]["numericCreaturesQuantities"].Bool())
return CCreature::getQuantityRangeStringForId(quantity);
return LIBRARY->generaltexth->arraytxt[174 + (int)quantity * 3 - 1 - capitalized];
return LIBRARY->generaltexth->arraytxt[174 + static_cast<int>(quantity) * 3 - 1 - capitalized];
}
else
return "";

View File

@@ -196,20 +196,20 @@ float Path::nonEuclideanCostFunction(const int3& src, const int3& dst, const int
float W = 10.0f;// width of the transition area
float A = 0.7f; // sine bias
// Euclidean distance:
float d = src.dist2d(dst);
// Distance from dst to the zone center:
float r = dst.dist2d(center);
// Compute normalized offset inside the zone:
// (R - W) is the inner edge, R is the outer edge.
float t = std::clamp((r - (R - W)) / W, 0.0f, 1.0f);
// Use sine bias: lowest cost in the middle (t=0.5), higher near edges.
float bias = 1.0f + A * std::sin(M_PI * t);
return d * bias;
// Euclidean distance:
float d = src.dist2d(dst);
// Distance from dst to the zone center:
float r = dst.dist2d(center);
// Compute normalized offset inside the zone:
// (R - W) is the inner edge, R is the outer edge.
float t = std::clamp((r - (R - W)) / W, 0.0f, 1.0f);
// Use sine bias: lowest cost in the middle (t=0.5), higher near edges.
float bias = 1.0f + A * std::sin(M_PI * t);
return d * bias;
}
Path::MoveCostFunction Path::createCurvedCostFunction(const Area & border)

View File

@@ -41,7 +41,7 @@ void PrisonHeroPlacer::getAllowedHeroes()
// Call that only once
if (allowedHeroes.empty())
{
allowedHeroes = generator.getAllPossibleHeroes();
allowedHeroes = generator.getAllPossibleHeroes();
}
}
@@ -56,8 +56,8 @@ HeroTypeID PrisonHeroPlacer::drawRandomHero()
if (getPrisonsRemaining() > 0)
{
RandomGeneratorUtil::randomShuffle(allowedHeroes, zone.getRand());
HeroTypeID ret = allowedHeroes.back();
allowedHeroes.pop_back();
HeroTypeID ret = allowedHeroes.back();
allowedHeroes.pop_back();
return ret;
}
else

View File

@@ -55,15 +55,6 @@ VCMI_LIB_NAMESPACE_BEGIN
template<typename Serializer>
void registerTypes(Serializer &s)
{
static_assert(std::is_abstract_v<IObjectInterface>, "If this type is no longer abstract consider registering it for serialization with ID 1");
static_assert(std::is_abstract_v<CGTeleport>, "If this type is no longer abstract consider registering it for serialization with ID 3");
static_assert(std::is_abstract_v<IQuestObject>, "If this type is no longer abstract consider registering it for serialization with ID 11");
static_assert(std::is_abstract_v<CArtifactSet>, "If this type is no longer abstract consider registering it for serialization with ID 29");
// static_assert(std::is_abstract_v<CPackForClient>, "If this type is no longer abstract consider registering it for serialization with ID 83");
// static_assert(std::is_abstract_v<Query>, "If this type is no longer abstract consider registering it for serialization with ID 153");
// static_assert(std::is_abstract_v<CGarrisonOperationPack>, "If this type is no longer abstract consider registering it for serialization with ID 161");
// static_assert(std::is_abstract_v<CArtifactOperationPack>, "If this type is no longer abstract consider registering it for serialization with ID 168");
s.template registerType<CGObjectInstance>(2);
s.template registerType<CGMonolith>(4);
s.template registerType<CGSubterraneanGate>(5);
@@ -86,7 +77,6 @@ void registerTypes(Serializer &s)
s.template registerType<CGUniversity>(23);
s.template registerType<CGHeroPlaceholder>(24);
s.template registerType<CArmedInstance>(25);
// s.template registerType<CBonusSystemNode>(26);
s.template registerType<CCreatureSet>(27);
s.template registerType<CGHeroInstance>(28);
s.template registerType<CGDwelling>(30);

View File

@@ -615,12 +615,12 @@ int64_t BaseMechanics::calculateRawEffectValue(int32_t basePowerMultiplier, int3
bool BaseMechanics::ownerMatches(const battle::Unit * unit) const
{
return ownerMatches(unit, owner->getPositiveness());
return ownerMatches(unit, owner->getPositiveness());
}
bool BaseMechanics::ownerMatches(const battle::Unit * unit, const boost::logic::tribool positivness) const
{
return cb->battleMatchOwner(caster->getCasterOwner(), unit, positivness);
return cb->battleMatchOwner(caster->getCasterOwner(), unit, positivness);
}
IBattleCast::Value BaseMechanics::getEffectLevel() const

View File

@@ -109,9 +109,9 @@ void Sacrifice::apply(ServerCallback * server, const Mechanics * m, const Effect
return;
}
const battle::Unit * victim = target.back().unitValue;
const battle::Unit * victim = target.back().unitValue;
if(!victim)
if(!victim)
{
logGlobal->error("No unit to Sacrifice");
return;

View File

@@ -145,9 +145,9 @@ void Helper::saveTemplate(std::map<std::string, std::shared_ptr<CRmgTemplate>> t
}
auto byteData = JsonNode(data).toBytes();
QByteArray byteDataArray = QByteArray(reinterpret_cast<const char*>(byteData.data()), static_cast<int>(byteData.size()));
QByteArray byteDataArray(reinterpret_cast<const char*>(byteData.data()), static_cast<int>(byteData.size()));
QFile file(filename);
if(file.open(QIODevice::WriteOnly))
file.write(byteDataArray);
file.write(byteDataArray);
}

View File

@@ -13,121 +13,123 @@
double GeometryAlgorithm::distance(double x1, double y1, double x2, double y2)
{
return std::sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)) + 1e-9;
return std::sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)) + 1e-9;
}
bool GeometryAlgorithm::edgesIntersect(const Node& a, const Node& b, const Node& c, const Node& d)
{
auto cross = [](double x1, double y1, double x2, double y2) {
return x1 * y2 - y1 * x2;
};
auto cross = [](double x1, double y1, double x2, double y2) {
return x1 * y2 - y1 * x2;
};
double dx1 = b.x - a.x, dy1 = b.y - a.y;
double dx2 = d.x - c.x, dy2 = d.y - c.y;
double dx1 = b.x - a.x;
double dy1 = b.y - a.y;
double dx2 = d.x - c.x;
double dy2 = d.y - c.y;
double delta = cross(dx1, dy1, dx2, dy2);
if (std::abs(delta) < 1e-10) return false; // Parallel
double delta = cross(dx1, dy1, dx2, dy2);
if (std::abs(delta) < 1e-10) return false; // Parallel
// Compute intersection
double s = cross(c.x - a.x, c.y - a.y, dx2, dy2) / delta;
double t = cross(c.x - a.x, c.y - a.y, dx1, dy1) / delta;
// Compute intersection
double s = cross(c.x - a.x, c.y - a.y, dx2, dy2) / delta;
double t = cross(c.x - a.x, c.y - a.y, dx1, dy1) / delta;
return s > 0 && s < 1 && t > 0 && t < 1;
return s > 0 && s < 1 && t > 0 && t < 1;
}
void GeometryAlgorithm::forceDirectedLayout(std::vector<Node> & nodes, const std::vector<Edge> & edges, int iterations, double width, double height)
{
const double area = width * height;
const double k = std::sqrt(area / nodes.size());
const double area = width * height;
const double k = std::sqrt(area / nodes.size());
for (int it = 0; it < iterations; ++it)
{
// Reset forces
for (auto& node : nodes)
node.dx = node.dy = 0;
for (int it = 0; it < iterations; ++it)
{
// Reset forces
for (auto& node : nodes)
node.dx = node.dy = 0;
// Repulsive forces
for (size_t i = 0; i < nodes.size(); ++i)
{
for (size_t j = i + 1; j < nodes.size(); ++j)
{
double dx = nodes[i].x - nodes[j].x;
double dy = nodes[i].y - nodes[j].y;
double dist = distance(nodes[i].x, nodes[i].y, nodes[j].x, nodes[j].y);
double force = (k * k) / dist;
// Repulsive forces
for (size_t i = 0; i < nodes.size(); ++i)
{
for (size_t j = i + 1; j < nodes.size(); ++j)
{
double dx = nodes[i].x - nodes[j].x;
double dy = nodes[i].y - nodes[j].y;
double dist = distance(nodes[i].x, nodes[i].y, nodes[j].x, nodes[j].y);
double force = (k * k) / dist;
nodes[i].dx += (dx / dist) * force;
nodes[i].dy += (dy / dist) * force;
nodes[j].dx -= (dx / dist) * force;
nodes[j].dy -= (dy / dist) * force;
}
}
nodes[i].dx += (dx / dist) * force;
nodes[i].dy += (dy / dist) * force;
nodes[j].dx -= (dx / dist) * force;
nodes[j].dy -= (dy / dist) * force;
}
}
// Attractive forces
for (const auto& edge : edges)
{
Node& u = nodes[edge.from];
Node& v = nodes[edge.to];
double dx = u.x - v.x;
double dy = u.y - v.y;
double dist = distance(u.x, u.y, v.x, v.y);
double force = (dist * dist) / k;
// Attractive forces
for (const auto& edge : edges)
{
Node& u = nodes[edge.from];
Node& v = nodes[edge.to];
double dx = u.x - v.x;
double dy = u.y - v.y;
double dist = distance(u.x, u.y, v.x, v.y);
double force = (dist * dist) / k;
double fx = (dx / dist) * force;
double fy = (dy / dist) * force;
double fx = (dx / dist) * force;
double fy = (dy / dist) * force;
u.dx -= fx;
u.dy -= fy;
v.dx += fx;
v.dy += fy;
}
u.dx -= fx;
u.dy -= fy;
v.dx += fx;
v.dy += fy;
}
// Edge crossing penalty
for (size_t i = 0; i < edges.size(); ++i) {
for (size_t j = i + 1; j < edges.size(); ++j) {
const Edge& e1 = edges[i];
const Edge& e2 = edges[j];
// Edge crossing penalty
for (size_t i = 0; i < edges.size(); ++i) {
for (size_t j = i + 1; j < edges.size(); ++j) {
const Edge& e1 = edges[i];
const Edge& e2 = edges[j];
if (e1.from == e2.from || e1.from == e2.to ||
e1.to == e2.from || e1.to == e2.to)
continue; // Skip if they share nodes
if (e1.from == e2.from || e1.from == e2.to ||
e1.to == e2.from || e1.to == e2.to)
continue; // Skip if they share nodes
Node& a = nodes[e1.from];
Node& b = nodes[e1.to];
Node& c = nodes[e2.from];
Node& d = nodes[e2.to];
Node& a = nodes[e1.from];
Node& b = nodes[e1.to];
Node& c = nodes[e2.from];
Node& d = nodes[e2.to];
if (edgesIntersect(a, b, c, d)) {
double strength = 0.05;
if (edgesIntersect(a, b, c, d)) {
double strength = 0.05;
a.dx += strength * (a.x - c.x);
a.dy += strength * (a.y - c.y);
b.dx += strength * (b.x - d.x);
b.dy += strength * (b.y - d.y);
c.dx += strength * (c.x - a.x);
c.dy += strength * (c.y - a.y);
d.dx += strength * (d.x - b.x);
d.dy += strength * (d.y - b.y);
}
}
}
a.dx += strength * (a.x - c.x);
a.dy += strength * (a.y - c.y);
b.dx += strength * (b.x - d.x);
b.dy += strength * (b.y - d.y);
c.dx += strength * (c.x - a.x);
c.dy += strength * (c.y - a.y);
d.dx += strength * (d.x - b.x);
d.dy += strength * (d.y - b.y);
}
}
}
// Apply displacement
for (auto& node : nodes)
{
node.x += std::max(-5.0, std::min(5.0, node.dx));
node.y += std::max(-5.0, std::min(5.0, node.dy));
// Apply displacement
for (auto& node : nodes)
{
node.x += std::max(-5.0, std::min(5.0, node.dx));
node.y += std::max(-5.0, std::min(5.0, node.dy));
// Keep within bounds
node.x = std::min(width, std::max(0.0, node.x));
node.y = std::min(height, std::max(0.0, node.y));
}
}
// Keep within bounds
node.x = std::min(width, std::max(0.0, node.x));
node.y = std::min(height, std::max(0.0, node.y));
}
}
for (auto& node : nodes)
{
// Center around 0
node.x -= width / 2;
node.y -= height / 2;
}
for (auto& node : nodes)
{
// Center around 0
node.x -= width / 2;
node.y -= height / 2;
}
}

View File

@@ -9,24 +9,25 @@
*/
#pragma once
#include "../StdInc.h"
class GeometryAlgorithm
{
public:
struct Node
{
double x, y;
double dx = 0, dy = 0;
int id;
};
struct Node
{
double x;
double y;
double dx = 0;
double dy = 0;
int id;
};
struct Edge
{
int from, to;
};
struct Edge
{
int from;
int to;
};
static double distance(double x1, double y1, double x2, double y2);
static bool edgesIntersect(const Node& a, const Node& b, const Node& c, const Node& d);
static void forceDirectedLayout(std::vector<Node>& nodes, const std::vector<Edge>& edges, int iterations, double width, double height);
static double distance(double x1, double y1, double x2, double y2);
static bool edgesIntersect(const Node& a, const Node& b, const Node& c, const Node& d);
static void forceDirectedLayout(std::vector<Node>& nodes, const std::vector<Edge>& edges, int iterations, double width, double height);
};

View File

@@ -55,10 +55,10 @@ void FactionSelector::on_buttonBoxResult_accepted()
factionsSelected.insert(FactionID(item->data(Qt::UserRole).toInt()));
}
close();
close();
}
void FactionSelector::on_buttonBoxResult_rejected()
{
close();
}
close();
}

View File

@@ -41,12 +41,12 @@ QDomElement CardItem::getElementById(const QDomDocument& doc, const QString& id)
bool isBlackTextNeeded(const QColor& bg)
{
int r = bg.red();
int g = bg.green();
int b = bg.blue();
int r = bg.red();
int g = bg.green();
int b = bg.blue();
double luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return luminance > 0.5;
double luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return luminance > 0.5;
}
CardItem::CardItem():

View File

@@ -35,12 +35,12 @@ MineSelector::MineSelector(std::map<TResource, ui16> & mines) :
{
auto name = LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", resources[row].getNum()).get());
auto label = new QLabel(QString::fromStdString(name));
label->setAlignment(Qt::AlignCenter);
label->setAlignment(Qt::AlignCenter);
ui->tableWidgetMines->setCellWidget(row, 0, label);
auto spinBox = new QSpinBox();
spinBox->setRange(0, 100);
spinBox->setValue(mines[resources[row]]);
spinBox->setRange(0, 100);
spinBox->setValue(mines[resources[row]]);
ui->tableWidgetMines->setCellWidget(row, 1, spinBox);
}
ui->tableWidgetMines->resizeColumnsToContents();
@@ -60,10 +60,10 @@ void MineSelector::on_buttonBoxResult_accepted()
for (int row = 0; row < resources.size(); ++row)
minesSelected[resources[row]] = static_cast<QSpinBox *>(ui->tableWidgetMines->cellWidget(row, 1))->value();
close();
close();
}
void MineSelector::on_buttonBoxResult_rejected()
{
close();
}
close();
}

View File

@@ -339,8 +339,8 @@ void TemplateEditor::loadZoneMenuContent(bool onlyPosition)
ui->comboBoxZoneType->addItem(tr("Water"), QVariant(static_cast<int>(ETemplateZoneType::WATER)));
ui->comboBoxZoneType->addItem(tr("Sealed"), QVariant(static_cast<int>(ETemplateZoneType::SEALED)));
for (int i = 0; i < ui->comboBoxZoneType->count(); ++i)
if (ui->comboBoxZoneType->itemData(i).toInt() == static_cast<int>(zone->getType()))
ui->comboBoxZoneType->setCurrentIndex(i);
if (ui->comboBoxZoneType->itemData(i).toInt() == static_cast<int>(zone->getType()))
ui->comboBoxZoneType->setCurrentIndex(i);
ui->comboBoxZoneOwner->clear();
auto type = static_cast<ETemplateZoneType>(ui->comboBoxZoneType->currentData().toInt());
@@ -370,8 +370,8 @@ void TemplateEditor::loadZoneMenuContent(bool onlyPosition)
ui->comboBoxMonsterStrength->addItem(tr("Normal"), QVariant(static_cast<int>(EMonsterStrength::EMonsterStrength::ZONE_NORMAL)));
ui->comboBoxMonsterStrength->addItem(tr("Strong"), QVariant(static_cast<int>(EMonsterStrength::EMonsterStrength::ZONE_STRONG)));
for (int i = 0; i < ui->comboBoxMonsterStrength->count(); ++i)
if (ui->comboBoxMonsterStrength->itemData(i).toInt() == static_cast<int>(zone->monsterStrength))
ui->comboBoxMonsterStrength->setCurrentIndex(i);
if (ui->comboBoxMonsterStrength->itemData(i).toInt() == static_cast<int>(zone->monsterStrength))
ui->comboBoxMonsterStrength->setCurrentIndex(i);
}
void TemplateEditor::loadZoneConnectionMenuContent()

View File

@@ -55,10 +55,10 @@ void TerrainSelector::on_buttonBoxResult_accepted()
terrainsSelected.insert(item->data(Qt::UserRole).toInt());
}
close();
close();
}
void TerrainSelector::on_buttonBoxResult_rejected()
{
close();
}
close();
}

View File

@@ -33,18 +33,18 @@ TreasureSelector::TreasureSelector(std::vector<CTreasureInfo> & treasures) :
auto addRow = [this](int min, int max, int density, int row){
auto spinBoxMin = new QSpinBox();
spinBoxMin->setRange(0, 1000000);
spinBoxMin->setValue(min);
spinBoxMin->setRange(0, 1000000);
spinBoxMin->setValue(min);
ui->tableWidgetTreasures->setCellWidget(row, 0, spinBoxMin);
auto spinBoxMax = new QSpinBox();
spinBoxMax->setRange(0, 1000000);
spinBoxMax->setValue(max);
spinBoxMax->setRange(0, 1000000);
spinBoxMax->setValue(max);
ui->tableWidgetTreasures->setCellWidget(row, 1, spinBoxMax);
auto spinBoxDensity = new QSpinBox();
spinBoxDensity->setRange(0, 1000);
spinBoxDensity->setValue(density);
spinBoxDensity->setRange(0, 1000);
spinBoxDensity->setValue(density);
ui->tableWidgetTreasures->setCellWidget(row, 2, spinBoxDensity);
auto deleteButton = new QPushButton("Delete");
@@ -93,10 +93,10 @@ void TreasureSelector::on_buttonBoxResult_accepted()
treasures.push_back(info);
}
close();
close();
}
void TreasureSelector::on_buttonBoxResult_rejected()
{
close();
}
close();
}

View File

@@ -235,29 +235,27 @@ int BonusBearerProxy::getBonuses(lua_State * L)
TConstBonusListPtr ret;
const bool hasSelector = S.isFunction(2);
const bool hasRangeSelector = S.isFunction(3);
//const bool hasRangeSelector = S.isFunction(3);
if(hasSelector)
{
auto selector = [](const Bonus * b)
{
return false; //TODO: BonusBearerProxy::getBonuses selector
};
if(hasRangeSelector)
{
//TODO: BonusBearerProxy::getBonuses rangeSelector
//auto rangeSelector = [](const Bonus * b)
//{
// return false;
//};
//if(hasRangeSelector)
//{
// //TODO: BonusBearerProxy::getBonuses rangeSelector
// auto rangeSelector = [](const Bonus * b)
// {
// return false;
// };
// ret = object->getBonuses(rangeSelector);
//}
//else
//{
auto selector = [](const Bonus * b)
{
return false; //TODO: BonusBearerProxy::getBonuses selector
};
ret = object->getBonuses(selector);
}
else
{
ret = object->getBonuses(selector);
}
//}
}
else
{

View File

@@ -67,7 +67,7 @@ public:
MOCK_CONST_METHOD2(getTileDigStatus, EDiggingStatus(int3 tile, bool verbose));
MOCK_CONST_METHOD1(calculatePaths, void(const std::shared_ptr<PathfinderConfig> & config));
MOCK_CONST_METHOD6(getTilesInRange, void( std::unordered_set<int3> & tiles, const int3 & pos, int radius, ETileVisibility mode, std::optional<PlayerColor> player, int3::EDistanceFormula formula));
MOCK_CONST_METHOD4(getAllTiles, void(std::unordered_set<int3> & tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter));
MOCK_CONST_METHOD4(getAllTiles, void(std::unordered_set<int3> & tiles, std::optional<PlayerColor> player, int level, const std::function<bool(const TerrainTile *)> & filter));
MOCK_CONST_METHOD2(getVisibleTeleportObjects, std::vector<ObjectInstanceID>(std::vector<ObjectInstanceID> ids, PlayerColor player));
MOCK_CONST_METHOD2(getTeleportChannelEntrances, std::vector<ObjectInstanceID>(TeleportChannelID id, PlayerColor Player));
MOCK_CONST_METHOD2(getTeleportChannelExits, std::vector<ObjectInstanceID>(TeleportChannelID id, PlayerColor Player));