Browse Source

stabilize ghost_map

More changes for issue #86
Image 4 years ago
parent
commit
6ae65e339a

+ 3 - 3
EQ2/source/WorldServer/client.cpp

@@ -8258,7 +8258,7 @@ void Client::SendSpawnChanges(set<Spawn*>& spawns) {
 
 	int count = 0;
 	for (const auto& spawn : spawns) {
-/*		if (count > 50 || (info_size+pos_size+vis_size) > 200)
+		if (count > 50 || (info_size+pos_size+vis_size) > 400)
 		{
 			MakeSpawnChangePacket(info_changes, pos_changes, vis_changes, info_size, pos_size, vis_size);
 
@@ -8279,9 +8279,9 @@ void Client::SendSpawnChanges(set<Spawn*>& spawns) {
 			info_size = 0;
 			pos_size = 0;
 			vis_size = 0;
-		}*/
+		}
 		int16 index = GetPlayer()->GetIndexForSpawn(spawn);
-		if (index == 0 || !GetPlayer()->WasSentSpawn(spawn->GetID()) || GetPlayer()->WasSpawnRemoved(spawn))
+		if (index == 0 || !GetPlayer()->WasSentSpawn(spawn->GetID()) || GetPlayer()->WasSpawnRemoved(spawn) || GetPlayer()->GetDistance(spawn) >= SEND_SPAWN_INBULK_DISTANCE)
 			continue;
 		
 		if (spawn->info_changed) {

+ 3 - 2
EQ2/source/WorldServer/zoneserver.h

@@ -95,10 +95,11 @@ class Bot;
 #define MAX_REVIVEPOINT_DISTANCE 1000
 
 /* JA: TODO Turn into R_World Rules */
-#define SEND_SPAWN_DISTANCE 150		/* when spawns appear visually to the client */
+#define SEND_SPAWN_DISTANCE 250		/* when spawns appear visually to the client */
 #define HEAR_SPAWN_DISTANCE	30		/* max distance a client can be from a spawn to 'hear' it */
 #define MAX_CHASE_DISTANCE 80
-#define REMOVE_SPAWN_DISTANCE 180
+#define REMOVE_SPAWN_DISTANCE 280
+#define SEND_SPAWN_INBULK_DISTANCE (SEND_SPAWN_DISTANCE+REMOVE_SPAWN_DISTANCE)/2
 
 #define TRACKING_STOP				0
 #define TRACKING_START				1

+ 15 - 4
EQ2/source/common/EQStream.cpp

@@ -604,8 +604,18 @@ int8 EQStream::EQ2_Compress(EQ2Packet* app, int8 offset){
 	stream.next_out = deflate_buff;
 	stream.avail_out = app->size;
 
-	deflate(&stream, Z_SYNC_FLUSH);
+	int ret = deflate(&stream, Z_SYNC_FLUSH);
+
+	if (ret != Z_OK)
+	{
+		printf("ZLIB COMPRESSION RETFAIL: %i, %i (Ret: %i)\n", app->size, stream.avail_out, ret);
+		MCompressData.unlock();
+		safe_delete_array(deflate_buff);
+		return 0;
+	}
+
 	int32 newsize = app->size - stream.avail_out;
+	DumpPacket(deflate_buff, newsize);
 	safe_delete_array(app->pBuffer);
 	app->size = newsize + offset;
 	app->pBuffer = new uchar[app->size];
@@ -711,9 +721,10 @@ void EQStream::PreparePacket(EQ2Packet* app, int8 offset){
 	DumpPacket(app);
 #endif
 
-	if(!app->eq2_compressed && app->size>=0x80){
+	if(!app->eq2_compressed && app->size>128){
 		compressed_offset = EQ2_Compress(app);
-		app->eq2_compressed = true;
+		if (compressed_offset)
+			app->eq2_compressed = true;
 	}
 	if(!app->packet_encrypted){
 		EncryptPacket(app, compressed_offset, offset);
@@ -897,7 +908,7 @@ bool EQStream::CheckCombineQueue(){
 					//DumpPacket(first);
 				}
 				MCombineQueueLock.lock();
-				if(count >= 10){ //other clients need packets too
+				if(count >= 60 || first->size > 4000){ //other clients need packets too
 					ret = false;
 					break;
 				}