File diff r16430:b3f65f9bc976 → r16431:ec558deca9d7
src/industry_gui.cpp
Show inline comments
 
@@ -1645,40 +1645,40 @@ struct CargoesField {
 
				GfxDrawLine(xpos,  ypos1, xpos2, ypos1, INDUSTRY_LINE_COLOUR);
 
				GfxDrawLine(xpos,  ypos1, xpos,  ypos2, INDUSTRY_LINE_COLOUR);
 
				GfxDrawLine(xpos,  ypos2, xpos2, ypos2, INDUSTRY_LINE_COLOUR);
 
				GfxDrawLine(xpos2, ypos1, xpos2, ypos2, INDUSTRY_LINE_COLOUR);
 
				ypos += (normal_height - FONT_HEIGHT_NORMAL) / 2;
 
				if (this->u.industry.ind_type < NUM_INDUSTRYTYPES) {
 
					const IndustrySpec *indsp = GetIndustrySpec(this->u.industry.ind_type);
 
					SetDParam(0, indsp->name);
 
					DrawString(xpos, xpos2, ypos, STR_JUST_STRING, TC_WHITE, SA_HOR_CENTER);
 

	
 
					/* Draw the industry legend. */
 
					int blob_left, blob_right;
 
					if (_dynlang.text_dir == TD_RTL) {
 
					if (_current_text_dir == TD_RTL) {
 
						blob_right = xpos2 - BLOB_DISTANCE;
 
						blob_left  = blob_right - BLOB_WIDTH;
 
					} else {
 
						blob_left  = xpos + BLOB_DISTANCE;
 
						blob_right = blob_left + BLOB_WIDTH;
 
					}
 
					GfxFillRect(blob_left,     ypos2 - BLOB_DISTANCE - BLOB_HEIGHT,     blob_right,     ypos2 - BLOB_DISTANCE,     0); // Border
 
					GfxFillRect(blob_left + 1, ypos2 - BLOB_DISTANCE - BLOB_HEIGHT + 1, blob_right - 1, ypos2 - BLOB_DISTANCE - 1, indsp->map_colour);
 
				} else {
 
					DrawString(xpos, xpos2, ypos, STR_INDUSTRY_CARGOES_HOUSES, TC_FROMSTRING, SA_HOR_CENTER);
 
				}
 

	
 
				/* Draw the other_produced/other_accepted cargoes. */
 
				const CargoID *other_right, *other_left;
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					other_right = this->u.industry.other_accepted;
 
					other_left  = this->u.industry.other_produced;
 
				} else {
 
					other_right = this->u.industry.other_produced;
 
					other_left  = this->u.industry.other_accepted;
 
				}
 
				ypos1 += VERT_CARGO_EDGE;
 
				for (uint i = 0; i < MAX_CARGOES; i++) {
 
					if (other_right[i] != INVALID_CARGO) {
 
						const CargoSpec *csp = CargoSpec::Get(other_right[i]);
 
						int xp = xpos + industry_width + CARGO_STUB_WIDTH;
 
						DrawHorConnection(xpos + industry_width, xp - 1, ypos1, csp);
 
@@ -1704,25 +1704,25 @@ struct CargoesField {
 
					if (this->u.cargo.top_end) GfxDrawLine(colpos, top - 1, colpos + HOR_CARGO_WIDTH - 1, top - 1, CARGO_LINE_COLOUR);
 
					if (this->u.cargo.bottom_end) GfxDrawLine(colpos, bot + 1, colpos + HOR_CARGO_WIDTH - 1, bot + 1, CARGO_LINE_COLOUR);
 
					GfxDrawLine(colpos, top, colpos, bot, CARGO_LINE_COLOUR);
 
					colpos++;
 
					const CargoSpec *csp = CargoSpec::Get(this->u.cargo.vertical_cargoes[i]);
 
					GfxFillRect(colpos, top, colpos + HOR_CARGO_WIDTH - 2, bot, csp->legend_colour, FILLRECT_OPAQUE);
 
					colpos += HOR_CARGO_WIDTH - 2;
 
					GfxDrawLine(colpos, top, colpos, bot, CARGO_LINE_COLOUR);
 
					colpos += 1 + HOR_CARGO_SPACE;
 
				}
 

	
 
				const CargoID *hor_left, *hor_right;
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					hor_left  = this->u.cargo.cust_cargoes;
 
					hor_right = this->u.cargo.supp_cargoes;
 
				} else {
 
					hor_left  = this->u.cargo.supp_cargoes;
 
					hor_right = this->u.cargo.cust_cargoes;
 
				}
 
				ypos += VERT_CARGO_EDGE + VERT_INTER_INDUSTRY_SPACE / 2;
 
				for (uint i = 0; i < MAX_CARGOES; i++) {
 
					if (hor_left[i] != INVALID_CARGO) {
 
						int col = hor_left[i];
 
						int dx = 0;
 
						const CargoSpec *csp = CargoSpec::Get(this->u.cargo.vertical_cargoes[col]);
 
@@ -2425,25 +2425,25 @@ struct IndustryCargoesWindow : public Wi
 

	
 
		int left_pos = WD_FRAMERECT_LEFT;
 
		if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::CARGO_FIELD_WIDTH) / 2;
 
		int last_column = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2;
 

	
 
		const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL);
 
		int vpos = -this->vscroll->GetPosition() * nwp->resize_y;
 
		for (uint i = 0; i < this->fields.Length(); i++) {
 
			int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
 
			if (vpos + row_height >= 0) {
 
				int xpos = left_pos;
 
				int col, dir;
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					col = last_column;
 
					dir = -1;
 
				} else {
 
					col = 0;
 
					dir = 1;
 
				}
 
				while (col >= 0 && col <= last_column) {
 
					this->fields[i].columns[col].Draw(xpos, vpos);
 
					xpos += (col & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width;
 
					col += dir;
 
				}
 
			}
 
@@ -2481,25 +2481,25 @@ struct IndustryCargoesWindow : public Wi
 
		for (column = 0; column <= 5; column++) {
 
			int width = (column & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width;
 
			if (pt.x < xpos + width) break;
 
			xpos += width;
 
		}
 
		int num_columns = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2;
 
		if (column > num_columns) return false;
 
		xpos = pt.x - xpos;
 

	
 
		/* Return both positions, compensating for RTL languages (which works due to the equal symmetry in both displays). */
 
		fieldxy->y = row;
 
		xy->y = vpos;
 
		if (_dynlang.text_dir == TD_RTL) {
 
		if (_current_text_dir == TD_RTL) {
 
			fieldxy->x = num_columns - column;
 
			xy->x = ((column & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width) - xpos;
 
		} else {
 
			fieldxy->x = column;
 
			xy->x = xpos;
 
		}
 
		return true;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {