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:
@@ -43,7 +43,7 @@
|
||||
|
||||
ObjectPool _object_pool("Object");
|
||||
INSTANTIATE_POOL_METHODS(Object)
|
||||
uint16 Object::counts[NUM_OBJECTS];
|
||||
uint16_t Object::counts[NUM_OBJECTS];
|
||||
|
||||
/**
|
||||
* Get the object associated with a tile.
|
||||
@@ -83,7 +83,7 @@ void InitializeObjects()
|
||||
* @pre All preconditions for building the object at that location
|
||||
* are met, e.g. slope and clearness of tiles are checked.
|
||||
*/
|
||||
void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, uint8 view)
|
||||
void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, uint8_t view)
|
||||
{
|
||||
const ObjectSpec *spec = ObjectSpec::Get(type);
|
||||
|
||||
@@ -108,7 +108,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
|
||||
if ((spec->flags & OBJECT_FLAG_2CC_COLOUR) == 0) o->colour &= 0xF;
|
||||
|
||||
if (HasBit(spec->callback_mask, CBM_OBJ_COLOUR)) {
|
||||
uint16 res = GetObjectCallback(CBID_OBJECT_COLOUR, o->colour, 0, spec, o, tile);
|
||||
uint16_t res = GetObjectCallback(CBID_OBJECT_COLOUR, o->colour, 0, spec, o, tile);
|
||||
if (res != CALLBACK_FAILED) {
|
||||
if (res >= 0x100) ErrorUnknownCallbackResult(spec->grf_prop.grffile->grfid, CBID_OBJECT_COLOUR, res);
|
||||
o->colour = GB(res, 0, 8);
|
||||
@@ -203,7 +203,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags);
|
||||
* @param view the view for the object
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type, uint8 view)
|
||||
CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type, uint8_t view)
|
||||
{
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
|
||||
@@ -269,7 +269,7 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type,
|
||||
if (GetTileSlope(tile, &allowed_z) != SLOPE_FLAT) allowed_z++;
|
||||
|
||||
for (TileIndex t : ta) {
|
||||
uint16 callback = CALLBACK_FAILED;
|
||||
uint16_t callback = CALLBACK_FAILED;
|
||||
if (HasBit(spec->callback_mask, CBM_OBJ_SLOPE_CHECK)) {
|
||||
TileIndex diff = t - tile;
|
||||
callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTileSlope(t), TileY(diff) << 4 | TileX(diff), spec, nullptr, t, view);
|
||||
@@ -384,7 +384,7 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type,
|
||||
* @param diagonal Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdBuildObjectArea(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, ObjectType type, uint8 view, bool diagonal)
|
||||
CommandCost CmdBuildObjectArea(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, ObjectType type, uint8_t view, bool diagonal)
|
||||
{
|
||||
if (start_tile >= Map::Size()) return CMD_ERROR;
|
||||
|
||||
@@ -813,7 +813,7 @@ void GenerateObjects()
|
||||
/* Continue, if the object was never available till now or shall not be placed */
|
||||
if (!spec.WasEverAvailable() || spec.generate_amount == 0) continue;
|
||||
|
||||
uint16 amount = spec.generate_amount;
|
||||
uint16_t amount = spec.generate_amount;
|
||||
|
||||
/* Scale by map size */
|
||||
if ((spec.flags & OBJECT_FLAG_SCALE_BY_WATER) && _settings_game.construction.freeform_edges) {
|
||||
@@ -839,7 +839,7 @@ void GenerateObjects()
|
||||
break;
|
||||
|
||||
default:
|
||||
uint8 view = RandomRange(spec.views);
|
||||
uint8_t view = RandomRange(spec.views);
|
||||
if (CmdBuildObject(DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, RandomTile(), spec.Index(), view).Succeeded()) amount--;
|
||||
break;
|
||||
}
|
||||
@@ -903,7 +903,7 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, int
|
||||
/* Call callback 'disable autosloping for objects'. */
|
||||
if (HasBit(spec->callback_mask, CBM_OBJ_AUTOSLOPE)) {
|
||||
/* If the callback fails, allow autoslope. */
|
||||
uint16 res = GetObjectCallback(CBID_OBJECT_AUTOSLOPE, 0, 0, spec, Object::GetByTile(tile), tile);
|
||||
uint16_t res = GetObjectCallback(CBID_OBJECT_AUTOSLOPE, 0, 0, spec, Object::GetByTile(tile), tile);
|
||||
if (res == CALLBACK_FAILED || !ConvertBooleanCallback(spec->grf_prop.grffile, CBID_OBJECT_AUTOSLOPE, res)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
||||
} else if (spec->IsEnabled()) {
|
||||
/* allow autoslope */
|
||||
|
Reference in New Issue
Block a user