refactor: cleaned up service directory structure (#300)

This commit is contained in:
Yimura
2022-06-30 00:11:54 +02:00
committed by GitHub
parent 39056979fa
commit dba617ae9f
54 changed files with 57 additions and 71 deletions

View File

@ -0,0 +1,28 @@
#include "friends_service.hpp"
#include "pointers.hpp"
namespace big
{
friends_service::friends_service()
{
g_friends_service = this;
}
friends_service::~friends_service()
{
g_friends_service = nullptr;
}
bool friends_service::is_friend(CNetGamePlayer* net_player)
{
if (net_player == nullptr)
return false;
const auto rockstar_id = net_player->get_net_data()->m_rockstar_id2;
for (std::uint32_t i = 0; i < g_pointers->m_friend_registry->m_friend_count; i++)
if (rockstar_id == g_pointers->m_friend_registry->m_friends_list->m_data[i].m_rockstar_id)
return true;
return false;
}
}

View File

@ -0,0 +1,20 @@
#pragma once
namespace big
{
class friends_service final
{
public:
friends_service();
~friends_service();
friends_service(const friends_service&) = delete;
friends_service(friends_service&&) noexcept = delete;
friends_service& operator=(const friends_service&) = delete;
friends_service& operator=(friends_service&&) noexcept = delete;
[[nodiscard]] static bool is_friend(CNetGamePlayer* net_player);
};
inline friends_service* g_friends_service{};
}