Changeset - r13436:8c37cd6574ae
[Not reviewed]
master
0 5 0
rubidium - 15 years ago 2009-11-02 16:07:09
rubidium@openttd.org
(svn r17955) -Codechange: s/SPR_PLAYER_ICON/SPR_COMPANY_ICON/
5 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -102,25 +102,25 @@ void SetLocalCompany(CompanyID new_compa
 
}
 

	
 
uint16 GetDrawStringCompanyColour(CompanyID company)
 
{
 
	/* Get the colour for DrawString-subroutines which matches the colour
 
	 * of the company */
 
	if (!Company::IsValidID(company)) return _colour_gradient[COLOUR_WHITE][4] | IS_PALETTE_COLOUR;
 
	return (_colour_gradient[_company_colours[company]][4]) | IS_PALETTE_COLOUR;
 
}
 

	
 
void DrawCompanyIcon(CompanyID c, int x, int y)
 
{
 
	DrawSprite(SPR_PLAYER_ICON, COMPANY_SPRITE_COLOUR(c), x, y);
 
	DrawSprite(SPR_COMPANY_ICON, COMPANY_SPRITE_COLOUR(c), x, y);
 
}
 

	
 
/**
 
 * Checks whether a company manager's face is a valid encoding.
 
 * Unused bits are not enforced to be 0.
 
 * @param cmf the fact to check
 
 * @return true if and only if the face is valid
 
 */
 
bool IsValidCompanyManagerFace(CompanyManagerFace cmf)
 
{
 
	if (!AreCompanyManagerFaceBitsValid(cmf, CMFV_GEN_ETHN, GE_WM)) return false;
 

	
src/graph_gui.cpp
Show inline comments
 
@@ -1047,25 +1047,25 @@ struct PerformanceRatingDetailWindow : W
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		/* No need to draw when there's nothing to draw */
 
		if (this->company == INVALID_COMPANY) return;
 

	
 
		if (IsInsideMM(widget, PRW_COMPANY_FIRST, PRW_COMPANY_LAST + 1)) {
 
			if (this->IsWidgetDisabled(widget)) return;
 
			CompanyID cid = (CompanyID)(widget - PRW_COMPANY_FIRST);
 
			int offset = (cid == this->company) ? 1 : 0;
 
			Dimension sprite_size = GetSpriteSize(SPR_PLAYER_ICON);
 
			Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
 
			DrawCompanyIcon(cid, (r.left + r.right - sprite_size.width) / 2 + offset, (r.top + r.bottom - sprite_size.height) / 2 + offset);
 
			return;
 
		}
 

	
 
		if (!IsInsideMM(widget, PRW_SCORE_FIRST, PRW_SCORE_LAST + 1)) return;
 

	
 
		ScoreID score_type = (ScoreID)(widget - PRW_SCORE_FIRST);
 

	
 
			/* The colours used to show how the progress is going */
 
		int colour_done = _colour_gradient[COLOUR_GREEN][4];
 
		int colour_notdone = _colour_gradient[COLOUR_RED][4];
 

	
 
@@ -1213,25 +1213,25 @@ static NWidgetBase *MakePerformanceDetai
 
 * Make a number of rows with button-like graphics, for enabling/disabling each company.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @return Panel with rows of company buttons.
 
 * @postcond \c *biggest_index contains the largest used index in the tree.
 
 */
 
static NWidgetBase *MakeCompanyButtonRows(int *biggest_index)
 
{
 
	static const int MAX_LENGTH = 8; // Maximal number of company buttons in one row.
 
	NWidgetVertical *vert = NULL; // Storage for all rows.
 
	NWidgetHorizontal *hor = NULL; // Storage for buttons in one row.
 
	int hor_length = 0;
 

	
 
	Dimension sprite_size = GetSpriteSize(SPR_PLAYER_ICON);
 
	Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
 
	sprite_size.width  += WD_MATRIX_LEFT + WD_MATRIX_RIGHT;
 
	sprite_size.height += WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1; // 1 for the 'offset' of being pressed
 

	
 
	for (int widnum = PRW_COMPANY_FIRST; widnum <= PRW_COMPANY_LAST; widnum++) {
 
		/* Ensure there is room in 'hor' for another button. */
 
		if (hor_length == MAX_LENGTH) {
 
			if (vert == NULL) vert = new NWidgetVertical();
 
			vert->Add(hor);
 
			hor = NULL;
 
			hor_length = 0;
 
		}
 
		if (hor == NULL) {
src/network/network_gui.cpp
Show inline comments
 
@@ -2029,25 +2029,25 @@ struct NetworkClientListWindow : Window 
 
		if (diff != 0) {
 
			ResizeWindow(this, 0, diff);
 
			return false;
 
		}
 
		return true;
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
 
	{
 
		if (widget != CLW_PANEL) return;
 

	
 
		this->server_client_width = max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT;
 
		this->company_icon_width = GetSpriteSize(SPR_PLAYER_ICON).width + WD_FRAMERECT_LEFT;
 
		this->company_icon_width = GetSpriteSize(SPR_COMPANY_ICON).width + WD_FRAMERECT_LEFT;
 

	
 
		uint width = 200; // Default width
 
		const NetworkClientInfo *ci;
 
		FOR_ALL_CLIENT_INFOS(ci) {
 
			width = max(width, GetStringBoundingBox(ci->client_name).width);
 
		}
 

	
 
		size->width = WD_FRAMERECT_LEFT + this->server_client_width + this->company_icon_width + WD_FRAMERECT_RIGHT;
 
	}
 

	
 
	virtual void OnPaint()
 
	{
src/signs_gui.cpp
Show inline comments
 
@@ -154,27 +154,27 @@ struct SignListWindow : Window, SignList
 
			ScrollMainWindowToTile(TileVirtXY(si->x, si->y));
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
 
	{
 
		if (widget == SLW_LIST) {
 
			Dimension spr_dim = GetSpriteSize(SPR_PLAYER_ICON);
 
			Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON);
 
			this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
 
			resize->height = max<uint>(FONT_HEIGHT_NORMAL, GetSpriteSize(SPR_PLAYER_ICON).height);
 
			resize->height = max<uint>(FONT_HEIGHT_NORMAL, GetSpriteSize(SPR_COMPANY_ICON).height);
 
			Dimension d = {this->text_offset + MAX_LENGTH_SIGN_NAME_PIXELS + WD_FRAMETEXT_RIGHT, WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM};
 
			*size = maxdim(*size, d);
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		if (data == 0) { // New or deleted sign.
 
			this->signs.ForceRebuild();
 
			this->BuildSignsList();
 
			this->SetWidgetDirty(SLW_CAPTION);
 
			this->vscroll.SetCount(this->signs.Length());
src/table/sprites.h
Show inline comments
 
@@ -245,25 +245,25 @@ enum Sprites {
 

	
 
	/* Not really a sprite, but an empty bounding box. Used to construct bounding boxes, that help sorting the sprites, but do not have a sprite associated. */
 
	SPR_EMPTY_BOUNDING_BOX = SPR_FLAGS_BASE + FLAGS_SPRITE_COUNT,
 
	EMPTY_BOUNDING_BOX_SPRITE_COUNT = 1,
 

	
 
	/* From where can we start putting NewGRFs? */
 
	SPR_NEWGRFS_BASE = SPR_EMPTY_BOUNDING_BOX + EMPTY_BOUNDING_BOX_SPRITE_COUNT,
 

	
 
	/* Manager face sprites */
 
	SPR_GRADIENT = 874, // background gradient behind manager face
 

	
 
	/* Icon showing company colour. */
 
	SPR_PLAYER_ICON = 747,
 
	SPR_COMPANY_ICON = 747,
 

	
 
	/* is itself no foundation sprite, because tileh 0 has no foundation */
 
	SPR_FOUNDATION_BASE = 989,
 

	
 
	/* Shadow cell */
 
	SPR_SHADOW_CELL = 1004,
 

	
 
	/* Unmovables spritenumbers */
 
	SPR_UNMOVABLE_TRANSMITTER   = 2601,
 
	SPR_UNMOVABLE_LIGHTHOUSE    = 2602,
 
	SPR_TINYHQ_NORTH            = 2603,
 
	SPR_TINYHQ_EAST             = 2604,
0 comments (0 inline, 0 general)