Skip to content

Commit

Permalink
Merge pull request #484 from Tiaansu/master
Browse files Browse the repository at this point in the history
Fix #465 and #462
  • Loading branch information
AmyrAhmady authored Feb 7, 2025
2 parents 3bc004b + 88e1243 commit 707a471
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/natives/actors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ cell AMX_NATIVE_CALL Natives::CreateDynamicActor(AMX *amx, cell *params)
actor->invulnerable = static_cast<int>(params[6]) != 0;
actor->health = amx_ctof(params[7]);
Utility::addToContainer(actor->worlds, static_cast<int>(params[8]));
if (actor->worlds.empty())
{
actor->worlds.insert(-1);
}
Utility::addToContainer(actor->interiors, static_cast<int>(params[9]));
Utility::addToContainer(actor->players, static_cast<int>(params[10]));
actor->comparableStreamDistance = amx_ctof(params[11]) < STREAMER_STATIC_DISTANCE_CUTOFF ? amx_ctof(params[11]) : amx_ctof(params[11]) * amx_ctof(params[11]);
Expand Down
4 changes: 4 additions & 0 deletions src/natives/pickups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ cell AMX_NATIVE_CALL Natives::CreateDynamicPickup(AMX *amx, cell *params)
pickup->type = static_cast<int>(params[2]);
pickup->position = Eigen::Vector3f(amx_ctof(params[3]), amx_ctof(params[4]), amx_ctof(params[5]));
Utility::addToContainer(pickup->worlds, static_cast<int>(params[6]));
if (pickup->worlds.empty())
{
pickup->worlds.insert(-1);
}
Utility::addToContainer(pickup->interiors, static_cast<int>(params[7]));
Utility::addToContainer(pickup->players, static_cast<int>(params[8]));
pickup->comparableStreamDistance = amx_ctof(params[9]) < STREAMER_STATIC_DISTANCE_CUTOFF ? amx_ctof(params[9]) : amx_ctof(params[9]) * amx_ctof(params[9]);
Expand Down
16 changes: 2 additions & 14 deletions src/streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,7 @@ void Streamer::discoverActors(Player &player, const std::vector<SharedCell> &cel
{
for (std::unordered_map<int, Item::SharedActor>::const_iterator a = (*c)->actors.begin(); a != (*c)->actors.end(); ++a)
{
std::unordered_set<int> worlds = a->second->worlds;
if (worlds.empty())
{
worlds.insert(-1);
}

for (std::unordered_set<int>::const_iterator w = worlds.begin(); w != worlds.end(); ++w)
for (std::unordered_set<int>::const_iterator w = a->second->worlds.begin(); w != a->second->worlds.end(); ++w)
{
if (player.worldId != *w && *w != -1)
{
Expand Down Expand Up @@ -1071,13 +1065,7 @@ void Streamer::discoverPickups(Player &player, const std::vector<SharedCell> &ce
{
for (std::unordered_map<int, Item::SharedPickup>::const_iterator p = (*c)->pickups.begin(); p != (*c)->pickups.end(); ++p)
{
std::unordered_set<int> worlds = p->second->worlds;
if (worlds.empty())
{
worlds.insert(-1);
}

for (std::unordered_set<int>::const_iterator w = worlds.begin(); w != worlds.end(); ++w)
for (std::unordered_set<int>::const_iterator w = p->second->worlds.begin(); w != p->second->worlds.end(); ++w)
{
if (player.worldId != *w && *w != -1)
{
Expand Down

0 comments on commit 707a471

Please sign in to comment.