Adding of _t to (u)int types, and WChar to char32_t

See: eaae0bb5e
This commit is contained in:
Jonathan G Rennison
2024-01-07 16:41:53 +00:00
parent 55d78a23be
commit 97e6f3062e
655 changed files with 7555 additions and 7555 deletions

View File

@@ -44,7 +44,7 @@
#include "safeguards.h"
static const uint16 _roadveh_images[] = {
static const uint16_t _roadveh_images[] = {
0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
0xD24, 0xD1C, 0xD2C, 0xD04, 0xD1C, 0xD24, 0xD6C, 0xD74,
0xD7C, 0xC14, 0xC1C, 0xC24, 0xC2C, 0xC34, 0xC3C, 0xC4C,
@@ -55,7 +55,7 @@ static const uint16 _roadveh_images[] = {
0xC5C, 0xC64, 0xC6C, 0xC74, 0xC84, 0xC94, 0xCA4
};
static const uint16 _roadveh_full_adder[] = {
static const uint16_t _roadveh_full_adder[] = {
0, 88, 0, 0, 0, 0, 48, 48,
48, 48, 0, 0, 64, 64, 0, 16,
16, 0, 88, 0, 0, 0, 0, 48,
@@ -68,7 +68,7 @@ static const uint16 _roadveh_full_adder[] = {
static_assert(lengthof(_roadveh_images) == lengthof(_roadveh_full_adder));
template <>
bool IsValidImageIndex<VEH_ROAD>(uint8 image_index)
bool IsValidImageIndex<VEH_ROAD>(uint8_t image_index)
{
return image_index < lengthof(_roadveh_images);
}
@@ -106,7 +106,7 @@ int RoadVehicle::GetDisplayImageWidth(Point *offset) const
static void GetRoadVehIcon(EngineID engine, EngineImageType image_type, VehicleSpriteSeq *result)
{
const Engine *e = Engine::Get(engine);
uint8 spritenum = e->u.road.image_index;
uint8_t spritenum = e->u.road.image_index;
if (is_custom_sprite(spritenum)) {
GetCustomVehicleIcon(engine, DIR_W, image_type, result);
@@ -121,7 +121,7 @@ static void GetRoadVehIcon(EngineID engine, EngineImageType image_type, VehicleS
void RoadVehicle::GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const
{
uint8 spritenum = this->spritenum;
uint8_t spritenum = this->spritenum;
if (is_custom_sprite(spritenum)) {
GetCustomVehicleSprite(this, (Direction)(direction + 4 * IS_CUSTOM_SECONDHEAD_SPRITE(spritenum)), image_type, result);
@@ -192,7 +192,7 @@ static uint GetRoadVehLength(const RoadVehicle *v)
const Engine *e = v->GetEngine();
uint length = VEHICLE_LENGTH;
uint16 veh_len = CALLBACK_FAILED;
uint16_t veh_len = CALLBACK_FAILED;
if (e->GetGRF() != nullptr && e->GetGRF()->grf_version >= 8) {
/* Use callback 36 */
veh_len = GetVehicleProperty(v, PROP_ROADVEH_SHORTEN_FACTOR, CALLBACK_FAILED);
@@ -396,7 +396,7 @@ static bool MayReverseOnOneWayRoadTile(TileIndex tile, DiagDirection dir)
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, const char *text)
{
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
if (v == nullptr) return CMD_ERROR;
@@ -437,7 +437,7 @@ void RoadVehicle::MarkDirty()
void RoadVehicle::UpdateDeltaXY()
{
static const int8 _delta_xy_table[8][10] = {
static const int8_t _delta_xy_table[8][10] = {
/* y_extent, x_extent, y_offs, x_offs, y_bb_offs, x_bb_offs, y_extent_shorten, x_extent_shorten, y_bb_offs_shorten, x_bb_offs_shorten */
{3, 3, -1, -1, 0, 0, -1, -1, -1, -1}, // N
{3, 7, -1, -3, 0, -1, 0, -1, 0, 0}, // NE
@@ -452,7 +452,7 @@ void RoadVehicle::UpdateDeltaXY()
int shorten = VEHICLE_LENGTH - this->gcache.cached_veh_length;
if (!IsDiagonalDirection(this->direction)) shorten >>= 1;
const int8 *bb = _delta_xy_table[this->direction];
const int8_t *bb = _delta_xy_table[this->direction];
this->x_bb_offs = bb[5] + bb[9] * shorten;
this->y_bb_offs = bb[4] + bb[8] * shorten;;
this->x_offs = bb[3];
@@ -477,7 +477,7 @@ int RoadVehicle::GetEffectiveMaxSpeed() const
}
/* clamp speed to be no less than lower of 5mph and 1/8 of base speed */
return std::max<uint16>(max_speed, std::min<uint16>(10, (this->vcache.cached_max_speed + 7) >> 3));
return std::max<uint16_t>(max_speed, std::min<uint16_t>(10, (this->vcache.cached_max_speed + 7) >> 3));
}
/**
@@ -535,7 +535,7 @@ static void RoadVehSetRandomDirection(RoadVehicle *v)
};
do {
uint32 r = Random();
uint32_t r = Random();
v->direction = ChangeDir(v->direction, delta[r & 3]);
v->UpdateViewport(true, true);
@@ -697,8 +697,8 @@ struct RoadVehFindData {
static Vehicle *EnumCheckRoadVehClose(Vehicle *veh, void *data)
{
static const int8 dist_x[] = { -4, -8, -4, -1, 4, 8, 4, 1 };
static const int8 dist_y[] = { -4, -1, 4, 8, 4, 1, -4, -8 };
static const int8_t dist_x[] = { -4, -8, -4, -1, 4, 8, 4, 1 };
static const int8_t dist_y[] = { -4, -1, 4, 8, 4, 1, -4, -8 };
RoadVehFindData *rvf = (RoadVehFindData*)data;
RoadVehicle *v = RoadVehicle::From(veh);
@@ -1149,7 +1149,7 @@ static void RoadZPosAffectSpeed(RoadVehicle *v, int old_z)
if (old_z < v->z_pos) {
v->cur_speed = v->cur_speed * 232 / 256; // slow down by ~10%
} else {
uint16 spd = v->cur_speed + 2;
uint16_t spd = v->cur_speed + 2;
if (spd <= v->gcache.cached_max_track_speed) v->cur_speed = spd;
}
}
@@ -1288,7 +1288,7 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection
default: NOT_REACHED();
}
DEBUG_UPDATESTATECHECKSUM("RoadFindPathToDest: v: %u, path_found: %d, best_track: %d", v->index, path_found, best_track);
UpdateStateChecksum((((uint64) v->index) << 32) | (path_found << 16) | best_track);
UpdateStateChecksum((((uint64_t) v->index) << 32) | (path_found << 16) | best_track);
v->HandlePathfindingResult(path_found);
found_best_track:;
@@ -1466,7 +1466,7 @@ struct FinishOvertakeData {
const Vehicle *v;
int min_coord;
int max_coord;
uint8 not_road_pos;
uint8_t not_road_pos;
RoadTypeCollisionMode collision_mode;
};
@@ -1828,7 +1828,7 @@ again:
}
}
uint32 r = VehicleEnterTile(v, tile, x, y);
uint32_t r = VehicleEnterTile(v, tile, x, y);
if (HasBit(r, VETS_CANNOT_ENTER)) {
if (!IsTileType(tile, MP_TUNNELBRIDGE)) {
v->cur_speed = 0;
@@ -1944,7 +1944,7 @@ again:
}
}
uint32 r = VehicleEnterTile(v, v->tile, x, y);
uint32_t r = VehicleEnterTile(v, v->tile, x, y);
if (HasBit(r, VETS_CANNOT_ENTER)) {
v->cur_speed = 0;
return false;
@@ -2097,7 +2097,7 @@ again:
/* Check tile position conditions - i.e. stop position in depot,
* entry onto bridge or into tunnel */
uint32 r = VehicleEnterTile(v, v->tile, x, y);
uint32_t r = VehicleEnterTile(v, v->tile, x, y);
if (HasBit(r, VETS_CANNOT_ENTER)) {
v->cur_speed = 0;
return false;
@@ -2219,9 +2219,9 @@ Money RoadVehicle::GetRunningCost() const
bool RoadVehicle::Tick()
{
DEBUG_UPDATESTATECHECKSUM("RoadVehicle::Tick 1: v: %u, x: %d, y: %d", this->index, this->x_pos, this->y_pos);
UpdateStateChecksum((((uint64) this->x_pos) << 32) | this->y_pos);
UpdateStateChecksum((((uint64_t) this->x_pos) << 32) | this->y_pos);
DEBUG_UPDATESTATECHECKSUM("RoadVehicle::Tick 2: v: %u, state: %d, frame: %d", this->index, this->state, this->frame);
UpdateStateChecksum((((uint64) this->state) << 32) | this->frame);
UpdateStateChecksum((((uint64_t) this->state) << 32) | this->frame);
if (this->IsFrontEngine()) {
if (!(this->IsRoadVehicleStopped() || this->IsWaitingInDepot())) this->running_ticks++;
return RoadVehController(this);
@@ -2346,9 +2346,9 @@ Trackdir RoadVehicle::GetVehicleTrackdir() const
return (Trackdir)((IsReversingRoadTrackdir((Trackdir)this->state)) ? (this->state - 6) : this->state);
}
uint16 RoadVehicle::GetMaxWeight() const
uint16_t RoadVehicle::GetMaxWeight() const
{
uint16 weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->GetEngine()->DetermineCapacity(this));
uint16_t weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->GetEngine()->DetermineCapacity(this));
/* Vehicle weight is not added for articulated parts. */
if (!this->IsArticulatedPart()) {