src/order_gui.cpp
branchcpp_gui
changeset 6251 cd413fa2e252
parent 6250 5135b200b376
child 6253 23983700e3d7
equal deleted inserted replaced
6250:5135b200b376 6251:cd413fa2e252
   355 }
   355 }
   356 
   356 
   357 static void OrderClick_Goto(Window *w, const Vehicle *v)
   357 static void OrderClick_Goto(Window *w, const Vehicle *v)
   358 {
   358 {
   359 	w->InvalidateWidget(ORDER_WIDGET_GOTO);
   359 	w->InvalidateWidget(ORDER_WIDGET_GOTO);
   360 	ToggleWidgetLoweredState(w, ORDER_WIDGET_GOTO);
   360 	w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
   361 	if (IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) {
   361 	if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
   362 		_place_clicked_vehicle = NULL;
   362 		_place_clicked_vehicle = NULL;
   363 		SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, 1, w);
   363 		SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, 1, w);
   364 	} else {
   364 	} else {
   365 		ResetObjectToPlace();
   365 		ResetObjectToPlace();
   366 	}
   366 	}
   546 	case WE_PLACE_OBJ: {
   546 	case WE_PLACE_OBJ: {
   547 		OrdersPlaceObj(GetVehicle(w->window_number), e->we.place.tile, w);
   547 		OrdersPlaceObj(GetVehicle(w->window_number), e->we.place.tile, w);
   548 	} break;
   548 	} break;
   549 
   549 
   550 	case WE_ABORT_PLACE_OBJ: {
   550 	case WE_ABORT_PLACE_OBJ: {
   551 		RaiseWindowWidget(w, ORDER_WIDGET_GOTO);
   551 		w->RaiseWidget(ORDER_WIDGET_GOTO);
   552 		w->InvalidateWidget( ORDER_WIDGET_GOTO);
   552 		w->InvalidateWidget( ORDER_WIDGET_GOTO);
   553 	} break;
   553 	} break;
   554 
   554 
   555 	// check if a vehicle in a depot was clicked..
   555 	// check if a vehicle in a depot was clicked..
   556 	case WE_MOUSELOOP: {
   556 	case WE_MOUSELOOP: {
   561 		 * This is because of all open order windows WE_MOUSELOOP is called
   561 		 * This is because of all open order windows WE_MOUSELOOP is called
   562 		 * and if you have 3 windows open, and this check is not done
   562 		 * and if you have 3 windows open, and this check is not done
   563 		 * the order is copied to the last open window instead of the
   563 		 * the order is copied to the last open window instead of the
   564 		 * one where GOTO is enabled
   564 		 * one where GOTO is enabled
   565 		 */
   565 		 */
   566 		if (v != NULL && IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) {
   566 		if (v != NULL && w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
   567 			_place_clicked_vehicle = NULL;
   567 			_place_clicked_vehicle = NULL;
   568 			HandleOrderVehClick(GetVehicle(w->window_number), v, w);
   568 			HandleOrderVehClick(GetVehicle(w->window_number), v, w);
   569 		}
   569 		}
   570 	} break;
   570 	} break;
   571 
   571 
   576 
   576 
   577 	case WE_TIMEOUT: { // handle button unclick ourselves...
   577 	case WE_TIMEOUT: { // handle button unclick ourselves...
   578 		// unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent'
   578 		// unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent'
   579 		uint i;
   579 		uint i;
   580 		for (i = 0; i < w->widget_count; i++) {
   580 		for (i = 0; i < w->widget_count; i++) {
   581 			if (IsWindowWidgetLowered(w, i) && i != ORDER_WIDGET_GOTO) {
   581 			if (w->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) {
   582 				RaiseWindowWidget(w, i);
   582 				w->RaiseWidget(i);
   583 				w->InvalidateWidget(i);
   583 				w->InvalidateWidget(i);
   584 			}
   584 			}
   585 		}
   585 		}
   586 	} break;
   586 	} break;
   587 	}
   587 	}