Skip to content

Pvs studio fixes #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions Source/Activities/MultiplayerServerLobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,11 +1048,8 @@ void MultiplayerServerLobby::DrawGUI(BITMAP* pTargetBitmap, const Vector& target
m_pRootBox->SetPositionAbs(0, 0);

// We need to manually draw UI's to intermediate buffer first, then to the player's backbuffer to make it centered on each player's screen.
for (int i = 0; i < 4; i++) {
if (i < c_MaxClients)
finalDestBitmap = g_FrameMan.GetNetworkBackBufferIntermediateGUI8Current(i);
else
finalDestBitmap = pTargetBitmap;
for (int i = 0; i < c_MaxClients; i++) {
finalDestBitmap = g_FrameMan.GetNetworkBackBufferIntermediateGUI8Current(i);

AllegroScreen drawScreen(drawBitmap);
m_pGUIController->Draw(&drawScreen);
Expand Down
6 changes: 0 additions & 6 deletions Source/Entities/MOSParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ void MOSParticle::Travel() {
m_Atom->ClearMOIDIgnoreList();

if (m_SpriteAnimMode == ONCOLLIDE) {
// Change angular velocity after collision.
if (hitCount >= 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also makes hitCount unused

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should actually return hitcount from Atom travel instead?

m_AngularVel *= 0.5F * velMag * RandomNormalNum();
m_AngularVel = -m_AngularVel;
}

// TODO: Rework this so it's less incomprehensible black magic math and not driven by AngularVel.
double newFrame = m_Rotation.GetRadAngle();

Expand Down
2 changes: 0 additions & 2 deletions Source/Entities/MOSprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ bool MOSprite::HitTestAtPixel(int pixelX, int pixelY, bool validOnly) const {
}

void MOSprite::SetFrame(unsigned int newFrame) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure this is lua accessible so I'd rather this accept int instead, to avoid underflow issues

if (newFrame < 0)
newFrame = 0;
if (newFrame >= m_FrameCount)
newFrame = m_FrameCount - 1;

Expand Down
4 changes: 0 additions & 4 deletions Source/GUI/GUIBanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,6 @@ void GUIBanner::Draw(BITMAP* pTargetBitmap) {
}
if (c == '\t') {
}
if (c < 0)
c += m_CharIndexCap;
if (c < 32 || c >= m_CharIndexCap)
continue;

Expand Down Expand Up @@ -362,8 +360,6 @@ int GUIBanner::CalculateWidth(const std::string text, FontMode mode) const {
*/
continue;
}
if (c < 0)
c += m_CharIndexCap;
if (c < 32 || c >= m_CharIndexCap)
continue;

Expand Down
6 changes: 0 additions & 6 deletions Source/GUI/GUIFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ void GUIFont::Draw(GUIBitmap* Bitmap, int X, int Y, const std::string& Text, uns
if (c == '\t') {
X += m_Characters[' '].m_Width * 4;
}
if (c < 0) {
c += m_CharIndexCap;
}
if (c < 32 || c >= m_CharIndexCap) {
continue;
}
Expand Down Expand Up @@ -270,9 +267,6 @@ int GUIFont::CalculateWidth(const std::string& Text) {
Width = 0;
continue;
}
if (c < 0) {
c += m_CharIndexCap;
}

if (c < 32 || c >= m_CharIndexCap) {
continue;
Expand Down