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:
commit
6641418218
6
Global.h
6
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 <algorithm>
|
||||
#include <any>
|
||||
#include <array>
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user