Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add preprocessor checks for debug builds #3028

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
32 changes: 22 additions & 10 deletions src/keybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,14 @@ void kf_ToggleTeamChat()
// --------------------------------------------------------------------------
void kf_BifferBaker()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}

#endif
// player deals far more damage, and the enemy far less
setDamageModifiers(999, 1);
std::string cmsg = astringf(_("(Player %u) is using cheat :%s"),
Expand All @@ -566,26 +567,29 @@ void kf_BifferBaker()
// --------------------------------------------------------------------------
void kf_SetEasyLevel()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}

#endif
setDifficultyLevel(DL_EASY);
addConsoleMessage(_("Takings thing easy!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
}

// --------------------------------------------------------------------------
void kf_UpThePower()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}
#endif
addPower(selectedPlayer, 1000);
std::string cmsg = astringf(_("(Player %u) is using cheat :%s"),
selectedPlayer, _("1000 big ones!!!"));
Expand All @@ -595,12 +599,14 @@ void kf_UpThePower()
// --------------------------------------------------------------------------
void kf_MaxPower()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}
#endif
setPower(selectedPlayer, 100000);
std::string cmsg = astringf(_("(Player %u) is using cheat :%s"),
selectedPlayer, _("Power overwhelming"));
Expand All @@ -610,38 +616,42 @@ void kf_MaxPower()
// --------------------------------------------------------------------------
void kf_SetNormalLevel()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}

#endif
setDifficultyLevel(DL_NORMAL);
addConsoleMessage(_("Back to normality!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
}
// --------------------------------------------------------------------------
void kf_SetHardLevel()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}

#endif
setDifficultyLevel(DL_HARD);
addConsoleMessage(_("Getting tricky!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
}
// --------------------------------------------------------------------------
void kf_DoubleUp()
{
#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}
#endif
setDamageModifiers(100, 50); // enemy damage halved
std::string cmsg = astringf(_("(Player %u) is using cheat :%s"),
selectedPlayer, _("Twice as nice!"));
Expand Down Expand Up @@ -716,14 +726,14 @@ void kf_FrameRate()
void kf_ShowNumObjects()
{
int droids, structures, features;

#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
if (runningMultiplayer())
{
noMPCheatMsg();
return;
}

#endif
objCount(&droids, &structures, &features);
std::string cmsg = astringf(_("(Player %u) is using a cheat :Num Droids: %d Num Structures: %d Num Features: %d"),
selectedPlayer, droids, structures, features);
Expand Down Expand Up @@ -907,11 +917,12 @@ void kf_MapCheck()
/* Raises the tile under the mouse */
void kf_RaiseTile()
{
#ifndef DEBUG
if (runningMultiplayer())
{
return; // Don't desynch if pressing 'W'...
}

#endif
raiseTile(mouseTileX, mouseTileY);
}

Expand All @@ -920,11 +931,12 @@ void kf_RaiseTile()
/* Lowers the tile under the mouse */
void kf_LowerTile()
{
#ifndef DEBUG
if (runningMultiplayer())
{
return; // Don't desynch if pressing 'A'...
}

#endif
lowerTile(mouseTileX, mouseTileY);
}

Expand Down Expand Up @@ -1240,14 +1252,14 @@ void enableGodMode()
{
return;
}

#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game and we aren't a spectator (to prevent MP cheating)
if (runningMultiplayer() && !NetPlay.players[selectedPlayer].isSpectator)
{
noMPCheatMsg();
return;
}

#endif
godMode = true; // view all structures and droids
revealAll(selectedPlayer);
setRevealStatus(true); // view the entire map
Expand Down