Skip to content

Commit 7035ac4

Browse files
authored
[GEN][ZH] Finalize the implementation for the 'Free Build' debug command (#1312)
This allows to build with no cost in debug builds
1 parent ebec03f commit 7035ac4

File tree

2 files changed

+13
-0
lines changed
  • GeneralsMD/Code/GameEngine/Source/Common/RTS
  • Generals/Code/GameEngine/Source/Common/RTS

2 files changed

+13
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,18 @@
4848
#include "Common/GameAudio.h"
4949
#include "Common/MiscAudio.h"
5050
#include "Common/Player.h"
51+
#include "Common/PlayerList.h"
5152
#include "Common/Xfer.h"
5253

5354
// ------------------------------------------------------------------------------------------------
5455
UnsignedInt Money::withdraw(UnsignedInt amountToWithdraw, Bool playSound)
5556
{
57+
#if defined(RTS_DEBUG)
58+
Player* player = ThePlayerList->getNthPlayer(m_playerIndex);
59+
if (player != NULL && player->buildsForFree())
60+
return 0;
61+
#endif
62+
5663
if (amountToWithdraw > m_money)
5764
amountToWithdraw = m_money;
5865

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
// ------------------------------------------------------------------------------------------------
5555
UnsignedInt Money::withdraw(UnsignedInt amountToWithdraw, Bool playSound)
5656
{
57+
#if defined(RTS_DEBUG)
58+
Player* player = ThePlayerList->getNthPlayer(m_playerIndex);
59+
if (player != NULL && player->buildsForFree())
60+
return 0;
61+
#endif
62+
5763
if (amountToWithdraw > m_money)
5864
amountToWithdraw = m_money;
5965

0 commit comments

Comments
 (0)