Dynamically allocate the Player struct in PlayerView.

This way we're not always passing it around by value.
Note that the Player structs in CNSharedData are still
pass-by-reference. Will probably change this later.
This commit is contained in:
2020-08-25 00:02:07 +02:00
parent c5dacb4958
commit 14bc368073
7 changed files with 118 additions and 127 deletions

View File

@@ -58,8 +58,8 @@ void NPCManager::updatePlayerNPCS(CNSocket* sock, PlayerView& view) {
std::list<int32_t> noView;
for (auto& pair : NPCs) {
int diffX = abs(view.plr.x - pair.second.appearanceData.iX);
int diffY = abs(view.plr.y - pair.second.appearanceData.iY);
int diffX = abs(view.plr->x - pair.second.appearanceData.iX);
int diffY = abs(view.plr->y - pair.second.appearanceData.iY);
if (diffX < settings::VIEWDISTANCE && diffY < settings::VIEWDISTANCE) {
yesView.push_back(pair.first);