equal
deleted
inserted
replaced
450 |
450 |
451 /* for human player that builds the bridge he gets a selection to choose from bridges (DC_QUERY_COST) |
451 /* for human player that builds the bridge he gets a selection to choose from bridges (DC_QUERY_COST) |
452 * It's unnecessary to execute this command every time for every bridge. So it is done only |
452 * It's unnecessary to execute this command every time for every bridge. So it is done only |
453 * and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated |
453 * and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated |
454 */ |
454 */ |
455 if (!(flags & DC_QUERY_COST) || (IsValidPlayer(_current_player) && GetPlayer(_current_player)->is_ai)) { |
455 if (!(flags & DC_QUERY_COST) || (IsValidPlayerID(_current_player) && GetPlayer(_current_player)->is_ai)) { |
456 bridge_len += 2; // begin and end tiles/ramps |
456 bridge_len += 2; // begin and end tiles/ramps |
457 |
457 |
458 if (IsValidPlayer(_current_player) && !_is_old_ai_player) |
458 if (IsValidPlayerID(_current_player) && !_is_old_ai_player) |
459 bridge_len = CalcBridgeLenCostFactor(bridge_len); |
459 bridge_len = CalcBridgeLenCostFactor(bridge_len); |
460 |
460 |
461 cost.AddCost((int64)bridge_len * _price.build_bridge * GetBridgeSpec(bridge_type)->price >> 8); |
461 cost.AddCost((int64)bridge_len * _price.build_bridge * GetBridgeSpec(bridge_type)->price >> 8); |
462 |
462 |
463 /* Aqueducts are a little more expensive. */ |
463 /* Aqueducts are a little more expensive. */ |