File diff r23519:04e2cd195801 → r23520:20bbc807b0eb
src/bridge_gui.cpp
Show inline comments
 
@@ -150,13 +150,13 @@ public:
 
		this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2));
 
		this->bridges->SetListing(this->last_sorting);
 
		this->bridges->SetSortFuncs(this->sorter_funcs);
 
		this->bridges->NeedResort();
 
		this->SortBridgeList();
 

	
 
		this->vscroll->SetCount(bl->Length());
 
		this->vscroll->SetCount(bl->size());
 
	}
 

	
 
	~BuildBridgeWindow()
 
	{
 
		this->last_sorting = this->bridges->GetListing();
 

	
 
@@ -183,13 +183,13 @@ public:
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
			case WID_BBS_BRIDGE_LIST: {
 
				Dimension sprite_dim = {0, 0}; // Biggest bridge sprite dimension
 
				Dimension text_dim   = {0, 0}; // Biggest text dimension
 
				for (int i = 0; i < (int)this->bridges->Length(); i++) {
 
				for (int i = 0; i < (int)this->bridges->size(); i++) {
 
					const BridgeSpec *b = this->bridges->Get(i)->spec;
 
					sprite_dim = maxdim(sprite_dim, GetSpriteSize(b->sprite));
 

	
 
					SetDParam(2, this->bridges->Get(i)->cost);
 
					SetDParam(1, b->speed);
 
					SetDParam(0, b->material);
 
@@ -223,13 +223,13 @@ public:
 
			case WID_BBS_DROPDOWN_ORDER:
 
				this->DrawSortButtonState(widget, this->bridges->IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
				break;
 

	
 
			case WID_BBS_BRIDGE_LIST: {
 
				uint y = r.top;
 
				for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < (int)this->bridges->Length(); i++) {
 
				for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < (int)this->bridges->size(); i++) {
 
					const BridgeSpec *b = this->bridges->Get(i)->spec;
 

	
 
					SetDParam(2, this->bridges->Get(i)->cost);
 
					SetDParam(1, b->speed);
 
					SetDParam(0, b->material);
 

	
 
@@ -243,13 +243,13 @@ public:
 
		}
 
	}
 

	
 
	EventState OnKeyPress(WChar key, uint16 keycode) override
 
	{
 
		const uint8 i = keycode - '1';
 
		if (i < 9 && i < this->bridges->Length()) {
 
		if (i < 9 && i < this->bridges->size()) {
 
			/* Build the requested bridge */
 
			this->BuildBridge(i);
 
			delete this;
 
			return ES_HANDLED;
 
		}
 
		return ES_NOT_HANDLED;
 
@@ -258,13 +258,13 @@ public:
 
	void OnClick(Point pt, int widget, int click_count) override
 
	{
 
		switch (widget) {
 
			default: break;
 
			case WID_BBS_BRIDGE_LIST: {
 
				uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BBS_BRIDGE_LIST);
 
				if (i < this->bridges->Length()) {
 
				if (i < this->bridges->size()) {
 
					this->BuildBridge(i);
 
					delete this;
 
				}
 
				break;
 
			}
 

	
 
@@ -423,13 +423,13 @@ void ShowBuildBridgeWindow(TileIndex sta
 
				 * bridge itself (not computed with DC_QUERY_COST) */
 
				item->cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->price) >> 8) + infra_cost;
 
			}
 
		}
 
	}
 

	
 
	if (bl != NULL && bl->Length() != 0) {
 
	if (bl != NULL && bl->size() != 0) {
 
		new BuildBridgeWindow(&_build_bridge_desc, start, end, type, bl);
 
	} else {
 
		delete bl;
 
		ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, WL_INFO, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
 
	}
 
}