Skip to content

Commit 0598519

Browse files
committed
Cleaned up some additional files
1 parent baab9d5 commit 0598519

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

src/Hooks.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "Versions.h"
4242
#include "main.h"
4343
#include <cmath>
44+
#include <cstring>
4445
#include <glm/glm.hpp>
4546
#include <glm/gtc/quaternion.hpp>
4647
#include <limits>
@@ -203,6 +204,16 @@ Packet *THISCALL CHookRakServer::Receive(void *ppRakServer)
203204
return nullptr;
204205
}
205206

207+
auto lastSyncData = &getLastSyncData<Structs>(playerid);
208+
if (syncDataFrozen[playerid])
209+
{
210+
d = lastSyncData;
211+
}
212+
else
213+
{
214+
lastSyncData = d;
215+
}
216+
206217
if (d->byteWeapon > 46 || (d->byteWeapon > 18 && d->byteWeapon < 22))
207218
{
208219
d->byteWeapon = 0;
@@ -399,16 +410,6 @@ Packet *THISCALL CHookRakServer::Receive(void *ppRakServer)
399410
}
400411
}
401412

402-
auto lastSyncData = &getLastSyncData<decltype(netGame)>(playerid);
403-
if (syncDataFrozen[playerid])
404-
{
405-
d = lastSyncData;
406-
}
407-
else
408-
{
409-
lastSyncData = d;
410-
}
411-
412413
if (blockKeySync[playerid])
413414
{
414415
d->wKeys = 0;
@@ -563,8 +564,8 @@ Packet *THISCALL CHookRakServer::Receive(void *ppRakServer)
563564

564565
void InstallPreHooks()
565566
{
566-
memset(&fakeHealth, 255, sizeof(fakeHealth));
567-
memset(&fakeArmour, 255, sizeof(fakeArmour));
567+
std::memset(&fakeHealth, 255, sizeof(fakeHealth));
568+
std::memset(&fakeArmour, 255, sizeof(fakeArmour));
568569

569570
for (int i = 0; i < 1000; i++)
570571
{

src/Scripting.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@
3434
#define SCRIPTING_H
3535

3636
#include "main.h"
37-
#include "Addresses.h"
3837

39-
#define CHECK_PARAMS(m, n) \
40-
if (params[0] != (m * 4)) \
41-
{ \
38+
#define CHECK_PARAMS(m, n) \
39+
if (params[0] != (m * 4)) \
40+
{ \
4241
logprintf("SKY: %s: Expecting %d parameter(s), but found %d", n, m, params[0] / sizeof(cell)); \
43-
return 0; \
42+
return 0; \
4443
}
4544

46-
int InitScripting(AMX *amx, int version);
45+
int InitScripting(AMX *amx);
4746
#endif

src/Versions.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
#include "CTypes.h"
1212
#include "main.h"
1313
#include <amx/amx.h>
14+
#include <plugincommon.h>
1415
#include <raknet/BitStream.h>
1516
#include <raknet/NetworkTypes.h>
16-
#include <samp-plugin-sdk/plugincommon.h>
1717

1818
#if !defined PAD
1919
#define PAD(a, b) char a[b]
2020
#endif
21-
2221
struct without_dl
2322
{
2423
#include "Structs.h"
@@ -35,19 +34,19 @@ auto getNetGame(Func func)
3534
{
3635
if (iVersion == eSAMPVersion::SAMP_VERSION_03DL_R1)
3736
{
38-
auto netGame = reinterpret_cast<with_dl::CNetGame *>(pNetGame);
37+
static with_dl::CNetGame *netGame = reinterpret_cast<with_dl::CNetGame *>(pNetGame);
3938
return func(netGame, with_dl());
4039
}
4140
else
4241
{
43-
auto netGame = reinterpret_cast<without_dl::CNetGame *>(pNetGame);
42+
static without_dl::CNetGame *netGame = reinterpret_cast<without_dl::CNetGame *>(pNetGame);
4443
return func(netGame, without_dl());
4544
}
4645
}
4746

48-
template <class NetGame>
47+
template <typename Struct>
4948
auto &getLastSyncData(int playerid)
5049
{
51-
static decltype(NetGame()->pPlayerPool->pPlayer[playerid]->syncData) data[MAX_PLAYERS];
50+
static typename Struct::CSyncData data[MAX_PLAYERS];
5251
return data[playerid];
5352
}

0 commit comments

Comments
 (0)