File diff r10677:1a6f3c7876cf → r10678:c59e6c7504cc
src/autoreplace_gui.cpp
Show inline comments
 
@@ -244,31 +244,24 @@ public:
 
		this->resize.width  = this->width;
 
		this->resize.height = this->height;
 

	
 
		this->caption_color = _local_company;
 
		this->sel_group = id_g;
 
		this->vscroll2.cap = this->vscroll.cap;   // these two are always the same
 

	
 
		this->FindWindowPlacementAndResize(desc);
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		static const StringID _vehicle_type_names[] = {
 
			STR_019F_TRAIN,
 
			STR_019C_ROAD_VEHICLE,
 
			STR_019E_SHIP,
 
			STR_019D_AIRCRAFT
 
		};
 

	
 
		if (this->update_left || this->update_right) this->GenerateLists();
 

	
 
		Company *c = GetCompany(_local_company);
 
		EngineID selected_id[2];
 
		const GroupID selected_group = this->sel_group;
 

	
 
		selected_id[0] = this->sel_engine[0];
 
		selected_id[1] = this->sel_engine[1];
 

	
 
		/* Disable the "Start Replacing" button if:
 
		 *    Either list is empty
 
		 * or The selected replacement engine has a replacement (to prevent loops)
 
@@ -278,25 +271,25 @@ public:
 
										selected_id[1] == INVALID_ENGINE ||
 
										EngineReplacementForCompany(c, selected_id[1], selected_group) != INVALID_ENGINE ||
 
										EngineReplacementForCompany(c, selected_id[0], selected_group) == selected_id[1]);
 

	
 
		/* Disable the "Stop Replacing" button if:
 
		 *   The left list (existing vehicle) is empty
 
		 *   or The selected vehicle has no replacement set up */
 
		this->SetWidgetDisabledState(RVW_WIDGET_STOP_REPLACE,
 
										selected_id[0] == INVALID_ENGINE ||
 
										!EngineHasReplacementForCompany(c, selected_id[0], selected_group));
 

	
 
		/* now the actual drawing of the window itself takes place */
 
		SetDParam(0, _vehicle_type_names[this->window_number]);
 
		SetDParam(0, STR_019F_TRAIN + this->window_number);
 

	
 
		if (this->window_number == VEH_TRAIN) {
 
			/* set on/off for renew_keep_length */
 
			SetDParam(1, c->renew_keep_length ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
 

	
 
			/* set wagon/engine button */
 
			SetDParam(2, this->wagon_btnstate ? STR_ENGINES : STR_WAGONS);
 

	
 
			/* sets the colour of that art thing */
 
			this->widget[RVW_WIDGET_TRAIN_FLUFF_LEFT].color  = _company_colours[_local_company];
 
			this->widget[RVW_WIDGET_TRAIN_FLUFF_RIGHT].color = _company_colours[_local_company];
 
		}