mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-22 16:52:30 +08:00
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:
@ -13,7 +13,7 @@ namespace big
|
||||
{
|
||||
if (!ENTITY::DOES_ENTITY_EXIST(vehicle) || !ENTITY::IS_ENTITY_A_VEHICLE(vehicle))
|
||||
{
|
||||
g_notification_service->push_warning("PERSIST_CAR_TITLE"_T.data(),
|
||||
g_notification_service.push_warning("PERSIST_CAR_TITLE"_T.data(),
|
||||
"PERSIST_CAR_INVALID_VEHICLE_SAVE_ATTEMPT"_T.data());
|
||||
return;
|
||||
}
|
||||
@ -42,7 +42,7 @@ namespace big
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
g_notification_service->push_warning("PERSIST_CAR_TITLE"_T.data(), "Failed to load JSON file");
|
||||
g_notification_service.push_warning("PERSIST_CAR_TITLE"_T.data(), "Failed to load JSON file");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user