Skip to content

Commit 982719a

Browse files
authored
bugfix(dumbprojectile): Fix in-flight DumbProjectile detonating instantly on save load (#2591)
1 parent 120bb81 commit 982719a

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,19 @@ void DumbProjectileBehavior::crc( Xfer *xfer )
696696
// ------------------------------------------------------------------------------------------------
697697
/** Xfer method
698698
* Version Info:
699-
* 1: Initial version */
699+
* 1: Initial version
700+
* 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load.
701+
*/
700702
// ------------------------------------------------------------------------------------------------
701703
void DumbProjectileBehavior::xfer( Xfer *xfer )
702704
{
703705

704706
// version
707+
#if RETAIL_COMPATIBLE_XFER_SAVE
705708
XferVersion currentVersion = 1;
709+
#else
710+
XferVersion currentVersion = 2;
711+
#endif
706712
XferVersion version = currentVersion;
707713
xfer->xferVersion( &version, currentVersion );
708714

@@ -753,6 +759,11 @@ void DumbProjectileBehavior::xfer( Xfer *xfer )
753759
// lifespan frame
754760
xfer->xferUnsignedInt( &m_lifespanFrame );
755761

762+
if( version >= 2 )
763+
{
764+
xfer->xferInt( &m_currentFlightPathStep );
765+
}
766+
756767
}
757768

758769
// ------------------------------------------------------------------------------------------------
@@ -764,4 +775,9 @@ void DumbProjectileBehavior::loadPostProcess()
764775
// extend base class
765776
UpdateModule::loadPostProcess();
766777

778+
if( m_flightPathSegments > 0 )
779+
{
780+
calcFlightPath( false );
781+
}
782+
767783
}

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,13 +747,19 @@ void DumbProjectileBehavior::crc( Xfer *xfer )
747747
// ------------------------------------------------------------------------------------------------
748748
/** Xfer method
749749
* Version Info:
750-
* 1: Initial version */
750+
* 1: Initial version
751+
* 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load.
752+
*/
751753
// ------------------------------------------------------------------------------------------------
752754
void DumbProjectileBehavior::xfer( Xfer *xfer )
753755
{
754756

755757
// version
758+
#if RETAIL_COMPATIBLE_XFER_SAVE
756759
XferVersion currentVersion = 1;
760+
#else
761+
XferVersion currentVersion = 2;
762+
#endif
757763
XferVersion version = currentVersion;
758764
xfer->xferVersion( &version, currentVersion );
759765

@@ -804,6 +810,11 @@ void DumbProjectileBehavior::xfer( Xfer *xfer )
804810
// lifespan frame
805811
xfer->xferUnsignedInt( &m_lifespanFrame );
806812

813+
if( version >= 2 )
814+
{
815+
xfer->xferInt( &m_currentFlightPathStep );
816+
}
817+
807818
}
808819

809820
// ------------------------------------------------------------------------------------------------
@@ -815,4 +826,9 @@ void DumbProjectileBehavior::loadPostProcess()
815826
// extend base class
816827
UpdateModule::loadPostProcess();
817828

829+
if( m_flightPathSegments > 0 )
830+
{
831+
calcFlightPath( false );
832+
}
833+
818834
}

0 commit comments

Comments
 (0)