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
ip=127.0.0.1
# distance at which other players and NPCs become visible
playerdistance=20000
npcdistance=16000
chunksize=40000
# time, in milliseconds, to wait before kicking a non-responsive client
# default is 1 minute
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) {
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) {
@ -103,4 +103,4 @@ std::vector<Chunk*> ChunkManager::getDeltaChunks(std::vector<Chunk*> from, std::
}
return delta;
}
}

View File

@ -252,7 +252,7 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) {
* it gets Count from Quest Inventory
*
* 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;
std::string settings::SHARDSERVERIP = "127.0.0.1";
time_t settings::TIMEOUT = 60000;
int settings::PLAYERDISTANCE = 20000;
int settings::NPCDISTANCE = 16000;
int settings::CHUNKSIZE = 40000;
// default spawn point is Sector V (future)
int settings::SPAWN_X = 632032;
@ -45,8 +44,7 @@ void settings::init() {
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL);
TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT);
PLAYERDISTANCE = reader.GetInteger("shard", "playerdistance", PLAYERDISTANCE);
NPCDISTANCE = reader.GetInteger("shard", "npcdistance", NPCDISTANCE);
CHUNKSIZE = reader.GetInteger("shard", "chunksize", CHUNKSIZE);
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);

View File

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