Skip to content

Commit aa37f91

Browse files
authored
bugfix(ghostobject): Add Ghost Objects of the local player to the scene correctly after loading a savegame (TheSuperHackers#2186)
1 parent 55ee429 commit aa37f91

2 files changed

Lines changed: 22 additions & 24 deletions

File tree

Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -725,22 +725,10 @@ void W3DGhostObject::xfer( Xfer *xfer )
725725

726726
// xfer data
727727
xfer->xferSnapshot( objectSnapshot );
728-
729-
// add snapshot to the scene
730-
objectSnapshot->addToScene();
731728
}
732729
}
733730
}
734731

735-
//
736-
// since there is a snapshot for this object, there cannot be a regular object/drawable
737-
// in the world, we need to remove it
738-
//
739-
if( m_parentObject &&
740-
m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != nullptr &&
741-
xfer->getXferMode() == XFER_LOAD )
742-
removeParentObject();
743-
744732
// count of partition shroudedness info to follow
745733
UnsignedByte shroudednessCount = 0;
746734
UnsignedByte playerIndex;
@@ -801,6 +789,17 @@ void W3DGhostObject::loadPostProcess( void )
801789
{
802790
// extend base class
803791
GhostObject::loadPostProcess();
792+
793+
const Int playerIndex = TheGhostObjectManager->getLocalPlayerIndex();
794+
795+
// add snapshot to the scene
796+
// TheSuperHackers @bugfix But only for the local player
797+
if (addToScene(playerIndex))
798+
{
799+
// since there is a snapshot for this object, there cannot be a regular object/drawable
800+
// in the world, we need to remove it
801+
removeParentObject();
802+
}
804803
}
805804

806805
// ------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -729,22 +729,10 @@ void W3DGhostObject::xfer( Xfer *xfer )
729729

730730
// xfer data
731731
xfer->xferSnapshot( objectSnapshot );
732-
733-
// add snapshot to the scene
734-
objectSnapshot->addToScene();
735732
}
736733
}
737734
}
738735

739-
//
740-
// since there is a snapshot for this object, there cannot be a regular object/drawable
741-
// in the world, we need to remove it
742-
//
743-
if( m_parentObject &&
744-
m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != nullptr &&
745-
xfer->getXferMode() == XFER_LOAD )
746-
removeParentObject();
747-
748736
// count of partition shroudedness info to follow
749737
UnsignedByte shroudednessCount = 0;
750738
UnsignedByte playerIndex;
@@ -805,6 +793,17 @@ void W3DGhostObject::loadPostProcess( void )
805793
{
806794
// extend base class
807795
GhostObject::loadPostProcess();
796+
797+
const Int playerIndex = TheGhostObjectManager->getLocalPlayerIndex();
798+
799+
// add snapshot to the scene
800+
// TheSuperHackers @bugfix But only for the local player
801+
if (addToScene(playerIndex))
802+
{
803+
// since there is a snapshot for this object, there cannot be a regular object/drawable
804+
// in the world, we need to remove it
805+
removeParentObject();
806+
}
808807
}
809808

810809
// ------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)