1
0
Fork 0

(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft

release/0.4.5
dominik 2004-08-10 16:54:34 +00:00
parent 39267dbad5
commit ee4511a836
4 changed files with 32 additions and 21 deletions

View File

@ -694,12 +694,16 @@ static int GetVehicleFromAircraftDepotWndPt(Window *w, int x, int y, Vehicle **v
static void AircraftDepotClickAircraft(Window *w, int x, int y) static void AircraftDepotClickAircraft(Window *w, int x, int y)
{ {
Vehicle *v; Vehicle *v;
int mode = GetVehicleFromAircraftDepotWndPt(w, x, y, &v);
switch(GetVehicleFromAircraftDepotWndPt(w, x, y, &v)) { // share / copy orders
if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; }
switch(mode) {
case 1: case 1:
return; return;
case 0: case 0: // start dragging of vehicle
if (v != NULL) { if (v != NULL) {
WP(w,traindepot_d).sel = v->index; WP(w,traindepot_d).sel = v->index;
SetWindowDirty(w); SetWindowDirty(w);
@ -707,11 +711,11 @@ static void AircraftDepotClickAircraft(Window *w, int x, int y)
} }
break; break;
case -1: case -1: // show info window
ShowAircraftViewWindow(v); ShowAircraftViewWindow(v);
break; break;
case -2: case -2: // click start/stop flag
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)); DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT));
break; break;

View File

@ -562,14 +562,16 @@ static int GetVehicleFromRoadDepotWndPt(Window *w, int x, int y, Vehicle **veh)
static void RoadDepotClickVeh(Window *w, int x, int y) static void RoadDepotClickVeh(Window *w, int x, int y)
{ {
Vehicle *v; Vehicle *v;
int r; int mode;
r = GetVehicleFromRoadDepotWndPt(w, x, y, &v); mode = GetVehicleFromRoadDepotWndPt(w, x, y, &v);
if (r > 0) return; if (mode > 0) return;
if (_thd.place_mode) { _place_clicked_vehicle = v; return; } // share / copy orders
switch (r) { if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; }
case 0:
switch (mode) {
case 0: // start dragging of vehicle
if (v != NULL) { if (v != NULL) {
WP(w,traindepot_d).sel = v->index; WP(w,traindepot_d).sel = v->index;
SetWindowDirty(w); SetWindowDirty(w);
@ -577,11 +579,11 @@ static void RoadDepotClickVeh(Window *w, int x, int y)
} }
break; break;
case -1: case -1: // show info window
ShowRoadVehViewWindow(v); ShowRoadVehViewWindow(v);
break; break;
case -2: case -2: // click start/stop flag
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE)); DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE));
break; break;

View File

@ -694,12 +694,16 @@ static int GetVehicleFromShipDepotWndPt(Window *w, int x, int y, Vehicle **veh)
static void ShipDepotClick(Window *w, int x, int y) static void ShipDepotClick(Window *w, int x, int y)
{ {
Vehicle *v; Vehicle *v;
int mode = GetVehicleFromShipDepotWndPt(w, x, y, &v);
switch (GetVehicleFromShipDepotWndPt(w, x, y, &v)) { // share / copy orders
case 1: if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; }
switch (mode) {
case 1: // invalid
return; return;
case 0: case 0: // start dragging of vehicle
if (v != NULL) { if (v != NULL) {
WP(w,traindepot_d).sel = v->index; WP(w,traindepot_d).sel = v->index;
SetWindowDirty(w); SetWindowDirty(w);
@ -708,11 +712,11 @@ static void ShipDepotClick(Window *w, int x, int y)
} }
break; break;
case -1: case -1: // show info window
ShowShipViewWindow(v); ShowShipViewWindow(v);
break; break;
case -2: case -2: // click start/stop flag
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP));
break; break;

View File

@ -442,13 +442,14 @@ static void TrainDepotClickTrain(Window *w, int x, int y)
Vehicle *v; Vehicle *v;
mode = GetVehicleFromTrainDepotWndPt(w, x, y, &gdvp); mode = GetVehicleFromTrainDepotWndPt(w, x, y, &gdvp);
// share / copy orders
if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = gdvp.head; return; } if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = gdvp.head; return; }
v = gdvp.wagon; v = gdvp.wagon;
switch(mode) { switch(mode) {
case 0: case 0: // start dragging of vehicle
sel = (int16)WP(w,traindepot_d).sel; sel = (int16)WP(w,traindepot_d).sel;
if (sel != -1) { if (sel != -1) {
WP(w,traindepot_d).sel = INVALID_VEHICLE; WP(w,traindepot_d).sel = INVALID_VEHICLE;
@ -460,11 +461,11 @@ static void TrainDepotClickTrain(Window *w, int x, int y)
} }
break; break;
case -1: case -1: // show info window
ShowTrainViewWindow(v); ShowTrainViewWindow(v);
break; break;
case -2: case -2: // click start/stop flag
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN)); DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
break; break;
} }