Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@
Drawable *riderDraw = me->getContain()->friend_getRider()->getDrawable();
if ( riderDraw )
{
TintEnvelope *env = getDrawable()->getColorTintEnvelope();
if ( env )
riderDraw->setColorTintEnvelope( *env );
if (const TintEnvelope* tint = getDrawable()->getColorTintEnvelope())
riderDraw->setColorTintEnvelope(*tint);

Check failure on line 101 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg-profile+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

Check failure on line 101 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

Check failure on line 101 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg-debug+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

riderDraw->notifyDrawableDependencyCleared();
riderDraw->draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
)
{
Drawable *riderDraw = me->getContain()->friend_getRider()->getDrawable();
riderDraw->setColorTintEnvelope( *getDrawable()->getColorTintEnvelope() );
if (const TintEnvelope* tint = getDrawable()->getColorTintEnvelope())
riderDraw->setColorTintEnvelope(*tint);

Check failure on line 90 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg-profile+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

Check failure on line 90 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

Check failure on line 90 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg-debug+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

riderDraw->notifyDrawableDependencyCleared();
riderDraw->draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
)
{
Drawable *riderDraw = me->getContain()->friend_getRider()->getDrawable();
riderDraw->setColorTintEnvelope( *getDrawable()->getColorTintEnvelope() );
if (const TintEnvelope* tint = getDrawable()->getColorTintEnvelope())
riderDraw->setColorTintEnvelope(*tint);

Check failure on line 90 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg-profile+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

Check failure on line 90 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

Check failure on line 90 in Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / win32-vcpkg-debug+t+e

'void Drawable::setColorTintEnvelope(TintEnvelope &)': cannot convert argument 1 from 'const TintEnvelope' to 'TintEnvelope &'

riderDraw->notifyDrawableDependencyCleared();
riderDraw->draw();
Expand Down
4 changes: 2 additions & 2 deletions GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ class Drawable : public Thing,
void setTintStatus( TintStatus statusBits ) { BitSet( m_tintStatus, statusBits ); };
void clearTintStatus( TintStatus statusBits ) { BitClear( m_tintStatus, statusBits ); };
Bool testTintStatus( TintStatus statusBits ) const { return BitIsSet( m_tintStatus, statusBits ); };
TintEnvelope *getColorTintEnvelope() { return m_colorTintEnvelope; }
void setColorTintEnvelope( TintEnvelope &source ) { if (m_colorTintEnvelope) *m_colorTintEnvelope = source; }
const TintEnvelope *getColorTintEnvelope() const { return m_colorTintEnvelope; }
void setColorTintEnvelope( const TintEnvelope& source ) { if (m_colorTintEnvelope) *m_colorTintEnvelope = source; }

void imitateStealthLook( Drawable& otherDraw );

Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ class Object : public Thing, public Snapshot
// @todo: inline
Bool hasSpecialPower( SpecialPowerType type ) const;
Bool hasAnySpecialPower() const;
void doPowerDisable(bool disabling);

void setWeaponBonusCondition(WeaponBonusConditionType wst);
void clearWeaponBonusCondition(WeaponBonusConditionType wst);
Expand Down
7 changes: 7 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ void Energy::objectEnteringInfluence( Object *obj )
addConsumption( -energy );
else if( energy > 0 )
addProduction( energy );
#if !RETAIL_COMPATIBLE_CRC
// TheSuperHackers @tweak Add support for powered objects that consume no energy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks odd because it is unpaired in objectLeavingInfluence and it does not match the previous intent of the function - see EA comment above the function.

Does this perhaps belong somewhere else?

Was this change needed to make it properly work, for example if a structure is captured and the player has not enough power?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It could be added here, but it was deemed undesirable (#3574 (comment)).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Github brings me nowhere good when clicking that link.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

How about now? I unresolved that particular conversation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It seems the branch was force pushed after that pull comment, so I am unable to understand the context of the comment, aka where it was placed before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't think this is relevant anymore now that the code's updated.

else if (obj->isKindOf(KINDOF_POWERED))
{
obj->doPowerDisable(!hasSufficientPower());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can do

void Object::doPowerDisable( bool disabling )
{
	if( isKindOf(KINDOF_POWERED) )
	{
		if( disabling )
			setDisabled( DISABLED_UNDERPOWERED ); //set disabled has a pauseAllSpecialPowers that prevents double pausing
		else
			clearDisabled( DISABLED_UNDERPOWERED );
	}
}

static void Player::doPowerDisable( Object *obj, void *userData )
{
	if (obj)
	{
		Bool disabling = *((Bool*)userData);
		obj->doPowerDisable(&disabling);
	}
}

void Energy::objectEnteringInfluence( Object *obj )
{
...
	else
	{
		obj->doPowerDisable(!hasSufficientPower());
	}
...
}

Or better flip to enablePower to avoid the double negative.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed.

#endif

// sanity
DEBUG_ASSERTCRASH( m_energyProduction >= 0 && m_energyConsumption >= 0,
Expand Down
9 changes: 3 additions & 6 deletions GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3280,13 +3280,10 @@ Bool Player::hasRadar() const
//------------------------------------------------------------------------------------------------
static void doPowerDisable( Object *obj, void *userData )
{
Bool disabling = *((Bool*)userData);
if( obj && obj->isKindOf(KINDOF_POWERED) )
if (obj)
{
if( disabling )
obj->setDisabled( DISABLED_UNDERPOWERED ); //set disabled has a pauseAllSpecialPowers that prevents double pausing
else
obj->clearDisabled( DISABLED_UNDERPOWERED );
const Bool disabling = *reinterpret_cast<Bool*>(userData);
obj->doPowerDisable(disabling);
}
}

Expand Down
6 changes: 6 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4096,6 +4096,12 @@ void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an
m_object = obj;
if (getObject())
{
// TheSuperHackers @bugfix Set tint status here because the object may get disabled before the drawable is attached.
if (getObject()->isKindOf(KINDOF_POWERED) && getObject()->isDisabledByType(DISABLED_UNDERPOWERED))
Comment thread
xezon marked this conversation as resolved.
Resolved
{
setTintStatus(TINT_STATUS_DISABLED);
}

if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
setIndicatorColor(getObject()->getNightIndicatorColor());
else
Expand Down
13 changes: 12 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu

// allocate the publicModule arrays
// pool[]ify
m_behaviors = MSGNEW("ModulePtrs") BehaviorModule*[totalModules + 1];
m_behaviors = MSGNEW("ModulePtrs") BehaviorModule*[totalModules + 1]();
BehaviorModule** curB = m_behaviors;
const ModuleInfo& mi = tt->getBehaviorModuleInfo();

Expand Down Expand Up @@ -3171,6 +3171,17 @@ Bool Object::hasAnySpecialPower() const
return SPECIALPOWERMASK_ANY_SET( m_specialPowerBits );
}

void Object::doPowerDisable(bool disabling)
{
if( isKindOf(KINDOF_POWERED) )
{
if( disabling )
setDisabled( DISABLED_UNDERPOWERED ); //set disabled has a pauseAllSpecialPowers that prevents double pausing
else
clearDisabled( DISABLED_UNDERPOWERED );
}
}

//-------------------------------------------------------------------------------------------------
void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback )
{
Expand Down
Loading