Loading

Revision differences

Old revision #pfskzrsgpNew revision #p8ta0btgs
1diff --git a/source.list b/source.list    
2index df35cdd26..888578b4b 100644    
3--- a/source.list    
4+++ b/source.list    
5@@ -442,7 +442,6 @@ core/smallmap_type.hpp    
6 core/smallmatrix_type.hpp    
7 core/smallstack_type.hpp    
8 core/smallvec_type.hpp    
9-core/sort_func.hpp    
10 core/string_compare_type.hpp    
11     
12 # GUI Source Code    
13diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp    
14index 1074d1dd7..7342c1864 100644    
15--- a/src/autoreplace_gui.cpp    
16+++ b/src/autoreplace_gui.cpp    
17@@ -32,11 +32,9 @@    
18     
19 void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);    
20     
21-static int CDECL EngineNumberSorter(const EngineID *a, const EngineID *b)    
22+static bool CDECL EngineNumberSorter(const EngineID &a, const EngineID &b)    
23 {    
24-       int r = Engine::Get(*a)->list_position - Engine::Get(*b)->list_position;    
25-    
26-       return r;    
27+       return Engine::Get(a)->list_position < Engine::Get(b)->list_position;    
28 }    
29     
30 /**    
31diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp    
32index 797ead1f5..dfbe5d435 100644    
33--- a/src/bridge_gui.cpp    
34+++ b/src/bridge_gui.cpp    
35@@ -93,21 +93,21 @@ private:    
36        Scrollbar *vscroll;    
37     
38        /** Sort the bridges by their index */    
39-       static int CDECL BridgeIndexSorter(const BuildBridgeData *a, const BuildBridgeData *b)    
40+       static bool CDECL BridgeIndexSorter(const BuildBridgeData &a, const BuildBridgeData &b)    
41        {    
42-               return a->index - b->index;    
43+               return a.index < b.index;    
44        }    
45     
46        /** Sort the bridges by their price */    
47-       static int CDECL BridgePriceSorter(const BuildBridgeData *a, const BuildBridgeData *b)    
48+       static bool CDECL BridgePriceSorter(const BuildBridgeData &a, const BuildBridgeData &b)    
49        {    
50-               return a->cost - b->cost;    
51+               return a.cost < b.cost;    
52        }    
53     
54        /** Sort the bridges by their maximum speed */    
55-       static int CDECL BridgeSpeedSorter(const BuildBridgeData *a, const BuildBridgeData *b)    
56+       static bool CDECL BridgeSpeedSorter(const BuildBridgeData &a, const BuildBridgeData &b)    
57        {    
58-               return a->spec->speed - b->spec->speed;    
59+               return a.spec->speed < b.spec->speed;    
60        }    
61     
62        void BuildBridge(uint8 i)    
63diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp    
64index 655a18d7f..b7137d91d 100644    
65--- a/src/build_vehicle_gui.cpp    
66+++ b/src/build_vehicle_gui.cpp    
67@@ -99,15 +99,14 @@ static CargoID _engine_sort_last_cargo_criteria[] = {CF_ANY, CF_ANY, CF_ANY, CF_    
68     
69 /**    
70  * Determines order of engines by engineID    
71- * @param *a first engine to compare    
72- * @param *b second engine to compare    
73+ * @param a first engine to compare    
74+ * @param b second engine to compare    
75  * @return for descending order: returns < 0 if a < b and > 0 for a > b. Vice versa for ascending order and 0 for equal    
76  */    
77-static int CDECL EngineNumberSorter(const EngineID *a, const EngineID *b)    
78+static bool CDECL EngineNumberSorter(const EngineID &a, const EngineID &b)    
79 {    
80-       int r = Engine::Get(*a)->list_position - Engine::Get(*b)->list_position;    
81-    
82-       return _engine_sort_direction ? -r : r;    
83+       bool r = Engine::Get(a)->list_position < Engine::Get(b)->list_position;    
84+       return _engine_sort_direction == r;    
85 }    
86     
87 /**    
88@@ -116,15 +115,14 @@ static int CDECL EngineNumberSorter(const EngineID *a, const EngineID *b)    
89  * @param *b second engine to compare    
90  * @return for descending order: returns < 0 if a < b and > 0 for a > b. Vice versa for ascending order and 0 for equal    
91  */    
92-static int CDECL EngineIntroDateSorter(const EngineID *a, const EngineID *b)    
93+static bool CDECL EngineIntroDateSorter(const EngineID &a, const EngineID &b)    
94 {    
95-       const int va = Engine::Get(*a)->intro_date;    
96-       const int vb = Engine::Get(*b)->intro_date;    
97-       const int r = va - vb;    
98+       const int va = Engine::Get(a)->intro_date;    
99+       const int vb = Engine::Get(b)->intro_date;    
100     
101        /* Use EngineID to sort instead since we want consistent sorting */    
102-       if (r == 0) return EngineNumberSorter(a, b);    
103-       return _engine_sort_direction ? -r : r;    
104+       if (va == vb) return EngineNumberSorter(a, b);    
105+       return _engine_sort_direction == (va < vb);    
106 }    
107     
108 /**    
109@@ -133,13 +131,13 @@ static int CDECL EngineIntroDateSorter(const EngineID *a, const EngineID *b)    
110  * @param *b second engine to compare    
111  * @return for descending order: returns < 0 if a < b and > 0 for a > b. Vice versa for ascending order and 0 for equal    
112  */    
113-static int CDECL EngineNameSorter(const EngineID *a, const EngineID *b)    
114+static bool CDECL EngineNameSorter(const EngineID &a, const EngineID &b)    
115 {    
116        static EngineID last_engine[2] = { INVALID_ENGINE, INVALID_ENGINE };    
117        static char     last_name[2][64] = { "\0", "\0" };    
118     
119-       const EngineID va = *a;    
120-       const EngineID vb = *b;    
121+       const EngineID va = a;    
122+       const EngineID vb = b;    
123[20:40 lordaro@Apollo openttd] > vim build_vehicle_gui.cpp    
124[20:40 lordaro@Apollo openttd] > vim src/build_vehicle_gui.cpp    
125[20:42 lordaro@Apollo openttd] > make run    
126make[1]: Entering directory '/home/lordaro/dev/openttd/objs/lang'    
127make[1]: Nothing to be done for 'all'.    
128make[1]: Leaving directory '/home/lordaro/dev/openttd/objs/lang'    
129make[1]: Entering directory '/home/lordaro/dev/openttd/objs/setting'    
130make[1]: Nothing to be done for 'all'.    
131make[1]: Leaving directory '/home/lordaro/dev/openttd/objs/setting'    
132make[1]: Entering directory '/home/lordaro/dev/openttd/objs/extra_grf'    
133make[1]: Nothing to be done for 'all'.    
134make[1]: Leaving directory '/home/lordaro/dev/openttd/objs/extra_grf'    
135make[1]: Entering directory '/home/lordaro/dev/openttd/objs/release'    
136[SRC] DEP CHECK (all files)    
137[SRC] Compiling build_vehicle_gui.cpp    
138[SRC] Linking openttd    
139make[1]: Leaving directory '/home/lordaro/dev/openttd/objs/release'    
140dbg: [grf] openttd_plus.0.1/ottdpp.grf: NewGRF "TD DP+ A set of trains designed to complement the default train set. This includes future maglevs and monorails as well as more default trains for desert/alpine." (GRFID 44460000) uses GRF version 1, which is incompatible with this version of OpenTTD.    
141ALSA lib pcm.c:8323:(snd_pcm_recover) underrun occurred    
142[20:44 lordaro@Apollo openttd] > git d    
143diff --git a/source.list b/source.list  1diff --git a/source.list b/source.list  
144index df35cdd26..888578b4b 100644  2index df35cdd26..888578b4b 100644  
145--- a/source.list  3--- a/source.list