i merged the pr wrong

This commit is contained in:
arthurdead 2023-03-05 02:42:08 -03:00
parent eefac413f7
commit a4cb9f5fec

View File

@ -762,13 +762,13 @@ private:
pack_entity_params_t &operator=(pack_entity_params_t &&) = delete;
};
static thread_var<bool> in_compute_packs;
static thread_var<bool> do_calc_delta;
static thread_var<bool> do_writedelta_entities;
static thread_var<int> writedeltaentities_client;
static thread_var<int> sendproxy_client_slot;
static thread_var<bool> in_compute_packs{};
static thread_var<bool> do_calc_delta{};
static thread_var<bool> do_writedelta_entities{};
static thread_var<int> writedeltaentities_client{};
static thread_var<int> sendproxy_client_slot{};
static std::unique_ptr<pack_entity_params_t> packentity_params;
static std::unique_ptr<pack_entity_params_t> packentity_params{};
static void Host_Error(const char *error, ...) noexcept
{
@ -1395,7 +1395,7 @@ DETOUR_DECL_STATIC6(SendTable_Encode, bool, const SendTable *, pTable, const voi
const std::vector<unsigned long> &entities{packentity_params->entities};
if(std::find(entities.cbegin(), entities.cend(), ref) != entities.cend()) {
const std::size_t slots_size{packentity_params->slots.size()};
for(int i{0}; i < slots_size; ++i) {
for(std::size_t i{0}; i < slots_size; ++i) {
std::vector<packed_entity_data_t> &vec{packentity_params->entity_data[i]};
vec.emplace_back();
packed_entity_data_t &packedData{vec.back()};
@ -1429,14 +1429,14 @@ DETOUR_DECL_STATIC8(SendTable_CalcDelta, int, const SendTable *, pTable, const v
int total_nChanges{global_nChanges};
if(total_nChanges < nMaxDeltaProps) {
int *client_deltaProps{new int[nMaxDeltaProps]};
int *client_deltaProps{new int[nMaxDeltaProps]{}};
int new_nChanges{total_nChanges};
unsigned long ref = ::IndexToReference(objectID);
const std::size_t slots_size{packentity_params->slots.size()};
for(int i{0}; i < slots_size; ++i) {
for(std::size_t i{0}; i < slots_size; ++i) {
using entity_data_t = std::vector<packed_entity_data_t>;
entity_data_t &entity_data{packentity_params->entity_data[i]};
@ -1540,7 +1540,7 @@ DETOUR_DECL_MEMBER2(CFrameSnapshotManager_GetPackedEntity, PackedEntity *, CFram
const packed_entity_data_t *packedData{nullptr};
const std::size_t slots_size{packentity_params->slots.size()};
for(int i{0}; i < slots_size; ++i) {
for(std::size_t i{0}; i < slots_size; ++i) {
if(packentity_params->slots[i] == slot) {
const std::vector<packed_entity_data_t> &entity_data{packentity_params->entity_data[i]};
for(const packed_entity_data_t &it : entity_data) {
@ -1834,7 +1834,29 @@ static void game_frame(bool simulating) noexcept
return;
}
// dumb nonsense so clients are fully aware that our hooked edicts are changing.
// this looks hacky, and it is, but there is not a better way i could find
// after tearing my hair out for 3 days of research
// sappho.io
for (auto& hook : hooks)
{
unsigned long ref = hook.first; // hook.second.ref;
//for (auto& cb : hook.second.callbacks)
//{
// cb.second.change_edict_state();
//}
CBaseEntity* pEntity = ::ReferenceToEntity(ref);
if (!pEntity)
{
continue;
}
edict_t* edict = pEntity->GetNetworkable()->GetEdict();
if (!edict)
{
continue;
}
gamehelpers->SetEdictStateChanged(edict, 0);
}
}
DETOUR_DECL_MEMBER1(CGameServer_SendClientMessages, void, bool, bSendSnapshots)