Skip to content

Commit c9e25d3

Browse files
Caball009Chapter5780
authored andcommitted
fix(update): Fix value initialization of ProjectileStreamUpdate::m_projectileIDs (TheSuperHackers#2248)
1 parent 0188248 commit c9e25d3

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,10 @@
4141
//-------------------------------------------------------------------------------------------------
4242
ProjectileStreamUpdate::ProjectileStreamUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData )
4343
{
44-
ObjectID m_projectileIDs[MAX_PROJECTILE_STREAM];
45-
for( Int index = 0; index < MAX_PROJECTILE_STREAM; index++ )
46-
{
47-
m_projectileIDs[index] = INVALID_ID;
48-
}
49-
50-
m_owningObject = INVALID_ID;
44+
std::fill(m_projectileIDs, m_projectileIDs + ARRAY_SIZE(m_projectileIDs), INVALID_ID);
5145
m_nextFreeIndex = 0;
5246
m_firstValidIndex = 0;
47+
m_owningObject = INVALID_ID;
5348
}
5449

5550
//-------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,10 @@
4141
//-------------------------------------------------------------------------------------------------
4242
ProjectileStreamUpdate::ProjectileStreamUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData )
4343
{
44-
ObjectID m_projectileIDs[MAX_PROJECTILE_STREAM];
45-
for( Int index = 0; index < MAX_PROJECTILE_STREAM; index++ )
46-
{
47-
m_projectileIDs[index] = INVALID_ID;
48-
}
49-
50-
m_owningObject = INVALID_ID;
44+
std::fill(m_projectileIDs, m_projectileIDs + ARRAY_SIZE(m_projectileIDs), INVALID_ID);
5145
m_nextFreeIndex = 0;
5246
m_firstValidIndex = 0;
47+
m_owningObject = INVALID_ID;
5348

5449
m_targetObject = INVALID_ID;
5550
m_targetPosition.zero();

0 commit comments

Comments
 (0)