forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 117
Labels
AudioIs audio relatedIs audio relatedInvestigateMinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < BlockerPerformanceIs a performance concernIs a performance concern
Description
There is an unnecessary "AsciiString("NoSound") allocation at the top.
And the shouldPlayLocally test can be moved higher up for eventToAdd instead of audioEvent. This will save a bunch of calculations and allocations.
if (!eventToAdd->getUninterruptable()) {
if (!shouldPlayLocally(eventToAdd)) {
return AHSV_NotForLocal;
}
}I already verified that this is correct by testing it together with the original code for audioEvent and see if they always return the same result, which they did.
This function is very often called for sounds that will fail to trigger, for example money deposit and withdrawal sounds for players that cannot be listened to.
There could be some benefit from making this function cheaper.
Metadata
Metadata
Assignees
Labels
AudioIs audio relatedIs audio relatedInvestigateMinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < BlockerPerformanceIs a performance concernIs a performance concern