Skip to content

Commit 84760ff

Browse files
committed
remove crc retail flag, add Xfer handling
1 parent b4451cb commit 84760ff

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
lines changed

Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,7 @@ class OpenContain : public UpdateModule,
164164
virtual const Object *friend_getRider() const{return NULL;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it.
165165
virtual Real getContainedItemsMass() const;
166166
virtual UnsignedInt getStealthUnitsContained() const { return m_stealthUnitsContained; }
167-
#if !RETAIL_COMPATIBLE_CRC
168167
virtual UnsignedInt getHeroUnitsContained() const { return m_heroUnitsContained; }
169-
#else
170-
virtual UnsignedInt getHeroUnitsContained() const { return 0; }
171-
#endif
172168

173169
virtual PlayerMaskType getPlayerWhoEntered(void) const { return m_playerEnteredMask; }
174170

@@ -243,9 +239,7 @@ class OpenContain : public UpdateModule,
243239

244240
ObjectEnterExitMap m_objectEnterExitInfo;
245241
UnsignedInt m_stealthUnitsContained; ///< number of stealth units that can't be seen by enemy players.
246-
#if !RETAIL_COMPATIBLE_CRC
247242
UnsignedInt m_heroUnitsContained; ///< cached hero count
248-
#endif
249243
Int m_whichExitPath; ///< Cycles from 1 to n and is used only in modules whose data has numberOfExitPaths > 1.
250244
UnsignedInt m_doorCloseCountdown; ///< When should I shut my door.
251245

Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM
125125
m_lastLoadSoundFrame = 0;
126126
m_containListSize = 0;
127127
m_stealthUnitsContained = 0;
128-
#if !RETAIL_COMPATIBLE_CRC
129128
m_heroUnitsContained = 0;
130-
#endif
131129
m_doorCloseCountdown = 0;
132130

133131
//Added By Sadullah Nader
@@ -636,13 +634,10 @@ void OpenContain::onContaining( Object *rider )
636634
TheAudio->addAudioEvent(&enterSound);
637635
}
638636

639-
// TheSuperHackers @performance bobtista 13/11/2025 Cache hero count to avoid O(n) iteration in Object::isHero().
640-
#if !RETAIL_COMPATIBLE_CRC
641637
if( rider && rider->isKindOf( KINDOF_HERO ) )
642638
{
643639
m_heroUnitsContained++;
644640
}
645-
#endif
646641
}
647642

648643
//-------------------------------------------------------------------------------------------------
@@ -659,12 +654,10 @@ void OpenContain::onRemoving( Object *rider)
659654
fallingSound.setObjectID(rider->getID());
660655
TheAudio->addAudioEvent(&fallingSound);
661656

662-
#if !RETAIL_COMPATIBLE_CRC
663657
if( rider->isKindOf( KINDOF_HERO ) && m_heroUnitsContained > 0 )
664658
{
665659
m_heroUnitsContained--;
666660
}
667-
#endif
668661
}
669662
}
670663

@@ -1547,6 +1540,9 @@ void OpenContain::xfer( Xfer *xfer )
15471540
// stealth units contained
15481541
xfer->xferUnsignedInt( &m_stealthUnitsContained );
15491542

1543+
// hero units contained
1544+
xfer->xferUnsignedInt( &m_heroUnitsContained );
1545+
15501546
// door close countdown
15511547
xfer->xferUnsignedInt( &m_doorCloseCountdown );
15521548

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,7 @@ class OpenContain : public UpdateModule,
174174
virtual const Object *friend_getRider() const{return NULL;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it.
175175
virtual Real getContainedItemsMass() const;
176176
virtual UnsignedInt getStealthUnitsContained() const { return m_stealthUnitsContained; }
177-
#if !RETAIL_COMPATIBLE_CRC
178177
virtual UnsignedInt getHeroUnitsContained() const { return m_heroUnitsContained; }
179-
#else
180-
virtual UnsignedInt getHeroUnitsContained() const { return 0; }
181-
#endif
182178

183179
virtual PlayerMaskType getPlayerWhoEntered(void) const { return m_playerEnteredMask; }
184180

@@ -264,9 +260,7 @@ class OpenContain : public UpdateModule,
264260

265261
ObjectEnterExitMap m_objectEnterExitInfo;
266262
UnsignedInt m_stealthUnitsContained; ///< number of stealth units that can't be seen by enemy players.
267-
#if !RETAIL_COMPATIBLE_CRC
268263
UnsignedInt m_heroUnitsContained; ///< cached hero count
269-
#endif
270264
Int m_whichExitPath; ///< Cycles from 1 to n and is used only in modules whose data has numberOfExitPaths > 1.
271265
UnsignedInt m_doorCloseCountdown; ///< When should I shut my door.
272266

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM
129129
m_lastLoadSoundFrame = 0;
130130
m_containListSize = 0;
131131
m_stealthUnitsContained = 0;
132-
#if !RETAIL_COMPATIBLE_CRC
133132
m_heroUnitsContained = 0;
134-
#endif
135133
m_doorCloseCountdown = 0;
136134

137135
//Added By Sadullah Nader
@@ -756,13 +754,10 @@ void OpenContain::onContaining( Object *rider, Bool wasSelected )
756754
TheAudio->addAudioEvent(&enterSound);
757755
}
758756

759-
// TheSuperHackers @performance bobtista 13/11/2025 Cache hero count to avoid O(n) iteration in Object::isHero().
760-
#if !RETAIL_COMPATIBLE_CRC
761757
if( rider && rider->isKindOf( KINDOF_HERO ) )
762758
{
763759
m_heroUnitsContained++;
764760
}
765-
#endif
766761
}
767762

768763
//-------------------------------------------------------------------------------------------------
@@ -779,12 +774,10 @@ void OpenContain::onRemoving( Object *rider)
779774
fallingSound.setObjectID(rider->getID());
780775
TheAudio->addAudioEvent(&fallingSound);
781776

782-
#if !RETAIL_COMPATIBLE_CRC
783777
if( rider->isKindOf( KINDOF_HERO ) && m_heroUnitsContained > 0 )
784778
{
785779
m_heroUnitsContained--;
786780
}
787-
#endif
788781
}
789782
}
790783

@@ -1772,6 +1765,9 @@ void OpenContain::xfer( Xfer *xfer )
17721765
// stealth units contained
17731766
xfer->xferUnsignedInt( &m_stealthUnitsContained );
17741767

1768+
// hero units contained
1769+
xfer->xferUnsignedInt( &m_heroUnitsContained );
1770+
17751771
// door close countdown
17761772
xfer->xferUnsignedInt( &m_doorCloseCountdown );
17771773

0 commit comments

Comments
 (0)