equal
deleted
inserted
replaced
130 static char _bufcache[64]; // used together with _last_vehicle to hopefully speed up stringsorting |
130 static char _bufcache[64]; // used together with _last_vehicle to hopefully speed up stringsorting |
131 static int CDECL TrainEngineNameSorter(const void *a, const void *b) |
131 static int CDECL TrainEngineNameSorter(const void *a, const void *b) |
132 { |
132 { |
133 const EngineID va = *(const EngineID*)a; |
133 const EngineID va = *(const EngineID*)a; |
134 const EngineID vb = *(const EngineID*)b; |
134 const EngineID vb = *(const EngineID*)b; |
135 char buf1[64] = "\0"; |
135 char buf1[64]; |
136 int r; |
136 int r; |
137 |
137 |
138 SetDParam(0, GetCustomEngineName(va)); |
138 GetString(buf1, GetCustomEngineName(va)); |
139 GetString(buf1, STR_JUST_STRING); |
|
140 |
139 |
141 if (vb != _last_engine) { |
140 if (vb != _last_engine) { |
142 _last_engine = vb; |
141 _last_engine = vb; |
143 _bufcache[0] = '\0'; |
142 _bufcache[0] = '\0'; |
144 |
143 |
145 SetDParam(0, GetCustomEngineName(vb)); |
144 GetString(_bufcache, GetCustomEngineName(vb)); |
146 GetString(_bufcache, STR_JUST_STRING); |
|
147 } |
145 } |
148 |
146 |
149 r = strcmp(buf1, _bufcache); // sort by name |
147 r = strcmp(buf1, _bufcache); // sort by name |
150 |
148 |
151 if (r == 0) { |
149 if (r == 0) { |