Fixed halved NPC distance and renamed config option to chunksize.

This commit is contained in:
dongresource 2020-09-21 23:30:05 +02:00
parent d6357197d3
commit a768a4f539
5 changed files with 7 additions and 11 deletions

View File

@ -20,8 +20,7 @@ dbsaveinterval=240
port=8002 port=8002
ip=127.0.0.1 ip=127.0.0.1
# distance at which other players and NPCs become visible # distance at which other players and NPCs become visible
playerdistance=20000 chunksize=40000
npcdistance=16000
# time, in milliseconds, to wait before kicking a non-responsive client # time, in milliseconds, to wait before kicking a non-responsive client
# default is 1 minute # default is 1 minute
timeout=60000 timeout=60000

View File

@ -61,7 +61,7 @@ bool ChunkManager::checkChunk(std::pair<int, int> chunk) {
} }
std::pair<int, int> ChunkManager::grabChunk(int posX, int posY) { std::pair<int, int> ChunkManager::grabChunk(int posX, int posY) {
return std::make_pair<int, int>(posX / (settings::PLAYERDISTANCE / 3), posY / (settings::PLAYERDISTANCE / 3)); return std::make_pair<int, int>(posX / (settings::CHUNKSIZE / 3), posY / (settings::CHUNKSIZE / 3));
} }
std::vector<Chunk*> ChunkManager::grabChunks(std::pair<int, int> chunk) { std::vector<Chunk*> ChunkManager::grabChunks(std::pair<int, int> chunk) {
@ -103,4 +103,4 @@ std::vector<Chunk*> ChunkManager::getDeltaChunks(std::vector<Chunk*> from, std::
} }
return delta; return delta;
} }

View File

@ -252,7 +252,7 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) {
* it gets Count from Quest Inventory * it gets Count from Quest Inventory
* *
* KillNPCCount sets RemainEnemyNum in the client * KillNPCCount sets RemainEnemyNum in the client
* Yes, this is extraordinary stupid, even for Grigon * Yes, this is extraordinary stupid.
*/ */
} }
} }

View File

@ -12,8 +12,7 @@ int settings::DBSAVEINTERVAL = 240;
int settings::SHARDPORT = 8002; int settings::SHARDPORT = 8002;
std::string settings::SHARDSERVERIP = "127.0.0.1"; std::string settings::SHARDSERVERIP = "127.0.0.1";
time_t settings::TIMEOUT = 60000; time_t settings::TIMEOUT = 60000;
int settings::PLAYERDISTANCE = 20000; int settings::CHUNKSIZE = 40000;
int settings::NPCDISTANCE = 16000;
// default spawn point is Sector V (future) // default spawn point is Sector V (future)
int settings::SPAWN_X = 632032; int settings::SPAWN_X = 632032;
@ -45,8 +44,7 @@ void settings::init() {
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1"); SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL); DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL);
TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT); TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT);
PLAYERDISTANCE = reader.GetInteger("shard", "playerdistance", PLAYERDISTANCE); CHUNKSIZE = reader.GetInteger("shard", "chunksize", CHUNKSIZE);
NPCDISTANCE = reader.GetInteger("shard", "npcdistance", NPCDISTANCE);
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X); SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y); SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z); SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);

View File

@ -8,8 +8,7 @@ namespace settings {
extern int SHARDPORT; extern int SHARDPORT;
extern std::string SHARDSERVERIP; extern std::string SHARDSERVERIP;
extern time_t TIMEOUT; extern time_t TIMEOUT;
extern int PLAYERDISTANCE; extern int CHUNKSIZE;
extern int NPCDISTANCE;
extern int SPAWN_X; extern int SPAWN_X;
extern int SPAWN_Y; extern int SPAWN_Y;
extern int SPAWN_Z; extern int SPAWN_Z;