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:
Rubidium
2023-05-08 19:01:06 +02:00
committed by rubidium42
parent 4f4810dc28
commit eaae0bb5e7
564 changed files with 4561 additions and 4561 deletions

View File

@@ -160,7 +160,7 @@
{
EnforceDeityMode(false);
EnforcePrecondition(false, IsValidTown(town_id));
uint16 growth_rate;
uint16_t growth_rate;
switch (days_between_town_growth) {
case TOWN_GROWTH_NORMAL:
growth_rate = 0;
@@ -206,7 +206,7 @@
if (!IsValidTown(town_id)) return false;
const Town *t = ::Town::Get(town_id);
return ((uint32)GetDistanceSquareToTile(town_id, tile) <= t->cache.squared_town_zone_radius[0]);
return ((uint32_t)GetDistanceSquareToTile(town_id, tile) <= t->cache.squared_town_zone_radius[0]);
}
/* static */ bool ScriptTown::HasStatue(TownID town_id)
@@ -243,7 +243,7 @@
EnforceCompanyModeValid(ScriptCompany::COMPANY_INVALID);
if (!IsValidTown(town_id)) return ScriptCompany::COMPANY_INVALID;
return (ScriptCompany::CompanyID)(int8)::Town::Get(town_id)->exclusivity;
return (ScriptCompany::CompanyID)(int8_t)::Town::Get(town_id)->exclusivity;
}
/* static */ SQInteger ScriptTown::GetExclusiveRightsDuration(TownID town_id)
@@ -302,7 +302,7 @@
text = name->GetDecodedText();
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_TOWN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
}
uint32 townnameparts;
uint32_t townnameparts;
if (!GenerateTownName(ScriptObject::GetRandomizer(), &townnameparts)) {
ScriptObject::SetLastError(ScriptError::ERR_NAME_IS_NOT_UNIQUE);
return false;
@@ -357,7 +357,7 @@
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
const Town *t = ::Town::Get(town_id);
int16 new_rating = Clamp(t->ratings[company] + delta, RATING_MINIMUM, RATING_MAXIMUM);
int16_t new_rating = Clamp(t->ratings[company] + delta, RATING_MINIMUM, RATING_MAXIMUM);
if (new_rating == t->ratings[company]) return false;
return ScriptObject::Command<CMD_TOWN_RATING>::Do(town_id, (::CompanyID)company_id, new_rating);