|
OpenTTD Source 20251116-master-g21329071df
|
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 "currency.h"#include "saveload/saveload.h"#include "vehicle_base.h"#include "textbuf_gui.h"#include "window_gui.h"#include "string_func.h"#include "strings_func.h"#include "window_func.h"#include "rail_gui.h"#include "settings_gui.h"#include "company_gui.h"#include "linkgraph/linkgraphschedule.h"#include "map_func.h"#include "tile_map.h"#include "newgrf.h"#include "error.h"#include "misc_cmd.h"#include "core/geometry_func.hpp"#include "settings_type.h"#include "settings_internal.h"#include "timer/timer.h"#include "timer/timer_game_calendar.h"#include "timer/timer_game_economy.h"#include "core/string_consumer.hpp"#include "widgets/cheat_widget.h"#include "table/sprites.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | CheatEntry |
| Information of a cheat. More... | |
| struct | CheatWindow |
| GUI for the cheats. More... | |
Typedefs | |
| typedef int32_t | CheckButtonClick(int32_t new_value, int32_t change_direction) |
| Signature of handler function when user clicks at a cheat. | |
Enumerations | |
| enum | CheatNumbers : uint8_t { CHT_MONEY , CHT_CHANGE_COMPANY , CHT_EXTRA_DYNAMITE , CHT_CROSSINGTUNNELS , CHT_NO_JETCRASH , CHT_SETUP_PROD , CHT_STATION_RATING , CHT_EDIT_MAX_HL , CHT_CHANGE_DATE , CHT_NUM_CHEATS } |
| Available cheats. More... | |
Functions | |
| static int32_t | ClickMoneyCheat (int32_t, int32_t change_direction) |
| Handle cheating of money. | |
| static int32_t | ClickChangeCompanyCheat (int32_t new_value, int32_t change_direction) |
| Handle changing of company. | |
| static int32_t | ClickSetProdCheat (int32_t new_value, int32_t) |
| Allow (or disallow) changing production of all industries. | |
| void | CalendarEnginesMonthlyLoop () |
| Monthly update of the availability, reliability, and preview offers of the engines. | |
| static int32_t | ClickChangeDateCheat (int32_t new_value, int32_t) |
| Handle changing of the current year. | |
| static int32_t | ClickChangeMaxHlCheat (int32_t new_value, int32_t) |
| Allow (or disallow) a change of the maximum allowed heightlevel. | |
| void | ShowCheatWindow () |
| Open cheat window. | |
Variables | |
| static int32_t | _money_cheat_amount = 10000000 |
| The 'amount' to cheat with. | |
| static const CheatEntry | _cheats_ui [] |
| The available cheats. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_cheat_widgets |
| Widget definitions of the cheat GUI. | |
| static WindowDesc | _cheats_desc (WDP_AUTO, "cheats", 0, 0, WC_CHEATS, WC_NONE, {}, _nested_cheat_widgets) |
| Window description of the cheats GUI. | |
GUI related to cheating.
Definition in file cheat_gui.cpp.
| typedef int32_t CheckButtonClick(int32_t new_value, int32_t change_direction) |
Signature of handler function when user clicks at a cheat.
| new_value | The new value. |
| change_direction | Change direction (+1, +1), 0 for boolean settings. |
Definition at line 192 of file cheat_gui.cpp.
| enum CheatNumbers : uint8_t |
Available cheats.
Definition at line 173 of file cheat_gui.cpp.
|
extern |
Monthly update of the availability, reliability, and preview offers of the engines.
Definition at line 1139 of file engine.cpp.
References _year_engine_aging_stops, Available, CalcEngineReliability(), TimerGameCalendar::date, TimerGameConst< struct Calendar >::DAYS_IN_YEAR, ExclusivePreview, InvalidateWindowClassesData(), IsVehicleTypeDisabled(), IsWagon(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::Iterate(), NewVehicleAvailable(), NoPreview, SetWindowClassesDirty(), WC_BUILD_VEHICLE, WC_REPLACE_VEHICLE, and TimerGameCalendar::year.
Referenced by ClickChangeDateCheat().
|
static |
Handle changing of company.
| new_value | company to set to |
| change_direction | is -1 or +1 (down/up) |
Definition at line 75 of file cheat_gui.cpp.
References _local_company, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetPoolSize(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), and SetLocalCompany().
|
static |
Handle changing of the current year.
| new_value | The chosen year to change to. |
Definition at line 107 of file cheat_gui.cpp.
References CalendarEnginesMonthlyLoop(), Clamp(), TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::ConvertYMDToDate(), TimerGameCalendar::date, TimerGameEconomy::date, TimerGameCalendar::date_fract, TimerGameEconomy::date_fract, LinkGraphSchedule::instance, InvalidateWindowClassesData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), TimerGameConst< struct Calendar >::MAX_YEAR, TimerGameConst< struct Calendar >::MIN_YEAR, ResetSignalVariant(), TimerGameCalendar::SetDate(), TimerGameEconomy::SetDate(), SetWindowDirty(), LinkGraphSchedule::ShiftDates(), TimerGameEconomy::UsingWallclockUnits(), WC_BUILD_OBJECT, WC_BUILD_STATION, WC_BUS_STATION, WC_FINANCES, WC_STATUS_BAR, WC_TRUCK_STATION, and TimerGameCalendar::year.
|
static |
Allow (or disallow) a change of the maximum allowed heightlevel.
| new_value | new value |
Definition at line 148 of file cheat_gui.cpp.
References _settings_game, Clamp(), GameSettings::construction, GetEncodedString(), InvalidateWindowClassesData(), Map::Iterate(), ConstructionSettings::map_height_limit, MAX_MAP_HEIGHT_LIMIT, MIN_MAP_HEIGHT_LIMIT, ReloadNewGRFData(), ShowErrorMessage(), TileHeight(), WC_SMALLMAP, and WL_ERROR.
|
static |
Handle cheating of money.
Note that the amount of money of a company must be changed through a command rather than by setting a variable. Since the cheat data structure expects a variable, the amount of given/taken money is used for this purpose.
| change_direction | is -1 or +1 (down/up) |
Definition at line 63 of file cheat_gui.cpp.
References _money_cheat_amount.
|
static |
Allow (or disallow) changing production of all industries.
| new_value | new value |
Definition at line 93 of file cheat_gui.cpp.
References _cheats, InvalidateWindowClassesData(), Cheats::setup_prod, Cheat::value, and WC_INDUSTRY_VIEW.
| void ShowCheatWindow | ( | ) |
Open cheat window.
Definition at line 652 of file cheat_gui.cpp.
References _cheats_desc, CloseWindowById(), and WC_CHEATS.
Referenced by MenuClickSettings(), and MainToolbarWindow::OnHotkey().
|
static |
The available cheats.
Order matches with the values of CheatNumbers
Definition at line 207 of file cheat_gui.cpp.
Referenced by CheatWindow::OnQueryTextFinished().
|
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 53 of file cheat_gui.cpp.
Referenced by ClickMoneyCheat().
|
staticconstexpr |
Widget definitions of the cheat GUI.
Definition at line 222 of file cheat_gui.cpp.