132 |
132 |
133 if (CmdFailed(ret)) { |
133 if (CmdFailed(ret)) { |
134 errmsg = _error_message; |
134 errmsg = _error_message; |
135 } else { |
135 } else { |
136 // check which bridges can be built |
136 // check which bridges can be built |
137 int bridge_len; // length of the middle parts of the bridge |
137 int bridge_len; // length of the middle parts of the bridge |
138 int tot_bridgedata_len; // total length of bridge |
138 int tot_bridgedata_len; // total length of bridge |
139 |
139 |
140 // get absolute bridge length |
140 // get absolute bridge length |
141 bridge_len = GetBridgeLength(start, end); |
141 bridge_len = GetBridgeLength(start, end); |
142 tot_bridgedata_len = bridge_len + 2; |
142 tot_bridgedata_len = bridge_len + 2; |
143 |
143 |
144 tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len); |
144 tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len); |
145 |
145 |
146 for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes |
146 for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes |
147 if (CheckBridge_Stuff(bridge_type, bridge_len)) { |
147 if (CheckBridge_Stuff(bridge_type, bridge_len)) { |
148 const Bridge *b = &_bridge[bridge_type]; |
148 const Bridge *b = &_bridge[bridge_type]; |
149 // bridge is accepted, add to list |
149 // bridge is accepted, add to list |
150 // add to terraforming & bulldozing costs the cost of the bridge itself (not computed with DC_QUERY_COST) |
150 // add to terraforming & bulldozing costs the cost of the bridge itself (not computed with DC_QUERY_COST) |
151 _bridgedata.costs[j] = ret + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8); |
151 _bridgedata.costs[j] = ret + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8); |