1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Merge pull request #3452 from IvanSavenko/glibc_assertions

Enable & fix glibc assertions
This commit is contained in:
Ivan Savenko 2024-01-08 11:08:37 +02:00 committed by GitHub
commit 6641418218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -100,6 +100,12 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
#define _USE_MATH_DEFINES
#ifndef NDEBUG
// Enable additional debug checks from glibc / libstdc++ when building with enabled assertions
// Since these defines must be declared BEFORE including glibc header we can not check for __GLIBCXX__ macro to detect that glibc is in use
# define _GLIBCXX_ASSERTIONS
#endif
#include <algorithm>
#include <any>
#include <array>

View File

@ -666,6 +666,7 @@ CStackWindow::CStackWindow(const CStack * stack, bool popup)
{
info->stack = stack;
info->stackNode = stack->base;
info->commander = dynamic_cast<const CCommanderInstance*>(stack->base);
info->creature = stack->unitType();
info->creatureCount = stack->getCount();
info->popupWindow = popup;

View File

@ -257,7 +257,15 @@ CHeroClass * CHeroClassHandler::loadFromJson(const std::string & scope, const Js
VLC->generaltexth->registerString(scope, heroClass->getNameTextID(), node["name"].String());
heroClass->affinity = vstd::find_pos(affinityStr, node["affinity"].String());
if (vstd::contains(affinityStr, node["affinity"].String()))
{
heroClass->affinity = vstd::find_pos(affinityStr, node["affinity"].String());
}
else
{
logGlobal->error("Mod '%s', hero class '%s': invalid affinity '%s'! Expected 'might' or 'magic'!", scope, identifier, node["affinity"].String());
heroClass->affinity = CHeroClass::MIGHT;
}
fillPrimarySkillData(node, heroClass, PrimarySkill::ATTACK);
fillPrimarySkillData(node, heroClass, PrimarySkill::DEFENSE);