1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00
vcmi/AI/Nullkiller
Sergei Trofimovich c2c352c6dd AI/Nullkiller/Goals/ExecuteHeroChain.cpp: catch polymorphic exceptions by reference
The suspicious code was detected by `gcc-13` as:

    AI/Nullkiller/Goals/ExecuteHeroChain.cpp: In member function 'virtual void NKAI::Goals::ExecuteHeroChain::accept(NKAI::AIGateway*)':
    AI/Nullkiller/Goals/ExecuteHeroChain.cpp:130:47: warning: catching polymorphic type 'class NKAI::cannotFulfillGoalException' by value [-Wcatch-value=]
      130 |                                         catch(cannotFulfillGoalException)
          |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
    AI/Nullkiller/Goals/ExecuteHeroChain.cpp:176:23: warning: catching polymorphic type 'class NKAI::goalFulfilledException' by value [-Wcatch-value=]
      176 |                 catch(goalFulfilledException)
          |                       ^~~~~~~~~~~~~~~~~~~~~~

Similar to object passing by value and reference passing polymorphic
exceptions by reference likely destroys them when copy-constructed to
a base class. Let's catch them by reference.
2022-12-17 21:50:57 +00:00
..
Analyzers Code refactor following C++ standard and condition fixes 2022-11-15 03:20:55 +03:00
Behaviors #1102 - NKAI: one more freeze - no mains with strong army 2022-11-10 21:12:08 +02:00
Engine NKAI: a few crash/hang fixes 2022-11-07 13:58:20 +02:00
Goals AI/Nullkiller/Goals/ExecuteHeroChain.cpp: catch polymorphic exceptions by reference 2022-12-17 21:50:57 +00:00
Markers NKAI: namespace 2022-10-04 08:40:14 +03:00
Pathfinding NKAI: a few crash/hang fixes 2022-11-07 13:58:20 +02:00
AIGateway.cpp use ArtifactID 2022-11-29 00:32:18 +02:00
AIGateway.h NKAI: hire retreated hero 2022-10-14 12:00:56 +03:00
AIUtility.cpp #1100 - fix visiting allied dwellings 2022-11-23 02:40:56 +04:00
AIUtility.h NKAI: fix retreat logic 2022-10-15 15:15:12 +03:00
CMakeLists.txt [Conan] add iOS support 2022-10-16 13:25:38 +03:00
main.cpp NKAI: namespace 2022-10-04 08:40:14 +03:00
StdInc.cpp Nullkiller: copy VCAI 2021-07-26 21:02:50 +03:00
StdInc.h wrap all library code into namespace if VCMI_LIB_NAMESPACE is defined 2022-09-24 15:55:21 +03:00