1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Code review tweaks

This commit is contained in:
nordsoft 2023-09-01 15:17:46 +04:00
parent 15037b782f
commit 8040cafb3d

View File

@ -61,16 +61,14 @@ std::string CModVersion::toString() const
bool CModVersion::compatible(const CModVersion & other, bool checkMinor, bool checkPatch) const
{
if(minor == Any || other.minor == Any)
checkMinor = false;
if(patch == Any || other.patch == Any)
checkPatch = false;
bool doCheckMinor = checkMinor && minor != Any && other.minor != Any;
bool doCheckPatch = checkPatch && patch != Any && other.patch != Any;
assert(!checkPatch || (checkPatch && checkMinor));
assert(!doCheckPatch || (doCheckPatch && doCheckMinor));
return (major == other.major &&
(!checkMinor || minor >= other.minor) &&
(!checkPatch || minor > other.minor || (minor == other.minor && patch >= other.patch)));
(!doCheckMinor || minor >= other.minor) &&
(!doCheckPatch || minor > other.minor || (minor == other.minor && patch >= other.patch)));
}
bool CModVersion::isNull() const