Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -76,9 +76,9 @@ INSTANTIATE_POOL_METHODS(CargoPayment)
|
||||
* @param shift The amount to shift the value to right.
|
||||
* @return The shifted result
|
||||
*/
|
||||
static inline int32 BigMulS(const int32 a, const int32 b, const uint8 shift)
|
||||
static inline int32_t BigMulS(const int32_t a, const int32_t b, const uint8_t shift)
|
||||
{
|
||||
return (int32)((int64)a * (int64)b >> shift);
|
||||
return (int32_t)((int64_t)a * (int64_t)b >> shift);
|
||||
}
|
||||
|
||||
typedef std::vector<Industry *> SmallIndustryList;
|
||||
@@ -99,7 +99,7 @@ const ScoreInfo _score_info[] = {
|
||||
{ 0, 0} // SCORE_TOTAL
|
||||
};
|
||||
|
||||
int64 _score_part[MAX_COMPANIES][SCORE_END];
|
||||
int64_t _score_part[MAX_COMPANIES][SCORE_END];
|
||||
Economy _economy;
|
||||
Prices _price;
|
||||
static PriceMultipliers _price_base_multiplier;
|
||||
@@ -304,7 +304,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
|
||||
/* Skip the total */
|
||||
if (i == SCORE_TOTAL) continue;
|
||||
/* Check the score */
|
||||
s = Clamp<int64>(_score_part[owner][i], 0, _score_info[i].needed) * _score_info[i].score / _score_info[i].needed;
|
||||
s = Clamp<int64_t>(_score_part[owner][i], 0, _score_info[i].needed) * _score_info[i].score / _score_info[i].needed;
|
||||
score += s;
|
||||
total_score += _score_info[i].score;
|
||||
}
|
||||
@@ -671,13 +671,13 @@ static void CompaniesGenStatistics()
|
||||
cur_company.Change(c->index);
|
||||
|
||||
CommandCost cost(EXPENSES_PROPERTY);
|
||||
uint32 rail_total = c->infrastructure.GetRailTotal();
|
||||
uint32_t rail_total = c->infrastructure.GetRailTotal();
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt < RAILTYPE_END; rt++) {
|
||||
if (c->infrastructure.rail[rt] != 0) cost.AddCost(RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total));
|
||||
}
|
||||
cost.AddCost(SignalMaintenanceCost(c->infrastructure.signal));
|
||||
uint32 road_total = c->infrastructure.GetRoadTotal();
|
||||
uint32 tram_total = c->infrastructure.GetTramTotal();
|
||||
uint32_t road_total = c->infrastructure.GetRoadTotal();
|
||||
uint32_t tram_total = c->infrastructure.GetTramTotal();
|
||||
for (RoadType rt = ROADTYPE_BEGIN; rt < ROADTYPE_END; rt++) {
|
||||
if (c->infrastructure.road[rt] != 0) cost.AddCost(RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total));
|
||||
}
|
||||
@@ -759,7 +759,7 @@ bool AddInflation(bool check_year)
|
||||
void RecomputePrices()
|
||||
{
|
||||
/* Setup maximum loan as a rounded down multiple of LOAN_INTERVAL. */
|
||||
_economy.max_loan = ((uint64)_settings_game.difficulty.max_loan * _economy.inflation_prices >> 16) / LOAN_INTERVAL * LOAN_INTERVAL;
|
||||
_economy.max_loan = ((uint64_t)_settings_game.difficulty.max_loan * _economy.inflation_prices >> 16) / LOAN_INTERVAL * LOAN_INTERVAL;
|
||||
|
||||
/* Setup price bases */
|
||||
for (Price i = PR_BEGIN; i < PR_END; i++) {
|
||||
@@ -786,7 +786,7 @@ void RecomputePrices()
|
||||
}
|
||||
|
||||
/* Apply inflation */
|
||||
price = (int64)price * _economy.inflation_prices;
|
||||
price = (int64_t)price * _economy.inflation_prices;
|
||||
|
||||
/* Apply newgrf modifiers, remove fractional part of inflation, and normalise on medium difficulty. */
|
||||
int shift = _price_base_multiplier[i] - 16 - 3;
|
||||
@@ -812,7 +812,7 @@ void RecomputePrices()
|
||||
|
||||
/* Setup cargo payment */
|
||||
for (CargoSpec *cs : CargoSpec::Iterate()) {
|
||||
cs->current_payment = (cs->initial_payment * (int64)_economy.inflation_payment) >> 16;
|
||||
cs->current_payment = (cs->initial_payment * (int64_t)_economy.inflation_payment) >> 16;
|
||||
}
|
||||
|
||||
SetWindowClassesDirty(WC_BUILD_VEHICLE);
|
||||
@@ -975,7 +975,7 @@ Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift
|
||||
return cost;
|
||||
}
|
||||
|
||||
Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16 transit_periods, CargoID cargo_type)
|
||||
Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16_t transit_periods, CargoID cargo_type)
|
||||
{
|
||||
const CargoSpec *cs = CargoSpec::Get(cargo_type);
|
||||
if (!cs->IsValid()) {
|
||||
@@ -985,8 +985,8 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16 transit_perio
|
||||
|
||||
/* Use callback to calculate cargo profit, if available */
|
||||
if (HasBit(cs->callback_mask, CBM_CARGO_PROFIT_CALC)) {
|
||||
uint32 var18 = ClampTo<uint16_t>(dist) | (ClampTo<uint8_t>(num_pieces) << 16) | (ClampTo<uint8_t>(transit_periods) << 24);
|
||||
uint16 callback = GetCargoCallback(CBID_CARGO_PROFIT_CALC, 0, var18, cs);
|
||||
uint32_t var18 = ClampTo<uint16_t>(dist) | (ClampTo<uint8_t>(num_pieces) << 16) | (ClampTo<uint8_t>(transit_periods) << 24);
|
||||
uint16_t callback = GetCargoCallback(CBID_CARGO_PROFIT_CALC, 0, var18, cs);
|
||||
if (callback != CALLBACK_FAILED) {
|
||||
int result = GB(callback, 0, 14);
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n
|
||||
* @return Revenue for delivering cargo
|
||||
* @note The cargo is just added to the stockpile of the industry. It is due to the caller to trigger the industry's production machinery
|
||||
*/
|
||||
static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, TileIndex source_tile, uint16 periods_in_transit, Company *company, SourceType src_type, SourceID src)
|
||||
static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, TileIndex source_tile, uint16_t periods_in_transit, Company *company, SourceType src_type, SourceID src)
|
||||
{
|
||||
assert(num_pieces > 0);
|
||||
|
||||
@@ -1157,7 +1157,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
|
||||
static void TriggerIndustryProduction(Industry *i)
|
||||
{
|
||||
const IndustrySpec *indspec = GetIndustrySpec(i->type);
|
||||
uint16 callback = indspec->callback_mask;
|
||||
uint16_t callback = indspec->callback_mask;
|
||||
|
||||
i->was_cargo_delivered = true;
|
||||
|
||||
@@ -1317,7 +1317,7 @@ static uint GetLoadAmount(Vehicle *v)
|
||||
if (air_mail) load_amount = CeilDiv(load_amount, 4);
|
||||
|
||||
if (_settings_game.order.gradual_loading) {
|
||||
uint16 cb_load_amount = CALLBACK_FAILED;
|
||||
uint16_t cb_load_amount = CALLBACK_FAILED;
|
||||
if (e->GetGRF() != nullptr && e->GetGRF()->grf_version >= 8) {
|
||||
/* Use callback 36 */
|
||||
cb_load_amount = GetVehicleProperty(v, PROP_VEHICLE_LOAD_AMOUNT, CALLBACK_FAILED);
|
||||
|
Reference in New Issue
Block a user