src/bridge_gui.cpp
branchNewGRF_ports
changeset 6720 35756db7e577
parent 6530 c43fa965e8ae
child 6725 23339968083f
equal deleted inserted replaced
6719:4cc327ad39d5 6720:35756db7e577
    20 	uint count;
    20 	uint count;
    21 	TileIndex start_tile;
    21 	TileIndex start_tile;
    22 	TileIndex end_tile;
    22 	TileIndex end_tile;
    23 	byte type;
    23 	byte type;
    24 	byte indexes[MAX_BRIDGES];
    24 	byte indexes[MAX_BRIDGES];
    25 	int32 costs[MAX_BRIDGES];
    25 	Money costs[MAX_BRIDGES];
    26 } _bridgedata;
    26 } _bridgedata;
    27 
    27 
    28 void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2)
    28 void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2)
    29 {
    29 {
    30 	if (success) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, tile);
    30 	if (success) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, tile);
   111 
   111 
   112 
   112 
   113 void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
   113 void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
   114 {
   114 {
   115 	uint j = 0;
   115 	uint j = 0;
   116 	int32 ret;
   116 	CommandCost ret;
   117 	StringID errmsg;
   117 	StringID errmsg;
   118 
   118 
   119 	DeleteWindowById(WC_BUILD_BRIDGE, 0);
   119 	DeleteWindowById(WC_BUILD_BRIDGE, 0);
   120 
   120 
   121 	_bridgedata.type = bridge_type;
   121 	_bridgedata.type = bridge_type;
   143 		for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes
   143 		for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes
   144 			if (CheckBridge_Stuff(bridge_type, bridge_len)) {
   144 			if (CheckBridge_Stuff(bridge_type, bridge_len)) {
   145 				const Bridge *b = &_bridge[bridge_type];
   145 				const Bridge *b = &_bridge[bridge_type];
   146 				// bridge is accepted, add to list
   146 				// bridge is accepted, add to list
   147 				// add to terraforming & bulldozing costs the cost of the bridge itself (not computed with DC_QUERY_COST)
   147 				// add to terraforming & bulldozing costs the cost of the bridge itself (not computed with DC_QUERY_COST)
   148 				_bridgedata.costs[j] = ret + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
   148 				_bridgedata.costs[j] = ret.GetCost() + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
   149 				_bridgedata.indexes[j] = bridge_type;
   149 				_bridgedata.indexes[j] = bridge_type;
   150 				j++;
   150 				j++;
   151 			}
   151 			}
   152 		}
   152 		}
   153 	}
   153 	}