src/bridge_gui.cpp
changeset 8532 ebe68d6899b6
parent 8491 97fcf662c3c3
child 8535 ef36a2eb9345
equal deleted inserted replaced
8531:00730ec6d8c8 8532:ebe68d6899b6
    24 	uint8 last_size;
    24 	uint8 last_size;
    25 	uint count;
    25 	uint count;
    26 	TileIndex start_tile;
    26 	TileIndex start_tile;
    27 	TileIndex end_tile;
    27 	TileIndex end_tile;
    28 	uint8 type;
    28 	uint8 type;
    29 	uint8 indexes[MAX_BRIDGES];
    29 	BridgeType indexes[MAX_BRIDGES];
    30 	Money costs[MAX_BRIDGES];
    30 	Money costs[MAX_BRIDGES];
    31 
    31 
    32 	BridgeData()
    32 	BridgeData()
    33 		: last_size(4)
    33 		: last_size(4)
    34 		, count(0)
    34 		, count(0)
   186 		const uint bridge_len = GetTunnelBridgeLength(start, end);
   186 		const uint bridge_len = GetTunnelBridgeLength(start, end);
   187 		/* total length of bridge */
   187 		/* total length of bridge */
   188 		const uint tot_bridgedata_len = CalcBridgeLenCostFactor(bridge_len + 2);
   188 		const uint tot_bridgedata_len = CalcBridgeLenCostFactor(bridge_len + 2);
   189 
   189 
   190 		/* loop for all bridgetypes */
   190 		/* loop for all bridgetypes */
   191 		for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) {
   191 		for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
   192 			if (CheckBridge_Stuff(bridge_type, bridge_len)) {
   192 			if (CheckBridge_Stuff(brd_type, bridge_len)) {
   193 				/* bridge is accepted, add to list */
   193 				/* bridge is accepted, add to list */
   194 				const Bridge *b = GetBridgeSpec(bridge_type);
   194 				const Bridge *b = GetBridgeSpec(brd_type);
   195 				/* Add to terraforming & bulldozing costs the cost of the
   195 				/* Add to terraforming & bulldozing costs the cost of the
   196 				 * bridge itself (not computed with DC_QUERY_COST) */
   196 				 * bridge itself (not computed with DC_QUERY_COST) */
   197 				_bridgedata.costs[j] = ret.GetCost() + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
   197 				_bridgedata.costs[j] = ret.GetCost() + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
   198 				_bridgedata.indexes[j] = bridge_type;
   198 				_bridgedata.indexes[j] = brd_type;
   199 				j++;
   199 				j++;
   200 			}
   200 			}
   201 		}
   201 		}
   202 
   202 
   203 		_bridgedata.count = j;
   203 		_bridgedata.count = j;