1
0
Fork 0

(svn r13280) -Fix (r13276): MSVC compilation was broken

release/0.7
smatz 2008-05-27 00:13:51 +00:00
parent a7761332f6
commit e424367938
3 changed files with 8 additions and 8 deletions

View File

@ -74,19 +74,19 @@ private:
GUIBridgeList *bridges; GUIBridgeList *bridges;
/** Sort the bridges by their index */ /** Sort the bridges by their index */
static int BridgeIndexSorter(const BuildBridgeData *a, const BuildBridgeData *b) static int CDECL BridgeIndexSorter(const BuildBridgeData *a, const BuildBridgeData *b)
{ {
return a->index - b->index; return a->index - b->index;
} }
/** Sort the bridges by their price */ /** Sort the bridges by their price */
static int BridgePriceSorter(const BuildBridgeData *a, const BuildBridgeData *b) static int CDECL BridgePriceSorter(const BuildBridgeData *a, const BuildBridgeData *b)
{ {
return a->cost - b->cost; return a->cost - b->cost;
} }
/** Sort the bridges by their maximum speed */ /** Sort the bridges by their maximum speed */
static int BridgeSpeedSorter(const BuildBridgeData *a, const BuildBridgeData *b) static int CDECL BridgeSpeedSorter(const BuildBridgeData *a, const BuildBridgeData *b)
{ {
return a->spec->speed - b->spec->speed; return a->spec->speed - b->spec->speed;
} }

View File

@ -147,7 +147,7 @@ private:
} }
/** Sort the groups by their name */ /** Sort the groups by their name */
static int GroupNameSorter(const Group* const *a, const Group* const *b) static int CDECL GroupNameSorter(const Group* const *a, const Group* const *b)
{ {
static const Group *last_group[2] = { NULL, NULL }; static const Group *last_group[2] = { NULL, NULL };
static char last_name[2][64] = { "", "" }; static char last_name[2][64] = { "", "" };
@ -295,7 +295,7 @@ public:
SortVehicleList(this); SortVehicleList(this);
this->BuildGroupList(owner); this->BuildGroupList(owner);
this->groups.Sort(GroupNameSorter); this->groups.Sort(&GroupNameSorter);
SetVScrollCount(this, this->groups.Length()); SetVScrollCount(this, this->groups.Length());
SetVScroll2Count(this, this->vehicles.Length()); SetVScroll2Count(this, this->vehicles.Length());

View File

@ -26,7 +26,7 @@ struct Listing {
template <typename T> template <typename T>
class GUIList : public SmallVector<T, 32> { class GUIList : public SmallVector<T, 32> {
public: public:
typedef int SortFunction(const T*, const T*); typedef int CDECL SortFunction(const T*, const T*);
public: // Temporary: public for conversion only public: // Temporary: public for conversion only
SortFunction* const *func_list; ///< The sort criteria functions SortFunction* const *func_list; ///< The sort criteria functions
@ -189,7 +189,7 @@ public:
* *
* @param compare The function to compare two list items * @param compare The function to compare two list items
* */ * */
FORCEINLINE void Sort(SortFunction compare) FORCEINLINE void Sort(SortFunction *compare)
{ {
/* Do not sort if the resort bit is not set */ /* Do not sort if the resort bit is not set */
if (!HASBITS(this->flags, VL_RESORT)) return; if (!HASBITS(this->flags, VL_RESORT)) return;
@ -204,7 +204,7 @@ public:
const bool desc = HASBITS(this->flags, VL_DESC); const bool desc = HASBITS(this->flags, VL_DESC);
if (HASBITS(this->flags, VL_FIRST_SORT)) { if (HASBITS(this->flags, VL_FIRST_SORT)) {
qsort(this->data, this->items, sizeof(T), (int (*)(const void *a, const void *b))compare); qsort(this->data, this->items, sizeof(T), (int (CDECL *)(const void *, const void *))compare);
if (desc) this->Reverse(); if (desc) this->Reverse();
return; return;