1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Fix potential compatibility with C++20 / C++23 mode

This fixes several issues with compatibility with C++20. C++23 was also
tested, but apparently it does not have any additional breaking changes
compared to C++20 (or we don't have those).

VCMI still uses C++17 as before - goal is only to make potential
transition easier.

There were 2 cases that are deprecated in C++20 that we use:
- Floating point operations on enums are deprecated
- `this` can no longer be captured when using default capture by value
`[=]`

Both of those should now be replaced with code that works fine in both C+
+17 and in C++20 mode
This commit is contained in:
Ivan Savenko
2025-03-01 10:25:33 +00:00
parent f348e20a63
commit a8a6be7ac1
28 changed files with 127 additions and 116 deletions

View File

@ -102,7 +102,7 @@ CSelectionBase::CSelectionBase(ESelectionScreen type)
}
pos = background->center();
card = std::make_shared<InfoCard>();
buttonBack = std::make_shared<CButton>(Point(581, 535), AnimationPath::builtin("SCNRBACK.DEF"), LIBRARY->generaltexth->zelp[105], [=](){ close();}, EShortcut::GLOBAL_CANCEL);
buttonBack = std::make_shared<CButton>(Point(581, 535), AnimationPath::builtin("SCNRBACK.DEF"), LIBRARY->generaltexth->zelp[105], [this](){ close();}, EShortcut::GLOBAL_CANCEL);
}
void CSelectionBase::toggleTab(std::shared_ptr<CIntObject> tab)