Changeset - r24627:c6f6c14fb7c9
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-01-09 22:43:06
truebrain@openttd.org
Fix #8272: vehicle destination text colour when mousing over (#8543)

Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
1 file changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/vehicle_gui.cpp
Show inline comments
 
@@ -2800,6 +2800,7 @@ public:
 

	
 
		const Vehicle *v = Vehicle::Get(this->window_number);
 
		StringID str;
 
		TextColour text_colour = TC_FROMSTRING;
 
		if (v->vehstatus & VS_CRASHED) {
 
			str = STR_VEHICLE_STATUS_CRASHED;
 
		} else if (v->type != VEH_AIRCRAFT && v->breakdown_ctr == 1) { // check for aircraft necessary?
 
@@ -2824,6 +2825,13 @@ public:
 
		} else if (v->type == VEH_AIRCRAFT && HasBit(Aircraft::From(v)->flags, VAF_DEST_TOO_FAR) && !v->current_order.IsType(OT_LOADING)) {
 
			str = STR_VEHICLE_STATUS_AIRCRAFT_TOO_FAR;
 
		} else { // vehicle is in a "normal" state, show current order
 
			if (mouse_over_start_stop) {
 
				if (v->vehstatus & VS_STOPPED) {
 
					text_colour = TC_RED | TC_FORCED;
 
				} else if (v->type == VEH_TRAIN && HasBit(Train::From(v)->flags, VRF_TRAIN_STUCK) && !v->current_order.IsType(OT_LOADING)) {
 
					text_colour = TC_ORANGE | TC_FORCED;
 
				}
 
			}
 
			switch (v->current_order.GetType()) {
 
				case OT_GOTO_STATION: {
 
					SetDParam(0, v->current_order.GetDestination());
 
@@ -2890,7 +2898,7 @@ public:
 
		int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING;
 
		int lowered = this->IsWidgetLowered(WID_VV_START_STOP) ? 1 : 0;
 
		DrawSprite(image, PAL_NONE, image_left + lowered, r.top + WD_IMGBTN_TOP + lowered);
 
		DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, TC_FROMSTRING, SA_HOR_CENTER);
 
		DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, text_colour, SA_HOR_CENTER);
 
	}
 

	
 
	void OnClick(Point pt, int widget, int click_count) override
0 comments (0 inline, 0 general)