376 const Town* tb = *(const Town**)b; |
376 const Town* tb = *(const Town**)b; |
377 char buf1[64]; |
377 char buf1[64]; |
378 int r; |
378 int r; |
379 |
379 |
380 SetDParam(0, ta->index); |
380 SetDParam(0, ta->index); |
381 GetString(buf1, STR_TOWN); |
381 GetString(buf1, STR_TOWN, lastof(buf1)); |
382 |
382 |
383 /* If 'b' is the same town as in the last round, use the cached value |
383 /* If 'b' is the same town as in the last round, use the cached value |
384 * We do this to speed stuff up ('b' is called with the same value a lot of |
384 * We do this to speed stuff up ('b' is called with the same value a lot of |
385 * times after eachother) */ |
385 * times after eachother) */ |
386 if (tb != _last_town) { |
386 if (tb != _last_town) { |
387 _last_town = tb; |
387 _last_town = tb; |
388 SetDParam(0, tb->index); |
388 SetDParam(0, tb->index); |
389 GetString(_bufcache, STR_TOWN); |
389 GetString(_bufcache, STR_TOWN, lastof(_bufcache)); |
390 } |
390 } |
391 |
391 |
392 r = strcmp(buf1, _bufcache); |
392 r = strcmp(buf1, _bufcache); |
393 if (_town_sort_order & 1) r = -r; |
393 if (_town_sort_order & 1) r = -r; |
394 return r; |
394 return r; |