1
0
Fork 0

Remove: Magic Bulldozer cheat

pull/13265/head
Tyler Trahan 2025-01-03 15:47:42 -05:00
parent b564013ca1
commit b574cd260c
7 changed files with 12 additions and 21 deletions

View File

@ -168,7 +168,7 @@ static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
enum CheatNumbers {
CHT_MONEY, ///< Change amount of money.
CHT_CHANGE_COMPANY, ///< Switch company.
CHT_EXTRA_DYNAMITE, ///< Dynamite anything.
CHT_EXTRA_DYNAMITE, ///< UNUSED: Dynamite anything.
CHT_CROSSINGTUNNELS, ///< Allow tunnels to cross each other.
CHT_NO_JETCRASH, ///< Disable jet-airplane crashes.
CHT_SETUP_PROD, ///< Allow manually editing of industry production.
@ -202,7 +202,6 @@ struct CheatEntry {
static const CheatEntry _cheats_ui[] = {
{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, 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_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, &ClickSetProdCheat },
@ -211,7 +210,7 @@ static const CheatEntry _cheats_ui[] = {
{SLE_INT32, STR_CHEAT_CHANGE_DATE, &TimerGameCalendar::year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
};
static_assert(CHT_NUM_CHEATS == lengthof(_cheats_ui));
static_assert(CHT_NUM_CHEATS == lengthof(_cheats_ui) + 1); // Removed from the UI: Magic Bulldozer.
/** Widget definitions of the cheat GUI. */
static constexpr NWidgetPart _nested_cheat_widgets[] = {

View File

@ -24,7 +24,7 @@ struct Cheat {
* Only add new entries at the end of the struct!
*/
struct Cheats {
Cheat magic_bulldozer; ///< dynamite industries, objects
Cheat magic_bulldozer; ///< REMOVED: dynamite industries, objects
Cheat switch_company; ///< change to another company
Cheat money; ///< get rich or poor
Cheat crossing_tunnels; ///< allow tunnels that cross each other

View File

@ -279,8 +279,6 @@ CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, R
if (!town_check) return CommandCost();
if (_cheats.magic_bulldozer.value) return CommandCost();
Town *t = ClosestTownFromTile(tile, UINT_MAX);
if (t == nullptr) return CommandCost();

View File

@ -17,8 +17,8 @@
#include "../safeguards.h"
static const SaveLoad _cheats_desc[] = {
SLE_VAR(Cheats, magic_bulldozer.been_used, SLE_BOOL),
SLE_VAR(Cheats, magic_bulldozer.value, SLE_BOOL),
SLE_CONDVAR(Cheats, magic_bulldozer.been_used, SLE_BOOL, SL_MIN_VERSION, SLV_REMOVE_MAGIC_BULLDOZER),
SLE_CONDVAR(Cheats, magic_bulldozer.value, SLE_BOOL, SL_MIN_VERSION, SLV_REMOVE_MAGIC_BULLDOZER),
SLE_VAR(Cheats, switch_company.been_used, SLE_BOOL),
SLE_VAR(Cheats, switch_company.value, SLE_BOOL),
SLE_VAR(Cheats, money.been_used, SLE_BOOL),

View File

@ -395,6 +395,7 @@ enum SaveLoadVersion : uint16_t {
SLV_PATH_CACHE_FORMAT, ///< 346 PR#12345 Vehicle path cache format changed.
SLV_ANIMATED_TILE_STATE_IN_MAP, ///< 347 PR#13082 Animated tile state saved for improved performance.
SLV_INCREASE_HOUSE_LIMIT, ///< 348 PR#12288 Increase house limit to 4096.
SLV_REMOVE_MAGIC_BULLDOZER, ///< 349 PR#13265 Remove Magic Bulldozer cheat.
SL_MAX_VERSION, ///< Highest possible saveload version
};

View File

@ -729,7 +729,7 @@ static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags)
if (Company::IsValidID(_current_company)) {
if (rating > t->ratings[_current_company] && !(flags & DC_NO_TEST_TOWN_RATING) &&
!_cheats.magic_bulldozer.value && _settings_game.difficulty.town_council_tolerance != TOWN_COUNCIL_PERMISSIVE) {
_settings_game.difficulty.town_council_tolerance != TOWN_COUNCIL_PERMISSIVE) {
SetDParam(0, t->index);
return CommandCost(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS);
}
@ -3974,12 +3974,8 @@ static int GetRating(const Town *t)
*/
void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
{
/* if magic_bulldozer cheat is active, town doesn't penalize for removing stuff */
if (t == nullptr || (flags & DC_NO_MODIFY_TOWN_RATING) ||
!Company::IsValidID(_current_company) ||
(_cheats.magic_bulldozer.value && add < 0)) {
return;
}
if (t == nullptr || !Company::IsValidID(_current_company)) return;
if (flags & DC_NO_MODIFY_TOWN_RATING) return;
int rating = GetRating(t);
if (add < 0) {
@ -4011,11 +4007,8 @@ void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
*/
CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType type)
{
/* if magic_bulldozer cheat is active, town doesn't restrict your destructive actions */
if (t == nullptr || !Company::IsValidID(_current_company) ||
_cheats.magic_bulldozer.value || (flags & DC_NO_TEST_TOWN_RATING)) {
return CommandCost();
}
if (t == nullptr || !Company::IsValidID(_current_company)) return CommandCost();
if (flags & DC_NO_MODIFY_TOWN_RATING) return CommandCost();
/* minimum rating needed to be allowed to remove stuff */
static const int needed_rating[][TOWN_RATING_CHECK_TYPE_COUNT] = {

View File

@ -811,7 +811,7 @@ static inline CommandCost CheckAllowRemoveTunnelBridge(TileIndex tile)
if (tram_rt != INVALID_ROADTYPE) tram_owner = GetRoadOwner(tile, RTT_TRAM);
/* We can remove unowned road and if the town allows it */
if (road_owner == OWNER_TOWN && _current_company != OWNER_TOWN && !(_settings_game.construction.extra_dynamite || _cheats.magic_bulldozer.value)) {
if (road_owner == OWNER_TOWN && _current_company != OWNER_TOWN && !(_settings_game.construction.extra_dynamite)) {
/* Town does not allow */
return CheckTileOwnership(tile);
}