Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10511


Ignore:
Timestamp:
May 30, 2015, 9:59:31 PM (9 years ago)
Author:
landauf
Message:

bugfix: comparison function was not symmetric.
e.g. two NetworkFunctionPointers:

NFP1 has pointer[0] = 1 and pointer[1] = 5;
NFP2 has pointer[0] = 5 and pointer[1] = 1

then so far NFP1 < NFP2 returned true and NFP2 < NFP1 also returned true
now the behavior is fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/network/NetworkFunction.h

    r10478 r10511  
    5656  {
    5757#if defined(ORXONOX_COMPILER_GCC) && defined(ORXONOX_ARCH_32)
    58     return pointer[0]<b.pointer[0] ? true : pointer[1]<b.pointer[1];
    59 #else //ORXONOX_COMPILER_GCC
    60     return pointer[0]<b.pointer[0] ? true : ( pointer[1]<b.pointer[1] ? true : ( pointer[2]<b.pointer[2] ? true : pointer[3]<b.pointer[3] ) );
    61 #endif //ORXONOX_COMPILER_GCC
     58    if (pointer[0] != b.pointer[0])
     59        return pointer[0] < b.pointer[0];
     60    else if (pointer[1] != b.pointer[1])
     61        return pointer[1] < b.pointer[1];
     62    else
     63        return false;
     64#else
     65    if (pointer[0] != b.pointer[0])
     66        return pointer[0] < b.pointer[0];
     67    else if (pointer[1] != b.pointer[1])
     68        return pointer[1] < b.pointer[1];
     69    else if (pointer[2] != b.pointer[2])
     70        return pointer[2] < b.pointer[2];
     71    else if (pointer[3] != b.pointer[3])
     72        return pointer[3] < b.pointer[3];
     73    else
     74        return false;
     75#endif
    6276  }
    6377};
Note: See TracChangeset for help on using the changeset viewer.