edited config.ini default back, better plr pos

This commit is contained in:
CPunch 2020-08-20 16:59:32 -05:00
parent c66ac111ab
commit 1425074ccb
2 changed files with 9 additions and 8 deletions

View File

@ -12,7 +12,7 @@ port=8002
# you'll want to change this one
ip=192.168.1.183
# distance at which other players and NPCs become visible
view=1000
view=20000
# little message players see when they enter the game
motd=Welcome to OpenFusion!

View File

@ -87,9 +87,9 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z) {
}
}
std::list<CNSocket*> cachedview(players[sock].viewable); // copies the viewable
for (CNSocket* otherSock : cachedview) {
std::list<CNSocket*>::iterator i = players[sock].viewable.begin();
while (i != players[sock].viewable.end()) {
CNSocket* otherSock = *i;
if (std::find(noView.begin(), noView.end(), otherSock) != noView.end()) {
// sock shouldn't be visible, send PC_EXIT packet & remove them
@ -102,15 +102,16 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z) {
otherSock->sendPacket(new CNPacketData((void*)exitPacket, P_FE2CL_PC_EXIT, sizeof(sP_FE2CL_PC_EXIT), otherSock->getFEKey()));
sock->sendPacket(new CNPacketData((void*)exitPacketOther, P_FE2CL_PC_EXIT, sizeof(sP_FE2CL_PC_EXIT), sock->getFEKey()));
players[sock].viewable.remove(otherSock);
players[sock].viewable.erase(i++);
players[otherSock].viewable.remove(sock);
continue;
}
++i;
}
cachedview = players[sock].viewable;
for (CNSocket* otherSock : yesView) {
if (std::find(cachedview.begin(), cachedview.end(), otherSock) == cachedview.end()) {
if (std::find(players[sock].viewable.begin(), players[sock].viewable.end(), otherSock) == players[sock].viewable.end()) {
// this needs to be added to the viewable players, send PC_ENTER
sP_FE2CL_PC_NEW* newPlayer = (sP_FE2CL_PC_NEW*)xmalloc(sizeof(sP_FE2CL_PC_NEW)); // current connection to other player