refactor!: Rewrite of the old notification service (#2866)
The main goal was improving the readability of the original code however some ugliness remains. - Swapped from pointer singleton to instance singleton - Actually make use of the alpha logic that used to be present - Added a counter to notifications to indicate if something is being spammed - Notification timeouts reset if they're sent to the queue again
This commit is contained in:
@ -26,7 +26,7 @@ namespace big
|
||||
const auto vehicle = persist_car_service::load_vehicle(selected_vehicle_file, g.persist_car.persist_vehicle_sub_folder);
|
||||
if (!vehicle)
|
||||
{
|
||||
g_notification_service->push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_TO_MANY_SPAWNED"_T.data());
|
||||
g_notification_service.push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_TO_MANY_SPAWNED"_T.data());
|
||||
}
|
||||
else if (g.persist_car.spawn_inside && self::veh != vehicle)
|
||||
{
|
||||
@ -37,7 +37,7 @@ namespace big
|
||||
}
|
||||
else
|
||||
{
|
||||
g_notification_service->push_warning("PERSIST_CAR"_T.data(), "SELECT_FILE_FIRST"_T.data());
|
||||
g_notification_service.push_warning("PERSIST_CAR"_T.data(), "SELECT_FILE_FIRST"_T.data());
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ namespace big
|
||||
return;
|
||||
|
||||
if (!self::veh)
|
||||
return g_notification_service->push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_NOT_IN_VEHICLE"_T.data());
|
||||
return g_notification_service.push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_NOT_IN_VEHICLE"_T.data());
|
||||
|
||||
save_vehicle(vehicle_file_name_input, save_folder);
|
||||
});
|
||||
@ -200,7 +200,7 @@ namespace big
|
||||
return;
|
||||
|
||||
if (!self::veh)
|
||||
return g_notification_service->push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_NOT_IN_VEHICLE"_T.data());
|
||||
return g_notification_service.push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_NOT_IN_VEHICLE"_T.data());
|
||||
|
||||
save_vehicle(vehicle_file_name_input, g.persist_car.persist_vehicle_sub_folder.c_str());
|
||||
});
|
||||
|
@ -193,7 +193,7 @@ namespace big
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
g_notification_service.push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ namespace big
|
||||
if (ImGui::Selectable(driving_style_names[i], g.vehicle.auto_drive_style == (AutoDriveStyle)i))
|
||||
{
|
||||
g.vehicle.auto_drive_style = (AutoDriveStyle)i;
|
||||
g_notification_service->push_success("AUTO_DRIVE"_T.data(),
|
||||
g_notification_service.push_success("AUTO_DRIVE"_T.data(),
|
||||
std::vformat("DRIVING_STYLE_SET_TO"_T.data(), std::make_format_args(driving_style_names[i])));
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ namespace big
|
||||
}
|
||||
else
|
||||
{
|
||||
g_notification_service->push_error("GUI_TAB_LSC"_T.data(), "VIEW_LSC_SELECTED_MOD_IS_INVALID"_T.data());
|
||||
g_notification_service.push_error("GUI_TAB_LSC"_T.data(), "VIEW_LSC_SELECTED_MOD_IS_INVALID"_T.data());
|
||||
}
|
||||
}
|
||||
else if (selected_slot == MOD_WINDOW_TINT)
|
||||
|
@ -126,7 +126,7 @@ namespace big
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
g_notification_service.push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -176,7 +176,7 @@ namespace big
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
g_notification_service.push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
components::button("MORS_FIX_ALL"_T, [] {
|
||||
int amount_fixed = mobile::mors_mutual::fix_all();
|
||||
g_notification_service->push_success("MOBILE"_T.data(),
|
||||
g_notification_service.push_success("MOBILE"_T.data(),
|
||||
std::vformat("VEHICLE_FIX_AMOUNT"_T.data(),
|
||||
std::make_format_args(amount_fixed,
|
||||
amount_fixed == 1 ? "VEHICLE_FIX_HAS"_T.data() : "VEHICLE_FIX_HAVE"_T.data())));
|
||||
|
Reference in New Issue
Block a user