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:
@@ -450,12 +450,12 @@ public:
|
||||
}
|
||||
/* Check for speed limit imposed by railtype */
|
||||
if (IsRailTT()) {
|
||||
uint16 rail_speed = GetRailTypeInfo(GetRailType(m_old_tile))->max_speed;
|
||||
uint16_t rail_speed = GetRailTypeInfo(GetRailType(m_old_tile))->max_speed;
|
||||
if (rail_speed > 0) max_speed = std::min<int>(max_speed, rail_speed);
|
||||
}
|
||||
if (IsRoadTT()) {
|
||||
/* max_speed is already in roadvehicle units, no need to further modify (divide by 2) */
|
||||
uint16 road_speed = GetRoadTypeInfo(GetRoadType(m_old_tile, GetRoadTramType(RoadVehicle::From(m_veh)->roadtype)))->max_speed;
|
||||
uint16_t road_speed = GetRoadTypeInfo(GetRoadType(m_old_tile, GetRoadTramType(RoadVehicle::From(m_veh)->roadtype)))->max_speed;
|
||||
if (road_speed > 0) max_speed = std::min<int>(max_speed, road_speed);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ struct AyStar;
|
||||
* - #AYSTAR_FOUND_END_NODE : indicates this is the end tile
|
||||
* - #AYSTAR_DONE : indicates this is not the end tile (or direction was wrong)
|
||||
*/
|
||||
typedef int32 AyStar_EndNodeCheck(const AyStar *aystar, const OpenListNode *current);
|
||||
typedef int32_t AyStar_EndNodeCheck(const AyStar *aystar, const OpenListNode *current);
|
||||
|
||||
/**
|
||||
* Calculate the G-value for the %AyStar algorithm.
|
||||
@@ -81,14 +81,14 @@ typedef int32 AyStar_EndNodeCheck(const AyStar *aystar, const OpenListNode *curr
|
||||
* - #AYSTAR_INVALID_NODE : indicates an item is not valid (e.g.: unwalkable)
|
||||
* - Any value >= 0 : the g-value for this tile
|
||||
*/
|
||||
typedef int32 AyStar_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
typedef int32_t AyStar_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
|
||||
/**
|
||||
* Calculate the H-value for the %AyStar algorithm.
|
||||
* Mostly, this must return the distance (Manhattan way) between the current point and the end point.
|
||||
* @return The h-value for this tile (any value >= 0)
|
||||
*/
|
||||
typedef int32 AyStar_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
typedef int32_t AyStar_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
|
||||
/**
|
||||
* This function requests the tiles around the current tile and put them in #neighbours.
|
||||
|
||||
@@ -148,7 +148,7 @@ static uint NPFHash(uint key1, uint key2)
|
||||
return ((part1 << NPF_HASH_HALFBITS | part2) + (NPF_HASH_SIZE * key2 / TRACKDIR_END)) % NPF_HASH_SIZE;
|
||||
}
|
||||
|
||||
static int32 NPFCalcZero(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
static int32_t NPFCalcZero(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ static int32 NPFCalcZero(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
/* Calculates the heuristic to the target station or tile. For train stations, it
|
||||
* takes into account the direction of approach.
|
||||
*/
|
||||
static int32 NPFCalcStationOrTileHeuristic(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
static int32_t NPFCalcStationOrTileHeuristic(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
NPFFindStationOrTileData *fstd = (NPFFindStationOrTileData*)as->user_target;
|
||||
NPFFoundTargetData *ftd = (NPFFoundTargetData*)as->user_path;
|
||||
@@ -312,9 +312,9 @@ static Vehicle *CountShipProc(Vehicle *v, void *data)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int32 NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
static int32_t NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
int32 cost = 0;
|
||||
int32_t cost = 0;
|
||||
Trackdir trackdir = current->direction;
|
||||
|
||||
cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks
|
||||
@@ -340,10 +340,10 @@ static int32 NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *par
|
||||
}
|
||||
|
||||
/* Determine the cost of this node, for road tracks */
|
||||
static int32 NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
static int32_t NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
TileIndex tile = current->tile;
|
||||
int32 cost = 0;
|
||||
int32_t cost = 0;
|
||||
|
||||
/* Determine base length */
|
||||
switch (GetTileType(tile)) {
|
||||
@@ -399,11 +399,11 @@ static int32 NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *pare
|
||||
|
||||
|
||||
/* Determine the cost of this node, for railway tracks */
|
||||
static int32 NPFRailPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
static int32_t NPFRailPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
TileIndex tile = current->tile;
|
||||
Trackdir trackdir = current->direction;
|
||||
int32 cost = 0;
|
||||
int32_t cost = 0;
|
||||
/* HACK: We create a OpenListNode manually, so we can call EndNodeCheck */
|
||||
OpenListNode new_node;
|
||||
|
||||
@@ -550,7 +550,7 @@ static int32 NPFRailPathCost(AyStar *as, AyStarNode *current, OpenListNode *pare
|
||||
}
|
||||
|
||||
/* Will find any depot */
|
||||
static int32 NPFFindDepot(const AyStar *as, const OpenListNode *current)
|
||||
static int32_t NPFFindDepot(const AyStar *as, const OpenListNode *current)
|
||||
{
|
||||
AyStarUserData *user = (AyStarUserData *)as->user_data;
|
||||
/* It's not worth caching the result with NPF_FLAG_IS_TARGET here as below,
|
||||
@@ -560,7 +560,7 @@ static int32 NPFFindDepot(const AyStar *as, const OpenListNode *current)
|
||||
}
|
||||
|
||||
/** Find any safe and free tile. */
|
||||
static int32 NPFFindSafeTile(const AyStar *as, const OpenListNode *current)
|
||||
static int32_t NPFFindSafeTile(const AyStar *as, const OpenListNode *current)
|
||||
{
|
||||
const Train *v = Train::From(((NPFFindStationOrTileData *)as->user_target)->v);
|
||||
|
||||
@@ -570,7 +570,7 @@ static int32 NPFFindSafeTile(const AyStar *as, const OpenListNode *current)
|
||||
}
|
||||
|
||||
/* Will find a station identified using the NPFFindStationOrTileData */
|
||||
static int32 NPFFindStationOrTile(const AyStar *as, const OpenListNode *current)
|
||||
static int32_t NPFFindStationOrTile(const AyStar *as, const OpenListNode *current)
|
||||
{
|
||||
NPFFindStationOrTileData *fstd = (NPFFindStationOrTileData*)as->user_target;
|
||||
const AyStarNode *node = ¤t->path.node;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/** key for cached segment cost for rail YAPF */
|
||||
struct CYapfRailSegmentKey
|
||||
{
|
||||
uint32 m_value;
|
||||
uint32_t m_value;
|
||||
|
||||
inline CYapfRailSegmentKey(const CYapfNodeKeyTrackDir &node_key)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ struct CYapfRailSegmentKey
|
||||
m_value = (((int)node_key.m_tile) << 4) | node_key.m_td;
|
||||
}
|
||||
|
||||
inline int32 CalcHash() const
|
||||
inline int32_t CalcHash() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
@@ -123,9 +123,9 @@ struct CYapfRailNodeT
|
||||
typedef CYapfRailSegment CachedData;
|
||||
|
||||
CYapfRailSegment *m_segment;
|
||||
uint16 m_num_signals_passed;
|
||||
uint16_t m_num_signals_passed;
|
||||
union {
|
||||
uint32 m_inherited_flags;
|
||||
uint32_t m_inherited_flags;
|
||||
struct {
|
||||
bool m_targed_seen : 1;
|
||||
bool m_choice_seen : 1;
|
||||
|
||||
Reference in New Issue
Block a user