mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Fix "identical expressions on both sides of comparison"
This commit is contained in:
@ -109,51 +109,52 @@ bool AbstractGoal::operator==(const AbstractGoal & g) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractGoal::operator<(AbstractGoal & g) //for std::unique
|
// FIXME: unused code?
|
||||||
{
|
//bool AbstractGoal::operator<(AbstractGoal & g) //for std::unique
|
||||||
//TODO: make sure it gets goals consistent with == operator
|
//{
|
||||||
if (goalType < g.goalType)
|
// //TODO: make sure it gets goals consistent with == operator
|
||||||
return true;
|
// if (goalType < g.goalType)
|
||||||
if (goalType > g.goalType)
|
// return true;
|
||||||
return false;
|
// if (goalType > g.goalType)
|
||||||
if (hero < g.hero)
|
// return false;
|
||||||
return true;
|
// if (hero < g.hero)
|
||||||
if (hero > g.hero)
|
// return true;
|
||||||
return false;
|
// if (hero > g.hero)
|
||||||
if (tile < g.tile)
|
// return false;
|
||||||
return true;
|
// if (tile < g.tile)
|
||||||
if (g.tile < tile)
|
// return true;
|
||||||
return false;
|
// if (g.tile < tile)
|
||||||
if (objid < g.objid)
|
// return false;
|
||||||
return true;
|
// if (objid < g.objid)
|
||||||
if (objid > g.objid)
|
// return true;
|
||||||
return false;
|
// if (objid > g.objid)
|
||||||
if (town < g.town)
|
// return false;
|
||||||
return true;
|
// if (town < g.town)
|
||||||
if (town > g.town)
|
// return true;
|
||||||
return false;
|
// if (town > g.town)
|
||||||
if (value < g.value)
|
// return false;
|
||||||
return true;
|
// if (value < g.value)
|
||||||
if (value > g.value)
|
// return true;
|
||||||
return false;
|
// if (value > g.value)
|
||||||
if (priority < g.priority)
|
// return false;
|
||||||
return true;
|
// if (priority < g.priority)
|
||||||
if (priority > g.priority)
|
// return true;
|
||||||
return false;
|
// if (priority > g.priority)
|
||||||
if (resID < g.resID)
|
// return false;
|
||||||
return true;
|
// if (resID < g.resID)
|
||||||
if (resID > g.resID)
|
// return true;
|
||||||
return false;
|
// if (resID > g.resID)
|
||||||
if (bid < g.bid)
|
// return false;
|
||||||
return true;
|
// if (bid < g.bid)
|
||||||
if (bid > g.bid)
|
// return true;
|
||||||
return false;
|
// if (bid > g.bid)
|
||||||
if (aid < g.aid)
|
// return false;
|
||||||
return true;
|
// if (aid < g.aid)
|
||||||
if (aid > g.aid)
|
// return true;
|
||||||
return false;
|
// if (aid > g.aid)
|
||||||
return false;
|
// return false;
|
||||||
}
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
//TODO: find out why the following are not generated automatically on MVS?
|
//TODO: find out why the following are not generated automatically on MVS?
|
||||||
bool TSubgoal::operator==(const TSubgoal & rhs) const
|
bool TSubgoal::operator==(const TSubgoal & rhs) const
|
||||||
|
@ -165,16 +165,16 @@ namespace Goals
|
|||||||
virtual float accept(FuzzyHelper * f);
|
virtual float accept(FuzzyHelper * f);
|
||||||
|
|
||||||
virtual bool operator==(const AbstractGoal & g) const;
|
virtual bool operator==(const AbstractGoal & g) const;
|
||||||
bool operator<(AbstractGoal & g); //final
|
// bool operator<(AbstractGoal & g); //final
|
||||||
virtual bool fulfillsMe(Goals::TSubgoal goal) //TODO: multimethod instead of type check
|
virtual bool fulfillsMe(Goals::TSubgoal goal) //TODO: multimethod instead of type check
|
||||||
{
|
{
|
||||||
return false; //use this method to check if goal is fulfilled by another (not equal) goal, operator == is handled spearately
|
return false; //use this method to check if goal is fulfilled by another (not equal) goal, operator == is handled spearately
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const AbstractGoal & g) const
|
// bool operator!=(const AbstractGoal & g) const
|
||||||
{
|
// {
|
||||||
return !(*this == g);
|
// return !(*this == g);
|
||||||
}
|
// }
|
||||||
|
|
||||||
template<typename Handler> void serialize(Handler & h)
|
template<typename Handler> void serialize(Handler & h)
|
||||||
{
|
{
|
||||||
|
20
lib/int3.h
20
lib/int3.h
@ -84,19 +84,13 @@ public:
|
|||||||
|
|
||||||
constexpr bool operator<(const int3 & i) const
|
constexpr bool operator<(const int3 & i) const
|
||||||
{
|
{
|
||||||
if (z < i.z)
|
if (z != i.z)
|
||||||
return true;
|
return z < i.z;
|
||||||
if (z > i.z)
|
|
||||||
return false;
|
if (y != i.y)
|
||||||
if (y < i.y)
|
return y < i.y;
|
||||||
return true;
|
|
||||||
if (y > i.y)
|
return x < i.x;
|
||||||
return false;
|
|
||||||
if (x < i.x)
|
|
||||||
return true;
|
|
||||||
if (x > i.x)
|
|
||||||
return false;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum EDistanceFormula
|
enum EDistanceFormula
|
||||||
|
@ -126,12 +126,8 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
if (y>i.y)
|
if (y>i.y)
|
||||||
return false;
|
return false;
|
||||||
if (x<i.x)
|
|
||||||
return true;
|
|
||||||
if (x>i.x)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return false;
|
return x<i.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toString() const
|
std::string toString() const
|
||||||
|
Reference in New Issue
Block a user