Fixed issue where guarded targets in space would crash

This commit is contained in:
Cekis
2022-09-21 19:54:18 -04:00
parent 20501250af
commit 1df9ef14e7
2 changed files with 6 additions and 7 deletions

View File

@@ -105,6 +105,7 @@ elseif (UNIX)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# O3 and Ofast include one or more flags that cause java to crash when using gcc6 # O3 and Ofast include one or more flags that cause java to crash when using gcc6
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize -fno-plt") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize -fno-plt")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -Og")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")

View File

@@ -116,13 +116,11 @@ SpaceSquad::~SpaceSquad()
} }
// Tell all the squads guarding me that I am not longer guardable // Tell all the squads guarding me that I am not longer guardable
for (SpaceSquadList::iterator it = m_guardedByList->begin(), next_it = it; it != m_guardedByList->end(); it = next_it)
SpaceSquadList::iterator iterGuardedByList = m_guardedByList->begin(); {
++next_it;
for (; iterGuardedByList != m_guardedByList->end(); ++iterGuardedByList) (*it)->removeGuardTarget();
{ }
(*iterGuardedByList)->removeGuardTarget();
}
delete m_guardedByList; delete m_guardedByList;