# cheat_gui.cpp File Reference

GUI related to cheating. More...

`#include "stdafx.h"`
`#include "command_func.h"`
`#include "cheat_type.h"`
`#include "company_base.h"`
`#include "company_func.h"`
`#include "gfx_func.h"`
`#include "date_func.h"`
`#include "saveload/saveload.h"`
`#include "window_gui.h"`
`#include "newgrf.h"`
`#include "settings_type.h"`
`#include "strings_func.h"`
`#include "window_func.h"`
`#include "rail_gui.h"`
`#include "gui.h"`
`#include "company_gui.h"`
`#include "gamelog.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
struct | CheatEntry
struct | CheatWindow
## Typedefs
typedef int32 | CheckButtonClick (int32, int32)
## Functions
static int32 | ClickMoneyCheat (int32 p1, int32 p2)
static int32 | ClickChangeCompanyCheat (int32 p1, int32 p2)
static int32 | ClickSetProdCheat (int32 p1, int32 p2)
static int32 | ClickChangeClimateCheat (int32 p1, int32 p2)
void | EnginesMonthlyLoop ()
static int32 | ClickChangeDateCheat (int32 p1, int32 p2)
void | ShowCheatWindow ()
## Variables
static int32 | _money_cheat_amount = 10000000
| The 'amount' to cheat with.
static const CheatEntry | _cheats_ui []
static const Widget | _cheat_widgets []
static const WindowDesc | _cheats_desc (240, 22, 400, 170, 400, 170, WC_CHEATS, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS, _cheat_widgets)

## Detailed Description

GUI related to cheating.

Definition in file cheat_gui.cpp.

## Function Documentation

static int32 ClickChangeClimateCheat | ( | int32 | p1,
|  | int32 | p2 |
| ) |  |  | `[static]`

Parameters:

  | p1 | new climate
  | p2 | unused

Definition at line 71 of file cheat_gui.cpp.

References _settings_game, GameSettings::game_creation, GamelogStartAction(), GamelogStopAction(), GamelogTestMode(), GLAT_CHEAT, GameCreationSettings::landscape, and ReloadNewGRFData().

static int32 ClickChangeCompanyCheat | ( | int32 | p1,
|  | int32 | p2 |
| ) |  |  | `[static]`

Parameters:

  | p1 | company to set to
  | p2 | is -1 or +1 (down/up)

Definition at line 44 of file cheat_gui.cpp.

References SetLocalCompany().

static int32 ClickChangeDateCheat | ( | int32 | p1,
|  | int32 | p2 |
| ) |  |  | `[static]`

Parameters:

  | p1 | unused
  | p2 | 1 (increase) or -1 (decrease)

Definition at line 91 of file cheat_gui.cpp.

References _cur_year, _date, ConvertDateToYMD(), ConvertYMDToDate(), YearMonthDay::day, FindWindowById(), YearMonthDay::month, ResetSignalVariant(), SetWindowDirty(), and YearMonthDay::year.

static int32 ClickSetProdCheat | ( | int32 | p1,
|  | int32 | p2 |
| ) |  |  | `[static]`

Parameters:

  | p1 | new value
  | p2 | unused

Definition at line 61 of file cheat_gui.cpp.

References InvalidateWindowClasses().

## Variable Documentation

const Widget _cheat_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,   STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   399,     0,    13, STR_CHEATS, STR_018C_WINDOW_TITLE_DRAG_THIS},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   399,    14,   169, 0x0,        STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   399,    14,   169, 0x0,        STR_CHEATS_TIP},
    {   WIDGETS_END},
    }

Definition at line 128 of file cheat_gui.cpp.

const CheatEntry _cheats_ui[]`[static]`

Initial value:

     {
      {SLE_INT32, STR_CHEAT_MONEY,           &_money_cheat_amount,                    &_cheats.money.been_used,            &ClickMoneyCheat         },
      {SLE_UINT8, STR_CHEAT_CHANGE_COMPANY,  &_local_company,                         &_cheats.switch_company.been_used,   &ClickChangeCompanyCheat },
      {SLE_BOOL,  STR_CHEAT_EXTRA_DYNAMITE,  &_cheats.magic_bulldozer.value,          &_cheats.magic_bulldozer.been_used,  NULL                     },
      {SLE_BOOL,  STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value,         &_cheats.crossing_tunnels.been_used, NULL                     },
      {SLE_BOOL,  STR_CHEAT_BUILD_IN_PAUSE,  &_cheats.build_in_pause.value,           &_cheats.build_in_pause.been_used,   NULL                     },
      {SLE_BOOL,  STR_CHEAT_NO_JETCRASH,     &_cheats.no_jetcrash.value,              &_cheats.no_jetcrash.been_used,      NULL                     },
      {SLE_BOOL,  STR_CHEAT_SETUP_PROD,      &_cheats.setup_prod.value,               &_cheats.setup_prod.been_used,       &ClickSetProdCheat       },
      {SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE,  &_settings_game.game_creation.landscape, &_cheats.switch_climate.been_used,   &ClickChangeClimateCheat },
      {SLE_INT32, STR_CHEAT_CHANGE_DATE,     &_cur_year,                              &_cheats.change_date.been_used,      &ClickChangeDateCheat    },
    }

Definition at line 115 of file cheat_gui.cpp.

int32 _money_cheat_amount = 10000000`[static]`

The 'amount' to cheat with.

This variable is semantically a constant value, but because the cheat code requires to be able to write to the variable it is not constified.

Definition at line 32 of file cheat_gui.cpp.