Skip to content

Commit

Permalink
Feature: Cheat to fix station ratings at 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
JGRennison authored and 2TallTyler committed Oct 1, 2023
1 parent c84219a commit 8605c57
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cheat_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ enum CheatNumbers {
CHT_CROSSINGTUNNELS, ///< Allow tunnels to cross each other.
CHT_NO_JETCRASH, ///< Disable jet-airplane crashes.
CHT_SETUP_PROD, ///< Allow manually editing of industry production.
CHT_STATION_RATING, ///< Station ratings fixed at 100%.
CHT_EDIT_MAX_HL, ///< Edit maximum allowed heightlevel
CHT_CHANGE_DATE, ///< Do time traveling.

Expand Down Expand Up @@ -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_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_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_INT32, STR_CHEAT_CHANGE_DATE, &TimerGameCalendar::year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
};
Expand Down
1 change: 1 addition & 0 deletions src/cheat_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct Cheats {
Cheat change_date; ///< changes date ingame
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 station_rating; ///< Station ratings fixed at 100%
};

extern Cheats _cheats;
Expand Down
1 change: 1 addition & 0 deletions src/lang/english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2196,6 +2196,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_QUERY_CAPT :{WHITE}Change current year
STR_CHEAT_SETUP_PROD :{LTBLUE}Enable modifying production values: {ORANGE}{STRING1}
STR_CHEAT_STATION_RATING :{LTBLUE}Station ratings fixed at 100%: {ORANGE}{STRING1}

# Livery window
STR_LIVERY_CAPTION :{WHITE}{COMPANY} - Colour Scheme
Expand Down
1 change: 1 addition & 0 deletions src/saveload/cheat_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static const SaveLoad _cheats_desc[] = {
SLE_VAR(Cheats, setup_prod.value, SLE_BOOL),
SLE_VAR(Cheats, edit_max_hl.been_used, SLE_BOOL),
SLE_VAR(Cheats, edit_max_hl.value, SLE_BOOL),
SLE_VAR(Cheats, station_rating.value, SLE_BOOL),
};


Expand Down
6 changes: 5 additions & 1 deletion src/station_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "timer/timer.h"
#include "timer/timer_game_calendar.h"
#include "timer/timer_game_tick.h"
#include "cheat_type.h"

#include "table/strings.h"

Expand Down Expand Up @@ -3678,7 +3679,10 @@ static void UpdateStationRating(Station *st)
*/
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 = 255;
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
* waiting cargo ratings must not be executed. */

Expand Down

0 comments on commit 8605c57

Please sign in to comment.