order_gui.c
changeset 4077 d4d440dd8925
parent 4012 62bea6a7f948
child 4171 5c6e60c392c3
equal deleted inserted replaced
4076:a6650b616430 4077:d4d440dd8925
   396 
   396 
   397 	case WE_CLICK: {
   397 	case WE_CLICK: {
   398 		Vehicle *v = GetVehicle(w->window_number);
   398 		Vehicle *v = GetVehicle(w->window_number);
   399 		switch (e->click.widget) {
   399 		switch (e->click.widget) {
   400 		case 2: { /* orders list */
   400 		case 2: { /* orders list */
   401 			int sel;
   401 			int sel = (e->click.pt.y - 15) / 10;
   402 			sel = (e->click.pt.y - 15) / 10;
   402 
   403 
   403 			if ((uint)sel >= w->vscroll.cap) return;
   404 			if ((uint)sel >= w->vscroll.cap)
       
   405 				return;
       
   406 
   404 
   407 			sel += w->vscroll.pos;
   405 			sel += w->vscroll.pos;
   408 
   406 
   409 			if (_ctrl_pressed && sel < v->num_orders) {
   407 			if (_ctrl_pressed && sel < v->num_orders) {
   410 				const Order *ord = GetVehicleOrder(v, sel);
   408 				const Order *ord = GetVehicleOrder(v, sel);
   411 				int xy = 0;
   409 				TileIndex xy;
       
   410 
   412 				switch (ord->type) {
   411 				switch (ord->type) {
   413 				case OT_GOTO_STATION:			/* station order */
   412 					case OT_GOTO_STATION:  xy = GetStation(ord->station)->xy ; break;
   414 					xy = GetStation(ord->station)->xy ;
   413 					case OT_GOTO_DEPOT:    xy = GetDepot(ord->station)->xy;    break;
   415 					break;
   414 					case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->station)->xy; break;
   416 				case OT_GOTO_DEPOT:				/* goto depot order */
   415 					default:               xy = 0; break;
   417 					xy = GetDepot(ord->station)->xy;
       
   418 					break;
       
   419 				case OT_GOTO_WAYPOINT:	/* goto waypoint order */
       
   420 					xy = GetWaypoint(ord->station)->xy;
       
   421 				}
   416 				}
   422 
   417 
   423 				if (xy)
   418 				if (xy != 0) ScrollMainWindowToTile(xy);
   424 					ScrollMainWindowToTile(xy);
       
   425 
       
   426 				return;
   419 				return;
   427 			}
   420 			}
   428 
   421 
   429 			if (sel == WP(w,order_d).sel) sel = -1;
   422 			if (sel == WP(w,order_d).sel) sel = -1;
   430 			WP(w,order_d).sel = sel;
   423 			WP(w,order_d).sel = sel;
   516 	case WE_RESIZE:
   509 	case WE_RESIZE:
   517 		/* Update the scroll + matrix */
   510 		/* Update the scroll + matrix */
   518 		w->vscroll.cap = (w->widget[2].bottom - w->widget[2].top) / 10;
   511 		w->vscroll.cap = (w->widget[2].bottom - w->widget[2].top) / 10;
   519 		break;
   512 		break;
   520 	}
   513 	}
   521 
       
   522 }
   514 }
   523 
   515 
   524 static const Widget _orders_train_widgets[] = {
   516 static const Widget _orders_train_widgets[] = {
   525 {   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,									STR_018B_CLOSE_WINDOW},
   517 {   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,									STR_018B_CLOSE_WINDOW},
   526 {    WWT_CAPTION,   RESIZE_RIGHT,   14,    11,   384,     0,    13, STR_8829_ORDERS,					STR_018C_WINDOW_TITLE_DRAG_THIS},
   518 {    WWT_CAPTION,   RESIZE_RIGHT,   14,    11,   384,     0,    13, STR_8829_ORDERS,					STR_018C_WINDOW_TITLE_DRAG_THIS},