Browse Source

sync with pubtest

changes still in the works..
Image 4 years ago
parent
commit
af0ed0ea4f

+ 6 - 1
EQ2/source/WorldServer/Spawn.cpp

@@ -276,6 +276,9 @@ void Spawn::InitializeFooterPacketData(Player* player, PacketStruct* footer) {
 		footer->setDataByName("show", 1);
 	}
 
+	if (strlen(appearance.name) < 1)
+		strncpy(appearance.name,to_string(GetID()).c_str(),128);
+
 	footer->setMediumStringByName("name", appearance.name);
 	footer->setMediumStringByName("guild", appearance.sub_title);
 	footer->setMediumStringByName("prefix", appearance.prefix_title);
@@ -373,10 +376,10 @@ EQ2Packet* Spawn::spawn_serialize(Player* player, int16 version){
 	string* part3 = footer->serializeString();
 
 	uchar tmp[900];
+	int32 origPart2Size = part2_size;
 	part2_size = Pack(tmp, part2, part2_size, 900, version);
 	int32 total_size = part1->length() + part2_size + part3->length() + 3;
 
-
 	uchar* final_packet = new uchar[total_size + 4];
 	ptr = final_packet;
 	memcpy(ptr, &total_size, sizeof(total_size));
@@ -397,6 +400,8 @@ EQ2Packet* Spawn::spawn_serialize(Player* player, int16 version){
 	memcpy(ptr, part3->c_str(), part3->length());
 	delete[] part2;
 
+//	printf("%s (%i): p1: %i, p2:% i (%i), p3:% i, ts: %i\n", GetName(), GetID(), part1->length(), part2_size, origPart2Size, part3->length(), total_size);
+
 	EQ2Packet* ret = new EQ2Packet(OP_ClientCmdMsg, final_packet, total_size + 4);
 	delete[] final_packet;
 

+ 7 - 11
EQ2/source/WorldServer/zoneserver.cpp

@@ -1322,14 +1322,14 @@ bool ZoneServer::Process()
 			}
 			database.LoadRevivePoints(revive_points, GetZoneID());
 
+			RemoveLocationGrids();
+			database.LoadLocationGrids(this);
+
 			LoadingData = false;
 
 			spawn_range.Trigger();
 			spawn_check_add.Trigger();
 
-			RemoveLocationGrids();
-			database.LoadLocationGrids(this);
-
 			const char* zone_script = world.GetZoneScript(this->GetZoneID());
 			if(lua_interface && zone_script) {
 				RemoveLocationProximities();
@@ -1471,10 +1471,7 @@ bool ZoneServer::SpawnProcess(){
 		for (itr = spawn_list.begin(); itr != spawn_list.end(); itr++) {
 			// if zone is shutting down kill the loop
 			if (zoneShuttingDown)
-			{
-				MSpawnList.releasereadlock(__FUNCTION__, __LINE__);
 				break;
-			}
 
 			Spawn* spawn = itr->second;
 			if (spawn) {
@@ -1507,10 +1504,7 @@ bool ZoneServer::SpawnProcess(){
 		for (itr = spawn_list.begin(); itr != spawn_list.end(); itr++) {
 			// Break the loop if the zone is shutting down
 			if (zoneShuttingDown)
-			{
-				MSpawnList.releasereadlock(__FUNCTION__, __LINE__);
 				break;
-			}
 
 			Spawn* spawn = itr->second;
 			if (spawn) {
@@ -1727,6 +1721,7 @@ void ZoneServer::SendSpawnChanges(Spawn* spawn, Client* client, bool override_ch
 }
 
 void ZoneServer::SendSpawnChanges(Spawn* spawn){
+	MSpawnList.readlock();
 	if(spawn && spawn->changed){
 		if(!spawn->IsPlayer() || (spawn->IsPlayer() && (spawn->info_changed || spawn->vis_changed))){
 			vector<Client*>::iterator itr;
@@ -1745,6 +1740,7 @@ void ZoneServer::SendSpawnChanges(Spawn* spawn){
 			spawn->position_changed = false;
 		spawn->vis_changed = false;
 	}
+	MSpawnList.releasereadlock();
 }
 
 Spawn* ZoneServer::FindSpawn(Player* searcher, const char* name){
@@ -3196,7 +3192,7 @@ void ZoneServer::SendSpawn(Spawn* spawn, Client* client){
 	EQ2Packet* outapp = spawn->serialize(client->GetPlayer(), client->GetVersion());
 
 	if(outapp)
-		client->QueuePacket(outapp);
+		client->QueuePacket(outapp, true);
 	/*
 	vis flags:
 	2 = show icon
@@ -3736,7 +3732,7 @@ void ZoneServer::RemoveFromRangeMap(Client* client){
 
 void ZoneServer::RemoveSpawn(bool spawnListLocked, Spawn* spawn, bool delete_spawn, bool respawn, bool lock) 
 {
-	LogWrite(ZONE__DEBUG, 3, "Zone", "Processing RemoveSpawn function...");
+	LogWrite(ZONE__DEBUG, 3, "Zone", "Processing RemoveSpawn function for %s (%i)...", spawn->GetName(),spawn->GetID());
 
 	if (Grid != nullptr) {
 		Grid->RemoveSpawnFromCell(spawn);

+ 1 - 1
EQ2/source/common/EQStream.cpp

@@ -1027,7 +1027,7 @@ void EQStream::AckPackets(uint16 seq)
 		//they are not acking anything new...
 
 		uint16 index = seq - SequencedBase;
-		if (SequencedQueue.size() > 0 && index < SequencedQueue.size())
+		if (SequencedQueue.size() > 0 && index > -1 && index < SequencedQueue.size() && seq == SequencedQueue[index]->sequence)
 		{
 			SequencedQueue[index]->acked = true;
 		}