Skip to content

Commit 2e8a2d1

Browse files
authored
[GEN][ZH] Do not acquire money transaction audio if the play sound parameter is false (#1130)
1 parent 75c40d0 commit 2e8a2d1

File tree

2 files changed

+20
-16
lines changed
  • GeneralsMD/Code/GameEngine/Source/Common/RTS
  • Generals/Code/GameEngine/Source/Common/RTS

2 files changed

+20
-16
lines changed

Generals/Code/GameEngine/Source/Common/RTS/Money.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ UnsignedInt Money::withdraw(UnsignedInt amountToWithdraw, Bool playSound)
5959
if (amountToWithdraw == 0)
6060
return amountToWithdraw;
6161

62-
//@todo: Do we do this frequently enough that it is a performance hit?
63-
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyWithdrawSound;
64-
event.setPlayerIndex(m_playerIndex);
65-
6662
// Play a sound
6763
if (playSound)
64+
{
65+
//@todo: Do we do this frequently enough that it is a performance hit?
66+
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyWithdrawSound;
67+
event.setPlayerIndex(m_playerIndex);
6868
TheAudio->addAudioEvent(&event);
69+
}
6970

7071
m_money -= amountToWithdraw;
7172

@@ -78,13 +79,14 @@ void Money::deposit(UnsignedInt amountToDeposit, Bool playSound)
7879
if (amountToDeposit == 0)
7980
return;
8081

81-
//@todo: Do we do this frequently enough that it is a performance hit?
82-
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyDepositSound;
83-
event.setPlayerIndex(m_playerIndex);
84-
8582
// Play a sound
8683
if (playSound)
84+
{
85+
//@todo: Do we do this frequently enough that it is a performance hit?
86+
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyDepositSound;
87+
event.setPlayerIndex(m_playerIndex);
8788
TheAudio->addAudioEvent(&event);
89+
}
8890

8991
m_money += amountToDeposit;
9092
}

GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ UnsignedInt Money::withdraw(UnsignedInt amountToWithdraw, Bool playSound)
6060
if (amountToWithdraw == 0)
6161
return amountToWithdraw;
6262

63-
//@todo: Do we do this frequently enough that it is a performance hit?
64-
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyWithdrawSound;
65-
event.setPlayerIndex(m_playerIndex);
66-
6763
// Play a sound
6864
if (playSound)
65+
{
66+
//@todo: Do we do this frequently enough that it is a performance hit?
67+
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyWithdrawSound;
68+
event.setPlayerIndex(m_playerIndex);
6969
TheAudio->addAudioEvent(&event);
70+
}
7071

7172
m_money -= amountToWithdraw;
7273

@@ -79,13 +80,14 @@ void Money::deposit(UnsignedInt amountToDeposit, Bool playSound)
7980
if (amountToDeposit == 0)
8081
return;
8182

82-
//@todo: Do we do this frequently enough that it is a performance hit?
83-
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyDepositSound;
84-
event.setPlayerIndex(m_playerIndex);
85-
8683
// Play a sound
8784
if (playSound)
85+
{
86+
//@todo: Do we do this frequently enough that it is a performance hit?
87+
AudioEventRTS event = TheAudio->getMiscAudio()->m_moneyDepositSound;
88+
event.setPlayerIndex(m_playerIndex);
8889
TheAudio->addAudioEvent(&event);
90+
}
8991

9092
m_money += amountToDeposit;
9193

0 commit comments

Comments
 (0)