Skip to content

Commit

Permalink
UPBGE: Fix invalid scene add.
Browse files Browse the repository at this point in the history
The call to ConvertScene wasn't taking care if the scene existed
because it's name was valid. This function call is moved down
in a if block.

Fix issue: UPBGE#615.
  • Loading branch information
panzergame committed Oct 19, 2017
1 parent 071e510 commit d5956ac
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions source/gameengine/Ketsji/KX_KetsjiEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,16 +1458,12 @@ void KX_KetsjiEngine::AddScheduledScenes()
{
std::vector<std::string>::iterator scenenameit;

if (m_addingOverlayScenes.size()) {
for (scenenameit = m_addingOverlayScenes.begin();
scenenameit != m_addingOverlayScenes.end();
scenenameit++)
{
std::string scenename = *scenenameit;
if (!m_addingOverlayScenes.empty()) {
for (const std::string& scenename : m_addingOverlayScenes) {
KX_Scene *tmpscene = CreateScene(scenename);
ConvertScene(tmpscene);

if (tmpscene) {
ConvertScene(tmpscene);
m_scenes->Add(tmpscene->AddRef());
PostProcessScene(tmpscene);
tmpscene->Release();
Expand All @@ -1479,16 +1475,12 @@ void KX_KetsjiEngine::AddScheduledScenes()
m_addingOverlayScenes.clear();
}

if (m_addingBackgroundScenes.size()) {
for (scenenameit = m_addingBackgroundScenes.begin();
scenenameit != m_addingBackgroundScenes.end();
scenenameit++)
{
std::string scenename = *scenenameit;
if (!m_addingBackgroundScenes.empty()) {
for (const std::string& scenename : m_addingBackgroundScenes) {
KX_Scene *tmpscene = CreateScene(scenename);
ConvertScene(tmpscene);

if (tmpscene) {
ConvertScene(tmpscene);
m_scenes->Insert(0, tmpscene->AddRef());
PostProcessScene(tmpscene);
tmpscene->Release();
Expand Down

0 comments on commit d5956ac

Please sign in to comment.