diff --git a/Global.h b/Global.h index e3987bbbe..1e8d6347f 100644 --- a/Global.h +++ b/Global.h @@ -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 #include #include diff --git a/client/windows/CCreatureWindow.cpp b/client/windows/CCreatureWindow.cpp index e7b8b22b6..1202febfb 100644 --- a/client/windows/CCreatureWindow.cpp +++ b/client/windows/CCreatureWindow.cpp @@ -666,6 +666,7 @@ CStackWindow::CStackWindow(const CStack * stack, bool popup) { info->stack = stack; info->stackNode = stack->base; + info->commander = dynamic_cast(stack->base); info->creature = stack->unitType(); info->creatureCount = stack->getCount(); info->popupWindow = popup; diff --git a/lib/CHeroHandler.cpp b/lib/CHeroHandler.cpp index 64892f944..34e95ef45 100644 --- a/lib/CHeroHandler.cpp +++ b/lib/CHeroHandler.cpp @@ -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);