Minor ModMenuModule tweaks

- Updated ModMenuModule::has_options_t template param name to CheatT
- Updated ModMenuModule::SpawnSavedVehicleAction::Execute to use const reference of SpawnSavedVehicleSegmentData
- Updated ModMenuModule::PositionMenuSegment and PositionRotationMenuSegment mode text color (added # symbols)
- Updated ModMenuModule::SpawnSavedVehicleSegment::ValidateSegment logging messages to be more precise
This commit is contained in:
izawartka 2026-08-22 01:36:57 +02:00
parent a41a66b377
commit 0afed76f8c
5 changed files with 8 additions and 7 deletions

View File

@ -5,8 +5,9 @@ namespace ModMenuModule {
template<typename, typename = void>
struct has_options_t : std::false_type {};
template<typename T>
struct has_options_t<T, std::void_t<typename T::OptionsT>> : std::true_type {};
template<typename CheatT>
struct has_options_t<CheatT, std::void_t<typename CheatT::OptionsT>> : std::true_type {};
template<typename CheatT>
class CheatOptionsUpdateEvent : public Core::EventBase {
static_assert(has_options_t<CheatT>::value, "CheatT must define `OptionsT` (e.g. `using OptionsT = ...;`)");

View File

@ -43,7 +43,7 @@ void ModMenuModule::SpawnSavedVehicleAction::Execute()
return;
}
SpawnSavedVehicleSegmentData data = m_data.value();
const SpawnSavedVehicleSegmentData& data = m_data.value();
if (savedCarsCheat->SpawnCar(data.savedCarName)) {
ModMenuModule::ToastManager::GetInstance()->Show({ L"Spawned " + data.savedCarName });

View File

@ -161,7 +161,7 @@ bool ModMenuModule::PositionMenuSegment::UpdateTexts()
return false;
}
std::wstring modeTextValue = (entry->updateFromPlayerPed) ? L"From player" : L"Custom";
std::wstring modeTextValue = (entry->updateFromPlayerPed) ? L"#From player#" : L"#Custom#";
std::wstring modeText = m_label + L": " + modeTextValue;
m_modeText->SetText(modeText);

View File

@ -162,7 +162,7 @@ bool ModMenuModule::PositionRotationMenuSegment::UpdateTexts()
return false;
}
std::wstring modeTextValue = (entry->updateFromPlayerPed) ? L"From player" : L"Custom";
std::wstring modeTextValue = (entry->updateFromPlayerPed) ? L"#From player#" : L"#Custom#";
std::wstring modeText = m_label + L": " + modeTextValue;
m_modeText->SetText(modeText);

View File

@ -16,7 +16,7 @@ bool ModMenuModule::SpawnSavedVehicleSegment::ValidateSegment() const
{
bool hasValue = m_savedCarNameController && m_savedCarNameController->GetValue().has_value();
if (!hasValue) {
spdlog::warn("No saved vehicles found");
spdlog::warn("SpawnSavedVehicleSegment: Validation failed, no saved vehicles found");
ToastManager::GetInstance()->Show({ L"No saved vehicles found", ToastType::Warning });
return false;
}
@ -26,7 +26,7 @@ bool ModMenuModule::SpawnSavedVehicleSegment::ValidateSegment() const
const auto& savedCarNames = savedCarsCheat->GetSavedCarsList();
if (std::find(savedCarNames.begin(), savedCarNames.end(), savedCarName) == savedCarNames.end()) {
spdlog::warn("Selected saved vehicle not found");
spdlog::warn(L"SpawnSavedVehicleSegment: Validation failed: Saved vehicle \"{}\" not found", savedCarName);
ToastManager::GetInstance()->Show({ L"Selected saved vehicle not found", ToastType::Warning });
return false;
}