30 #include "table/strings.h"
63 if (result.
Failed())
return;
66 TransportType transport_type = Extract<TransportType, 15, 2>(p2);
98 return a->index - b->index;
104 return a->cost - b->cost;
113 void BuildBridge(uint8 i)
120 DoCommandP(this->end_tile, this->start_tile, this->type | this->bridges->
Get(i)->index,
127 this->bridges->
Sort();
147 this->GetWidget<NWidgetCore>(
WID_BBS_CAPTION)->widget_data = (
GB(this->type, 15, 2) ==
TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION;
172 d.height += padding.height;
181 d.width += padding.width;
182 d.height += padding.height;
189 for (
int i = 0; i < (int)this->bridges->
Length(); i++) {
196 text_dim =
maxdim(text_dim,
GetStringBoundingBox(_game_mode == GM_EDITOR ? STR_SELECT_BRIDGE_SCENEDIT_INFO : STR_SELECT_BRIDGE_INFO));
200 resize->height =
max(sprite_dim.height, text_dim.height) + 2;
204 size->height = 4 * resize->height;
216 corner.x =
Clamp(_cursor.
pos.x - list->
pos_x - 5, 0, _screen.width - sm_width);
237 DrawStringMultiLine(r.left + this->bridgetext_offset, r.right, y + 2, y + this->resize.step_height,
238 _game_mode == GM_EDITOR ? STR_SELECT_BRIDGE_SCENEDIT_INFO : STR_SELECT_BRIDGE_INFO);
248 const uint8 i = keycode -
'1';
249 if (i < 9 && i < this->bridges->
Length()) {
251 this->BuildBridge(i);
264 if (i < this->bridges->
Length()) {
265 this->BuildBridge(i);
311 STR_SORT_BY_MAX_SPEED,
332 NWidget(
WWT_MATRIX, COLOUR_DARK_GREEN,
WID_BBS_BRIDGE_LIST),
SetFill(1, 0),
SetResize(0, 22),
SetMatrixDataTip(1, 0, STR_SELECT_BRIDGE_SELECTION_TOOLTIP),
SetScrollbar(
WID_BBS_SCROLLBAR),
348 _nested_build_bridge_widgets,
lengthof(_nested_build_bridge_widgets)
369 uint32 type = (transport_type << 15) | (road_rail_type << 8);
380 switch (transport_type) {
404 Money infra_cost = 0;
405 switch (transport_type) {
407 infra_cost = (bridge_len + 2) * _price[PR_BUILD_ROAD] * 2;
420 item->index = brd_type;
424 item->cost = ret.
GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->
price) >> 8) + infra_cost;
429 if (bl != NULL && bl->
Length() != 0) {