Changeset - r10:6cb1c9bf87be
[Not reviewed]
master
0 4 0
dominik - 20 years ago 2004-08-10 16:54:34
dominik@openttd.org
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
4 files changed with 32 insertions and 21 deletions:
0 comments (0 inline, 0 general)
aircraft_gui.c
Show inline comments
 
@@ -691,30 +691,34 @@ static int GetVehicleFromAircraftDepotWn
 
	return 1; /* outside */
 
}
 

	
 
static void AircraftDepotClickAircraft(Window *w, int x, int y)
 
{
 
	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:
 
		return;
 

	
 
	case 0:
 
	case 0: // start dragging of vehicle
 
		if (v != NULL) {
 
			WP(w,traindepot_d).sel = v->index;
 
			SetWindowDirty(w);
 
			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetAircraftImage(v, 6), 4, w);
 
		}
 
		break;
 

	
 
	case -1:
 
	case -1: // show info window
 
		ShowAircraftViewWindow(v);
 
		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));
 
		break;
 

	
 
	default:
 
		NOT_REACHED();
 
	}
roadveh_gui.c
Show inline comments
 
@@ -559,32 +559,34 @@ static int GetVehicleFromRoadDepotWndPt(
 
	return 1; /* outside */
 
}
 

	
 
static void RoadDepotClickVeh(Window *w, int x, int y)
 
{
 
	Vehicle *v;
 
	int r;
 
	int mode;
 

	
 
	mode = GetVehicleFromRoadDepotWndPt(w, x, y, &v);
 
	if (mode > 0) return;
 

	
 
	r = GetVehicleFromRoadDepotWndPt(w, x, y, &v);
 
	if (r > 0) return;
 
	// share / copy orders
 
	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; }
 

	
 
	if (_thd.place_mode) { _place_clicked_vehicle = v; return; }
 
	switch (r) {
 
	case 0:
 
	switch (mode) {
 
	case 0: // start dragging of vehicle
 
		if (v != NULL) {
 
			WP(w,traindepot_d).sel = v->index;
 
			SetWindowDirty(w);
 
			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetRoadVehImage(v, 6), 4, w);
 
		}
 
		break;
 

	
 
	case -1:
 
	case -1: // show info window
 
		ShowRoadVehViewWindow(v);
 
		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));
 
		break;
 

	
 
	default:
 
		NOT_REACHED();
 
	}
ship_gui.c
Show inline comments
 
@@ -691,31 +691,35 @@ static int GetVehicleFromShipDepotWndPt(
 
	
 
}
 

	
 
static void ShipDepotClick(Window *w, int x, int y)
 
{
 
	Vehicle *v;
 
	int mode = GetVehicleFromShipDepotWndPt(w, x, y, &v);
 

	
 
	switch (GetVehicleFromShipDepotWndPt(w, x, y, &v)) {
 
	case 1:
 
	// share / copy orders
 
	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; }
 

	
 
	switch (mode) {
 
	case 1: // invalid
 
		return;
 

	
 
	case 0:
 
	case 0: // start dragging of vehicle
 
		if (v != NULL) {
 
			WP(w,traindepot_d).sel = v->index;
 
			SetWindowDirty(w);
 
			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + 
 
				GetShipImage(v, 6), 4, w);
 
		}
 
		break;
 

	
 
	case -1:
 
	case -1: // show info window
 
		ShowShipViewWindow(v);
 
		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));
 
		break;
 

	
 
	default:
 
		NOT_REACHED();
 
	}
train_gui.c
Show inline comments
 
@@ -439,35 +439,36 @@ static void TrainDepotClickTrain(Window 
 
{
 
	GetDepotVehiclePtData gdvp;
 
	int mode, sel;
 
	Vehicle *v;
 

	
 
	mode = GetVehicleFromTrainDepotWndPt(w, x, y, &gdvp);
 
	
 

	
 
	// share / copy orders
 
	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = gdvp.head; return; }
 
	
 
	v = gdvp.wagon;
 

	
 
	switch(mode) {
 
	case 0:
 
	case 0: // start dragging of vehicle
 
		sel = (int16)WP(w,traindepot_d).sel;
 
		if (sel != -1) {
 
			WP(w,traindepot_d).sel = INVALID_VEHICLE;
 
			TrainDepotMoveVehicle(v, sel, gdvp.head);
 
		} else if (v != NULL) {
 
			WP(w,traindepot_d).sel = v->index;
 
			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetTrainImage(v, 6), 4, w);
 
			SetWindowDirty(w);
 
		}
 
		break;
 

	
 
	case -1:
 
	case -1: // show info window
 
		ShowTrainViewWindow(v);
 
		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));
 
		break;
 
	}
 
}
 

	
 
static void TrainDepotWndProc(Window *w, WindowEvent *e)
0 comments (0 inline, 0 general)