Commit 323182d6 authored by bitplane's avatar bitplane

changed irrArray::linear_search to use == operator to avoid false positives.

changed operators on classes that used linear_search (only used in string comparisons)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@742 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 97b6ac7a
Changes in version 1.4 (... 2007) Changes in version 1.4 (... 2007)
- Changed irrArray::linear_search to use the == operator rather than <
This may be slower in some cases, but it no longer returns false positives
when searching arrays of classes that override the < operator but
!(x<y) && !(y<x) does not necessarily mean x==y (vectors, positions etc).
- Fixed getSize/getOriginalSize method inversion in OpenGL textures. - Fixed getSize/getOriginalSize method inversion in OpenGL textures.
- Added per texture-layer filter settings, i.e. one can choose to filter - Added per texture-layer filter settings, i.e. one can choose to filter
......
...@@ -194,9 +194,9 @@ namespace scene ...@@ -194,9 +194,9 @@ namespace scene
core::vector3df position; core::vector3df position;
core::quaternion rotation; core::quaternion rotation;
bool operator < ( const SMD3QuaterionTag &other ) const bool operator == ( const SMD3QuaterionTag &other ) const
{ {
return Name < other.Name; return Name == other.Name;
} }
}; };
......
...@@ -53,9 +53,9 @@ namespace quake3 ...@@ -53,9 +53,9 @@ namespace quake3
return name.size(); return name.size();
} }
bool operator < ( const SVariable &other ) const bool operator == ( const SVariable &other ) const
{ {
return name < other.name; return name == other.name;
} }
}; };
...@@ -444,6 +444,11 @@ namespace quake3 ...@@ -444,6 +444,11 @@ namespace quake3
class SShader class SShader
{ {
public: public:
bool operator == (const SShader &other ) const
{
return name == other.name;
}
bool operator < (const SShader &other ) const bool operator < (const SShader &other ) const
{ {
return name < other.name; return name < other.name;
......
...@@ -426,7 +426,7 @@ public: ...@@ -426,7 +426,7 @@ public:
s32 linear_search(const T& element) const s32 linear_search(const T& element) const
{ {
for (u32 i=0; i<used; ++i) for (u32 i=0; i<used; ++i)
if (!(element < data[i]) && !(data[i] < element)) if (element == data[i])
return (s32)i; return (s32)i;
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment