Skip to content
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

Fixed few mistakes and warnings in the code #1142

Merged
merged 9 commits into from
Dec 17, 2022
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_GL/gl_rendertarget_phase_combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void CRenderTarget::phase_combine()

// PP enabled ?
// Render to RT texture to be able to copy RT even in windowed mode.
BOOL PP_Complex = u_need_PP() | (BOOL)RImplementation.m_bMakeAsyncSS;
BOOL PP_Complex = u_need_PP() || (BOOL)RImplementation.m_bMakeAsyncSS;
if (_menu_pp)
PP_Complex = FALSE;

Expand Down
2 changes: 0 additions & 2 deletions src/Layers/xrRenderPC_GL/r2_R_sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ void XRMatrixOrthoOffCenterLH(Fmatrix* pout, float l, float r, float b, float t,
void XRMatrixInverse(Fmatrix* pout, float* pdeterminant, const Fmatrix& pm)
{
glm::mat4 out = glm::inverse(glm::make_mat4x4(&pm.m[0][0]));

*pout = *(Fmatrix*)glm::value_ptr(out);
return;
}

//////////////////////////////////////////////////////////////////////////
Expand Down
14 changes: 12 additions & 2 deletions src/xrGame/ActorInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,18 @@ void CActor::IR_OnKeyboardHold(int cmd)
break;

case kACCEL: mstate_wishful |= mcAccel; break;
case kL_STRAFE: mstate_wishful |= mcLStrafe; break;
case kR_STRAFE: mstate_wishful |= mcRStrafe; break;
case kL_STRAFE:
{
mstate_wishful &= ~mcSprint;
mstate_wishful |= mcLStrafe;
break;
}
case kR_STRAFE:
{
mstate_wishful &= ~mcSprint;
mstate_wishful |= mcRStrafe;
break;
}
case kL_LOOKOUT: mstate_wishful |= mcLLookout; break;
case kR_LOOKOUT: mstate_wishful |= mcRLookout; break;
case kFWD: mstate_wishful |= mcFwd; break;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Actor_Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ bool CActor::net_Relevant() // relevant for export to server
{
if (OnServer())
{
return getSVU() | getLocal();
return getSVU() || getLocal();
}
else
{
Expand Down
5 changes: 2 additions & 3 deletions src/xrGame/PHMovementControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,9 @@ struct STraceBorderQParams
CPHMovementControl* m_movement;
const Fvector& m_dir;
STraceBorderQParams(CPHMovementControl* movement, const Fvector& dir) : m_dir(dir) { m_movement = movement; }
STraceBorderQParams& operator=(STraceBorderQParams& p)
STraceBorderQParams& operator=(const STraceBorderQParams& p)
{
VERIFY(FALSE);
return p;
Xottab-DUTY marked this conversation as resolved.
Show resolved Hide resolved
return *this;
}
};

Expand Down
14 changes: 1 addition & 13 deletions src/xrGame/WeaponMagazinedWGrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,19 +407,7 @@ void CWeaponMagazinedWGrenade::ReloadMagazine()

void CWeaponMagazinedWGrenade::OnStateSwitch(u32 S, u32 oldState)
{
switch (S)
{
case eSwitch:
{
if (!SwitchMode())
{
SwitchState(eIdle);
return;
}
}
break;
}

if (S == eSwitch && !SwitchMode()) return;
inherited::OnStateSwitch(S, oldState);
UpdateGrenadeVisibility(!!iAmmoElapsed || S == eReload);
}
Expand Down
13 changes: 5 additions & 8 deletions src/xrGame/movement_manager_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ void CMovementManager::process_level_path()

if (!m_build_at_once)
break;

[[fallthrough]]; // xxx: or break?
}
case ePathStateContinueLevelPath:
{
level_path().select_intermediate_vertex();

m_path_state = ePathStateBuildDetailPath;
[[fallthrough]];
}
case ePathStateBuildDetailPath:
{
Expand All @@ -69,9 +70,7 @@ void CMovementManager::process_level_path()
}
case ePathStatePathVerification:
{
if (!level_path().actual())
m_path_state = ePathStateBuildLevelPath;
else if (!detail().actual())
if (!level_path().actual() || !detail().actual())
m_path_state = ePathStateBuildLevelPath;
else
{
Expand All @@ -86,9 +85,7 @@ void CMovementManager::process_level_path()
}
case ePathStatePathCompleted:
{
if (!level_path().actual())
m_path_state = ePathStateBuildLevelPath;
else if (!detail().actual())
if (!level_path().actual() || !detail().actual())
m_path_state = ePathStateBuildLevelPath;
break;
}
Expand Down
9 changes: 3 additions & 6 deletions src/xrGame/movement_manager_patrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void CMovementManager::process_patrol_path()
break;
}

m_path_state = ePathStateBuildLevelPath;
[[fallthrough]];
}
case ePathStateBuildLevelPath:
{
Expand All @@ -62,8 +62,7 @@ void CMovementManager::process_patrol_path()
case ePathStateContinueLevelPath:
{
level_path().select_intermediate_vertex();

m_path_state = ePathStateBuildDetailPath;
[[fallthrough]];
}
case ePathStateBuildDetailPath:
{
Expand Down Expand Up @@ -91,9 +90,7 @@ void CMovementManager::process_patrol_path()
// Msg ("[%6d][%s] actuality is false 3",Device.dwFrame,*object().cName());
m_path_state = ePathStateSelectPatrolPoint;
}
else if (!level_path().actual())
m_path_state = ePathStateBuildLevelPath;
else if (!detail().actual())
else if (!level_path().actual() || !detail().actual())
m_path_state = ePathStateBuildLevelPath;
else if (detail().completed(object().Position(), !detail().state_patrol_path()))
{
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/ui/UIMapList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ void CUIMapList::LoadMapList()
{
const auto& weathers = gMapListHelper.GetGameWeathers();
u32 cnt = 0;
if (m_pWeatherSelector->GetSize() > 0);
if (m_pWeatherSelector->GetSize() > 0)
m_pWeatherSelector->ClearList();
for (const MPWeatherDesc& weather : weathers)
for (const auto& weather : weathers)
AddWeather(weather.Name, weather.StartTime, cnt++);
if (weathers.size() > 0)
m_pWeatherSelector->SetItemIDX(0);
Expand Down