Changeset 266 for trunk/src/game/ObjectAccessor.cpp
- Timestamp:
- 11/21/08 08:48:50 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/ObjectAccessor.cpp
r257 r266 504 504 505 505 { 506 //Player update now in MapManager -> UpdatePlayers 507 /* 506 508 // player update might remove the player from grid, and that causes crashes. We HAVE to update players first, and then the active objects. 507 509 HashMapHolder<Player>::MapType& playerMap = HashMapHolder<Player>::GetContainer(); … … 512 514 iter->second->Update(diff); 513 515 } 514 } 515 516 }*/ 517 518 // TODO: move this to Map::Update 516 519 // clone the active object list, because update might remove from it 517 520 std::set<WorldObject *> activeobjects(i_activeobjects); … … 573 576 } 574 577 } 578 579 UpdateDataMapType update_players; 580 { 581 Guard guard(i_updateGuard); 582 while(!i_objects.empty()) 583 { 584 Object* obj = *i_objects.begin(); 585 i_objects.erase(i_objects.begin()); 586 if (!obj) 587 continue; 588 _buildUpdateObject(obj, update_players); 589 obj->ClearUpdateMask(false); 590 } 591 } 592 593 WorldPacket packet; // here we allocate a std::vector with a size of 0x10000 594 for(UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter) 595 { 596 iter->second.BuildPacket(&packet); 597 iter->first->GetSession()->SendPacket(&packet); 598 packet.clear(); // clean the string 599 } 575 600 } 576 601