692 } |
692 } |
693 |
693 |
694 static void ShipDepotClick(Window *w, int x, int y) |
694 static void ShipDepotClick(Window *w, int x, int y) |
695 { |
695 { |
696 Vehicle *v; |
696 Vehicle *v; |
697 |
697 int mode = GetVehicleFromShipDepotWndPt(w, x, y, &v); |
698 switch (GetVehicleFromShipDepotWndPt(w, x, y, &v)) { |
698 |
699 case 1: |
699 // share / copy orders |
|
700 if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; } |
|
701 |
|
702 switch (mode) { |
|
703 case 1: // invalid |
700 return; |
704 return; |
701 |
705 |
702 case 0: |
706 case 0: // start dragging of vehicle |
703 if (v != NULL) { |
707 if (v != NULL) { |
704 WP(w,traindepot_d).sel = v->index; |
708 WP(w,traindepot_d).sel = v->index; |
705 SetWindowDirty(w); |
709 SetWindowDirty(w); |
706 SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + |
710 SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + |
707 GetShipImage(v, 6), 4, w); |
711 GetShipImage(v, 6), 4, w); |
708 } |
712 } |
709 break; |
713 break; |
710 |
714 |
711 case -1: |
715 case -1: // show info window |
712 ShowShipViewWindow(v); |
716 ShowShipViewWindow(v); |
713 break; |
717 break; |
714 |
718 |
715 case -2: |
719 case -2: // click start/stop flag |
716 DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); |
720 DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); |
717 break; |
721 break; |
718 |
722 |
719 default: |
723 default: |
720 NOT_REACHED(); |
724 NOT_REACHED(); |