diff options
author | celestar <celestar@openttd.org> | 2005-02-20 07:47:42 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-02-20 07:47:42 +0000 |
commit | d06f52a7f029b05bff96c70a1561761dc68412fb (patch) | |
tree | 40d8347f083126ca5ae7aed3ce32d172c9544f7f /train_gui.c | |
parent | 2de3dc273574b632b2a82dc512351d3f42f94cb2 (diff) | |
download | openttd-d06f52a7f029b05bff96c70a1561761dc68412fb.tar.xz |
(svn r1891) -Fix: [ 1143587 ] carriages of newgrfs can be refitted again
Diffstat (limited to 'train_gui.c')
-rw-r--r-- | train_gui.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/train_gui.c b/train_gui.c index f3809421a..b477cf25b 100644 --- a/train_gui.c +++ b/train_gui.c @@ -809,16 +809,29 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) { switch(e->event) { case WE_PAINT: { - Vehicle *v; + Vehicle *v, *u; StringID str; v = GetVehicle(w->window_number); w->disabled_state = (v->owner == _local_player) ? 0 : 0x380; - if (v->cargo_cap == 0) { - //we cannot refit this engine - SETBIT(w->disabled_state, 12); + SETBIT(w->disabled_state, 12); + + /* See if any carriage can be refitted */ + for ( u = v; u != NULL; u = u->next) { + if (_engine_refit_masks[u->engine_type] != 0) { + CLRBIT(w->disabled_state, 12); + /* We have a refittable carriage, bail out */ + break; + } + } + + /* Above code doesn't seem to handle non-newgrf engines, do it separately + TODO: handle engines which are NOT the head of the train, but don't break wagons */ + if (v->cargo_cap != 0) { + /* we can refit this engine */ + CLRBIT(w->disabled_state, 12); } /* draw widgets & caption */ |