CCameraSpline: Resolve sign-conversion warnings

All call sites are already compatible with these changes, so they can
safely be made.
This commit is contained in:
Lioncash 2020-04-06 12:46:28 -04:00
parent dd7d9c024f
commit 92d65462b9
2 changed files with 25 additions and 18 deletions

View File

@ -50,15 +50,18 @@ void CCameraSpline::Initialize(TUniqueId cameraId, const std::vector<SConnection
x44_length = CalculateSplineLength();
}
void CCameraSpline::Reset(int size) {
void CCameraSpline::Reset(size_t size) {
x4_positions.clear();
x24_t.clear();
x34_directions.clear();
if (size != 0) {
if (size == 0) {
return;
}
x4_positions.reserve(size);
x24_t.reserve(size);
x34_directions.reserve(size);
}
}
void CCameraSpline::AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir) {
@ -66,21 +69,24 @@ void CCameraSpline::AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& d
x34_directions.push_back(dir);
}
void CCameraSpline::SetKnotPosition(int idx, const zeus::CVector3f& pos) {
if (idx >= x4_positions.size())
void CCameraSpline::SetKnotPosition(size_t idx, const zeus::CVector3f& pos) {
if (idx >= x4_positions.size()) {
return;
}
x4_positions[idx] = pos;
}
const zeus::CVector3f& CCameraSpline::GetKnotPosition(int idx) const {
if (idx >= x4_positions.size())
const zeus::CVector3f& CCameraSpline::GetKnotPosition(size_t idx) const {
if (idx >= x4_positions.size()) {
return zeus::skZero3f;
}
return x4_positions[idx];
}
float CCameraSpline::GetKnotT(int idx) const {
if (idx >= x4_positions.size())
float CCameraSpline::GetKnotT(size_t idx) const {
if (idx >= x4_positions.size()) {
return 0.f;
}
return x24_t[idx];
}
@ -117,10 +123,11 @@ float CCameraSpline::CalculateSplineLength() {
return 0.f;
}
bool CCameraSpline::GetSurroundingPoints(int idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
bool CCameraSpline::GetSurroundingPoints(size_t idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
rstl::reserved_vector<zeus::CVector3f, 4>& directions) const {
if (x4_positions.size() <= 3 || idx < 0 || idx >= x4_positions.size())
if (x4_positions.size() <= 3 || idx < 0 || idx >= x4_positions.size()) {
return false;
}
if (idx > 0) {
positions.push_back(x4_positions[idx - 1]);

View File

@ -15,18 +15,18 @@ class CCameraSpline {
std::vector<zeus::CVector3f> x34_directions;
float x44_length = 0.f;
bool x48_closedLoop = false;
bool GetSurroundingPoints(int idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
bool GetSurroundingPoints(size_t idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
rstl::reserved_vector<zeus::CVector3f, 4>& directions) const;
public:
explicit CCameraSpline(bool closedLoop);
void CalculateKnots(TUniqueId cameraId, const std::vector<SConnection>& connections, CStateManager& mgr);
void Initialize(TUniqueId cameraId, const std::vector<SConnection>& connections, CStateManager& mgr);
void Reset(int size);
void Reset(size_t size);
void AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir);
void SetKnotPosition(int idx, const zeus::CVector3f& pos);
const zeus::CVector3f& GetKnotPosition(int idx) const;
float GetKnotT(int idx) const;
void SetKnotPosition(size_t idx, const zeus::CVector3f& pos);
const zeus::CVector3f& GetKnotPosition(size_t idx) const;
float GetKnotT(size_t idx) const;
float CalculateSplineLength();
void UpdateSplineLength() { x44_length = CalculateSplineLength(); }
zeus::CTransform GetInterpolatedSplinePointByLength(float pos) const;