2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CWEAPONMGR
|
|
|
|
#define _CWEAPONMGR
|
2022-08-13 02:48:34 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
2022-11-10 02:06:24 +00:00
|
|
|
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
|
2022-08-13 02:48:34 +00:00
|
|
|
|
|
|
|
#include "rstl/map.hpp"
|
|
|
|
#include "rstl/reserved_vector.hpp"
|
|
|
|
|
|
|
|
class CWeaponMgr {
|
2022-11-10 02:06:24 +00:00
|
|
|
public:
|
|
|
|
typedef rstl::reserved_vector< int, 15 > Vec;
|
|
|
|
|
|
|
|
CWeaponMgr();
|
|
|
|
void Remove(TUniqueId);
|
|
|
|
void IncrCount(TUniqueId, EWeaponType);
|
|
|
|
void DecrCount(TUniqueId, EWeaponType);
|
|
|
|
int GetNumActive(TUniqueId, EWeaponType) const;
|
|
|
|
|
|
|
|
void Add(TUniqueId uid, EWeaponType type) {
|
|
|
|
rstl::pair< TUniqueId, Vec > newIndex(uid, Vec(0));
|
|
|
|
newIndex.second[type] += 1;
|
|
|
|
x0_weapons.insert(newIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
Vec* GetIndex(TUniqueId uid) const {
|
|
|
|
rstl::map< TUniqueId, Vec >::const_iterator iter = x0_weapons.find(uid);
|
|
|
|
|
|
|
|
if (iter != x0_weapons.end()) {
|
|
|
|
return const_cast<Vec*>(&iter->second);
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-08-13 02:48:34 +00:00
|
|
|
private:
|
2022-11-10 02:06:24 +00:00
|
|
|
rstl::map< TUniqueId, Vec > x0_weapons;
|
2022-08-13 02:48:34 +00:00
|
|
|
};
|
|
|
|
CHECK_SIZEOF(CWeaponMgr, 0x14);
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CWEAPONMGR
|