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:
@@ -47,25 +47,25 @@ INSTANTIATE_NEWGRF_CLASS_METHODS(RoadStopClass, RoadStopSpec, RoadStopClassID, R
|
||||
|
||||
static const uint NUM_ROADSTOPSPECS_PER_STATION = 63; ///< Maximum number of parts per station.
|
||||
|
||||
uint32 RoadStopScopeResolver::GetRandomBits() const
|
||||
uint32_t RoadStopScopeResolver::GetRandomBits() const
|
||||
{
|
||||
if (this->st == nullptr) return 0;
|
||||
|
||||
uint32 bits = this->st->random_bits;
|
||||
uint32_t bits = this->st->random_bits;
|
||||
if (this->tile != INVALID_TILE && Station::IsExpected(this->st)) {
|
||||
bits |= Station::From(this->st)->GetRoadStopRandomBits(this->tile) << 16;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
uint32 RoadStopScopeResolver::GetTriggers() const
|
||||
uint32_t RoadStopScopeResolver::GetTriggers() const
|
||||
{
|
||||
return this->st == nullptr ? 0 : this->st->waiting_triggers;
|
||||
}
|
||||
|
||||
uint32 RoadStopScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
|
||||
uint32_t RoadStopScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const
|
||||
{
|
||||
auto get_road_type_variable = [&](RoadTramType rtt) -> uint32 {
|
||||
auto get_road_type_variable = [&](RoadTramType rtt) -> uint32_t {
|
||||
RoadType rt;
|
||||
if (this->tile == INVALID_TILE) {
|
||||
rt = (GetRoadTramType(this->roadtype) == rtt) ? this->roadtype : INVALID_ROADTYPE;
|
||||
@@ -144,10 +144,10 @@ uint32 RoadStopScopeResolver::GetVariable(byte variable, uint32 parameter, bool
|
||||
|
||||
if (!IsRoadStopTile(nearby_tile)) return 0xFFFFFFFF;
|
||||
|
||||
uint32 grfid = this->st->roadstop_speclist[GetCustomRoadStopSpecIndex(this->tile)].grfid;
|
||||
uint32_t grfid = this->st->roadstop_speclist[GetCustomRoadStopSpecIndex(this->tile)].grfid;
|
||||
bool same_orientation = GetStationGfx(this->tile) == GetStationGfx(nearby_tile);
|
||||
bool same_station = GetStationIndex(nearby_tile) == this->st->index;
|
||||
uint32 res = GetStationGfx(nearby_tile) << 12 | !same_orientation << 11 | !!same_station << 10;
|
||||
uint32_t res = GetStationGfx(nearby_tile) << 12 | !same_orientation << 11 | !!same_station << 10;
|
||||
StationType type = GetStationType(nearby_tile);
|
||||
if (type == STATION_TRUCK) res |= (1 << 16);
|
||||
if (type == this->type) SetBit(res, 20);
|
||||
@@ -189,8 +189,8 @@ const SpriteGroup *RoadStopResolverObject::ResolveReal(const RealSpriteGroup *gr
|
||||
return group->loading[0];
|
||||
}
|
||||
|
||||
RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8 view,
|
||||
CallbackID callback, uint32 param1, uint32 param2)
|
||||
RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view,
|
||||
CallbackID callback, uint32_t param1, uint32_t param2)
|
||||
: ResolverObject(roadstopspec->grf_prop.grffile, callback, param1, param2), roadstop_scope(*this, st, roadstopspec, tile, roadtype, type, view)
|
||||
{
|
||||
|
||||
@@ -242,7 +242,7 @@ TownScopeResolver* RoadStopResolverObject::GetTown()
|
||||
return this->town_scope;
|
||||
}
|
||||
|
||||
uint16 GetRoadStopCallback(CallbackID callback, uint32 param1, uint32 param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8 view)
|
||||
uint16_t GetRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view)
|
||||
{
|
||||
RoadStopResolverObject object(roadstopspec, st, tile, roadtype, type, view, callback, param1, param2);
|
||||
return object.ResolveCallback();
|
||||
@@ -305,7 +305,7 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec,
|
||||
}
|
||||
|
||||
/** Wrapper for animation control, see GetRoadStopCallback. */
|
||||
uint16 GetAnimRoadStopCallback(CallbackID callback, uint32 param1, uint32 param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, int extra_data)
|
||||
uint16_t GetAnimRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, int extra_data)
|
||||
{
|
||||
return GetRoadStopCallback(callback, param1, param2, roadstopspec, st, tile, INVALID_ROADTYPE, GetStationType(tile), GetStationGfx(tile));
|
||||
}
|
||||
@@ -341,7 +341,7 @@ void TriggerRoadStopAnimation(BaseStation *st, TileIndex trigger_tile, StationAn
|
||||
* to bother with any further processing. */
|
||||
if (!HasBit(st->cached_roadstop_anim_triggers, trigger)) return;
|
||||
|
||||
uint16 random_bits = Random();
|
||||
uint16_t random_bits = Random();
|
||||
auto process_tile = [&](TileIndex cur_tile) {
|
||||
const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
|
||||
if (ss != nullptr && HasBit(ss->animation.triggers, trigger)) {
|
||||
@@ -351,7 +351,7 @@ void TriggerRoadStopAnimation(BaseStation *st, TileIndex trigger_tile, StationAn
|
||||
} else {
|
||||
cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
|
||||
}
|
||||
RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIM_START_STOP, ss, st, cur_tile, (random_bits << 16) | Random(), (uint8)trigger | (cargo << 8));
|
||||
RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIM_START_STOP, ss, st, cur_tile, (random_bits << 16) | Random(), (uint8_t)trigger | (cargo << 8));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -383,7 +383,7 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri
|
||||
|
||||
SetBit(st->waiting_triggers, trigger);
|
||||
|
||||
uint32 whole_reseed = 0;
|
||||
uint32_t whole_reseed = 0;
|
||||
|
||||
CargoTypes empty_mask = 0;
|
||||
if (trigger == RSRT_CARGO_TAKEN) {
|
||||
@@ -395,7 +395,7 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri
|
||||
}
|
||||
}
|
||||
|
||||
uint32 used_triggers = 0;
|
||||
uint32_t used_triggers = 0;
|
||||
auto process_tile = [&](TileIndex cur_tile) {
|
||||
const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
|
||||
if (ss == nullptr) return;
|
||||
@@ -415,13 +415,13 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri
|
||||
|
||||
used_triggers |= object.used_triggers;
|
||||
|
||||
uint32 reseed = object.GetReseedSum();
|
||||
uint32_t reseed = object.GetReseedSum();
|
||||
if (reseed != 0) {
|
||||
whole_reseed |= reseed;
|
||||
reseed >>= 16;
|
||||
|
||||
/* Set individual tile random bits */
|
||||
uint8 random_bits = st->GetRoadStopRandomBits(cur_tile);
|
||||
uint8_t random_bits = st->GetRoadStopRandomBits(cur_tile);
|
||||
random_bits &= ~reseed;
|
||||
random_bits |= Random() & reseed;
|
||||
st->SetRoadStopRandomBits(cur_tile, random_bits);
|
||||
|
Reference in New Issue
Block a user