mirror of https://github.com/OpenTTD/OpenTTD.git
Feature: Cheat to fix station ratings at 100% (#11346)
This commit is contained in:
parent
37f84b7372
commit
2dd2910ab3
|
@ -163,6 +163,7 @@ enum CheatNumbers {
|
||||||
CHT_CROSSINGTUNNELS, ///< Allow tunnels to cross each other.
|
CHT_CROSSINGTUNNELS, ///< Allow tunnels to cross each other.
|
||||||
CHT_NO_JETCRASH, ///< Disable jet-airplane crashes.
|
CHT_NO_JETCRASH, ///< Disable jet-airplane crashes.
|
||||||
CHT_SETUP_PROD, ///< Allow manually editing of industry production.
|
CHT_SETUP_PROD, ///< Allow manually editing of industry production.
|
||||||
|
CHT_STATION_RATING, ///< Fix station ratings at 100%.
|
||||||
CHT_EDIT_MAX_HL, ///< Edit maximum allowed heightlevel
|
CHT_EDIT_MAX_HL, ///< Edit maximum allowed heightlevel
|
||||||
CHT_CHANGE_DATE, ///< Do time traveling.
|
CHT_CHANGE_DATE, ///< Do time traveling.
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ static const CheatEntry _cheats_ui[] = {
|
||||||
{SLE_BOOL, STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value, &_cheats.crossing_tunnels.been_used, nullptr },
|
{SLE_BOOL, STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value, &_cheats.crossing_tunnels.been_used, nullptr },
|
||||||
{SLE_BOOL, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, nullptr },
|
{SLE_BOOL, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, nullptr },
|
||||||
{SLE_BOOL, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, &ClickSetProdCheat },
|
{SLE_BOOL, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, &ClickSetProdCheat },
|
||||||
|
{SLE_BOOL, STR_CHEAT_STATION_RATING, &_cheats.station_rating.value, &_cheats.station_rating.been_used, nullptr },
|
||||||
{SLE_UINT8, STR_CHEAT_EDIT_MAX_HL, &_settings_game.construction.map_height_limit, &_cheats.edit_max_hl.been_used, &ClickChangeMaxHlCheat },
|
{SLE_UINT8, STR_CHEAT_EDIT_MAX_HL, &_settings_game.construction.map_height_limit, &_cheats.edit_max_hl.been_used, &ClickChangeMaxHlCheat },
|
||||||
{SLE_INT32, STR_CHEAT_CHANGE_DATE, &TimerGameCalendar::year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
|
{SLE_INT32, STR_CHEAT_CHANGE_DATE, &TimerGameCalendar::year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct Cheats {
|
||||||
Cheat change_date; ///< changes date ingame
|
Cheat change_date; ///< changes date ingame
|
||||||
Cheat setup_prod; ///< setup raw-material production in game
|
Cheat setup_prod; ///< setup raw-material production in game
|
||||||
Cheat edit_max_hl; ///< edit the maximum heightlevel; this is a cheat because of the fact that it needs to reset NewGRF game state and doing so as a simple configuration breaks the expectation of many
|
Cheat edit_max_hl; ///< edit the maximum heightlevel; this is a cheat because of the fact that it needs to reset NewGRF game state and doing so as a simple configuration breaks the expectation of many
|
||||||
|
Cheat station_rating; ///< Fix station ratings at 100%
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Cheats _cheats;
|
extern Cheats _cheats;
|
||||||
|
|
|
@ -2194,6 +2194,7 @@ STR_CHEAT_EDIT_MAX_HL_QUERY_CAPT :{WHITE}Edit the
|
||||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Change date: {ORANGE}{DATE_SHORT}
|
STR_CHEAT_CHANGE_DATE :{LTBLUE}Change date: {ORANGE}{DATE_SHORT}
|
||||||
STR_CHEAT_CHANGE_DATE_QUERY_CAPT :{WHITE}Change current year
|
STR_CHEAT_CHANGE_DATE_QUERY_CAPT :{WHITE}Change current year
|
||||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Enable modifying production values: {ORANGE}{STRING1}
|
STR_CHEAT_SETUP_PROD :{LTBLUE}Enable modifying production values: {ORANGE}{STRING1}
|
||||||
|
STR_CHEAT_STATION_RATING :{LTBLUE}Fix station ratings at 100%: {ORANGE}{STRING1}
|
||||||
|
|
||||||
# Livery window
|
# Livery window
|
||||||
STR_LIVERY_CAPTION :{WHITE}{COMPANY} - Colour Scheme
|
STR_LIVERY_CAPTION :{WHITE}{COMPANY} - Colour Scheme
|
||||||
|
|
|
@ -33,6 +33,8 @@ static const SaveLoad _cheats_desc[] = {
|
||||||
SLE_VAR(Cheats, setup_prod.value, SLE_BOOL),
|
SLE_VAR(Cheats, setup_prod.value, SLE_BOOL),
|
||||||
SLE_VAR(Cheats, edit_max_hl.been_used, SLE_BOOL),
|
SLE_VAR(Cheats, edit_max_hl.been_used, SLE_BOOL),
|
||||||
SLE_VAR(Cheats, edit_max_hl.value, SLE_BOOL),
|
SLE_VAR(Cheats, edit_max_hl.value, SLE_BOOL),
|
||||||
|
SLE_CONDVAR(Cheats, station_rating.been_used, SLE_BOOL, SLV_STATION_RATING_CHEAT, SL_MAX_VERSION),
|
||||||
|
SLE_CONDVAR(Cheats, station_rating.value, SLE_BOOL, SLV_STATION_RATING_CHEAT, SL_MAX_VERSION),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,8 @@ enum SaveLoadVersion : uint16_t {
|
||||||
SLV_REMOVE_LOADED_AT_XY, ///< 318 PR#11276 Remove loaded_at_xy variable from CargoPacket.
|
SLV_REMOVE_LOADED_AT_XY, ///< 318 PR#11276 Remove loaded_at_xy variable from CargoPacket.
|
||||||
SLV_CARGO_TRAVELLED, ///< 319 PR#11283 CargoPacket now tracks how far it travelled inside a vehicle.
|
SLV_CARGO_TRAVELLED, ///< 319 PR#11283 CargoPacket now tracks how far it travelled inside a vehicle.
|
||||||
|
|
||||||
|
SLV_STATION_RATING_CHEAT, ///< 320 PR#11346 Add cheat to fix station ratings at 100%.
|
||||||
|
|
||||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
#include "newgrf_storage.h"
|
#include "newgrf_storage.h"
|
||||||
#include "bitmap_type.h"
|
#include "bitmap_type.h"
|
||||||
|
|
||||||
static const byte INITIAL_STATION_RATING = 175;
|
static const uint8_t INITIAL_STATION_RATING = 175;
|
||||||
|
static const uint8_t MAX_STATION_RATING = 255;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flow statistics telling how much flow should be sent along a link. This is
|
* Flow statistics telling how much flow should be sent along a link. This is
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#include "timer/timer.h"
|
#include "timer/timer.h"
|
||||||
#include "timer/timer_game_calendar.h"
|
#include "timer/timer_game_calendar.h"
|
||||||
#include "timer/timer_game_tick.h"
|
#include "timer/timer_game_tick.h"
|
||||||
|
#include "cheat_type.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
|
@ -3650,7 +3651,10 @@ static void UpdateStationRating(Station *st)
|
||||||
*/
|
*/
|
||||||
uint waiting_avg = waiting / (num_dests + 1);
|
uint waiting_avg = waiting / (num_dests + 1);
|
||||||
|
|
||||||
if (HasBit(cs->callback_mask, CBM_CARGO_STATION_RATING_CALC)) {
|
if (_cheats.station_rating.value) {
|
||||||
|
ge->rating = rating = MAX_STATION_RATING;
|
||||||
|
skip = true;
|
||||||
|
} else if (HasBit(cs->callback_mask, CBM_CARGO_STATION_RATING_CALC)) {
|
||||||
/* Perform custom station rating. If it succeeds the speed, days in transit and
|
/* Perform custom station rating. If it succeeds the speed, days in transit and
|
||||||
* waiting cargo ratings must not be executed. */
|
* waiting cargo ratings must not be executed. */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue