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:
@ -29,7 +29,7 @@ namespace big
|
||||
{
|
||||
current_destination = AutoDriveDestination::STOPPED;
|
||||
changing_driving_styles = false;
|
||||
g_notification_service->push_warning("AUTO_DRIVE"_T.data(), "PLAYER_INFO_NO_VEHICLE"_T.data());
|
||||
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "PLAYER_INFO_NO_VEHICLE"_T.data());
|
||||
}
|
||||
else if (current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] || current_speed != g.vehicle.auto_drive_speed)
|
||||
{
|
||||
@ -77,11 +77,11 @@ namespace big
|
||||
|
||||
if (to_waypoint && !does_waypoint_exist)
|
||||
{
|
||||
g_notification_service->push_warning("AUTO_DRIVE"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data());
|
||||
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
g_notification_service->push_warning("AUTO_DRIVE"_T.data(), "BACKEND_LOOPED_VEHICLE_AUTO_DRIVE_STOPPED"_T.data());
|
||||
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "BACKEND_LOOPED_VEHICLE_AUTO_DRIVE_STOPPED"_T.data());
|
||||
}
|
||||
|
||||
started = false;
|
||||
|
@ -125,7 +125,7 @@ namespace big
|
||||
|
||||
virtual void on_enable() override
|
||||
{
|
||||
g_notification_service->push("TURN_SIGNALS"_T.data(), "BACKEND_LOOPED_VEHICLE_TURN_SIGNALS_HELP"_T.data());
|
||||
g_notification_service.push("TURN_SIGNALS"_T.data(), "BACKEND_LOOPED_VEHICLE_TURN_SIGNALS_HELP"_T.data());
|
||||
}
|
||||
|
||||
virtual void on_tick() override
|
||||
|
Reference in New Issue
Block a user