1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Merge pull request #2320 from IvanSavenko/debug_build_fix

Fix building in debug mode
This commit is contained in:
Ivan Savenko 2023-07-11 18:45:54 +03:00 committed by GitHub
commit b74d608709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 7 deletions

View File

@ -76,6 +76,10 @@ jobs:
os: ubuntu-20.04
test: 0
preset: linux-gcc-test
- platform: linux
os: ubuntu-20.04
test: 0
preset: linux-gcc-debug
- platform: mac-intel
os: macos-12
test: 0

View File

@ -70,6 +70,18 @@
"description": "VCMI Linux GCC",
"inherits": "linux-release",
"cacheVariables": {
"ENABLE_LUA" : "ON",
"CMAKE_C_COMPILER": "/usr/bin/gcc",
"CMAKE_CXX_COMPILER": "/usr/bin/g++"
}
},
{
"name": "linux-gcc-debug",
"displayName": "GCC x86_64-pc-linux-gnu (debug)",
"description": "VCMI Linux GCC (Debug)",
"inherits": "linux-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"ENABLE_LUA" : "ON",
"ENABLE_PCH" : "OFF",
"CMAKE_C_COMPILER": "/usr/bin/gcc",
@ -93,7 +105,6 @@
"inherits": "linux-test",
"cacheVariables": {
"ENABLE_LUA" : "OFF",
"ENABLE_PCH" : "OFF",
"CMAKE_C_COMPILER": "/usr/bin/gcc",
"CMAKE_CXX_COMPILER": "/usr/bin/g++"
}
@ -239,6 +250,11 @@
"hidden": true,
"configuration": "RelWithDebInfo"
},
{
"name": "default-debug",
"hidden": true,
"configuration": "Debug"
},
{
"name": "linux-clang-release",
"configurePreset": "linux-clang-release",
@ -259,6 +275,11 @@
"configurePreset": "linux-gcc-release",
"inherits": "default-release"
},
{
"name": "linux-gcc-debug",
"configurePreset": "linux-gcc-debug",
"inherits": "default-debug"
},
{
"name": "macos-xcode-release",
"configurePreset": "macos-xcode-release",

View File

@ -125,7 +125,7 @@ DLL_LINKAGE std::vector<const CArtifact*> ArtifactUtils::assemblyPossibilities(
for(const auto artifact : art->getPartOf())
{
assert(artifact->constituents);
assert(artifact->isCombined());
bool possible = true;
for(const auto constituent : artifact->getConstituents()) //check if all constituents are available
@ -171,7 +171,7 @@ DLL_LINKAGE CArtifactInstance * ArtifactUtils::createNewArtifactInstance(CArtifa
auto * artInst = new CArtifactInstance(art);
if(art->isCombined())
{
assert(art->constituents);
assert(art->isCombined());
for(const auto & part : art->getConstituents())
artInst->addPart(ArtifactUtils::createNewArtifactInstance(part), ArtifactPosition::PRE_FIRST);
}

View File

@ -209,7 +209,7 @@ bool CArtifact::canBePutAt(const CArtifactSet * artSet, ArtifactPosition slot, b
fittingSet.artifactsWorn = artSet->artifactsWorn;
if(assumeDestRemoved)
fittingSet.removeArtifact(slot);
assert(constituents);
for(const auto art : constituents)
{
auto possibleSlot = ArtifactUtils::getArtAnyPosition(&fittingSet, art->getId());

View File

@ -20,7 +20,7 @@ VCMI_LIB_NAMESPACE_BEGIN
void CCombinedArtifactInstance::addPart(CArtifactInstance * art, const ArtifactPosition & slot)
{
auto artInst = static_cast<CArtifactInstance*>(this);
assert(vstd::contains_if(*artInst->artType->constituents,
assert(vstd::contains_if(artInst->artType->getConstituents(),
[=](const CArtifact * partType)
{
return partType->getId() == art->getTypeId();

View File

@ -1530,7 +1530,6 @@ void NewArtifact::applyGs(CGameState *gs)
art->setType(art->artType);
if(art->isCombined())
{
assert(art->artType->getConstituents());
for(const auto & part : art->artType->getConstituents())
art->addPart(ArtifactUtils::createNewArtifactInstance(part), ArtifactPosition::PRE_FIRST);
}

View File

@ -473,7 +473,7 @@ void CMap::addNewArtifactInstance(CArtifactInstance * art)
void CMap::eraseArtifactInstance(CArtifactInstance * art)
{
//TODO: handle for artifacts removed in map editor
assert(artInstances[art->id.getNum()] == art);
assert(artInstances[art->getId().getNum()] == art);
artInstances[art->getId().getNum()].dellNull();
}