The-Cataclysm-Preservation-Project / TrinityCore

Archived repository for WoW 4.3.4.15595. The project will be reworked for Cataclysm Classic as an official new branch of TrinityCore at https://github.com/TrinityCore/TrinityCore
GNU General Public License v2.0
239 stars 97 forks source link

Possible problem with MapTransport::BuildUpdate #363

Closed Lordron closed 2 years ago

Lordron commented 2 years ago

Description:

There is possible issue with this return https://github.com/The-Cataclysm-Preservation-Project/TrinityCore/blob/master/src/server/game/Entities/Transport/Transport.cpp#L1145

What the problem?

  1. Server modifies update fields (SetXXXValue for example)
  2. If object is in world and not updated (m_objectUpdated = false) AddToObjectUpdate will be called. This will add object in _updateObjects container in Map class
  3. m_objectUpdated is set to true
  4. SendObjectUpdates is called
  5. For every object in list BuildUpdate is executed
  6. ClearUpdateMask is called from BuildUpdate and m_objectUpdated is set to false, meaning that this update cycle is finished
  7. _updateObjects now empty

basically m_objectUpdated is used to protect object from being added to update queue more than once during one update cycle

What happening with transport Step 1-5 is the same, but 6. If there is no player on the map "return" statement will prevent ClearUpdateMask from being executed leaving this object with m_objectUpdated = true.

So next time you will try to modify fields (toggling move state for example) updates will not seeded to client, because server thinks that object is still in update queue (see step 1)