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:
Andreas Maerten
2024-03-23 00:04:49 +01:00
committed by GitHub
parent dd5da5efec
commit 99afa8dfbb
99 changed files with 459 additions and 359 deletions

View File

@ -172,7 +172,7 @@ namespace big
4.f,
5.f);
//LOG(INFO) << "Navmesh probably failed, issiuing regular task ";
g_notification_service->push_warning("VEHICLE_CONTROLLER"_T.data(),
g_notification_service.push_warning("VEHICLE_CONTROLLER"_T.data(),
"VEHICLE_CONTROLLER_TRY_ALT_PATHFINDING"_T.data());
script::get_current()->yield(500ms);
}
@ -308,13 +308,13 @@ namespace big
if (vehicle_control::find_suitable_destination_near_player(destination, heading))
{
//LOG(INFO) << "Suitable destination found";
g_notification_service->push_success("VEHICLE_CONTROLLER"_T.data(),
g_notification_service.push_success("VEHICLE_CONTROLLER"_T.data(),
"VEHICLE_CONTROLLER_FOUND_LOCATION"_T.data());
}
else
{
//LOG(INFO) << "Couldn't find suitable destionation, defaulting to offset of player\nThis might go wrong";
g_notification_service->push_error("VEHICLE_CONTROLLER"_T.data(),
g_notification_service.push_error("VEHICLE_CONTROLLER"_T.data(),
"VEHICLE_CONTROLLER_FORCE_PATHFINDING"_T.data());
destination = behind_pos;
}
@ -338,7 +338,7 @@ namespace big
else
{
//LOG(INFO) << "Navmesh load failed";
g_notification_service->push_error("VEHICLE_CONTROLLER"_T.data(), "VEHICLE_CONTROLLER_NAVMESH_FAILURE"_T.data());
g_notification_service.push_error("VEHICLE_CONTROLLER"_T.data(), "VEHICLE_CONTROLLER_NAVMESH_FAILURE"_T.data());
m_driver_performing_task = false;
}
}