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
master
bitplane 2007-06-28 05:10:23 +00:00
parent 97b6ac7a7c
commit 323182d605
4 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,10 @@
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.
- Added per texture-layer filter settings, i.e. one can choose to filter

View File

@ -194,9 +194,9 @@ namespace scene
core::vector3df position;
core::quaternion rotation;
bool operator < ( const SMD3QuaterionTag &other ) const
bool operator == ( const SMD3QuaterionTag &other ) const
{
return Name < other.Name;
return Name == other.Name;
}
};

View File

@ -53,9 +53,9 @@ namespace quake3
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
class SShader
{
public:
bool operator == (const SShader &other ) const
{
return name == other.name;
}
bool operator < (const SShader &other ) const
{
return name < other.name;

View File

@ -426,7 +426,7 @@ public:
s32 linear_search(const T& element) const
{
for (u32 i=0; i<used; ++i)
if (!(element < data[i]) && !(data[i] < element))
if (element == data[i])
return (s32)i;
return -1;