CnC_Remastered_Collection
CnC_Remastered_Collection copied to clipboard
Removed unneeded conditional
That's not an unneeded conditional. It says if the damage value is zero the function returns zero.
Grinshpon, the condition that follows immediately after checks for that again, so I'd say it's unnecessary.
The original implementation could have been an optimisation, if the checks that follow were expensive to perform, allowing the function to return early before incurring that cost -- however this is probably irrelevant in 2020.
This is not a performance improvement, but rather a removing of redundant code and brings this check to parity with https://github.com/electronicarts/CnC_Remastered_Collection/blob/d9e287e08b3e2fb3e46690d1029f90e3b17faf0f/TIBERIANDAWN/COMBAT.CPP#L75
The original implementation could have been an optimisation, if the checks that follow were expensive to perform, allowing the function to return early before incurring that cost -- however this is probably irrelevant in 2020.
And even now one could get it back by simply swapping !damage to the front and early-out that way:
if ( !damage || Special.IsInert || warhead == WARHEAD_NONE ) return(0);