Fix compilation on MSVC due to ambiguous overload:

OverflowSafeInt<T,T_MAX,T_MIN>::operator /
This commit is contained in:
Jonathan G Rennison
2015-11-01 11:28:17 +00:00
parent 938babfe7b
commit def0347ea8

View File

@@ -123,7 +123,9 @@ void VehicleServiceInDepot(Vehicle *v)
NOT_REACHED(); NOT_REACHED();
} }
assert(type != INVALID_EXPENSES); assert(type != INVALID_EXPENSES);
Money repair_cost = (v->breakdowns_since_last_service * v->repair_cost / _settings_game.vehicle.repair_cost) + 1;
// The static cast is to fix compilation on (old) MSVC as the overload for OverflowSafeInt operator / is ambiguous.
Money repair_cost = (v->breakdowns_since_last_service * v->repair_cost / static_cast<uint>(_settings_game.vehicle.repair_cost)) + 1;
CommandCost cost(type, repair_cost); CommandCost cost(type, repair_cost);
v->First()->profit_this_year -= cost.GetCost() << 8; v->First()->profit_this_year -= cost.GetCost() << 8;
SubtractMoneyFromCompany(cost); SubtractMoneyFromCompany(cost);