diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-10-17 16:06:38 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-10-17 16:06:38 +0200 |
commit | 7fc70179edb58702725aa2bab31185da66b2b31d (patch) | |
tree | 01b7e950ff9eaae435e46733f86921e827debdb7 /src | |
parent | Small inner fix (diff) | |
download | re3-7fc70179edb58702725aa2bab31185da66b2b31d.tar re3-7fc70179edb58702725aa2bab31185da66b2b31d.tar.gz re3-7fc70179edb58702725aa2bab31185da66b2b31d.tar.bz2 re3-7fc70179edb58702725aa2bab31185da66b2b31d.tar.lz re3-7fc70179edb58702725aa2bab31185da66b2b31d.tar.xz re3-7fc70179edb58702725aa2bab31185da66b2b31d.tar.zst re3-7fc70179edb58702725aa2bab31185da66b2b31d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/control/Pickups.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 71d7401e..90641960 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1320,6 +1320,7 @@ CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType } } +// --MIAMI: Done void CPickups::Load(uint8 *buf, uint32 size) { @@ -1328,8 +1329,13 @@ INITSAVEBUF for (int32 i = 0; i < NUMPICKUPS; i++) { aPickUps[i] = ReadSaveBuf<CPickup>(buf); - if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pObject != nil) - aPickUps[i].m_pObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pObject - 1); + if (aPickUps[i].m_eType != PICKUP_NONE) { + if (aPickUps[i].m_pObject != nil) + aPickUps[i].m_pObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pObject - 1); + if (aPickUps[i].m_pExtraObject != nil) + aPickUps[i].m_pExtraObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pExtraObject - 1); + } + } CollectedPickUpIndex = ReadSaveBuf<uint16>(buf); @@ -1342,17 +1348,23 @@ INITSAVEBUF VALIDATESAVEBUF(size) } +// --MIAMI: Done void CPickups::Save(uint8 *buf, uint32 *size) { - *size = sizeof(aPickUps) + sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected); + *size = sizeof(aPickUps); + *size += sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected); INITSAVEBUF for (int32 i = 0; i < NUMPICKUPS; i++) { CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]); - if (buf_pickup->m_eType != PICKUP_NONE && buf_pickup->m_pObject != nil) - buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pObject) + 1); + if (buf_pickup->m_eType != PICKUP_NONE) { + if (buf_pickup->m_pObject != nil) + buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pObject) + 1); + if (buf_pickup->m_pExtraObject != nil) + buf_pickup->m_pExtraObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pExtraObject) + 1); + } } WriteSaveBuf(buf, CollectedPickUpIndex); |