2022-10-28 16:54:33 +02:00
|
|
|
#include "handling_profile.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
handling_profile::handling_profile(CVehicle* vehicle)
|
|
|
|
{
|
|
|
|
m_gravity = vehicle->m_gravity;
|
|
|
|
m_handling_data = *vehicle->m_handling_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void handling_profile::apply_to(CVehicle* vehicle, bool restore_hash) const
|
|
|
|
{
|
|
|
|
const auto hash = vehicle->m_handling_data->m_model_hash;
|
|
|
|
|
|
|
|
vehicle->m_gravity = m_gravity;
|
2022-12-17 15:11:36 +01:00
|
|
|
|
|
|
|
// cursed but works perfectly without overriding members that we shouldn't override
|
|
|
|
nlohmann::json j = m_handling_data; // exports our binary object so we can apply it field by field instead of copying the whole object
|
|
|
|
from_json(j, *vehicle->m_handling_data); // macro is defined in global scope of which CHandlingData is part of
|
2022-10-28 16:54:33 +02:00
|
|
|
|
|
|
|
if (restore_hash)
|
|
|
|
vehicle->m_handling_data->m_model_hash = hash;
|
|
|
|
}
|
|
|
|
}
|