refactor: change comparison order in weapon pickup code

This commit is contained in:
dmitry 2022-02-22 10:21:21 +03:00
commit 5104508665
No known key found for this signature in database
GPG key ID: 8297CE728B7A7E37
3 changed files with 11 additions and 11 deletions

View file

@ -632,19 +632,19 @@ void Bot::updatePickups () {
else if (m_isVIP || !rateGroundWeapon (ent)) {
allowPickup = false;
}
else if (strcmp (model, "medkit.mdl") == 0 && m_healthValue >= 100.0f) {
else if (m_healthValue >= 100.0f && strcmp (model, "medkit.mdl") == 0) {
allowPickup = false;
}
else if ((strcmp (model, "kevlar.mdl") == 0 || strcmp (model, "battery.mdl") == 0) && pev->armorvalue >= 100.0f) {
else if (pev->armorvalue >= 100.0f && (strcmp (model, "kevlar.mdl") == 0 || strcmp (model, "battery.mdl") == 0)) {
allowPickup = false;
}
else if (strcmp (model, "flashbang.mdl") == 0 && (pev->weapons & cr::bit (Weapon::Flashbang))) {
else if ((pev->weapons & cr::bit (Weapon::Flashbang)) && strcmp (model, "flashbang.mdl") == 0) {
allowPickup = false;
}
else if (strcmp (model, "hegrenade.mdl") == 0 && (pev->weapons & cr::bit (Weapon::Explosive))) {
else if ((pev->weapons & cr::bit (Weapon::Explosive)) && strcmp (model, "hegrenade.mdl") == 0) {
allowPickup = false;
}
else if (strcmp (model, "smokegrenade.mdl") == 0 && (pev->weapons & cr::bit (Weapon::Smoke))) {
else if ((pev->weapons & cr::bit (Weapon::Smoke)) && strcmp (model, "smokegrenade.mdl") == 0) {
allowPickup = false;
}
}

View file

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28016.0
# Visual Studio Version 17
VisualStudioVersion = 17.1.32127.271
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yapb", "yapb.vcxproj", "{C232645A-3B99-48F4-A1F3-F20CF0A9568B}"
EndProject

View file

@ -90,7 +90,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<WholeProgramOptimization>true</WholeProgramOptimization>
<EnableASAN>false</EnableASAN>
@ -98,7 +98,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<UseDebugLibraries>false</UseDebugLibraries>
<EnableASAN>false</EnableASAN>
</PropertyGroup>
@ -170,7 +170,7 @@
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard>Default</LanguageStandard>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
@ -251,7 +251,7 @@
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard>Default</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>