Changeset - r1006:d0eeb17855a5
[Not reviewed]
master
0 1 0
celestar - 20 years ago 2005-01-14 09:36:29
celestar@openttd.org
(svn r1505) -Fix: Refit engine button is now disabled when cargo capacity equals zero
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
train_gui.c
Show inline comments
 
@@ -795,48 +795,52 @@ static Widget _train_view_widgets[] = {
 
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   231,    14,   121, 0x0,			STR_NULL},
 
{          WWT_6,   RESIZE_NONE,    14,     2,   229,    16,   119, 0x0,			STR_NULL},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,     0,   249,   122,   133, 0x0,			STR_8846_CURRENT_TRAIN_ACTION_CLICK},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    14,    31, 0x2AB,		STR_8848_CENTER_MAIN_VIEW_ON_TRAIN},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    32,    49, 0x2AD,		STR_8849_SEND_TRAIN_TO_DEPOT},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    50,    67, 0x2B1,		STR_884A_FORCE_TRAIN_TO_PROCEED},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    68,    85, 0x2CB,		STR_884B_REVERSE_DIRECTION_OF_TRAIN},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    86,   103, 0x2B2,		STR_8847_SHOW_TRAIN_S_ORDERS},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,   104,   121, 0x2B3,		STR_884C_SHOW_TRAIN_DETAILS},
 
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    68,    85, 0x2B4,		STR_RAIL_REFIT_VEHICLE_TO_CARRY},
 
{   WIDGETS_END},
 
};
 

	
 
static void TrainViewWndProc(Window *w, WindowEvent *e)
 
{
 
	switch(e->event) {
 
	case WE_PAINT: {
 
		Vehicle *v;
 
		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);
 
		}
 

	
 
		/* draw widgets & caption */
 
		SetDParam(0, v->string_id);
 
		SetDParam(1, v->unitnumber);
 
		DrawWindowWidgets(w);
 

	
 
		/* draw the flag */
 
		DrawSprite( (v->vehstatus&VS_STOPPED) ? 0xC12 : 0xC13, 2, 123);
 

	
 
		if (v->u.rail.crash_anim_pos != 0) {
 
			str = STR_8863_CRASHED;
 
		} else if (v->breakdown_ctr == 1) {
 
			str = STR_885C_BROKEN_DOWN;
 
		} else if (v->vehstatus & VS_STOPPED) {
 
			if (v->u.rail.last_speed == 0) {
 
				str = STR_8861_STOPPED;
 
			} else {
 
				SetDParam(0, v->u.rail.last_speed * 10 >> 4);
 
				str = STR_TRAIN_STOPPING + _patches.vehicle_speed;
 
			}
 
		} else {
 
			switch (v->current_order.type) {
 
			case OT_GOTO_STATION: {
 
				str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
0 comments (0 inline, 0 general)