mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Assert the advertised position data is up to date when serializing
Deserialize reconstructs the last advertised data from the current position. Assert the equality when serializing, so a future code path changing the position without advertising fails loudly instead of desyncing rejoined clients silently. Asked-by: vladislavbelov on #8978 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
fc6a908775
commit
b222db28fc
1 changed files with 8 additions and 0 deletions
|
|
@ -195,6 +195,14 @@ public:
|
|||
|
||||
void Serialize(ISerializer& serialize) override
|
||||
{
|
||||
// Deserialize reconstructs the last advertised data from the current
|
||||
// position, which relies on every change to the advertised data being
|
||||
// advertised before the simulation can serialize.
|
||||
ENSURE(m_LastAdvertisedInWorld == m_InWorld &&
|
||||
m_LastAdvertisedX == (m_InWorld ? m_X : entity_pos_t::Zero()) &&
|
||||
m_LastAdvertisedZ == (m_InWorld ? m_Z : entity_pos_t::Zero()) &&
|
||||
m_LastAdvertisedRotY == (m_InWorld ? m_RotY : entity_angle_t::Zero()));
|
||||
|
||||
serialize.Bool("in world", m_InWorld);
|
||||
if (m_InWorld)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue