Skip to content

Commit

Permalink
Merge branch 'dev' into rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Oct 20, 2023
2 parents 1b61599 + fcccba8 commit d91cedf
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 34 deletions.
20 changes: 14 additions & 6 deletions c-api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,19 +770,21 @@ uint64_t Core_GetClosestEntitiesCount(alt::ICore* core, vector3_t position, int3
return core->GetClosestEntities(pos, range, dimension, limit, allowedTypes).size();
}

void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size) {
void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) {
auto entitiesArray = core->GetEntitiesInDimension(dimension, allowedTypes);
if (entitiesArray.size() < size) {
size = entitiesArray.size();
}

auto entityArr = new void*[size];
for (uint64_t i = 0; i < size; i++) {
entities[i] = entitiesArray[i];
entityArr[i] = Util_GetBaseObjectPointer(entitiesArray[i]);
types[i] = (uint8_t) entitiesArray[i]->GetType();
}
entities = entityArr;
}

void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size) {
void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) {
alt::Position pos;
pos.x = position.x;
pos.y = position.y;
Expand All @@ -792,13 +794,16 @@ void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range
if (entitiesArray.size() < size) {
size = entitiesArray.size();
}

auto entityArr = new void*[size];
for (uint64_t i = 0; i < size; i++) {
entities[i] = entitiesArray[i];
entityArr[i] = Util_GetBaseObjectPointer(entitiesArray[i]);
types[i] = (uint8_t) entitiesArray[i]->GetType();
}
entities = entityArr;
}

void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size) {
void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) {
alt::Position pos;
pos.x = position.x;
pos.y = position.y;
Expand All @@ -808,10 +813,13 @@ void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range
if (entitiesArray.size() < size) {
size = entitiesArray.size();
}

auto entityArr = new void*[size];
for (uint64_t i = 0; i < size; i++) {
entities[i] = entitiesArray[i];
entityArr[i] = Util_GetBaseObjectPointer(entitiesArray[i]);
types[i] = (uint8_t) entitiesArray[i]->GetType();
}
entities = entityArr;
}

alt::IMarker* Core_CreateMarker(alt::ICore* core, alt::IPlayer* target, uint8_t type, position_t position, rgba_t color,
Expand Down
6 changes: 3 additions & 3 deletions c-api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ EXPORT_SERVER void Core_SetWorldProfiler(alt::ICore* core, uint8_t state);
EXPORT_SERVER uint64_t Core_GetEntitiesInDimensionCount(alt::ICore* core, int32_t dimension, uint64_t allowedTypes);
EXPORT_SERVER uint64_t Core_GetEntitiesInRangeCount(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes);
EXPORT_SERVER uint64_t Core_GetClosestEntitiesCount(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes);
EXPORT_SERVER void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size);
EXPORT_SERVER void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size);
EXPORT_SERVER void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size);
EXPORT_SERVER void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size);
EXPORT_SERVER void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size);
EXPORT_SERVER void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size);

#ifdef ALT_CLIENT_API
EXPORT_CLIENT uint8_t Core_Client_FileExists(alt::ICore* core, alt::IResource* resource, const char* path);
Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

CAPI_START()

uint16_t Entity_GetID(alt::IEntity* entity) {
uint32_t Entity_GetID(alt::IEntity* entity) {
return entity->GetID();
}

Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#pragma clang diagnostic pop
#endif

EXPORT_SHARED uint16_t Entity_GetID(alt::IEntity* entity);
EXPORT_SHARED uint32_t Entity_GetID(alt::IEntity* entity);
EXPORT_SHARED alt::IWorldObject* Entity_GetWorldObject(alt::IEntity* entity);

EXPORT_SHARED uint32_t Entity_GetModel(alt::IEntity* entity);
Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/local_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CAPI_START()

#ifdef ALT_CLIENT_API

uint16_t LocalObject_GetID(alt::ILocalObject* localObject) {
uint32_t LocalObject_GetID(alt::ILocalObject* localObject) {
return localObject->GetID();
}

Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/local_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#pragma clang diagnostic pop
#endif

EXPORT_CLIENT uint16_t LocalObject_GetID(alt::ILocalObject* localObject);
EXPORT_CLIENT uint32_t LocalObject_GetID(alt::ILocalObject* localObject);
EXPORT_CLIENT alt::IObject* LocalObject_GetObject(alt::ILocalObject* localObject);
EXPORT_CLIENT void LocalObject_ResetAlpha(alt::ILocalObject* localObject);

Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

CAPI_START()

uint16_t Object_GetID(alt::IObject* object)
uint32_t Object_GetID(alt::IObject* object)
{
return object->GetID();
}
Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#pragma clang diagnostic pop
#endif

EXPORT_SHARED uint16_t Object_GetID(alt::IObject* object);
EXPORT_SHARED uint32_t Object_GetID(alt::IObject* object);
EXPORT_SHARED alt::IEntity* Object_GetEntity(alt::IObject* object);

EXPORT_SHARED uint8_t Object_GetAlpha(alt::IObject* object);
Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/ped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

CAPI_START()

uint16_t Ped_GetID(alt::IPed* ped) {
uint32_t Ped_GetID(alt::IPed* ped) {
return ped->GetID();
}

Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/ped.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#pragma clang diagnostic pop
#endif

EXPORT_SHARED uint16_t Ped_GetID(alt::IPed* ped);
EXPORT_SHARED uint32_t Ped_GetID(alt::IPed* ped);
EXPORT_SHARED alt::IEntity* Ped_GetEntity(alt::IPed* ped);

EXPORT_SHARED uint16_t Ped_GetHealth(alt::IPed* ped);
Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

CAPI_START()

uint16_t Player_GetID(alt::IPlayer* player) {
uint32_t Player_GetID(alt::IPlayer* player) {
return player->GetID();
}

Expand Down
2 changes: 1 addition & 1 deletion c-api/entities/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#pragma clang diagnostic pop
#endif

EXPORT_SHARED uint16_t Player_GetID(alt::IPlayer* player);
EXPORT_SHARED uint32_t Player_GetID(alt::IPlayer* player);
EXPORT_SHARED alt::IEntity* Player_GetEntity(alt::IPlayer* player);

EXPORT_SHARED const char* Player_GetName(alt::IPlayer* player, int32_t& size);
Expand Down
4 changes: 2 additions & 2 deletions c-api/entities/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

CAPI_START()

uint16_t Vehicle_GetID(alt::IVehicle* entity) {
uint32_t Vehicle_GetID(alt::IVehicle* entity) {
return entity->GetID();
}

Expand All @@ -32,7 +32,7 @@ alt::IPlayer* Vehicle_GetDriver(alt::IVehicle* vehicle) {
return vehicle->GetDriver();
}

uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint16_t& id) {
uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint32_t& id) {
auto driver = vehicle->GetDriver();
if (driver == nullptr) return false;
id = driver->GetID();
Expand Down
4 changes: 2 additions & 2 deletions c-api/entities/vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
#pragma clang diagnostic pop
#endif

EXPORT_SHARED uint16_t Vehicle_GetID(alt::IVehicle* vehicle);
EXPORT_SHARED uint32_t Vehicle_GetID(alt::IVehicle* vehicle);
EXPORT_SHARED alt::IEntity* Vehicle_GetEntity(alt::IVehicle* vehicle);

EXPORT_SHARED uint8_t Vehicle_GetWheelsCount(alt::IVehicle* vehicle);
EXPORT_SHARED int32_t Vehicle_GetPetrolTankHealth(alt::IVehicle* vehicle);

EXPORT_SERVER alt::IPlayer* Vehicle_GetDriver(alt::IVehicle* vehicle);
EXPORT_SERVER uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint16_t& id);
EXPORT_SERVER uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint32_t& id);

EXPORT_SERVER uint8_t Vehicle_IsDestroyed(alt::IVehicle* vehicle);

Expand Down
22 changes: 11 additions & 11 deletions c-api/func_table.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "func_table.h"

inline uint64_t capiHash = 14520310097856707558UL;
inline uint64_t capiHash = 4677548953854785821UL;
inline uint64_t capiHashes[] = {
0,
#ifdef ALT_CLIENT_API
Expand Down Expand Up @@ -458,7 +458,7 @@ inline uint64_t capiHashes[] = {
8482470825689546294UL,
6719251755255314299UL,
15889022995396061331UL,
11677534497960574507UL,
15103894139399401453UL,
872653086987800810UL,
12256606847122365951UL,
9339331434227951252UL,
Expand Down Expand Up @@ -1081,7 +1081,7 @@ inline uint64_t capiHashes[] = {
4905441971289102819UL,
17798706175912111294UL,
2095655564565809781UL,
12913447266302910987UL,
10233629489933073997UL,
6111944054700936115UL,
7130354370478174789UL,
10262653550309861069UL,
Expand Down Expand Up @@ -1175,14 +1175,14 @@ inline uint64_t capiHashes[] = {
2951895109234703784UL,
4782965940294523501UL,
4934471410579771998UL,
12916172794746864343UL,
6815264172955104609UL,
9053583879265260950UL,
4660664364773957039UL,
4106400780828488738UL,
446737373633343515UL,
17974792644403470118UL,
7104729899977702888UL,
4733988892192620155UL,
8160348533631447101UL,
18375756057324289044UL,
6124580830261182834UL,
343339663996265887UL,
Expand All @@ -1196,7 +1196,7 @@ inline uint64_t capiHashes[] = {
12498998920879213674UL,
17222204554789096264UL,
14695407730559477910UL,
2649376720891219187UL,
18416303018230933813UL,
4693803817659874615UL,
4164549052335308174UL,
10963946276172720740UL,
Expand Down Expand Up @@ -1252,7 +1252,7 @@ inline uint64_t capiHashes[] = {
3918260719528326415UL,
2302278843105157392UL,
8318093389193375258UL,
17687301249122992283UL,
15007201997776333277UL,
18440829979133890169UL,
7918377113203812466UL,
6954962557541059864UL,
Expand Down Expand Up @@ -1330,13 +1330,13 @@ inline uint64_t capiHashes[] = {
16312284234900575747UL,
14452794280175707515UL,
10333270135403224879UL,
4559218685940666205UL,
12057843286905322939UL,
419502286495548608UL,
12193205314801108926UL,
13972691773502904173UL,
4124119004202747553UL,
11709139263193592519UL,
12784287737200780200UL,
12414549446254212526UL,
4074854033126410216UL,
6795936790869684439UL,
5931751806478777368UL,
3581368898059030296UL,
Expand Down Expand Up @@ -1549,7 +1549,7 @@ inline uint64_t capiHashes[] = {
1312826368700331414UL,
3655237348473428026UL,
8554773347420139463UL,
6476166832678215577UL,
1447949168829725163UL,
8002690258276396481UL,
4097244648501164820UL,
10761034670704244318UL,
Expand Down

0 comments on commit d91cedf

Please sign in to comment.