forked from mirror/OpenTTD
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:
@@ -21,7 +21,7 @@
|
||||
#include "newgrf_commons.h"
|
||||
|
||||
/** Various object behaviours. */
|
||||
enum ObjectFlags : uint16 {
|
||||
enum ObjectFlags : uint16_t {
|
||||
OBJECT_FLAG_NONE = 0, ///< Just nothing.
|
||||
OBJECT_FLAG_ONLY_IN_SCENEDIT = 1 << 0, ///< Object can only be constructed in the scenario editor.
|
||||
OBJECT_FLAG_CANNOT_REMOVE = 1 << 1, ///< Object can not be removed.
|
||||
@@ -40,12 +40,12 @@ enum ObjectFlags : uint16 {
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(ObjectFlags)
|
||||
|
||||
static const uint8 OBJECT_SIZE_1X1 = 0x11; ///< The value of a NewGRF's size property when the object is 1x1 tiles: low nibble for X, high nibble for Y.
|
||||
static const uint8_t OBJECT_SIZE_1X1 = 0x11; ///< The value of a NewGRF's size property when the object is 1x1 tiles: low nibble for X, high nibble for Y.
|
||||
|
||||
void ResetObjects();
|
||||
|
||||
/** Class IDs for objects. */
|
||||
enum ObjectClassID : uint8 {
|
||||
enum ObjectClassID : uint8_t {
|
||||
OBJECT_CLASS_BEGIN = 0, ///< The lowest valid value
|
||||
OBJECT_CLASS_MAX = 0xFF, ///< Maximum number of classes.
|
||||
INVALID_OBJECT_CLASS = 0xFF, ///< Class for the less fortunate.
|
||||
@@ -64,17 +64,17 @@ struct ObjectSpec {
|
||||
ObjectClassID cls_id; ///< The class to which this spec belongs.
|
||||
StringID name; ///< The name for this object.
|
||||
|
||||
uint8 climate; ///< In which climates is this object available?
|
||||
uint8 size; ///< The size of this objects; low nibble for X, high nibble for Y.
|
||||
uint8 build_cost_multiplier; ///< Build cost multiplier per tile.
|
||||
uint8 clear_cost_multiplier; ///< Clear cost multiplier per tile.
|
||||
uint8_t climate; ///< In which climates is this object available?
|
||||
uint8_t size; ///< The size of this objects; low nibble for X, high nibble for Y.
|
||||
uint8_t build_cost_multiplier; ///< Build cost multiplier per tile.
|
||||
uint8_t clear_cost_multiplier; ///< Clear cost multiplier per tile.
|
||||
TimerGameCalendar::Date introduction_date; ///< From when can this object be built.
|
||||
TimerGameCalendar::Date end_of_life_date; ///< When can't this object be built anymore.
|
||||
ObjectFlags flags; ///< Flags/settings related to the object.
|
||||
uint16 callback_mask; ///< Bitmask of requested/allowed callbacks.
|
||||
uint8 height; ///< The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
|
||||
uint8 views; ///< The number of views.
|
||||
uint8 generate_amount; ///< Number of objects which are attempted to be generated per 256^2 map during world generation.
|
||||
uint16_t callback_mask; ///< Bitmask of requested/allowed callbacks.
|
||||
uint8_t height; ///< The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
|
||||
uint8_t views; ///< The number of views.
|
||||
uint8_t generate_amount; ///< Number of objects which are attempted to be generated per 256^2 map during world generation.
|
||||
|
||||
/**
|
||||
* Test if this object is enabled.
|
||||
@@ -112,7 +112,7 @@ struct ObjectScopeResolver : public ScopeResolver {
|
||||
struct Object *obj; ///< The object the callback is ran for.
|
||||
const ObjectSpec *spec; ///< Specification of the object type.
|
||||
TileIndex tile; ///< The tile related to the object.
|
||||
uint8 view; ///< The view of the object.
|
||||
uint8_t view; ///< The view of the object.
|
||||
|
||||
/**
|
||||
* Constructor of an object scope resolver.
|
||||
@@ -121,13 +121,13 @@ struct ObjectScopeResolver : public ScopeResolver {
|
||||
* @param tile %Tile of the object.
|
||||
* @param view View of the object.
|
||||
*/
|
||||
ObjectScopeResolver(ResolverObject &ro, Object *obj, const ObjectSpec *spec, TileIndex tile, uint8 view = 0)
|
||||
ObjectScopeResolver(ResolverObject &ro, Object *obj, const ObjectSpec *spec, TileIndex tile, uint8_t view = 0)
|
||||
: ScopeResolver(ro), obj(obj), spec(spec), tile(tile), view(view)
|
||||
{
|
||||
}
|
||||
|
||||
uint32 GetRandomBits() const override;
|
||||
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
|
||||
uint32_t GetRandomBits() const override;
|
||||
uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override;
|
||||
};
|
||||
|
||||
/** A resolver object to be used with feature 0F spritegroups. */
|
||||
@@ -135,8 +135,8 @@ struct ObjectResolverObject : public ResolverObject {
|
||||
ObjectScopeResolver object_scope; ///< The object scope resolver.
|
||||
TownScopeResolver *town_scope; ///< The town scope resolver (created on the first call).
|
||||
|
||||
ObjectResolverObject(const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view = 0,
|
||||
CallbackID callback = CBID_NO_CALLBACK, uint32 param1 = 0, uint32 param2 = 0);
|
||||
ObjectResolverObject(const ObjectSpec *spec, Object *o, TileIndex tile, uint8_t view = 0,
|
||||
CallbackID callback = CBID_NO_CALLBACK, uint32_t param1 = 0, uint32_t param2 = 0);
|
||||
~ObjectResolverObject();
|
||||
|
||||
ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
|
||||
@@ -157,7 +157,7 @@ struct ObjectResolverObject : public ResolverObject {
|
||||
}
|
||||
|
||||
GrfSpecFeature GetFeature() const override;
|
||||
uint32 GetDebugID() const override;
|
||||
uint32_t GetDebugID() const override;
|
||||
|
||||
private:
|
||||
TownScopeResolver *GetTown();
|
||||
@@ -169,10 +169,10 @@ typedef NewGRFClass<ObjectSpec, ObjectClassID, OBJECT_CLASS_MAX> ObjectClass;
|
||||
static const size_t OBJECT_SPRITE_GROUP_DEFAULT = 0;
|
||||
static const size_t OBJECT_SPRITE_GROUP_PURCHASE = 1;
|
||||
|
||||
uint16 GetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view = 0);
|
||||
uint16_t GetObjectCallback(CallbackID callback, uint32_t param1, uint32_t param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8_t view = 0);
|
||||
|
||||
void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec);
|
||||
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view);
|
||||
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8_t view);
|
||||
void AnimateNewObjectTile(TileIndex tile);
|
||||
void TriggerObjectTileAnimation(Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec);
|
||||
void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec);
|
||||
|
Reference in New Issue
Block a user