Code cleanup (#667)
* chore: Changed detour_hook extension back to cpp * chore(crossmap): split crossmap into header and source file * chore(logger): rename macro's to code style * chore(logger): removed unused local variable * chore(benchmark): changed extension to C++ header * chore: cleanup pickup_rewards file * chore(gta): cleanup code and file naming * chore(CanApplyData): Removed unused code
This commit is contained in:
parent
f338479c5c
commit
173d01145d
@ -1,4 +1,4 @@
|
|||||||
#include "gta/PickupRewards.h"
|
#include "gta/pickup_rewards.hpp"
|
||||||
#include "backend/looped/looped.hpp"
|
#include "backend/looped/looped.hpp"
|
||||||
#include "services/players/player_service.hpp"
|
#include "services/players/player_service.hpp"
|
||||||
#include "util/globals.hpp"
|
#include "util/globals.hpp"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "gta\VehicleValues.h"
|
#include "gta/vehicle_values.hpp"
|
||||||
|
|
||||||
|
|
||||||
static const std::map<int, std::string> lsc_plate_styles = {
|
static const std::map<int, std::string> lsc_plate_styles = {
|
||||||
|
6201
src/crossmap.cpp
Normal file
6201
src/crossmap.cpp
Normal file
File diff suppressed because it is too large
Load Diff
6200
src/crossmap.hpp
6200
src/crossmap.hpp
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "gta\joaat.hpp"
|
#include "gta/joaat.hpp"
|
||||||
|
|
||||||
enum Rewards : Hash
|
enum Rewards : Hash
|
||||||
{
|
{
|
@ -3,7 +3,7 @@
|
|||||||
#include "fwddec.hpp"
|
#include "fwddec.hpp"
|
||||||
#include "extensible.hpp"
|
#include "extensible.hpp"
|
||||||
#include "vector.hpp"
|
#include "vector.hpp"
|
||||||
#include "gta\natives.hpp"
|
#include "gta/natives.hpp"
|
||||||
|
|
||||||
namespace gta
|
namespace gta
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Vehicles.h"
|
#include "vehicles.hpp"
|
||||||
|
|
||||||
enum SeatPositions
|
enum SeatPositions
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gta\joaat.hpp"
|
#include "gta/joaat.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
|
|
||||||
enum Boats : Hash
|
enum Boats : Hash
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "gta\joaat.hpp"
|
#include "gta/joaat.hpp"
|
||||||
|
|
||||||
enum WeaponHashes : Hash
|
enum WeaponHashes : Hash
|
||||||
{
|
{
|
@ -83,81 +83,6 @@ namespace big
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T* get_node_from_object(rage::netSyncNodeBase* node)
|
|
||||||
{
|
|
||||||
constexpr uint64_t hash = CLASS_TO_MANGLED_NAME(T)""_fnv1a;
|
|
||||||
if (node->IsParentNode())
|
|
||||||
{
|
|
||||||
for (auto child = node->m_first_child; child; child = child->m_next_sibling)
|
|
||||||
{
|
|
||||||
T* attach_node = get_node_from_object<T>(child);
|
|
||||||
if (attach_node != nullptr)
|
|
||||||
return attach_node;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (node->IsDataNode())
|
|
||||||
{
|
|
||||||
if (typeid(*node).hash_code() == hash)
|
|
||||||
return dynamic_cast<T*>(node);
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_attachment_infinite(CPhysicalAttachDataNode* node, uint16_t object_id)
|
|
||||||
{
|
|
||||||
if (rage::netObject* attached_object = (*g_pointers->m_network_object_mgr)->find_object_by_id(node->m_attached_to, false); attached_object)
|
|
||||||
{
|
|
||||||
if (rage::netSyncTree* tree = attached_object->GetSyncTree(); tree)
|
|
||||||
{
|
|
||||||
if (rage::netSyncNodeBase* base_node = tree->m_sync_node; base_node)
|
|
||||||
{
|
|
||||||
const auto attached_attach_node = get_node_from_object<CPhysicalAttachDataNode>(base_node);
|
|
||||||
if (attached_attach_node && attached_attach_node->m_attached)
|
|
||||||
{
|
|
||||||
if (attached_attach_node->m_attached_to == object_id)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return is_attachment_infinite(attached_attach_node, object_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_ped_attachment_infinite(CPedAttachDataNode* node, uint16_t object_id)
|
|
||||||
{
|
|
||||||
if (rage::netObject* attached_object = (*g_pointers->m_network_object_mgr)->find_object_by_id(node->m_attached_to, false); attached_object)
|
|
||||||
{
|
|
||||||
if (rage::netSyncTree* tree = attached_object->GetSyncTree(); tree)
|
|
||||||
{
|
|
||||||
if (rage::netSyncNodeBase* base_node = tree->m_sync_node; base_node)
|
|
||||||
{
|
|
||||||
const auto attached_attach_node = get_node_from_object<CPedAttachDataNode>(base_node);
|
|
||||||
if (attached_attach_node && attached_attach_node->m_attached)
|
|
||||||
{
|
|
||||||
if (attached_attach_node->m_attached_to == object_id)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return is_ped_attachment_infinite(attached_attach_node, object_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool check_node(rage::netSyncNodeBase* node, CNetGamePlayer* sender, rage::netObject* object)
|
bool check_node(rage::netSyncNodeBase* node, CNetGamePlayer* sender, rage::netObject* object)
|
||||||
{
|
{
|
||||||
if (node->IsParentNode())
|
if (node->IsParentNode())
|
||||||
|
@ -32,8 +32,8 @@ namespace big
|
|||||||
BLACK = 30
|
BLACK = 30
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AddColorToStream(color) "\x1b[" << int(color) << "m"
|
#define ADD_COLOR_TO_STREAM(color) "\x1b[" << int(color) << "m"
|
||||||
#define ResetStreamColor "\x1b[" << int(LogColor::RESET) << "m"
|
#define RESET_STREAM_COLOR "\x1b[" << int(LogColor::RESET) << "m"
|
||||||
#define HEX_TO_UPPER(value) "0x" << std::hex << std::uppercase << (DWORD64)value << std::dec << std::nouppercase
|
#define HEX_TO_UPPER(value) "0x" << std::hex << std::uppercase << (DWORD64)value << std::dec << std::nouppercase
|
||||||
|
|
||||||
class logger final
|
class logger final
|
||||||
@ -181,17 +181,16 @@ namespace big
|
|||||||
|
|
||||||
out
|
out
|
||||||
<< "[" << msg.timestamp("%H:%M:%S") << "]"
|
<< "[" << msg.timestamp("%H:%M:%S") << "]"
|
||||||
<< AddColorToStream(color)
|
<< ADD_COLOR_TO_STREAM(color)
|
||||||
<< "[" << msg.level() << "/"
|
<< "[" << msg.level() << "/"
|
||||||
<< msg.file() << ":" << msg.line() << "]"
|
<< msg.file() << ":" << msg.line() << "]"
|
||||||
<< ResetStreamColor
|
<< RESET_STREAM_COLOR
|
||||||
<< ": ";
|
<< ": ";
|
||||||
|
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
static std::string format_file(const g3::LogMessage& msg)
|
static std::string format_file(const g3::LogMessage& msg)
|
||||||
{
|
{
|
||||||
LogColor color = log_sink::get_color(msg._level);
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
out
|
out
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "pointers.hpp"
|
#include "pointers.hpp"
|
||||||
#include "script_local.hpp"
|
#include "script_local.hpp"
|
||||||
#include "gta\script_thread.hpp"
|
#include "gta/script_thread.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gta\VehicleValues.h"
|
#include "gta/vehicle_values.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "core/scr_globals.hpp"
|
#include "core/scr_globals.hpp"
|
||||||
#include "core/enums.hpp"
|
#include "core/enums.hpp"
|
||||||
#include "gta/net_object_mgr.hpp"
|
#include "gta/net_object_mgr.hpp"
|
||||||
#include "gta/PickupRewards.h"
|
#include "gta/pickup_rewards.hpp"
|
||||||
#include "util/session.hpp"
|
#include "util/session.hpp"
|
||||||
#include "util/scripts.hpp"
|
#include "util/scripts.hpp"
|
||||||
#include "services/gta_data/gta_data_service.hpp"
|
#include "services/gta_data/gta_data_service.hpp"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "script.hpp"
|
#include "script.hpp"
|
||||||
#include "teleport.hpp"
|
#include "teleport.hpp"
|
||||||
#include "script_global.hpp"
|
#include "script_global.hpp"
|
||||||
#include "gta/VehicleValues.h"
|
#include "gta/vehicle_values.hpp"
|
||||||
#include "services/vehicle_helper/vehicle_helper.hpp"
|
#include "services/vehicle_helper/vehicle_helper.hpp"
|
||||||
#include "core/scr_globals.hpp"
|
#include "core/scr_globals.hpp"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user