summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-11-10 22:08:32 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-11-10 22:08:32 +0100
commitef2089cafbdbd37589d17a4af9e1989f04672777 (patch)
treeb4b1e77e277272a52de8fcca35496cec3f5e337f /src/control
parentfixes (diff)
downloadre3-ef2089cafbdbd37589d17a4af9e1989f04672777.tar
re3-ef2089cafbdbd37589d17a4af9e1989f04672777.tar.gz
re3-ef2089cafbdbd37589d17a4af9e1989f04672777.tar.bz2
re3-ef2089cafbdbd37589d17a4af9e1989f04672777.tar.lz
re3-ef2089cafbdbd37589d17a4af9e1989f04672777.tar.xz
re3-ef2089cafbdbd37589d17a4af9e1989f04672777.tar.zst
re3-ef2089cafbdbd37589d17a4af9e1989f04672777.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Pickups.cpp14
-rw-r--r--src/control/Pickups.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 2a5863f1..acfb1fbb 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -1411,6 +1411,20 @@ CPickups::DetonateMinesHitByGunShot(CVector *vec1, CVector *vec2)
}
void
+CPickups::RemoveUnnecessaryPickups(const CVector& center, float radius)
+{
+ for (int i = 0; i < NUMPICKUPS; i++) {
+ if (aPickUps[i].m_eType == PICKUP_ONCE_TIMEOUT || aPickUps[i].m_eType == PICKUP_MONEY) {
+ if ((aPickUps[i].m_vecPos - center).Magnitude() < radius) {
+ aPickUps[i].GetRidOfObjects();
+ aPickUps[i].m_bRemoved = true;
+ aPickUps[i].m_eType = PICKUP_NONE;
+ }
+ }
+ }
+}
+
+void
CPickups::Load(uint8 *buf, uint32 size)
{
INITSAVEBUF
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index e48ae3b7..36179f66 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -103,6 +103,7 @@ public:
static bool TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uint32 quantity, bool unused);
static void CreateSomeMoney(CVector, int);
static void DetonateMinesHitByGunShot(CVector *vec1, CVector *vec2);
+ static void RemoveUnnecessaryPickups(const CVector& center, float radius);
static void Load(uint8 *buf, uint32 size);
static void Save(uint8 *buf, uint32 *size);