Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other )
const ContainedItemsList* items = contain->getContainedItemsList();
if (items)
{
for (ContainedItemsList::const_iterator it = items->begin(); *it != NULL && numKilled < d->m_garrisonHitKillCount; )
for (ContainedItemsList::const_iterator it = items->begin(); it != items->end() && numKilled < d->m_garrisonHitKillCount; )

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks genuine to me, should not affect VC6 as the original behaviour was fine for STLPort.

If you can replicate this and the other iterator fix to generals as well, that would be great.

{
Object* thingToKill = *it++;
if (!thingToKill->isEffectivelyDead() && thingToKill->isKindOfMulti(d->m_garrisonHitKillKindof, d->m_garrisonHitKillKindofNot))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other )
const ContainedItemsList* items = contain->getContainedItemsList();
if (items)
{
for (ContainedItemsList::const_iterator it = items->begin(); *it != NULL && numKilled < d->m_garrisonHitKillCount; )
for (ContainedItemsList::const_iterator it = items->begin(); it != items->end() && numKilled < d->m_garrisonHitKillCount; )
{
Object* thingToKill = *it++;
if (!thingToKill->isEffectivelyDead() && thingToKill->isKindOfMulti(d->m_garrisonHitKillKindof, d->m_garrisonHitKillKindofNot))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,14 @@ void DockUpdate::loadDockPositions()
if( m_numberApproachPositions != DYNAMIC_APPROACH_VECTOR_FLAG )
{
// Dynamic means no bones
Coord3D approachBones[DEFAULT_APPROACH_VECTOR_SIZE];
// TheSuperHackers @fix helmutbuhler 04/19/2025
// approachBones was originally not initialized. It needs to be initialized because
// myDrawable->getPristineBonePositions only sets a certain amount of elements
// (m_numberApproachPositionBones), but the following code copies a different amount
// (m_numberApproachPositions) into m_approachPositions (which CRC indirectly depends on).
// Luckily, just setting it to zero seems to work.

Coord3D approachBones[DEFAULT_APPROACH_VECTOR_SIZE] = {0};
m_numberApproachPositionBones = myDrawable->getPristineBonePositions( "DockWaiting", 1, approachBones, NULL, m_numberApproachPositions);
if( m_numberApproachPositions == m_approachPositions.size() )//safeguard: will always be true
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,10 @@ void ParticleUplinkCannonUpdate::createGroundToOrbitLaser( UnsignedInt growthFra
if( beam )
{
TheGameClient->destroyDrawable( beam );
m_orbitToTargetBeamID = INVALID_DRAWABLE_ID;

// TheSuperHackers @fix helmutbuhler 04/19/2025
// This originally mistakenly assigned to m_orbitToTargetBeamID and thus caused a leak.
m_groundToOrbitBeamID = INVALID_DRAWABLE_ID;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legitimate to me, will just need to check against VC6 that we don't cause a mismatch by this change,

}

if( data->m_particleBeamLaserName.isNotEmpty() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,9 @@ void StealthUpdate::changeVisualDisguise()

const ThingTemplate *tTemplate = self->getTemplate();

TheThingFactory->newDrawable( tTemplate );
// TheSuperHackers @bugfix helmutbuhler 04/13/2025
// draw was originally not assigned here and potentially caused memory corruption
draw = TheThingFactory->newDrawable( tTemplate );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks genuine, might need checking again against VC6 since it could cause a mismatch even though it fixes behaviour.

if( draw )
{
TheGameLogic->bindObjectAndDrawable(self, draw);
Expand Down