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

@@ -764,11 +764,11 @@ void RunTileLoop()
/* Maximal length LFSR feedback terms, from 12-bit (for 64x64 maps) to 24-bit (for 4096x4096 maps).
* Extracted from http://www.ece.cmu.edu/~koopman/lfsr/ */
static const uint32 feedbacks[] = {
static const uint32_t feedbacks[] = {
0xD8F, 0x1296, 0x2496, 0x4357, 0x8679, 0x1030E, 0x206CD, 0x403FE, 0x807B8, 0x1004B2, 0x2006A8, 0x4004B2, 0x800B87
};
static_assert(lengthof(feedbacks) == 2 * MAX_MAP_SIZE_BITS - 2 * MIN_MAP_SIZE_BITS + 1);
const uint32 feedback = feedbacks[Map::LogX() + Map::LogY() - 2 * MIN_MAP_SIZE_BITS];
const uint32_t feedback = feedbacks[Map::LogX() + Map::LogY() - 2 * MIN_MAP_SIZE_BITS];
/* We update every tile every 256 ticks, so divide the map size by 2^8 = 256 */
uint count = 1 << (Map::LogX() + Map::LogY() - 8);
@@ -787,7 +787,7 @@ void RunTileLoop()
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
/* Get the next tile in sequence using a Galois LFSR. */
tile = (tile >> 1) ^ (-(int32)(tile & 1) & feedback);
tile = (tile >> 1) ^ (-(int32_t)(tile & 1) & feedback);
}
_cur_tileloop_tile = tile;
@@ -813,7 +813,7 @@ static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 };
static void GenerateTerrain(int type, uint flag)
{
uint32 r = Random();
uint32_t r = Random();
/* Choose one of the templates from the graphics file. */
const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + SPR_MAPGEN_BEGIN, SpriteType::MapGen);
@@ -1210,19 +1210,19 @@ struct River_UserData {
};
/* AyStar callback for checking whether we reached our destination. */
static int32 River_EndNodeCheck(const AyStar *aystar, const OpenListNode *current)
static int32_t River_EndNodeCheck(const AyStar *aystar, const OpenListNode *current)
{
return current->path.node.tile == *(TileIndex*)aystar->user_target ? AYSTAR_FOUND_END_NODE : AYSTAR_DONE;
}
/* AyStar callback for getting the cost of the current node. */
static int32 River_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
static int32_t River_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
{
return 1 + RandomRange(_settings_game.game_creation.river_route_random);
}
/* AyStar callback for getting the estimated cost to the destination. */
static int32 River_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
static int32_t River_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
{
return DistanceManhattan(*(TileIndex*)aystar->user_target, current->tile);
}
@@ -1551,7 +1551,7 @@ static void CalculateSnowLine()
* Calculate the line (in height) between desert and tropic.
* @return The height of the line between desert and tropic.
*/
static uint8 CalculateDesertLine()
static uint8_t CalculateDesertLine()
{
/* CalculateCoverageLine() runs from top to bottom, so we need to invert the coverage. */
return CalculateCoverageLine(100 - _settings_game.game_creation.desert_coverage, 4);
@@ -1584,7 +1584,7 @@ void GenerateLandscape(byte mode)
}
switch (_settings_game.game_creation.landscape) {
case LT_ARCTIC: {
uint32 r = Random();
uint32_t r = Random();
for (uint i = Map::ScaleBySize(GB(r, 0, 7) + 950); i != 0; --i) {
GenerateTerrain(2, 0);
@@ -1598,7 +1598,7 @@ void GenerateLandscape(byte mode)
}
case LT_TROPIC: {
uint32 r = Random();
uint32_t r = Random();
for (uint i = Map::ScaleBySize(GB(r, 0, 7) + 170); i != 0; --i) {
GenerateTerrain(0, 0);
@@ -1618,7 +1618,7 @@ void GenerateLandscape(byte mode)
}
default: {
uint32 r = Random();
uint32_t r = Random();
assert(_settings_game.difficulty.quantity_sea_lakes != CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY);
uint i = Map::ScaleBySize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);