1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 22:13:07 +01:00

Allow staff to use ‘real’ names as well (#22732)

This commit is contained in:
Aaron van Geffen
2024-09-15 22:18:00 +02:00
committed by GitHub
parent 2b36d59bf9
commit e70ca5c889
10 changed files with 58 additions and 31 deletions

View File

@@ -3740,6 +3740,8 @@ STR_6667 :Fauna
STR_6668 :Staff cheats
STR_6669 :Show staff cheats
STR_6670 :Guest behaviour
STR_6671 :Show real names of staff
STR_6672 :Toggle between showing real names of staff and staff numbers
#############
# Scenarios #

View File

@@ -3,6 +3,7 @@
- Feature: [#15642] Track design placement can now use contruction modifier keys (ctrl/shift).
- Feature: [#21521] [Plugin] Add hook 'park.guest.softcap.calculate' called before calculating the soft guest cap.
- Change: [#22596] Land ownership fixes described by .parkpatch files are now only considered on scenarios.
- Change: [#22724] Staff now have optional real names as well.
- Change: [#22740] Add virtual floor to shifted track design placement.
- Fix: [#2614] The colour tab of the ride window does not hide invisible cars (original bug).
- Fix: [#15406] Tunnels on steep Side-Friction track are drawn too low.

View File

@@ -1152,8 +1152,10 @@ namespace OpenRCT2
STR_PATH_TO_RCT1_IS_WRONG_VERSION = 6372,
STR_PATH_TO_RCT1_TIP = 6038,
STR_PATH_TO_RCT1_WRONG_ERROR = 6037,
STR_REAL_NAME = 2487,
STR_REAL_NAME_TIP = 2488,
STR_REAL_NAME_GUESTS = 2487,
STR_REAL_NAME_GUESTS_TIP = 2488,
STR_REAL_NAME_STAFF = 6671,
STR_REAL_NAME_STAFF_TIP = 6672,
STR_REAL_VALUES = 2359,
STR_RENDERING_GROUP = 5477,
STR_RENDER_WEATHER_EFFECTS = 5920,

View File

@@ -194,7 +194,8 @@ namespace OpenRCT2::Ui::Windows
WIDX_SCENARIO_OPTIONS_GROUP,
WIDX_ALLOW_EARLY_COMPLETION,
WIDX_TWEAKS_GROUP,
WIDX_REAL_NAME_CHECKBOX,
WIDX_REAL_NAMES_GUESTS_CHECKBOX,
WIDX_REAL_NAMES_STAFF_CHECKBOX,
WIDX_AUTO_STAFF_PLACEMENT,
WIDX_AUTO_OPEN_SHOPS,
WIDX_DEFAULT_INSPECTION_INTERVAL_LABEL,
@@ -377,13 +378,14 @@ namespace OpenRCT2::Ui::Windows
MakeWidget({ 5, kScenarioOptionsGroupStart + 0}, {300, 35}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_SCENARIO_OPTIONS ),
MakeWidget({10, kScenarioOptionsGroupStart + 15}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ALLOW_EARLY_COMPLETION, STR_EARLY_COMPLETION_TIP), // Allow early scenario completion
MakeWidget({ 5, kTweaksStart + 0}, {300, 81}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TWEAKS ),
MakeWidget({ 10, kTweaksStart + 15}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_REAL_NAME, STR_REAL_NAME_TIP ), // Show 'real' names of guests
MakeWidget({ 10, kTweaksStart + 30}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_AUTO_STAFF_PLACEMENT, STR_AUTO_STAFF_PLACEMENT_TIP ), // Auto staff placement
MakeWidget({ 10, kTweaksStart + 45}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_AUTO_OPEN_SHOPS, STR_AUTO_OPEN_SHOPS_TIP ), // Automatically open shops & stalls
MakeWidget({ 10, kTweaksStart + 62}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DEFAULT_INSPECTION_INTERVAL, STR_DEFAULT_INSPECTION_INTERVAL_TIP),
MakeWidget({175, kTweaksStart + 61}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Default inspection time dropdown
MakeWidget({288, kTweaksStart + 62}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button
MakeWidget({ 5, kTweaksStart + 0}, {300, 96}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TWEAKS ),
MakeWidget({ 10, kTweaksStart + 15}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_REAL_NAME_GUESTS, STR_REAL_NAME_GUESTS_TIP ), // Show 'real' names of guests
MakeWidget({ 10, kTweaksStart + 30}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_REAL_NAME_STAFF, STR_REAL_NAME_STAFF_TIP ), // Show 'real' names of staff
MakeWidget({ 10, kTweaksStart + 45}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_AUTO_STAFF_PLACEMENT, STR_AUTO_STAFF_PLACEMENT_TIP ), // Auto staff placement
MakeWidget({ 10, kTweaksStart + 60}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_AUTO_OPEN_SHOPS, STR_AUTO_OPEN_SHOPS_TIP ), // Automatically open shops & stalls
MakeWidget({ 10, kTweaksStart + 77}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DEFAULT_INSPECTION_INTERVAL, STR_DEFAULT_INSPECTION_INTERVAL_TIP),
MakeWidget({175, kTweaksStart + 76}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Default inspection time dropdown
MakeWidget({288, kTweaksStart + 77}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button
kWidgetsEnd,
};
@@ -1693,11 +1695,17 @@ namespace OpenRCT2::Ui::Windows
{
switch (widgetIndex)
{
case WIDX_REAL_NAME_CHECKBOX:
case WIDX_REAL_NAMES_GUESTS_CHECKBOX:
Config::Get().general.ShowRealNamesOfGuests ^= 1;
Config::Save();
Invalidate();
PeepUpdateNames(Config::Get().general.ShowRealNamesOfGuests);
PeepUpdateNames();
break;
case WIDX_REAL_NAMES_STAFF_CHECKBOX:
Config::Get().general.ShowRealNamesOfStaff ^= 1;
Config::Save();
Invalidate();
PeepUpdateNames();
break;
case WIDX_AUTO_STAFF_PLACEMENT:
Config::Get().general.AutoStaffPlacement ^= 1;
@@ -1851,8 +1859,10 @@ namespace OpenRCT2::Ui::Windows
// and the server cannot change the setting during gameplay to prevent desyncs
if (NetworkGetMode() != NETWORK_MODE_NONE)
{
disabled_widgets |= (1uLL << WIDX_REAL_NAME_CHECKBOX);
widgets[WIDX_REAL_NAME_CHECKBOX].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY;
disabled_widgets |= (1uLL << WIDX_REAL_NAMES_GUESTS_CHECKBOX) | (1uLL << WIDX_REAL_NAMES_STAFF_CHECKBOX);
widgets[WIDX_REAL_NAMES_GUESTS_CHECKBOX].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY;
widgets[WIDX_REAL_NAMES_STAFF_CHECKBOX].tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY;
// Disable the use of the allow_early_completion option during network play on clients.
// This is to prevent confusion on clients because changing this setting during network play wouldn't change
// the way scenarios are completed during this network-session
@@ -1863,7 +1873,8 @@ namespace OpenRCT2::Ui::Windows
}
}
SetCheckboxValue(WIDX_REAL_NAME_CHECKBOX, Config::Get().general.ShowRealNamesOfGuests);
SetCheckboxValue(WIDX_REAL_NAMES_GUESTS_CHECKBOX, Config::Get().general.ShowRealNamesOfGuests);
SetCheckboxValue(WIDX_REAL_NAMES_STAFF_CHECKBOX, Config::Get().general.ShowRealNamesOfStaff);
SetCheckboxValue(WIDX_AUTO_STAFF_PLACEMENT, Config::Get().general.AutoStaffPlacement);
SetCheckboxValue(WIDX_AUTO_OPEN_SHOPS, Config::Get().general.AutoOpenShops);
SetCheckboxValue(WIDX_ALLOW_EARLY_COMPLETION, Config::Get().general.AllowEarlyCompletion);

View File

@@ -850,7 +850,7 @@ namespace OpenRCT2
}
// This ensures that the newly loaded save reflects the user's
// 'show real names of guests' option, now that it's a global setting
PeepUpdateNames(Config::Get().general.ShowRealNamesOfGuests);
PeepUpdateNames();
#ifndef DISABLE_NETWORK
if (sendMap)
{

View File

@@ -237,6 +237,7 @@ namespace OpenRCT2::Config
model->RenderWeatherGloom = reader->GetBoolean("render_weather_gloom", true);
model->ShowGuestPurchases = reader->GetBoolean("show_guest_purchases", false);
model->ShowRealNamesOfGuests = reader->GetBoolean("show_real_names_of_guests", true);
model->ShowRealNamesOfStaff = reader->GetBoolean("show_real_names_of_staff", false);
model->AllowEarlyCompletion = reader->GetBoolean("allow_early_completion", false);
model->AssetPackOrder = reader->GetString("asset_pack_order", "");
model->EnabledAssetPacks = reader->GetString("enabled_asset_packs", "");
@@ -323,6 +324,7 @@ namespace OpenRCT2::Config
writer->WriteBoolean("render_weather_gloom", model->RenderWeatherGloom);
writer->WriteBoolean("show_guest_purchases", model->ShowGuestPurchases);
writer->WriteBoolean("show_real_names_of_guests", model->ShowRealNamesOfGuests);
writer->WriteBoolean("show_real_names_of_staff", model->ShowRealNamesOfStaff);
writer->WriteBoolean("allow_early_completion", model->AllowEarlyCompletion);
writer->WriteString("asset_pack_order", model->AssetPackOrder);
writer->WriteString("enabled_asset_packs", model->EnabledAssetPacks);

View File

@@ -102,6 +102,7 @@ namespace OpenRCT2::Config
bool ScenarioHideMegaPark;
bool SteamOverlayPause;
bool ShowRealNamesOfGuests;
bool ShowRealNamesOfStaff;
bool AllowEarlyCompletion;
u8string AssetPackOrder;
u8string EnabledAssetPacks;

View File

@@ -1599,8 +1599,19 @@ void Peep::FormatNameTo(Formatter& ft) const
{
if (Name == nullptr)
{
auto& gameState = GetGameState();
const bool showGuestNames = gameState.Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
const bool showStaffNames = gameState.Park.Flags & PARK_FLAGS_SHOW_REAL_STAFF_NAMES;
auto* staff = As<Staff>();
if (staff != nullptr)
const bool isStaff = staff != nullptr;
if ((!isStaff && showGuestNames) || (isStaff && showStaffNames))
{
auto realNameStringId = GetRealNameStringIDFromPeepID(PeepId);
ft.Add<StringId>(realNameStringId);
}
else if (isStaff)
{
auto staffNameIndex = static_cast<uint8_t>(staff->AssignedStaffType);
if (staffNameIndex >= std::size(_staffNames))
@@ -1611,11 +1622,6 @@ void Peep::FormatNameTo(Formatter& ft) const
ft.Add<StringId>(_staffNames[staffNameIndex]);
ft.Add<uint32_t>(PeepId);
}
else if (GetGameState().Park.Flags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
{
auto realNameStringId = GetRealNameStringIDFromPeepID(PeepId);
ft.Add<StringId>(realNameStringId);
}
else
{
ft.Add<StringId>(STR_GUEST_X).Add<uint32_t>(PeepId);
@@ -2654,19 +2660,20 @@ int32_t PeepCompare(const EntityId sprite_index_a, const EntityId sprite_index_b
*
* rct2: 0x0069926C
*/
void PeepUpdateNames(bool realNames)
void PeepUpdateNames()
{
auto& gameState = GetGameState();
if (realNames)
{
auto& config = Config::Get().general;
if (config.ShowRealNamesOfGuests)
gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
// Peep names are now dynamic
}
else
{
gameState.Park.Flags &= ~PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
// Peep names are now dynamic
}
if (config.ShowRealNamesOfStaff)
gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_STAFF_NAMES;
else
gameState.Park.Flags &= ~PARK_FLAGS_SHOW_REAL_STAFF_NAMES;
auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST);
ContextBroadcastIntent(&intent);

View File

@@ -460,6 +460,6 @@ void PeepDecrementNumRiders(Peep* peep);
void PeepSetMapTooltip(Peep* peep);
int32_t PeepCompare(const EntityId sprite_index_a, const EntityId sprite_index_b);
void PeepUpdateNames(bool realNames);
void PeepUpdateNames();
StringId GetRealNameStringIDFromPeepID(uint32_t id);

View File

@@ -34,6 +34,7 @@ enum : uint32_t
PARK_FLAGS_FORBID_MARKETING_CAMPAIGN = (1 << 7),
PARK_FLAGS_ANTI_CHEAT_DEPRECATED = (1 << 8), // Not used anymore, used for cheat detection
PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 9),
PARK_FLAGS_SHOW_REAL_STAFF_NAMES = (1 << 10),
PARK_FLAGS_NO_MONEY = (1 << 11),
PARK_FLAGS_DIFFICULT_GUEST_GENERATION = (1 << 12),
PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13),