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:
@@ -54,9 +54,9 @@ enum ExtraTreePlacement {
|
||||
/** Determines when to consider building more trees. */
|
||||
byte _trees_tick_ctr;
|
||||
|
||||
static const uint16 DEFAULT_TREE_STEPS = 1000; ///< Default number of attempts for placing trees.
|
||||
static const uint16 DEFAULT_RAINFOREST_TREE_STEPS = 15000; ///< Default number of attempts for placing extra trees at rainforest in tropic.
|
||||
static const uint16 EDITOR_TREE_DIV = 5; ///< Game editor tree generation divisor factor.
|
||||
static const uint16_t DEFAULT_TREE_STEPS = 1000; ///< Default number of attempts for placing trees.
|
||||
static const uint16_t DEFAULT_RAINFOREST_TREE_STEPS = 15000; ///< Default number of attempts for placing extra trees at rainforest in tropic.
|
||||
static const uint16_t EDITOR_TREE_DIV = 5; ///< Game editor tree generation divisor factor.
|
||||
|
||||
/**
|
||||
* Tests if a tile can be converted to MP_TREES
|
||||
@@ -161,7 +161,7 @@ static TreeType GetRandomTreeType(TileIndex tile, uint seed)
|
||||
* @param tile The tile to make a tree-tile from
|
||||
* @param r The randomness value from a Random() value
|
||||
*/
|
||||
static void PlaceTree(TileIndex tile, uint32 r)
|
||||
static void PlaceTree(TileIndex tile, uint32_t r)
|
||||
{
|
||||
TreeType tree = GetRandomTreeType(tile, GB(r, 24, 8));
|
||||
|
||||
@@ -189,7 +189,7 @@ static void PlaceTreeGroups(uint num_groups)
|
||||
TileIndex center_tile = RandomTile();
|
||||
|
||||
for (uint i = 0; i < DEFAULT_TREE_STEPS; i++) {
|
||||
uint32 r = Random();
|
||||
uint32_t r = Random();
|
||||
int x = GB(r, 0, 5) - 16;
|
||||
int y = GB(r, 8, 5) - 16;
|
||||
uint dist = abs(x) + abs(y);
|
||||
@@ -217,7 +217,7 @@ static void PlaceTreeGroups(uint num_groups)
|
||||
static void PlaceTreeAtSameHeight(TileIndex tile, int height)
|
||||
{
|
||||
for (uint i = 0; i < DEFAULT_TREE_STEPS; i++) {
|
||||
uint32 r = Random();
|
||||
uint32_t r = Random();
|
||||
int x = GB(r, 0, 5) - 16;
|
||||
int y = GB(r, 8, 5) - 16;
|
||||
TileIndex cur_tile = TileAddWrap(tile, x, y);
|
||||
@@ -250,7 +250,7 @@ void PlaceTreesRandomly()
|
||||
i = Map::ScaleBySize(DEFAULT_TREE_STEPS);
|
||||
if (_game_mode == GM_EDITOR) i /= EDITOR_TREE_DIV;
|
||||
do {
|
||||
uint32 r = Random();
|
||||
uint32_t r = Random();
|
||||
TileIndex tile = RandomTileSeed(r);
|
||||
|
||||
IncreaseGeneratingWorldProgress(GWP_TREE);
|
||||
@@ -279,7 +279,7 @@ void PlaceTreesRandomly()
|
||||
if (_game_mode == GM_EDITOR) i /= EDITOR_TREE_DIV;
|
||||
|
||||
do {
|
||||
uint32 r = Random();
|
||||
uint32_t r = Random();
|
||||
TileIndex tile = RandomTileSeed(r);
|
||||
|
||||
IncreaseGeneratingWorldProgress(GWP_TREE);
|
||||
@@ -312,14 +312,14 @@ uint PlaceTreeGroupAroundTile(TileIndex tile, TreeType treetype, uint radius, ui
|
||||
|
||||
for (; count > 0; count--) {
|
||||
/* Simple quasi-normal distribution with range [-radius; radius) */
|
||||
auto mkcoord = [&]() -> int32 {
|
||||
const uint32 rand = InteractiveRandom();
|
||||
const int32 dist = GB<int32>(rand, 0, 8) + GB<int32>(rand, 8, 8) + GB<int32>(rand, 16, 8) + GB<int32>(rand, 24, 8);
|
||||
const int32 scu = dist * radius / 512;
|
||||
auto mkcoord = [&]() -> int32_t {
|
||||
const uint32_t rand = InteractiveRandom();
|
||||
const int32_t dist = GB<int32_t>(rand, 0, 8) + GB<int32_t>(rand, 8, 8) + GB<int32_t>(rand, 16, 8) + GB<int32_t>(rand, 24, 8);
|
||||
const int32_t scu = dist * radius / 512;
|
||||
return scu - radius;
|
||||
};
|
||||
const int32 xofs = mkcoord();
|
||||
const int32 yofs = mkcoord();
|
||||
const int32_t xofs = mkcoord();
|
||||
const int32_t yofs = mkcoord();
|
||||
const TileIndex tile_to_plant = TileAddWrap(tile, xofs, yofs);
|
||||
if (tile_to_plant != INVALID_TILE) {
|
||||
if (IsTileType(tile_to_plant, MP_TREES) && GetTreeCount(tile_to_plant) < 4) {
|
||||
@@ -527,7 +527,7 @@ static void DrawTile_Trees(TileInfo *ti)
|
||||
/* Do not draw trees when the invisible trees setting is set */
|
||||
if (IsInvisibilitySet(TO_TREES)) return;
|
||||
|
||||
uint tmp = CountBits(static_cast<uint32>(ti->tile + ti->x + ti->y));
|
||||
uint tmp = CountBits(static_cast<uint32_t>(ti->tile + ti->x + ti->y));
|
||||
uint index = GB(tmp, 0, 2) + (GetTreeType(ti->tile) << 2);
|
||||
|
||||
/* different tree styles above one of the grounds */
|
||||
@@ -646,7 +646,7 @@ static void TileLoopTreesDesert(TileIndex tile)
|
||||
SND_44_RAINFOREST_3,
|
||||
SND_48_RAINFOREST_4
|
||||
};
|
||||
uint32 r = Random();
|
||||
uint32_t r = Random();
|
||||
|
||||
if (Chance16I(1, 200, r) && _settings_client.sound.ambient) SndPlayTileFx(forest_sounds[GB(r, 16, 2)], tile);
|
||||
break;
|
||||
@@ -676,7 +676,7 @@ static void TileLoopTreesAlps(TileIndex tile)
|
||||
SetTreeGroundDensity(tile, GetTreeGround(tile), density);
|
||||
} else {
|
||||
if (GetTreeDensity(tile) == 3) {
|
||||
uint32 r = Random();
|
||||
uint32_t r = Random();
|
||||
if (Chance16I(1, 200, r) && _settings_client.sound.ambient) {
|
||||
SndPlayTileFx((r & 0x80000000) ? SND_39_ARCTIC_SNOW_2 : SND_34_ARCTIC_SNOW_1, tile);
|
||||
}
|
||||
@@ -711,7 +711,7 @@ static void TileLoop_Trees(TileIndex tile)
|
||||
* Also, we use a simple hash to spread the updates evenly over the map.
|
||||
* 11 and 9 are just some co-prime numbers for better spread.
|
||||
*/
|
||||
uint32 cycle = 11 * TileX(tile) + 9 * TileY(tile) + (TimerGameTick::counter >> 8);
|
||||
uint32_t cycle = 11 * TileX(tile) + 9 * TileY(tile) + (TimerGameTick::counter >> 8);
|
||||
|
||||
/* Handle growth of grass (under trees/on MP_TREES tiles) at every 8th processings, like it's done for grass on MP_CLEAR tiles. */
|
||||
if ((cycle & 7) == 7 && GetTreeGround(tile) == TREE_GROUND_GRASS) {
|
||||
@@ -833,7 +833,7 @@ void OnTick_Trees()
|
||||
/* Don't spread trees if that's not allowed */
|
||||
if (_settings_game.construction.extra_tree_placement == ETP_NO_SPREAD || _settings_game.construction.extra_tree_placement == ETP_NO_GROWTH_NO_SPREAD) return;
|
||||
|
||||
uint32 r;
|
||||
uint32_t r;
|
||||
TileIndex tile;
|
||||
TreeType tree;
|
||||
|
||||
|
Reference in New Issue
Block a user