summaryrefslogtreecommitdiff
path: root/vehicle_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-02-04 21:48:46 +0000
committerpeter1138 <peter1138@openttd.org>2006-02-04 21:48:46 +0000
commit500a7e6627c130d3ec8bae00384dafe18e86da7e (patch)
tree87ce1a898e14813f5cc02bbe02c5671b8f166c37 /vehicle_gui.c
parent78b51cbec2d027a4e8f3066370d5994d4e8b0935 (diff)
downloadopenttd-500a7e6627c130d3ec8bae00384dafe18e86da7e.tar.xz
(svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list)
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r--vehicle_gui.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 0b2f77387..407287398 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -453,11 +453,12 @@ static int CDECL VehicleValueSorter(const void *a, const void *b)
static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, EngineID *selected_id, RailType railtype,
uint8 lines_drawn, bool is_engine, bool show_cars, bool show_outdated)
{
- EngineID i;
+ EngineID j;
byte colour;
const Player *p = GetPlayer(_local_player);
- for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
+ for (j = 0; j < NUM_TRAIN_ENGINES; j++) {
+ EngineID i = GetRailVehAtPosition(j);
const Engine *e = GetEngine(i);
const RailVehicleInfo *rvi = RailVehInfo(i);
const EngineInfo *info = &_engine_info[i];
@@ -467,7 +468,7 @@ static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, Engine
if ((rvi->power == 0 && !show_cars) || (rvi->power != 0 && show_cars)) // show wagons or engines (works since wagons do not have power)
continue;
- if (*sel == 0) *selected_id = i;
+ if (*sel == 0) *selected_id = j;
colour = *sel == 0 ? 0xC : 0x10;
@@ -513,10 +514,12 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
switch (WP(w,replaceveh_d).vehicletype) {
case VEH_Train: {
+ EngineID i;
railtype = _railtype_selected_in_replace_gui;
w->widget[13].color = _player_colors[_local_player]; // sets the colour of that art thing
w->widget[16].color = _player_colors[_local_player]; // sets the colour of that art thing
- for (engine_id = 0; engine_id < NUM_TRAIN_ENGINES; engine_id++) {
+ for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
+ EngineID engine_id = GetRailVehAtPosition(i);
const Engine *e = GetEngine(engine_id);
const EngineInfo *info = &_engine_info[engine_id];