roadveh_gui.c
changeset 10 c35ab8426202
parent 0 29654efe3188
child 156 8fef5e5752d6
equal deleted inserted replaced
9:b1ecf90eb6da 10:c35ab8426202
   560 }
   560 }
   561 
   561 
   562 static void RoadDepotClickVeh(Window *w, int x, int y)
   562 static void RoadDepotClickVeh(Window *w, int x, int y)
   563 {
   563 {
   564 	Vehicle *v;
   564 	Vehicle *v;
   565 	int r;
   565 	int mode;
   566 
   566 
   567 	r = GetVehicleFromRoadDepotWndPt(w, x, y, &v);
   567 	mode = GetVehicleFromRoadDepotWndPt(w, x, y, &v);
   568 	if (r > 0) return;
   568 	if (mode > 0) return;
   569 
   569 
   570 	if (_thd.place_mode) { _place_clicked_vehicle = v; return; }
   570 	// share / copy orders
   571 	switch (r) {
   571 	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; }
   572 	case 0:
   572 
       
   573 	switch (mode) {
       
   574 	case 0: // start dragging of vehicle
   573 		if (v != NULL) {
   575 		if (v != NULL) {
   574 			WP(w,traindepot_d).sel = v->index;
   576 			WP(w,traindepot_d).sel = v->index;
   575 			SetWindowDirty(w);
   577 			SetWindowDirty(w);
   576 			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetRoadVehImage(v, 6), 4, w);
   578 			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetRoadVehImage(v, 6), 4, w);
   577 		}
   579 		}
   578 		break;
   580 		break;
   579 
   581 
   580 	case -1:
   582 	case -1: // show info window
   581 		ShowRoadVehViewWindow(v);
   583 		ShowRoadVehViewWindow(v);
   582 		break;
   584 		break;
   583 
   585 
   584 	case -2:
   586 	case -2: // click start/stop flag
   585 		DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE));
   587 		DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE));
   586 		break;
   588 		break;
   587 
   589 
   588 	default:
   590 	default:
   589 		NOT_REACHED();
   591 		NOT_REACHED();