diff --git a/CODINGSTYLE.md b/CODINGSTYLE.md index 263b495333..555bd5f681 100644 --- a/CODINGSTYLE.md +++ b/CODINGSTYLE.md @@ -248,7 +248,7 @@ Templates are a very powerful C++ tool, but they can easily confuse beginners. T * Templates are to be documented in a very clear and verbose manner. Never assume anything in the documentation. * the template keyword and the template layout get a separate line. typenames are either "T" or preceded by a "T", integers get a single capital letter or a descriptive name preceded by "T". ```c++ -template +template int Func(); ``` diff --git a/src/3rdparty/md5/md5.h b/src/3rdparty/md5/md5.h index 611589e615..f689272bec 100644 --- a/src/3rdparty/md5/md5.h +++ b/src/3rdparty/md5/md5.h @@ -59,8 +59,8 @@ static const size_t MD5_HASH_BYTES = 16; /** Container for storing a MD5 hash/checksum/digest. */ -struct MD5Hash : std::array { - MD5Hash() : std::array{} {} +struct MD5Hash : std::array { + MD5Hash() : std::array{} {} /** * Exclusively-or the given hash into this hash. diff --git a/src/aircraft.h b/src/aircraft.h index 7414063090..9865f12e83 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -67,22 +67,22 @@ int GetAircraftFlightLevel(T *v, bool takeoff = false); struct AircraftCache { uint32_t cached_max_range_sqr; ///< Cached squared maximum range. uint16_t cached_max_range; ///< Cached maximum range. - byte image_movement_state; ///< Cached image aircraft movement state + uint8_t image_movement_state; ///< Cached image aircraft movement state }; /** * Aircraft, helicopters, rotors and their shadows belong to this class. */ struct Aircraft final : public SpecializedVehicle { - uint16_t crashed_counter; ///< Timer for handling crash animations. - byte pos; ///< Next desired position of the aircraft. - byte previous_pos; ///< Previous desired position of the aircraft. - StationID targetairport; ///< Airport to go to next. - byte state; ///< State of the airport. @see AirportMovementStates + uint16_t crashed_counter; ///< Timer for handling crash animations. + uint8_t pos; ///< Next desired position of the aircraft. + uint8_t previous_pos; ///< Previous desired position of the aircraft. + StationID targetairport; ///< Airport to go to next. + uint8_t state; ///< State of the airport. @see AirportMovementStates Direction last_direction; - byte number_consecutive_turns; ///< Protection to prevent the aircraft of making a lot of turns in order to reach a specific point. - byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns. - byte flags; ///< Aircraft flags. @see AirVehicleFlags + uint8_t number_consecutive_turns; ///< Protection to prevent the aircraft of making a lot of turns in order to reach a specific point. + uint8_t turn_counter; ///< Ticks between each turn to prevent > 45 degree turns. + uint8_t flags; ///< Aircraft flags. @see AirVehicleFlags AircraftCache acache; @@ -146,6 +146,6 @@ void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteS Station *GetTargetAirportIfValid(const Aircraft *v); void HandleMissingAircraftOrders(Aircraft *v); -const char *AirportMovementStateToString(byte state); +const char *AirportMovementStateToString(uint8_t state); #endif /* AIRCRAFT_H */ diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 6658d74d54..c8148c89dc 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -692,7 +692,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, * ~ acceleration * 77 (km-ish/h / 256) */ uint spd = v->acceleration * 77; - byte t; + uint8_t t; /* Adjust speed limits by plane speed factor to prevent taxiing * and take-off speeds being too low. */ @@ -710,7 +710,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, speed_limit = v->vcache.cached_max_speed; } - v->subspeed = (t = v->subspeed) + (byte)spd; + v->subspeed = (t = v->subspeed) + (uint8_t)spd; /* Aircraft's current speed is used twice so that very fast planes are * forced to slow down rapidly in the short distance needed. The magic @@ -737,7 +737,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, spd = v->GetOldAdvanceSpeed(spd); spd += v->progress; - v->progress = (byte)spd; + v->progress = (uint8_t)spd; return spd >> 8; } @@ -861,7 +861,7 @@ template int GetAircraftFlightLevel(Aircraft *v, bool takeoff); * @param rotation The rotation of the airport. * @return The index of the entry point */ -static byte AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc, Direction rotation) +static uint8_t AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc, Direction rotation) { assert(v != nullptr); assert(apc != nullptr); @@ -1775,7 +1775,7 @@ static void AircraftEventHandler_Flying(Aircraft *v, const AirportFTAClass *apc) /* {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41}, * if it is an airplane, look for LANDING, for helicopter HELILANDING * it is possible to choose from multiple landing runways, so loop until a free one is found */ - byte landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING; + uint8_t landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING; const AirportFTA *current = apc->layout[v->pos].next; while (current != nullptr) { if (current->heading == landingtype) { @@ -1922,8 +1922,8 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc) const AirportFTA *current = &apc->layout[v->pos]; /* we have arrived in an important state (eg terminal, hangar, etc.) */ if (current->heading == v->state) { - byte prev_pos = v->pos; // location could be changed in state, so save it before-hand - byte prev_state = v->state; + uint8_t prev_pos = v->pos; // location could be changed in state, so save it before-hand + uint8_t prev_state = v->state; _aircraft_state_handlers[v->state](v, apc); if (v->state != FLYING) v->previous_pos = prev_pos; if (v->state != prev_state || v->pos != prev_pos) UpdateAircraftCache(v); @@ -2059,7 +2059,7 @@ static const MovementTerminalMapping _airport_terminal_mapping[] = { * @param last_terminal Terminal number to stop examining. * @return A terminal or helipad has been found, and has been assigned to the aircraft. */ -static bool FreeTerminal(Aircraft *v, byte i, byte last_terminal) +static bool FreeTerminal(Aircraft *v, uint8_t i, uint8_t last_terminal) { assert(last_terminal <= lengthof(_airport_terminal_mapping)); Station *st = Station::Get(v->targetairport); @@ -2259,8 +2259,8 @@ bool Aircraft::Tick() } if (HasBit(this->vcache.cached_veh_flags, VCF_REDRAW_ON_SPEED_CHANGE)) { - extern byte MapAircraftMovementState(const Aircraft *v); - byte state = MapAircraftMovementState(this); + extern uint8_t MapAircraftMovementState(const Aircraft *v); + uint8_t state = MapAircraftMovementState(this); if (state != this->acache.image_movement_state) { this->InvalidateImageCacheOfChain(); this->acache.image_movement_state = state; @@ -2317,7 +2317,7 @@ void UpdateAirplanesOnNewStation(const Station *st) if (!st->airport.HasHangar()) RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, st->index, true); } -const char *AirportMovementStateToString(byte state) +const char *AirportMovementStateToString(uint8_t state) { #define AMS(s) case s: return #s; switch (state) { diff --git a/src/airport.cpp b/src/airport.cpp index 936087f3c0..a1e68b0629 100644 --- a/src/airport.cpp +++ b/src/airport.cpp @@ -110,12 +110,12 @@ AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Directi AirportFTAClass::AirportFTAClass( const AirportMovingData *moving_data_, - const byte *terminals_, - const byte num_helipads_, - const byte *entry_points_, + const uint8_t *terminals_, + const uint8_t num_helipads_, + const uint8_t *entry_points_, Flags flags_, const AirportFTAbuildup *apFA, - byte delta_z_ + uint8_t delta_z_ ) : moving_data(moving_data_), terminals(terminals_), @@ -204,7 +204,7 @@ static AirportFTA *AirportBuildAutomata(uint nofelements, const AirportFTAbuildu * @param airport_type %Airport type to query FTA from. @see AirportTypes * @return Finite state machine of the airport. */ -const AirportFTAClass *GetAirport(const byte airport_type) +const AirportFTAClass *GetAirport(const uint8_t airport_type) { if (airport_type == AT_DUMMY) return &_airportfta_dummy; return AirportSpec::Get(airport_type)->fsm; @@ -215,7 +215,7 @@ const AirportFTAClass *GetAirport(const byte airport_type) * @param hangar_tile The tile on which the vehicle is build * @return The position (index in airport node array) where the aircraft ends up */ -byte GetVehiclePosOnBuild(TileIndex hangar_tile) +uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile) { const Station *st = Station::GetByTile(hangar_tile); const AirportFTAClass *apc = st->airport.GetFTA(); diff --git a/src/airport.h b/src/airport.h index 1e8a36336a..8db60c8a5d 100644 --- a/src/airport.h +++ b/src/airport.h @@ -152,12 +152,12 @@ public: AirportFTAClass( const AirportMovingData *moving_data, - const byte *terminals, - const byte num_helipads, - const byte *entry_points, + const uint8_t *terminals, + const uint8_t num_helipads, + const uint8_t *entry_points, Flags flags, const AirportFTAbuildup *apFA, - byte delta_z + uint8_t delta_z ); ~AirportFTAClass(); @@ -167,7 +167,7 @@ public: * @param position Element number to get movement data about. * @return Pointer to the movement data. */ - const AirportMovingData *MovingData(byte position) const + const AirportMovingData *MovingData(uint8_t position) const { assert(position < nofelements); return &moving_data[position]; @@ -175,12 +175,12 @@ public: const AirportMovingData *moving_data; ///< Movement data. struct AirportFTA *layout; ///< state machine for airport - const byte *terminals; ///< %Array with the number of terminal groups, followed by the number of terminals in each group. - const byte num_helipads; ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals. + const uint8_t *terminals; ///< %Array with the number of terminal groups, followed by the number of terminals in each group. + const uint8_t num_helipads; ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals. Flags flags; ///< Flags for this airport type. - byte nofelements; ///< number of positions the airport consists of - const byte *entry_points; ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction - byte delta_z; ///< Z adjustment for helicopter pads + uint8_t nofelements; ///< number of positions the airport consists of + const uint8_t *entry_points; ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction + uint8_t delta_z; ///< Z adjustment for helicopter pads }; DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags) @@ -190,12 +190,12 @@ DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags) struct AirportFTA { AirportFTA *next; ///< possible extra movement choices from this position uint64_t block; ///< 64 bit blocks (st->airport.flags), should be enough for the most complex airports - byte position; ///< the position that an airplane is at - byte next_position; ///< next position from this position - byte heading; ///< heading (current orders), guiding an airplane to its target on an airport + uint8_t position; ///< the position that an airplane is at + uint8_t next_position; ///< next position from this position + uint8_t heading; ///< heading (current orders), guiding an airplane to its target on an airport }; -const AirportFTAClass *GetAirport(const byte airport_type); -byte GetVehiclePosOnBuild(TileIndex hangar_tile); +const AirportFTAClass *GetAirport(const uint8_t airport_type); +uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile); #endif /* AIRPORT_H */ diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 0452556ab0..4cc86e2e7a 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -36,11 +36,11 @@ static AirportClassID _selected_airport_class; ///< the currently visible airport class static int _selected_airport_index; ///< the index of the selected airport in the current class or -1 -static byte _selected_airport_layout; ///< selected airport layout number. +static uint8_t _selected_airport_layout; ///< selected airport layout number. static void ShowBuildAirportPicker(Window *parent); -SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout); +SpriteID GetCustomAirportSprite(const AirportSpec *as, uint8_t layout); void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32_t p1, uint32_t p2, uint64_t p3, uint32_t cmd) { @@ -339,7 +339,7 @@ public: for (int i = 0; i < NUM_AIRPORTS; i++) { const AirportSpec *as = AirportSpec::Get(i); if (!as->enabled) continue; - for (byte layout = 0; layout < as->num_table; layout++) { + for (uint8_t layout = 0; layout < as->num_table; layout++) { SpriteID sprite = GetCustomAirportSprite(as, layout); if (sprite != 0) { Dimension d = GetSpriteSize(sprite); @@ -355,7 +355,7 @@ public: for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) { const AirportSpec *as = AirportSpec::Get(i); if (!as->enabled) continue; - for (byte layout = 0; layout < as->num_table; layout++) { + for (uint8_t layout = 0; layout < as->num_table; layout++) { StringID string = GetAirportTextCallback(as, layout, CBID_AIRPORT_ADDITIONAL_TEXT); if (string == STR_UNDEFINED) continue; diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 87b0baa413..713307b426 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -343,7 +343,7 @@ static CommandCost BuildReplacementMultiPartShipSimple(EngineID e, const Vehicle for (; v != nullptr && old != nullptr; v = v->Next(), old = old->Next()) { if (old->cargo_type == INVALID_CARGO) continue; - byte subtype = GetBestFittingSubType(old, v, old->cargo_type); + uint8_t subtype = GetBestFittingSubType(old, v, old->cargo_type); CommandCost refit_cost = DoCommand(0, v->index, old->cargo_type | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v)); if (refit_cost.Succeeded()) cost.AddCost(refit_cost); } @@ -396,7 +396,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_ CargoID c = FindFirstBit(available); assert(old_cargo_vehs[c] != nullptr); - byte subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c); + uint8_t subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c); CommandCost refit_cost = DoCommand(0, v->index, c | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v)); if (refit_cost.Succeeded()) cost.AddCost(refit_cost); } @@ -453,7 +453,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_ if (c == INVALID_CARGO) continue; assert(old_cargo_vehs[c] != nullptr); - byte subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c); + uint8_t subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c); CommandCost refit_cost = DoCommand(0, v->index, c | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v)); if (refit_cost.Succeeded()) cost.AddCost(refit_cost); } @@ -514,7 +514,7 @@ static CommandCost BuildReplacementVehicle(const Vehicle *old_veh, Vehicle **new /* Refit the vehicle if needed */ if (refit_cargo != CARGO_NO_REFIT) { - byte subtype = GetBestFittingSubType(old_veh, new_veh, refit_cargo); + uint8_t subtype = GetBestFittingSubType(old_veh, new_veh, refit_cargo); cost.AddCost(DoCommand(0, new_veh->index, refit_cargo | (subtype << 8), DC_EXEC, GetCmdRefitVeh(new_veh))); assert(cost.Succeeded()); // This should be ensured by GetNewCargoTypeForReplace() diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 25e2f32f29..c4757b9f2e 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -83,7 +83,7 @@ class ReplaceVehicleWindow : public Window { bool reset_sel_engine; ///< Also reset #sel_engine while updating left and/or right and no valid engine selected. GroupID sel_group; ///< Group selected to replace. int details_height; ///< Minimal needed height of the details panels, in text lines (found so far). - byte sort_criteria; ///< Criteria of sorting vehicles. + uint8_t sort_criteria; ///< Criteria of sorting vehicles. bool descending_sort_order; ///< Order of sorting vehicles. bool show_hidden_engines; ///< Whether to show the hidden engines. RailType sel_railtype; ///< Type of rail tracks selected. #INVALID_RAILTYPE to show all. @@ -141,7 +141,7 @@ class ReplaceVehicleWindow : public Window { std::vector variants; EngineID selected_engine = INVALID_ENGINE; VehicleType type = (VehicleType)this->window_number; - byte side = draw_left ? 0 : 1; + uint8_t side = draw_left ? 0 : 1; GUIEngineList list; @@ -606,7 +606,7 @@ public: case WID_RV_LEFT_MATRIX: case WID_RV_RIGHT_MATRIX: { - byte click_side; + uint8_t click_side; if (widget == WID_RV_LEFT_MATRIX) { click_side = 0; } else { diff --git a/src/base_media_base.h b/src/base_media_base.h index d069ff107b..e2b3d8b007 100644 --- a/src/base_media_base.h +++ b/src/base_media_base.h @@ -314,7 +314,7 @@ static const uint NUM_SONGS_PLAYLIST = 32; /* Functions to read DOS music CAT files, similar to but not quite the same as sound effect CAT files */ char *GetMusicCatEntryName(const std::string &filename, size_t entrynum); -byte *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen); +uint8_t *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen); enum MusicTrackType { MTT_STANDARDMIDI, ///< Standard MIDI file @@ -324,7 +324,7 @@ enum MusicTrackType { /** Metadata about a music track. */ struct MusicSongInfo { std::string songname; ///< name of song displayed in UI - byte tracknr; ///< track number of song displayed in UI + uint8_t tracknr; ///< track number of song displayed in UI std::string filename; ///< file on disk containing song (when used in MusicSet class) MusicTrackType filetype; ///< decoder required for song file int cat_index; ///< entry index in CAT file, for filetype==MTT_MPSMIDI @@ -338,7 +338,7 @@ struct MusicSet : BaseSet { /** Data about individual songs in set. */ MusicSongInfo songinfo[NUM_SONGS_AVAILABLE]; /** Number of valid songs in set. */ - byte num_available; + uint8_t num_available; bool FillSetDetails(const IniFile &ini, const std::string &path, const std::string &full_filename); }; diff --git a/src/base_station_base.h b/src/base_station_base.h index 39f59ab4c0..0d9c360883 100644 --- a/src/base_station_base.h +++ b/src/base_station_base.h @@ -80,8 +80,8 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> { std::vector roadstop_speclist; ///< List of road stop specs of this station uint16_t random_bits; ///< Random bits assigned to this station - byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station - byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted. + uint8_t waiting_triggers; ///< Waiting triggers (NewGRF) for this station + uint8_t delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted. uint8_t cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen. uint8_t cached_roadstop_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen. CargoTypes cached_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask @@ -119,7 +119,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> { * @param available will return false if ever the variable asked for does not exist * @return the value stored in the corresponding variable */ - virtual uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint16_t variable, byte parameter, bool *available) const = 0; + virtual uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint16_t variable, uint8_t parameter, bool *available) const = 0; /** * Update the coordinated of the sign (as shown in the viewport). @@ -195,7 +195,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> { return (this->facilities & facilities) != 0; } - inline byte GetRoadStopRandomBits(TileIndex tile) const + inline uint8_t GetRoadStopRandomBits(TileIndex tile) const { for (const RoadStopTileData &tile_data : this->custom_roadstop_tile_data) { if (tile_data.tile == tile) return tile_data.random_bits; @@ -203,7 +203,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> { return 0; } - inline byte GetRoadStopAnimationFrame(TileIndex tile) const + inline uint8_t GetRoadStopAnimationFrame(TileIndex tile) const { for (const RoadStopTileData &tile_data : this->custom_roadstop_tile_data) { if (tile_data.tile == tile) return tile_data.animation_frame; @@ -212,11 +212,11 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> { } private: - bool SetRoadStopTileData(TileIndex tile, byte data, bool animation); + bool SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation); public: - inline void SetRoadStopRandomBits(TileIndex tile, byte random_bits) { this->SetRoadStopTileData(tile, random_bits, false); } - inline bool SetRoadStopAnimationFrame(TileIndex tile, byte frame) { return this->SetRoadStopTileData(tile, frame, true); } + inline void SetRoadStopRandomBits(TileIndex tile, uint8_t random_bits) { this->SetRoadStopTileData(tile, random_bits, false); } + inline bool SetRoadStopAnimationFrame(TileIndex tile, uint8_t frame) { return this->SetRoadStopTileData(tile, frame, true); } void RemoveRoadStopTileData(TileIndex tile); static void PostDestructor(size_t index); diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index 9395048dce..9014ccde32 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -36,14 +36,14 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel const uint16_t *src_n = (const uint16_t *)(src->data + src->offset[zoom][1]); for (uint i = bp->skip_top; i != 0; i--) { - src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px); - src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n); + src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px); + src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n); } Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left; uint16_t *anim = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)bp->dst) + bp->top * this->anim_buf_pitch + bp->left; - const byte *remap = bp->remap; // store so we don't have to access it via bp every time + const uint8_t *remap = bp->remap; // store so we don't have to access it via bp every time const int width = bp->width; const int pitch = bp->pitch; const int anim_pitch = this->anim_buf_pitch; @@ -54,10 +54,10 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel Colour *dst_ln = dst + pitch; uint16_t *anim_ln = anim + anim_pitch; - const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px); + const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px); src_px++; - const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n); + const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n); src_n += 2; Colour *dst_end = dst; diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp index bfe185d870..f7ef160381 100644 --- a/src/blitter/32bpp_anim_sse4.cpp +++ b/src/blitter/32bpp_anim_sse4.cpp @@ -33,7 +33,7 @@ template remap; + const uint8_t * const remap = bp->remap; Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left; uint16_t *anim_line = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)bp->dst) + bp->top * this->anim_buf_pitch + bp->left; int effective_width = bp->width; @@ -42,7 +42,7 @@ inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom const Blitter_32bppSSE_Base::SpriteData * const sd = (const Blitter_32bppSSE_Base::SpriteData *) bp->sprite; const SpriteInfo * const si = &sd->infos[zoom]; const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width; - const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size); + const Colour *src_rgba_line = (const Colour *) ((const uint8_t *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size); if (read_mode != RM_WITH_MARGIN) { src_rgba_line += bp->skip_left; @@ -104,20 +104,20 @@ inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom if (animated) { /* Remap colours. */ - const byte m0 = mvX2; + const uint8_t m0 = mvX2; if (m0 >= PALETTE_ANIM_START) { const Colour c0 = (this->LookupColourInPalette(m0).data & 0x00FFFFFF) | (src[0].data & 0xFF000000); - InsertFirstUint32(AdjustBrightneSSE(c0, (byte) (mvX2 >> 8)).data, srcABCD); + InsertFirstUint32(AdjustBrightneSSE(c0, (uint8_t) (mvX2 >> 8)).data, srcABCD); } - const byte m1 = mvX2 >> 16; + const uint8_t m1 = mvX2 >> 16; if (m1 >= PALETTE_ANIM_START) { const Colour c1 = (this->LookupColourInPalette(m1).data & 0x00FFFFFF) | (src[1].data & 0xFF000000); - InsertSecondUint32(AdjustBrightneSSE(c1, (byte) (mvX2 >> 24)).data, srcABCD); + InsertSecondUint32(AdjustBrightneSSE(c1, (uint8_t) (mvX2 >> 24)).data, srcABCD); } /* Update anim buffer. */ - const byte a0 = src[0].a; - const byte a1 = src[1].a; + const uint8_t a0 = src[0].a; + const uint8_t a1 = src[1].a; uint32_t anim01 = 0; if (a0 == 255) { if (a1 == 255) { @@ -185,9 +185,9 @@ bmno_full_transparency: __m128i dstABCD = _mm_loadl_epi64((__m128i*) dst); /* Remap colours. */ - const uint m0 = (byte) mvX2; + const uint m0 = (uint8_t) mvX2; const uint r0 = remap[m0]; - const uint m1 = (byte) (mvX2 >> 16); + const uint m1 = (uint8_t) (mvX2 >> 16); const uint r1 = remap[m1]; if (mvX2 & 0x00FF00FF) { #define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \ @@ -195,7 +195,7 @@ bmno_full_transparency: Colour m_colour = m_colour_init; \ { \ const Colour srcm = (Colour) (m_src); \ - const uint m = (byte) (m_m); \ + const uint m = (uint8_t) (m_m); \ const uint r = remap[m]; \ const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \ m_colour = r == 0 ? m_colour : cmap; \ @@ -225,8 +225,8 @@ bmno_full_transparency: /* Update anim buffer. */ if (animated) { - const byte a0 = src[0].a; - const byte a1 = src[1].a; + const uint8_t a0 = src[0].a; + const uint8_t a1 = src[1].a; uint32_t anim01 = mvX2 & 0xFF00FF00; if (a0 == 255) { anim01 |= r0; @@ -437,7 +437,7 @@ bmcr_alpha_blend_single_brightness: next_line: if (mode != BM_TRANSPARENT && mode != BM_TRANSPARENT_REMAP) src_mv_line += si->sprite_width; - src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size); + src_rgba_line = (const Colour*) ((const uint8_t*) src_rgba_line + si->sprite_line_size); dst_line += bp->pitch; anim_line += this->anim_buf_pitch; } diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp index 483c45fc58..3fca934753 100644 --- a/src/blitter/32bpp_optimized.cpp +++ b/src/blitter/32bpp_optimized.cpp @@ -41,26 +41,26 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL /* skip upper lines in src_px and src_n */ for (uint i = bp->skip_top; i != 0; i--) { - src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px); - src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n); + src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px); + src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n); } /* skip lines in dst */ Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left; /* store so we don't have to access it via bp every time (compiler assumes pointer aliasing) */ - const byte *remap = bp->remap; + const uint8_t *remap = bp->remap; for (int y = 0; y < bp->height; y++) { /* next dst line begins here */ Colour *dst_ln = dst + bp->pitch; /* next src line begins here */ - const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px); + const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px); src_px++; /* next src_n line begins here */ - const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n); + const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n); src_n += 2; /* we will end this line when we reach this point */ @@ -459,8 +459,8 @@ template Sprite *Blitter_32bppOptimized::EncodeInternal(const dst_n_ln = (uint32_t *)dst_n; } - lengths[z][0] = (byte *)dst_px_ln - (byte *)dst_px_orig[z]; // all are aligned to 4B boundary - lengths[z][1] = (byte *)dst_n_ln - (byte *)dst_n_orig[z]; + lengths[z][0] = (uint8_t *)dst_px_ln - (uint8_t *)dst_px_orig[z]; // all are aligned to 4B boundary + lengths[z][1] = (uint8_t *)dst_n_ln - (uint8_t *)dst_n_orig[z]; px_buffer_next = (Colour *)dst_px_ln; n_buffer_next = (uint16_t *)dst_n_ln; diff --git a/src/blitter/32bpp_optimized.hpp b/src/blitter/32bpp_optimized.hpp index 44b0d3fb70..d51302e57b 100644 --- a/src/blitter/32bpp_optimized.hpp +++ b/src/blitter/32bpp_optimized.hpp @@ -19,7 +19,7 @@ public: struct SpriteData { BlitterSpriteFlags flags; uint32_t offset[ZOOM_LVL_SPR_COUNT][2]; ///< Offsets (from .data) to streams for different zoom levels, and the normal and remap image information. - byte data[]; ///< Data, all zoomlevels. + uint8_t data[]; ///< Data, all zoomlevels. }; Blitter_32bppOptimized() diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp index 8c3e721ebf..21a1d39745 100644 --- a/src/blitter/32bpp_sse2.cpp +++ b/src/blitter/32bpp_sse2.cpp @@ -142,7 +142,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri (*dst_rgba_line).data = nb_pix_transp; Colour *nb_right = dst_rgba_line + 1; - dst_rgba_line = (Colour*) ((byte*) dst_rgba_line + sd.infos[z].sprite_line_size); + dst_rgba_line = (Colour*) ((uint8_t*) dst_rgba_line + sd.infos[z].sprite_line_size); /* Count the number of transparent pixels from the right. */ dst_rgba = dst_rgba_line - 1; diff --git a/src/blitter/32bpp_sse2.hpp b/src/blitter/32bpp_sse2.hpp index 7026a91c54..f6cd6b85b7 100644 --- a/src/blitter/32bpp_sse2.hpp +++ b/src/blitter/32bpp_sse2.hpp @@ -61,7 +61,7 @@ public: struct SpriteData { BlitterSpriteFlags flags; SpriteInfo infos[ZOOM_LVL_SPR_COUNT]; - byte data[]; ///< Data, all zoomlevels. + uint8_t data[]; ///< Data, all zoomlevels. }; Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator); diff --git a/src/blitter/32bpp_sse_func.hpp b/src/blitter/32bpp_sse_func.hpp index 9f8539f1c8..d2c8fe3cdd 100644 --- a/src/blitter/32bpp_sse_func.hpp +++ b/src/blitter/32bpp_sse_func.hpp @@ -10,10 +10,17 @@ #ifndef BLITTER_32BPP_SSE_FUNC_HPP #define BLITTER_32BPP_SSE_FUNC_HPP +/* ATTENTION + * This file is compiled multiple times with different defines for SSE_VERSION and MARGIN_NORMAL_THRESHOLD. + * Be careful when declaring things with external linkage. + * Use internal linkage instead, i.e. "static". + */ +#define INTERNAL_LINKAGE static + #ifdef WITH_SSE GNU_TARGET(SSE_TARGET) -inline void InsertFirstUint32(const uint32_t value, __m128i &into) +INTERNAL_LINKAGE inline void InsertFirstUint32(const uint32_t value, __m128i &into) { #if (SSE_VERSION >= 4) into = _mm_insert_epi32(into, value, 0); @@ -24,7 +31,7 @@ inline void InsertFirstUint32(const uint32_t value, __m128i &into) } GNU_TARGET(SSE_TARGET) -inline void InsertSecondUint32(const uint32_t value, __m128i &into) +INTERNAL_LINKAGE inline void InsertSecondUint32(const uint32_t value, __m128i &into) { #if (SSE_VERSION >= 4) into = _mm_insert_epi32(into, value, 1); @@ -35,7 +42,7 @@ inline void InsertSecondUint32(const uint32_t value, __m128i &into) } GNU_TARGET(SSE_TARGET) -inline void LoadUint64(const uint64_t value, __m128i &into) +INTERNAL_LINKAGE inline void LoadUint64(const uint64_t value, __m128i &into) { #ifdef POINTER_IS_64BIT into = _mm_cvtsi64_si128(value); @@ -50,7 +57,7 @@ inline void LoadUint64(const uint64_t value, __m128i &into) } GNU_TARGET(SSE_TARGET) -inline __m128i PackUnsaturated(__m128i from, const __m128i &mask) +INTERNAL_LINKAGE inline __m128i PackUnsaturated(__m128i from, const __m128i &mask) { #if (SSE_VERSION == 2) from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing @@ -61,7 +68,7 @@ inline __m128i PackUnsaturated(__m128i from, const __m128i &mask) } GNU_TARGET(SSE_TARGET) -inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask) +INTERNAL_LINKAGE inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask) { #if (SSE_VERSION == 2) __m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1 @@ -73,7 +80,7 @@ inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask) } GNU_TARGET(SSE_TARGET) -inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask) +INTERNAL_LINKAGE inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask) { __m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8_t into uint16 __m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128()); @@ -97,7 +104,7 @@ inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &dist * rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4) */ GNU_TARGET(SSE_TARGET) -inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base) +INTERNAL_LINKAGE inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base) { __m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); __m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128()); @@ -111,7 +118,7 @@ inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribu IGNORE_UNINITIALIZED_WARNING_START GNU_TARGET(SSE_TARGET) -static Colour ReallyAdjustBrightness(Colour colour, uint8_t brightness) +INTERNAL_LINKAGE Colour ReallyAdjustBrightness(Colour colour, uint8_t brightness) { uint64_t c16 = colour.b | (uint64_t) colour.g << 16 | (uint64_t) colour.r << 32; c16 *= brightness; @@ -145,7 +152,7 @@ IGNORE_UNINITIALIZED_WARNING_STOP /** ReallyAdjustBrightness() is not called that often. * Inlining this function implies a far jump, which has a huge latency. */ -inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness) +INTERNAL_LINKAGE inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness) { /* Shortcut for normal brightness. */ if (likely(brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS)) return colour; @@ -154,7 +161,7 @@ inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness) } GNU_TARGET(SSE_TARGET) -inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness) +INTERNAL_LINKAGE inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness) { #if (SSE_VERSION < 3) NOT_REACHED(); @@ -214,7 +221,7 @@ inline void Blitter_32bppSSSE3::Draw(const Blitter::BlitterParams *bp, ZoomLevel inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom) #endif { - const byte * const remap = bp->remap; + const uint8_t * const remap = bp->remap; Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left; int effective_width = bp->width; @@ -222,7 +229,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel const SpriteData * const sd = (const SpriteData *) bp->sprite; const SpriteInfo * const si = &sd->infos[zoom]; const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width; - const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size); + const Colour *src_rgba_line = (const Colour *) ((const uint8_t *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size); uint32_t bm_normal_brightness = 0; if (mode == BM_NORMAL_WITH_BRIGHTNESS) { @@ -313,7 +320,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel Colour m_colour = m_colour_init; \ { \ const Colour srcm = (Colour) (m_src); \ - const uint m = (byte) (m_m); \ + const uint m = (uint8_t) (m_m); \ const uint r = remap[m]; \ const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \ m_colour = r == 0 ? m_colour : cmap; \ @@ -496,7 +503,7 @@ bmcr_alpha_blend_single_brightness: next_line: if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP || mode == BM_COLOUR_REMAP_WITH_BRIGHTNESS) src_mv_line += si->sprite_width; - src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size); + src_rgba_line = (const Colour*) ((const uint8_t*) src_rgba_line + si->sprite_line_size); dst_line += bp->pitch; } } diff --git a/src/blitter/32bpp_sse_type.h b/src/blitter/32bpp_sse_type.h index d3a73df1c3..e8662e4949 100644 --- a/src/blitter/32bpp_sse_type.h +++ b/src/blitter/32bpp_sse_type.h @@ -10,6 +10,12 @@ #ifndef BLITTER_32BPP_SSE_TYPE_H #define BLITTER_32BPP_SSE_TYPE_H +/* ATTENTION + * This file is compiled multiple times with different defines for SSE_VERSION. + * Be careful when declaring things with external linkage. + * Use internal linkage instead, i.e. "static". + */ + #ifdef WITH_SSE #include "32bpp_simple.hpp" diff --git a/src/blitter/40bpp_anim.cpp b/src/blitter/40bpp_anim.cpp index f57c3a7f2f..dc4edbbb07 100644 --- a/src/blitter/40bpp_anim.cpp +++ b/src/blitter/40bpp_anim.cpp @@ -167,8 +167,8 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel /* skip upper lines in src_px and src_n */ for (uint i = bp->skip_top; i != 0; i--) { - src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px); - src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n); + src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px); + src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n); } /* skip lines in dst */ @@ -177,7 +177,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel uint8_t *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32_t *)bp->dst - (uint32_t *)_screen.dst_ptr) + bp->top * bp->pitch + bp->left; /* store so we don't have to access it via bp everytime (compiler assumes pointer aliasing) */ - const byte *remap = bp->remap; + const uint8_t *remap = bp->remap; for (int y = 0; y < bp->height; y++) { /* next dst line begins here */ @@ -185,11 +185,11 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel uint8_t *anim_ln = anim + bp->pitch; /* next src line begins here */ - const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px); + const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px); src_px++; /* next src_n line begins here */ - const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n); + const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n); src_n += 2; /* we will end this line when we reach this point */ diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp index 6c8a88fb82..d61acdc0b0 100644 --- a/src/blitter/8bpp_optimized.cpp +++ b/src/blitter/8bpp_optimized.cpp @@ -148,10 +148,10 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri /* Don't allocate memory each time, but just keep some * memory around as this function is called quite often * and the memory usage is quite low. */ - static ReusableBuffer temp_buffer; + static ReusableBuffer temp_buffer; SpriteData *temp_dst = (SpriteData *)temp_buffer.Allocate(memory); memset(temp_dst, 0, sizeof(*temp_dst)); - byte *dst = temp_dst->data; + uint8_t *dst = temp_dst->data; /* Make the sprites per zoom-level */ for (ZoomLevel i = zoom_min; i <= zoom_max; i++) { @@ -167,7 +167,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri uint trans = 0; uint pixels = 0; uint last_colour = 0; - byte *count_dst = nullptr; + uint8_t *count_dst = nullptr; /* Store the scaled image */ const SpriteLoader::CommonPixel *src = &sprite[i].data[y * sprite[i].width]; @@ -214,7 +214,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri } } - uint size = dst - (byte *)temp_dst; + uint size = dst - (uint8_t *)temp_dst; /* Safety check, to make sure we guessed the size correctly */ assert(size < memory); diff --git a/src/blitter/8bpp_optimized.hpp b/src/blitter/8bpp_optimized.hpp index 17579f5740..7e5b83c2e1 100644 --- a/src/blitter/8bpp_optimized.hpp +++ b/src/blitter/8bpp_optimized.hpp @@ -19,7 +19,7 @@ public: /** Data stored about a (single) sprite. */ struct SpriteData { uint32_t offset[ZOOM_LVL_SPR_COUNT]; ///< Offsets (from .data) to streams for different zoom levels. - byte data[]; ///< Data, all zoomlevels. + uint8_t data[]; ///< Data, all zoomlevels. }; void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override; diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp index 7b5b54d7c1..c25b5ecf33 100644 --- a/src/blitter/base.hpp +++ b/src/blitter/base.hpp @@ -58,7 +58,7 @@ public: /** Parameters related to blitting. */ struct BlitterParams { const void *sprite; ///< Pointer to the sprite how ever the encoder stored it - const byte *remap; ///< XXX -- Temporary storage for remap array + const uint8_t *remap; ///< XXX -- Temporary storage for remap array int brightness_adjust; ///< Brightness adjustment int skip_left; ///< How much pixels of the source to skip on the left (based on zoom of dst) diff --git a/src/bmp.cpp b/src/bmp.cpp index eca61335dd..544217f51f 100644 --- a/src/bmp.cpp +++ b/src/bmp.cpp @@ -39,7 +39,7 @@ static inline bool EndOfBuffer(BmpBuffer *buffer) return buffer->pos == buffer->read; } -static inline byte ReadByte(BmpBuffer *buffer) +static inline uint8_t ReadByte(BmpBuffer *buffer) { if (buffer->read < 0) return 0; @@ -83,9 +83,9 @@ static inline void SetStreamOffset(BmpBuffer *buffer, int offset) static inline bool BmpRead1(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { uint x, y, i; - byte pad = GB(4 - info->width / 8, 0, 2); - byte *pixel_row; - byte b; + uint8_t pad = GB(4 - info->width / 8, 0, 2); + uint8_t *pixel_row; + uint8_t b; for (y = info->height; y > 0; y--) { x = 0; pixel_row = &data->bitmap[(y - 1) * info->width]; @@ -110,9 +110,9 @@ static inline bool BmpRead1(BmpBuffer *buffer, BmpInfo *info, BmpData *data) static inline bool BmpRead4(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { uint x, y; - byte pad = GB(4 - info->width / 2, 0, 2); - byte *pixel_row; - byte b; + uint8_t pad = GB(4 - info->width / 2, 0, 2); + uint8_t *pixel_row; + uint8_t b; for (y = info->height; y > 0; y--) { x = 0; pixel_row = &data->bitmap[(y - 1) * info->width]; @@ -140,12 +140,12 @@ static inline bool BmpRead4Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { uint x = 0; uint y = info->height - 1; - byte *pixel = &data->bitmap[y * info->width]; + uint8_t *pixel = &data->bitmap[y * info->width]; while (y != 0 || x < info->width) { if (EndOfBuffer(buffer)) return false; // the file is shorter than expected - byte n = ReadByte(buffer); - byte c = ReadByte(buffer); + uint8_t n = ReadByte(buffer); + uint8_t c = ReadByte(buffer); if (n == 0) { switch (c) { case 0: // end of line @@ -159,8 +159,8 @@ static inline bool BmpRead4Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data) case 2: { // delta if (EndOfBuffer(buffer)) return false; - byte dx = ReadByte(buffer); - byte dy = ReadByte(buffer); + uint8_t dx = ReadByte(buffer); + uint8_t dy = ReadByte(buffer); /* Check for over- and underflow. */ if (x + dx >= info->width || x + dx < x || dy > y) return false; @@ -175,7 +175,7 @@ static inline bool BmpRead4Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data) uint i = 0; while (i++ < c) { if (EndOfBuffer(buffer) || x >= info->width) return false; - byte b = ReadByte(buffer); + uint8_t b = ReadByte(buffer); *pixel++ = GB(b, 4, 4); x++; if (i++ < c) { @@ -214,8 +214,8 @@ static inline bool BmpRead8(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { uint i; uint y; - byte pad = GB(4 - info->width, 0, 2); - byte *pixel; + uint8_t pad = GB(4 - info->width, 0, 2); + uint8_t *pixel; for (y = info->height; y > 0; y--) { if (EndOfBuffer(buffer)) return false; // the file is shorter than expected pixel = &data->bitmap[(y - 1) * info->width]; @@ -233,12 +233,12 @@ static inline bool BmpRead8Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { uint x = 0; uint y = info->height - 1; - byte *pixel = &data->bitmap[y * info->width]; + uint8_t *pixel = &data->bitmap[y * info->width]; while (y != 0 || x < info->width) { if (EndOfBuffer(buffer)) return false; // the file is shorter than expected - byte n = ReadByte(buffer); - byte c = ReadByte(buffer); + uint8_t n = ReadByte(buffer); + uint8_t c = ReadByte(buffer); if (n == 0) { switch (c) { case 0: // end of line @@ -252,8 +252,8 @@ static inline bool BmpRead8Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data) case 2: { // delta if (EndOfBuffer(buffer)) return false; - byte dx = ReadByte(buffer); - byte dy = ReadByte(buffer); + uint8_t dx = ReadByte(buffer); + uint8_t dy = ReadByte(buffer); /* Check for over- and underflow. */ if (x + dx >= info->width || x + dx < x || dy > y) return false; @@ -294,8 +294,8 @@ static inline bool BmpRead8Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data) static inline bool BmpRead24(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { uint x, y; - byte pad = GB(4 - info->width * 3, 0, 2); - byte *pixel_row; + uint8_t pad = GB(4 - info->width * 3, 0, 2); + uint8_t *pixel_row; for (y = info->height; y > 0; y--) { pixel_row = &data->bitmap[(y - 1) * info->width * 3]; for (x = 0; x < info->width; x++) { @@ -395,7 +395,7 @@ bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { assert(info != nullptr && data != nullptr); - data->bitmap = CallocT(static_cast(info->width) * info->height * ((info->bpp == 24) ? 3 : 1)); + data->bitmap = CallocT(static_cast(info->width) * info->height * ((info->bpp == 24) ? 3 : 1)); /* Load image */ SetStreamOffset(buffer, info->offset); diff --git a/src/bmp.h b/src/bmp.h index 2aa59e3e23..6027c616a4 100644 --- a/src/bmp.h +++ b/src/bmp.h @@ -24,13 +24,13 @@ struct BmpInfo { struct BmpData { Colour *palette; - byte *bitmap; + uint8_t *bitmap; }; #define BMP_BUFFER_SIZE 1024 struct BmpBuffer { - byte data[BMP_BUFFER_SIZE]; + uint8_t data[BMP_BUFFER_SIZE]; int pos; int read; FILE *file; diff --git a/src/bridge.h b/src/bridge.h index f9c1fcaa83..cbb0cfee8c 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -63,7 +63,7 @@ enum BridgeSpecCtrlFlags { */ struct BridgeSpec { CalTime::Year avail_year; ///< the year where it becomes available - byte min_length; ///< the minimum length (not counting start and end tile) + uint8_t min_length; ///< the minimum length (not counting start and end tile) uint16_t max_length; ///< the maximum length (not counting start and end tile) uint16_t price; ///< the price multiplier uint16_t speed; ///< maximum travel speed (1 unit = 1/1.6 mph = 1 km-ish/h) @@ -72,9 +72,9 @@ struct BridgeSpec { StringID material; ///< the string that contains the bridge description StringID transport_name[2]; ///< description of the bridge, when built for road or rail PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge - byte flags; ///< bit 0 set: disable drawing of far pillars. - byte ctrl_flags; ///< control flags - byte pillar_flags[12]; ///< bridge pillar flags: 6 x pairs of x and y flags + uint8_t flags; ///< bit 0 set: disable drawing of far pillars. + uint8_t ctrl_flags; ///< control flags + uint8_t pillar_flags[12]; ///< bridge pillar flags: 6 x pairs of x and y flags }; extern BridgeSpec _bridge[MAX_BRIDGES]; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 12c0f269e7..54d181ba07 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -373,7 +373,7 @@ static WindowDesc _build_bridge_desc(__FILE__, __LINE__, * @param transport_type The transport type * @param road_rail_type The road/rail type */ -void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type) +void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, uint8_t road_rail_type) { CloseWindowByClass(WC_BUILD_BRIDGE); diff --git a/src/bridge_map.h b/src/bridge_map.h index 2584994bc3..2ae206c31b 100644 --- a/src/bridge_map.h +++ b/src/bridge_map.h @@ -360,7 +360,7 @@ inline bool IsCustomBridgeHeadTile(TileIndex t) inline TrackBits GetBridgeReservationTrackBits(TileIndex t) { assert_tile(IsRailBridgeHeadTile(t), t); - byte track_b = GB(_m[t].m2, 0, 3); + uint8_t track_b = GB(_m[t].m2, 0, 3); Track track = (Track)(track_b - 1); // map array saves Track+1 if (track_b == 0) return TRACK_BIT_NONE; return (TrackBits)(TrackToTrackBits(track) | (HasBit(_m[t].m2, 3) ? TrackToTrackBits(TrackToOppositeTrack(track)) : 0)); @@ -378,7 +378,7 @@ inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b) assert(!TracksOverlap(b)); Track track = RemoveFirstTrack(&b); SB(_m[t].m2, 0, 3, track == INVALID_TRACK ? 0 : track + 1); - SB(_m[t].m2, 3, 1, (byte)(b != TRACK_BIT_NONE)); + SB(_m[t].m2, 3, 1, (uint8_t)(b != TRACK_BIT_NONE)); } diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 312bace46b..07f5bd43f6 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -198,8 +198,8 @@ static constexpr NWidgetPart _nested_build_vehicle_widgets_train_advanced[] = { EndContainer(), }; -bool _engine_sort_direction; ///< \c false = descending, \c true = ascending. -byte _engine_sort_last_criteria[] = {0, 0, 0, 0}; ///< Last set sort criteria, for each vehicle type. +bool _engine_sort_direction; ///< \c false = descending, \c true = ascending. +uint8_t _engine_sort_last_criteria[] = {0, 0, 0, 0}; ///< Last set sort criteria, for each vehicle type. bool _engine_sort_last_order[] = {false, false, false, false}; ///< Last set direction of the sort order, for each vehicle type. bool _engine_sort_show_hidden_engines[] = {false, false, false, false}; ///< Last set 'show hidden engines' setting for each vehicle type. bool _engine_sort_show_hidden_locos = false; ///< Last set 'show hidden locos' setting. @@ -229,11 +229,11 @@ struct EngineCapacityCache { }; static EngineCapacityCache *_engine_sort_capacity_cache = nullptr; -static byte _last_sort_criteria_loco = 0; +static uint8_t _last_sort_criteria_loco = 0; static bool _last_sort_order_loco = false; static CargoID _last_filter_criteria_loco = CargoFilterCriteria::CF_ANY; -static byte _last_sort_criteria_wagon = 0; +static uint8_t _last_sort_criteria_wagon = 0; static bool _last_sort_order_wagon = false; static CargoID _last_filter_criteria_wagon = CargoFilterCriteria::CF_ANY; @@ -1528,7 +1528,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { RoadType roadtype; ///< Road type to show, or #INVALID_ROADTYPE. } filter; ///< Filter to apply. bool descending_sort_order; ///< Sort direction, @see _engine_sort_direction - byte sort_criteria; ///< Current sort criterium. + uint8_t sort_criteria; ///< Current sort criterium. bool show_hidden_engines; ///< State of the 'show hidden engines' button. EngineID sel_engine; ///< Currently selected engine, or #INVALID_ENGINE EngineID rename_engine; ///< Engine being renamed. @@ -2349,7 +2349,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase { struct PanelState { bool descending_sort_order; ///< Sort direction, @see _engine_sort_direction - byte sort_criteria; ///< Current sort criterium. + uint8_t sort_criteria; ///< Current sort criterium. EngineID sel_engine; ///< Currently selected engine, or #INVALID_ENGINE EngineID rename_engine {}; ///< Engine being renamed. GUIEngineList eng_list; @@ -3151,7 +3151,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase { switch (widget) { case WID_BV_SORT_DROPDOWN_LOCO: { if (this->loco.sort_criteria != index) { - this->loco.sort_criteria = static_cast(index); + this->loco.sort_criteria = static_cast(index); _last_sort_criteria_loco = this->loco.sort_criteria; this->loco.eng_list.ForceRebuild(); } @@ -3160,7 +3160,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase { case WID_BV_CARGO_FILTER_DROPDOWN_LOCO: { // Select a cargo filter criteria if (this->loco.cargo_filter_criteria != index) { - this->loco.cargo_filter_criteria = static_cast(index); + this->loco.cargo_filter_criteria = static_cast(index); _last_filter_criteria_loco = this->loco.cargo_filter_criteria; /* deactivate filter if criteria is 'Show All', activate it otherwise */ this->loco.eng_list.SetFilterState(this->loco.cargo_filter_criteria != CargoFilterCriteria::CF_ANY); @@ -3171,7 +3171,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase { case WID_BV_SORT_DROPDOWN_WAGON: { if (this->wagon.sort_criteria != index) { - this->wagon.sort_criteria = static_cast(index); + this->wagon.sort_criteria = static_cast(index); _last_sort_criteria_wagon = this->wagon.sort_criteria; this->wagon.eng_list.ForceRebuild(); } @@ -3180,7 +3180,7 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase { case WID_BV_CARGO_FILTER_DROPDOWN_WAGON: { // Select a cargo filter criteria if (this->wagon.cargo_filter_criteria != index) { - this->wagon.cargo_filter_criteria = static_cast(index); + this->wagon.cargo_filter_criteria = static_cast(index); _last_filter_criteria_wagon = this->wagon.cargo_filter_criteria; /* deactivate filter if criteria is 'Show All', activate it otherwise */ this->wagon.eng_list.SetFilterState(this->wagon.cargo_filter_criteria != CargoFilterCriteria::CF_ANY); diff --git a/src/cargo_type.h b/src/cargo_type.h index 84f7bf60fc..437601b746 100644 --- a/src/cargo_type.h +++ b/src/cargo_type.h @@ -22,7 +22,7 @@ using CargoLabel = StrongType::Typedef { /** Types of cargo source and destination */ -enum class SourceType : byte { +enum class SourceType : uint8_t { Industry, ///< Source/destination is an industry Town, ///< Source/destination is a town Headquarters, ///< Source/destination are company headquarters diff --git a/src/cargotype.h b/src/cargotype.h index f79328086f..f8737a6fe4 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -19,7 +19,7 @@ #include /** Town growth effect when delivering cargo. */ -enum TownAcceptanceEffect : byte { +enum TownAcceptanceEffect : uint8_t { TAE_BEGIN = 0, TAE_NONE = TAE_BEGIN, ///< Cargo has no effect. TAE_PASSENGERS, ///< Cargo behaves passenger-like. @@ -32,7 +32,7 @@ enum TownAcceptanceEffect : byte { }; /** Town effect when producing cargo. */ -enum TownProductionEffect : byte { +enum TownProductionEffect : uint8_t { TPE_NONE, ///< Town will not produce this cargo type. TPE_PASSENGERS, ///< Cargo behaves passenger-like for production. TPE_MAIL, ///< Cargo behaves mail-like for production. @@ -61,7 +61,7 @@ enum CargoClass { CC_SPECIAL = 1 << 15, ///< Special bit used for livery refit tricks instead of normal cargoes. }; -static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo +static const uint8_t INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo static const uint TOWN_PRODUCTION_DIVISOR = 256; diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index f01e0068e8..7834dacb2f 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -46,12 +46,12 @@ static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags) return price; } -SpriteID GetSpriteIDForClearLand(const Slope slope, byte set) +SpriteID GetSpriteIDForClearLand(const Slope slope, uint8_t set) { return SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(slope) + set * 19; } -void DrawClearLandTile(const TileInfo *ti, byte set) +void DrawClearLandTile(const TileInfo *ti, uint8_t set) { DrawGroundSprite(GetSpriteIDForClearLand(ti->tileh, set), PAL_NONE); } diff --git a/src/clear_func.h b/src/clear_func.h index 9fe62c0583..c0d6e05ed9 100644 --- a/src/clear_func.h +++ b/src/clear_func.h @@ -13,9 +13,9 @@ #include "tile_cmd.h" void DrawHillyLandTile(const TileInfo *ti); -void DrawClearLandTile(const TileInfo *ti, byte set); +void DrawClearLandTile(const TileInfo *ti, uint8_t set); -SpriteID GetSpriteIDForClearLand(const Slope slope, byte set); +SpriteID GetSpriteIDForClearLand(const Slope slope, uint8_t set); SpriteID GetSpriteIDForHillyLand(const Slope slope, const uint rough_index); SpriteID GetSpriteIDForRocks(const Slope slope, const uint tile_hash); SpriteID GetSpriteIDForFields(const Slope slope, const uint field_type); diff --git a/src/command.cpp b/src/command.cpp index 109a587491..2a557764c5 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -1119,7 +1119,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32_t p1, uint32_t p2, uint64_ _additional_cash_required = 0; /* Get pointer to command handler */ - byte cmd_id = cmd & CMD_ID_MASK; + uint cmd_id = cmd & CMD_ID_MASK; assert(cmd_id < lengthof(_command_proc_table)); const Command &command = _command_proc_table[cmd_id]; @@ -1177,7 +1177,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32_t p1, uint32_t p2, uint64_ if (_debug_desync_level >= 1) { std::string aux_str; if (aux_data != nullptr) { - std::vector buffer; + std::vector buffer; CommandSerialisationBuffer serialiser(buffer, SHRT_MAX); aux_data->Serialise(serialiser); aux_str = FormatArrayAsHex(buffer); diff --git a/src/command_aux.h b/src/command_aux.h index a432fd3bd2..8937afbdc4 100644 --- a/src/command_aux.h +++ b/src/command_aux.h @@ -25,7 +25,7 @@ struct CommandDeserialisationBuffer : public BufferDeserialisationHelperbuffer; } + const uint8_t *GetDeserialisationBuffer() const { return this->buffer; } size_t GetDeserialisationBufferSize() const { return this->size; } size_t &GetDeserialisationPosition() { return this->pos; } @@ -44,17 +44,17 @@ struct CommandDeserialisationBuffer : public BufferDeserialisationHelper { - std::vector &buffer; + std::vector &buffer; size_t limit; - CommandSerialisationBuffer(std::vector &buffer, size_t limit) : buffer(buffer), limit(limit) {} + CommandSerialisationBuffer(std::vector &buffer, size_t limit) : buffer(buffer), limit(limit) {} - std::vector &GetSerialisationBuffer() { return this->buffer; } + std::vector &GetSerialisationBuffer() { return this->buffer; } size_t GetSerialisationLimit() const { return this->limit; } }; struct CommandAuxiliarySerialised : public CommandAuxiliaryBase { - std::vector serialised_data; + std::vector serialised_data; CommandAuxiliaryBase *Clone() const override { diff --git a/src/company_base.h b/src/company_base.h index 3df5ac88e7..d1a67529d1 100644 --- a/src/company_base.h +++ b/src/company_base.h @@ -65,7 +65,7 @@ private: std::vector used_bitmap; }; -enum CompanyBankruptcyFlags : byte { +enum CompanyBankruptcyFlags : uint8_t { CBRF_NONE = 0x0, CBRF_SALE = 0x1, ///< the company has been marked for sale CBRF_SALE_ONLY = 0x2, ///< the company has been marked for sale without being in a bankruptcy state first @@ -88,13 +88,13 @@ struct CompanyProperties { CompanyManagerFace face; ///< Face description of the president. Money money; ///< Money owned by the company. - byte money_fraction; ///< Fraction of money of the company, too small to represent in #money. + uint8_t money_fraction; ///< Fraction of money of the company, too small to represent in #money. Money current_loan; ///< Amount of money borrowed from the bank. Money max_loan; ///< Max allowed amount of the loan or COMPANY_MAX_LOAN_DEFAULT. Colours colour; ///< Company colour. - byte block_preview; ///< Number of quarters that the company is not allowed to get new exclusive engine previews (see CompaniesGenStatistics). + uint8_t block_preview; ///< Number of quarters that the company is not allowed to get new exclusive engine previews (see CompaniesGenStatistics). TileIndex location_of_HQ; ///< Northern tile of HQ; #INVALID_TILE when there is none. TileIndex last_build_coordinate; ///< Coordinate of the last build thing by this company. @@ -105,7 +105,7 @@ struct CompanyProperties { int32_t display_inaugurated_period;///< Wallclock display period of starting the company. YearDelta age_years; ///< Number of economy years that the company has been operational. - byte months_of_bankruptcy; ///< Number of months that the company is unable to pay its debts + uint8_t months_of_bankruptcy; ///< Number of months that the company is unable to pay its debts CompanyID bankrupt_last_asked; ///< Which company was most recently asked about buying it? CompanyBankruptcyFlags bankrupt_flags; ///< bankruptcy flags CompanyMask bankrupt_asked; ///< which companies were asked about buying it? @@ -127,7 +127,7 @@ struct CompanyProperties { std::array yearly_expenses{}; ///< Expenses of the company for the last three years. CompanyEconomyEntry cur_economy; ///< Economic data of the company of this quarter. CompanyEconomyEntry old_economy[MAX_HISTORY_QUARTERS]; ///< Economic data of the company of the last #MAX_HISTORY_QUARTERS quarters. - byte num_valid_stat_ent; ///< Number of valid statistical entries in #old_economy. + uint8_t num_valid_stat_ent; ///< Number of valid statistical entries in #old_economy. Livery livery[LS_END]; diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 559ec2a5cb..d664081089 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -323,10 +323,10 @@ void SubtractMoneyFromCompany(const CommandCost &cost) void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cst) { Company *c = Company::Get(company); - byte m = c->money_fraction; + uint8_t m = c->money_fraction; Money cost = cst.GetCost(); - c->money_fraction = m - (byte)cost; + c->money_fraction = m - (uint8_t)cost; cost >>= 8; if (c->money_fraction > m) cost++; if (cost != 0) SubtractMoneyFromAnyCompany(c, CommandCost(cst.GetExpensesType(), cost)); @@ -473,7 +473,7 @@ bad_town_name:; } /** Sorting weights for the company colours. */ -static const byte _colour_sort[COLOUR_END] = {2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1, 1}; +static const uint8_t _colour_sort[COLOUR_END] = {2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1, 1}; /** Similar colours, so we can try to prevent same coloured companies. */ static const Colours _similar_colour[COLOUR_END][2] = { { COLOUR_BLUE, COLOUR_LIGHT_BLUE }, // COLOUR_DARK_BLUE diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 63992c2d54..0bd5a4e14c 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -651,7 +651,7 @@ private: uint32_t used_colours = 0; const Livery *livery, *default_livery = nullptr; bool primary = widget == WID_SCL_PRI_COL_DROPDOWN; - byte default_col = 0; + uint8_t default_col = 0; /* Disallow other company colours for the primary colour */ if (this->livery_class < LC_GROUP_RAIL && HasBit(this->sel, LS_DEFAULT) && primary) { @@ -692,7 +692,7 @@ private: list.push_back(std::make_unique>(i, HasBit(used_colours, i))); } - byte sel; + uint8_t sel; if (default_livery == nullptr || HasBit(livery->in_use, primary ? 0 : 1)) { sel = primary ? livery->colour1 : livery->colour2; } else { @@ -2636,7 +2636,7 @@ struct CompanyWindow : Window } case WID_C_BUILD_HQ: - if ((byte)this->window_number != _local_company) return; + if ((uint8_t)this->window_number != _local_company) return; if (this->IsWidgetLowered(WID_C_BUILD_HQ)) { ResetObjectToPlace(); this->RaiseButtons(); diff --git a/src/company_manager_face.h b/src/company_manager_face.h index 113a4c728b..2b02a6f7a7 100644 --- a/src/company_manager_face.h +++ b/src/company_manager_face.h @@ -54,9 +54,9 @@ DECLARE_POSTFIX_INCREMENT(CompanyManagerFaceVariable) /** Information about the valid values of CompanyManagerFace bitgroups as well as the sprites to draw */ struct CompanyManagerFaceBitsInfo { - byte offset; ///< Offset in bits into the CompanyManagerFace - byte length; ///< Number of bits used in the CompanyManagerFace - byte valid_values[GE_END]; ///< The number of valid values per gender/ethnicity + uint8_t offset; ///< Offset in bits into the CompanyManagerFace + uint8_t length; ///< Number of bits used in the CompanyManagerFace + uint8_t valid_values[GE_END]; ///< The number of valid values per gender/ethnicity SpriteID first_sprite[GE_END]; ///< The first sprite per gender/ethnicity }; diff --git a/src/company_type.h b/src/company_type.h index 07a0d05822..d7f4a35e67 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -15,7 +15,7 @@ /** * Enum for all companies/owners. */ -enum Owner : byte { +enum Owner : uint8_t { /* All companies below MAX_COMPANIES are playable * companies, above, they are special, computer controlled 'companies' */ OWNER_BEGIN = 0x00, ///< First owner @@ -47,7 +47,7 @@ static const uint MIN_COMPETITORS_INTERVAL = 0; ///< The minimum interval (in static const uint MAX_COMPETITORS_INTERVAL = 500; ///< The maximum interval (in minutes) between competitors. /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; typedef Owner CompanyID; diff --git a/src/console.cpp b/src/console.cpp index 43fd18063c..ef74c66dbc 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -249,7 +249,7 @@ std::string RemoveUnderscores(std::string name) * @param tokencount the number of parameters passed * @param *tokens are the parameters given to the original command (0 is the first param) */ -static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[ICON_TOKEN_COUNT], const uint recurse_count) +static void IConsoleAliasExec(const IConsoleAlias *alias, uint8_t tokencount, char *tokens[ICON_TOKEN_COUNT], const uint recurse_count) { std::string alias_buffer; diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 1425d747bb..8dc71c1901 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -111,7 +111,7 @@ static ConsoleFileList _console_file_list_scenario{FT_SCENARIO, false}; ///< Fil static ConsoleFileList _console_file_list_heightmap{FT_HEIGHTMAP, false}; ///< File storage cache for heightmaps. /* console command defines */ -#define DEF_CONSOLE_CMD(function) static bool function([[maybe_unused]] byte argc, [[maybe_unused]] char *argv[]) +#define DEF_CONSOLE_CMD(function) static bool function([[maybe_unused]] uint8_t argc, [[maybe_unused]] char *argv[]) #define DEF_CONSOLE_HOOK(function) static ConsoleHookResult function(bool echo) /**************** @@ -2367,7 +2367,7 @@ DEF_CONSOLE_CMD(ConFont) uint size = setting->size; bool aa = setting->aa; - byte arg_index = 2; + uint8_t arg_index = 2; /* We may encounter "aa" or "noaa" but it must be the last argument. */ if (StrEqualsIgnoreCase(argv[arg_index], "aa") || StrEqualsIgnoreCase(argv[arg_index], "noaa")) { aa = !StrStartsWithIgnoreCase(argv[arg_index++], "no"); @@ -3810,7 +3810,7 @@ DEF_CONSOLE_CMD(ConSwitchBaseset) return 1; } -static bool ConConditionalCommon(byte argc, char *argv[], int value, const char *value_name, const char *name) +static bool ConConditionalCommon(uint8_t argc, char *argv[], int value, const char *value_name, const char *name) { if (argc < 4) { IConsolePrintF(CC_WARNING, "- Execute command if %s is within the specified range. Usage: '%s '", value_name, name); diff --git a/src/console_internal.h b/src/console_internal.h index 91b837edb7..efad467ef7 100644 --- a/src/console_internal.h +++ b/src/console_internal.h @@ -31,7 +31,7 @@ enum ConsoleHookResult { * If you want to handle multiple words as one, enclose them in double-quotes * eg. 'say "hello everybody"' */ -typedef bool IConsoleCmdProc(byte argc, char *argv[]); +typedef bool IConsoleCmdProc(uint8_t argc, char *argv[]); typedef ConsoleHookResult IConsoleHook(bool echo); struct IConsoleCmd { IConsoleCmd(const std::string &name, IConsoleCmdProc *proc, IConsoleHook *hook, bool unlisted) : name(name), proc(proc), hook(hook), unlisted(unlisted) {} diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp index b6419fb251..3961a422ea 100644 --- a/src/core/alloc_type.hpp +++ b/src/core/alloc_type.hpp @@ -94,14 +94,14 @@ public: * @param size the amount of bytes to allocate. * @return the given amounts of bytes zeroed. */ - inline void *operator new(size_t size) { return CallocT(size); } + inline void *operator new(size_t size) { return CallocT(size); } /** * Memory allocator for an array of class instances. * @param size the amount of bytes to allocate. * @return the given amounts of bytes zeroed. */ - inline void *operator new[](size_t size) { return CallocT(size); } + inline void *operator new[](size_t size) { return CallocT(size); } /** * Memory release for a single class instance. diff --git a/src/core/checksum_func.hpp b/src/core/checksum_func.hpp index 5101ce6d6f..fc03aebd55 100644 --- a/src/core/checksum_func.hpp +++ b/src/core/checksum_func.hpp @@ -49,7 +49,7 @@ inline bool ShouldLogUpdateStateChecksum() return _networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE)); } # define DEBUG_UPDATESTATECHECKSUM(str, ...) if (ShouldLogUpdateStateChecksum()) DEBUG(statecsum, 0, "%s; %04x; %02x; " OTTD_PRINTFHEX64PAD "; %s:%d " str, \ - debug_date_dumper().HexDate(), _frame_counter, (byte)_current_company, _state_checksum.state, __FILE__, __LINE__, __VA_ARGS__); + debug_date_dumper().HexDate(), _frame_counter, (uint8_t)_current_company, _state_checksum.state, __FILE__, __LINE__, __VA_ARGS__); #else # define DEBUG_UPDATESTATECHECKSUM(str, ...) #endif /* RANDOM_DEBUG */ diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index bd2d6e51fc..7e75d6c3ae 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -49,7 +49,7 @@ * other templates below. Here we have only forward declaration. For each enum type * we will create specialization derived from MakeEnumPropsT<>. * i.e.: - * template <> struct EnumPropsT : MakeEnumPropsT {}; + * template <> struct EnumPropsT : MakeEnumPropsT {}; */ template struct EnumPropsT; @@ -58,7 +58,7 @@ template struct EnumPropsT; * from outsize. It is used as base class of several EnumPropsT specializations each * dedicated to one of commonly used enumeration types. * @param Tenum_t enumeration type that you want to describe - * @param Tstorage_t what storage type would be sufficient (i.e. byte) + * @param Tstorage_t what storage type would be sufficient (i.e. uint8_t) * @param Tbegin first valid value from the contiguous range (i.e. TRACK_BEGIN) * @param Tend one past the last valid value from the contiguous range (i.e. TRACK_END) * @param Tinvalid value used as invalid value marker (i.e. INVALID_TRACK) @@ -67,7 +67,7 @@ template struct EnumPropsT; template struct MakeEnumPropsT { typedef Tenum_t type; ///< enum type (i.e. Trackdir) - typedef Tstorage_t storage; ///< storage type (i.e. byte) + typedef Tstorage_t storage; ///< storage type (i.e. uint8_t) static const Tenum_t begin = Tbegin; ///< lowest valid value (i.e. TRACKDIR_BEGIN) static const Tenum_t end = Tend; ///< one after the last valid value (i.e. TRACKDIR_END) static const Tenum_t invalid = Tinvalid; ///< what value is used as invalid value (i.e. INVALID_TRACKDIR) diff --git a/src/core/mem_func.hpp b/src/core/mem_func.hpp index 26bd7c6b7c..202d1ebe15 100644 --- a/src/core/mem_func.hpp +++ b/src/core/mem_func.hpp @@ -46,7 +46,7 @@ inline void MemMoveT(T *destination, const T *source, size_t num = 1) * @param num number of items to be set (!not number of bytes!) */ template -inline void MemSetT(T *ptr, byte value, size_t num = 1) +inline void MemSetT(T *ptr, uint8_t value, size_t num = 1) { memset(ptr, value, num * sizeof(T)); } diff --git a/src/core/overflowsafe_type.hpp b/src/core/overflowsafe_type.hpp index f9a14d62f4..fa6dc1490a 100644 --- a/src/core/overflowsafe_type.hpp +++ b/src/core/overflowsafe_type.hpp @@ -138,7 +138,7 @@ public: inline constexpr OverflowSafeInt operator * (const int factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; } inline constexpr OverflowSafeInt operator * (const uint factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; } inline constexpr OverflowSafeInt operator * (const uint16_t factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; } - inline constexpr OverflowSafeInt operator * (const byte factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; } + inline constexpr OverflowSafeInt operator * (const uint8_t factor) const { OverflowSafeInt result = *this; result *= (int64_t)factor; return result; } /* Operators for division. */ inline constexpr OverflowSafeInt& operator /= (const int64_t divisor) { this->m_value /= divisor; return *this; } @@ -197,11 +197,11 @@ template inline constexpr OverflowSafeInt operator - (const uint a template inline constexpr OverflowSafeInt operator * (const uint a, const OverflowSafeInt b) { return b * a; } template inline constexpr OverflowSafeInt operator / (const uint a, const OverflowSafeInt b) { return (OverflowSafeInt)a / (int)b; } -/* Sometimes we got byte operator OverflowSafeInt instead of vice versa. Handle that properly. */ -template inline constexpr OverflowSafeInt operator + (const byte a, const OverflowSafeInt b) { return b + (uint)a; } -template inline constexpr OverflowSafeInt operator - (const byte a, const OverflowSafeInt b) { return -b + (uint)a; } -template inline constexpr OverflowSafeInt operator * (const byte a, const OverflowSafeInt b) { return b * (uint)a; } -template inline constexpr OverflowSafeInt operator / (const byte a, const OverflowSafeInt b) { return (OverflowSafeInt)a / (int)b; } +/* Sometimes we got uint8_t operator OverflowSafeInt instead of vice versa. Handle that properly. */ +template inline constexpr OverflowSafeInt operator + (const uint8_t a, const OverflowSafeInt b) { return b + (uint)a; } +template inline constexpr OverflowSafeInt operator - (const uint8_t a, const OverflowSafeInt b) { return -b + (uint)a; } +template inline constexpr OverflowSafeInt operator * (const uint8_t a, const OverflowSafeInt b) { return b * (uint)a; } +template inline constexpr OverflowSafeInt operator / (const uint8_t a, const OverflowSafeInt b) { return (OverflowSafeInt)a / (int)b; } typedef OverflowSafeInt OverflowSafeInt64; typedef OverflowSafeInt OverflowSafeInt32; diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index 0f1bfdb3dc..8d968035a1 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -125,9 +125,9 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index, Pool: memset((void *)item, 0, sizeof(Titem)); } } else if (Tzero) { - item = (Titem *)CallocT(size); + item = (Titem *)CallocT(size); } else { - item = (Titem *)MallocT(size); + item = (Titem *)MallocT(size); } this->data[index] = Tops::PutPtr(item, param); SetBit(this->free_bitmap[index / 64], index % 64); diff --git a/src/core/random_func.cpp b/src/core/random_func.cpp index 1a92f4288b..0721e6c64f 100644 --- a/src/core/random_func.cpp +++ b/src/core/random_func.cpp @@ -87,7 +87,7 @@ void SetRandomSeed(uint32_t seed) uint32_t DoRandom(int line, const char *file) { if (_networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE))) { - DEBUG(random, 0, "%s; %04x; %02x; %s:%d", debug_date_dumper().HexDate(), _frame_counter, (byte)_current_company, file, line); + DEBUG(random, 0, "%s; %04x; %02x; %s:%d", debug_date_dumper().HexDate(), _frame_counter, (uint8_t)_current_company, file, line); } return _random.Next(); diff --git a/src/core/ring_buffer.hpp b/src/core/ring_buffer.hpp index 5979014518..0798dbebfa 100644 --- a/src/core/ring_buffer.hpp +++ b/src/core/ring_buffer.hpp @@ -25,7 +25,7 @@ template class ring_buffer { - std::unique_ptr data; + std::unique_ptr data; uint32_t head = 0; uint32_t count = 0; uint32_t mask = (uint32_t)-1; @@ -219,11 +219,11 @@ public: void construct_from(const U &other) { uint32_t cap = round_up_size((uint32_t)other.size()); - this->data.reset(MallocT(cap * sizeof(T))); + this->data.reset(MallocT(cap * sizeof(T))); this->mask = cap - 1; this->head = 0; this->count = (uint32_t)other.size(); - byte *ptr = this->data.get(); + uint8_t *ptr = this->data.get(); for (const T &item : other) { new (ptr) T(item); ptr += sizeof(T); @@ -259,12 +259,12 @@ public: if (!other.empty()) { if (other.size() > this->capacity()) { uint32_t cap = round_up_size(other.count); - this->data.reset(MallocT(cap * sizeof(T))); + this->data.reset(MallocT(cap * sizeof(T))); this->mask = cap - 1; } this->head = 0; this->count = other.count; - byte *ptr = this->data.get(); + uint8_t *ptr = this->data.get(); for (const T &item : other) { new (ptr) T(item); ptr += sizeof(T); @@ -341,8 +341,8 @@ private: void reallocate(uint32_t new_cap) { const uint32_t cap = round_up_size(new_cap); - byte *new_buf = MallocT(cap * sizeof(T)); - byte *pos = new_buf; + uint8_t *new_buf = MallocT(cap * sizeof(T)); + uint8_t *pos = new_buf; for (T &item : *this) { new (pos) T(std::move(item)); item.~T(); @@ -522,8 +522,8 @@ private: if (this->count + num > (uint32_t)this->capacity()) { /* grow container */ const uint32_t cap = round_up_size(this->count + num); - byte *new_buf = MallocT(cap * sizeof(T)); - byte *write_to = new_buf; + uint8_t *new_buf = MallocT(cap * sizeof(T)); + uint8_t *write_to = new_buf; const uint32_t end = this->head + this->count; for (uint32_t idx = this->head; idx != end; idx++) { if (idx == pos) { diff --git a/src/core/serialisation.cpp b/src/core/serialisation.cpp index 3c734681b7..47d772ebab 100644 --- a/src/core/serialisation.cpp +++ b/src/core/serialisation.cpp @@ -16,7 +16,7 @@ * @param bytes_to_write The amount of bytes we want to try to write. * @return True iff the given amount of bytes can be written to the packet. */ -[[maybe_unused]] static bool BufferCanWriteToPacket(const std::vector &buffer, size_t limit, size_t bytes_to_write) +[[maybe_unused]] static bool BufferCanWriteToPacket(const std::vector &buffer, size_t limit, size_t bytes_to_write) { return buffer.size() + bytes_to_write <= limit; } @@ -37,7 +37,7 @@ * Package a boolean in the packet. * @param data The data to send. */ -void BufferSend_bool(std::vector &buffer, size_t limit, bool data) +void BufferSend_bool(std::vector &buffer, size_t limit, bool data) { BufferSend_uint8(buffer, limit, data ? 1 : 0); } @@ -46,7 +46,7 @@ void BufferSend_bool(std::vector &buffer, size_t limit, bool data) * Package a 8 bits integer in the packet. * @param data The data to send. */ -void BufferSend_uint8(std::vector &buffer, size_t limit, uint8_t data) +void BufferSend_uint8(std::vector &buffer, size_t limit, uint8_t data) { assert(BufferCanWriteToPacket(buffer, limit, sizeof(data))); buffer.emplace_back(data); @@ -56,7 +56,7 @@ void BufferSend_uint8(std::vector &buffer, size_t limit, uint8_t data) * Package a 16 bits integer in the packet. * @param data The data to send. */ -void BufferSend_uint16(std::vector &buffer, size_t limit, uint16_t data) +void BufferSend_uint16(std::vector &buffer, size_t limit, uint16_t data) { assert(BufferCanWriteToPacket(buffer, limit, sizeof(data))); buffer.insert(buffer.end(), { @@ -69,7 +69,7 @@ void BufferSend_uint16(std::vector &buffer, size_t limit, uint16_t data) * Package a 32 bits integer in the packet. * @param data The data to send. */ -void BufferSend_uint32(std::vector &buffer, size_t limit, uint32_t data) +void BufferSend_uint32(std::vector &buffer, size_t limit, uint32_t data) { assert(BufferCanWriteToPacket(buffer, limit, sizeof(data))); buffer.insert(buffer.end(), { @@ -84,7 +84,7 @@ void BufferSend_uint32(std::vector &buffer, size_t limit, uint32_t data) * Package a 64 bits integer in the packet. * @param data The data to send. */ -void BufferSend_uint64(std::vector &buffer, size_t limit, uint64_t data) +void BufferSend_uint64(std::vector &buffer, size_t limit, uint64_t data) { assert(BufferCanWriteToPacket(buffer, limit, sizeof(data))); buffer.insert(buffer.end(), { @@ -104,7 +104,7 @@ void BufferSend_uint64(std::vector &buffer, size_t limit, uint64_t data) * the string + '\0'. No size-byte or something. * @param data The string to send */ -void BufferSend_string(std::vector &buffer, size_t limit, const std::string_view data) +void BufferSend_string(std::vector &buffer, size_t limit, const std::string_view data) { assert(BufferCanWriteToPacket(buffer, limit, data.size() + 1)); buffer.insert(buffer.end(), data.begin(), data.end()); @@ -119,7 +119,7 @@ void BufferSend_string(std::vector &buffer, size_t limit, const std::strin * @param end The end of the buffer to send. * @return The number of bytes that were added to this packet. */ -size_t BufferSend_binary_until_full(std::vector &buffer, size_t limit, const byte *begin, const byte *end) +size_t BufferSend_binary_until_full(std::vector &buffer, size_t limit, const uint8_t *begin, const uint8_t *end) { size_t amount = std::min(end - begin, limit - buffer.size()); buffer.insert(buffer.end(), begin, begin + amount); @@ -130,7 +130,7 @@ size_t BufferSend_binary_until_full(std::vector &buffer, size_t limit, con * Sends a binary data over the network. * @param data The data to send */ -void BufferSend_binary(std::vector &buffer, size_t limit, const byte *data, const size_t size) +void BufferSend_binary(std::vector &buffer, size_t limit, const uint8_t *data, const size_t size) { assert(data != nullptr); assert(BufferCanWriteToPacket(buffer, limit, size)); @@ -142,7 +142,7 @@ void BufferSend_binary(std::vector &buffer, size_t limit, const byte *data * The data is length prefixed with a uint16. * @param data The string to send */ -void BufferSend_buffer(std::vector &buffer, size_t limit, const byte *data, const size_t size) +void BufferSend_buffer(std::vector &buffer, size_t limit, const uint8_t *data, const size_t size) { assert(size <= UINT16_MAX); assert(BufferCanWriteToPacket(buffer, limit, size + 2)); diff --git a/src/core/serialisation.hpp b/src/core/serialisation.hpp index 6a53744b7b..8ec4cdafb4 100644 --- a/src/core/serialisation.hpp +++ b/src/core/serialisation.hpp @@ -18,15 +18,15 @@ #include #include -void BufferSend_bool (std::vector &buffer, size_t limit, bool data); -void BufferSend_uint8 (std::vector &buffer, size_t limit, uint8_t data); -void BufferSend_uint16(std::vector &buffer, size_t limit, uint16_t data); -void BufferSend_uint32(std::vector &buffer, size_t limit, uint32_t data); -void BufferSend_uint64(std::vector &buffer, size_t limit, uint64_t data); -void BufferSend_string(std::vector &buffer, size_t limit, const std::string_view data); -size_t BufferSend_binary_until_full(std::vector &buffer, size_t limit, const byte *begin, const byte *end); -void BufferSend_binary(std::vector &buffer, size_t limit, const byte *data, const size_t size); -void BufferSend_buffer(std::vector &buffer, size_t limit, const byte *data, const size_t size); +void BufferSend_bool (std::vector &buffer, size_t limit, bool data); +void BufferSend_uint8 (std::vector &buffer, size_t limit, uint8_t data); +void BufferSend_uint16(std::vector &buffer, size_t limit, uint16_t data); +void BufferSend_uint32(std::vector &buffer, size_t limit, uint32_t data); +void BufferSend_uint64(std::vector &buffer, size_t limit, uint64_t data); +void BufferSend_string(std::vector &buffer, size_t limit, const std::string_view data); +size_t BufferSend_binary_until_full(std::vector &buffer, size_t limit, const uint8_t *begin, const uint8_t *end); +void BufferSend_binary(std::vector &buffer, size_t limit, const uint8_t *data, const size_t size); +void BufferSend_buffer(std::vector &buffer, size_t limit, const uint8_t *data, const size_t size); template struct BufferSerialisationHelper { @@ -66,30 +66,30 @@ struct BufferSerialisationHelper { BufferSend_string(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data); } - size_t Send_binary_until_full(const byte *begin, const byte *end) + size_t Send_binary_until_full(const uint8_t *begin, const uint8_t *end) { T *self = static_cast(this); return BufferSend_binary_until_full(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), begin, end); } - void Send_binary(const byte *data, const size_t size) + void Send_binary(const uint8_t *data, const size_t size) { T *self = static_cast(this); BufferSend_binary(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data, size); } - void Send_binary(std::span data) + void Send_binary(std::span data) { this->Send_binary(data.data(), data.size()); } - void Send_buffer(const byte *data, const size_t size) + void Send_buffer(const uint8_t *data, const size_t size) { T *self = static_cast(this); BufferSend_buffer(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data, size); } - void Send_buffer(const std::vector &data) + void Send_buffer(const std::vector &data) { this->Send_buffer(data.data(), data.size()); } @@ -100,7 +100,7 @@ void BufferRecvStringValidate(std::string &buffer, StringValidationSettings sett template struct BufferDeserialisationHelper { private: - const byte *GetBuffer() + const uint8_t *GetBuffer() { return static_cast(this)->GetDeserialisationBuffer(); } @@ -253,7 +253,7 @@ public: * @param buffer The buffer to put the data into. * @param size The size of the data. */ - void Recv_binary(byte *buffer, size_t size) + void Recv_binary(uint8_t *buffer, size_t size) { if (!this->CanRecvBytes(size, true)) return; @@ -267,7 +267,7 @@ public: * Reads binary data. * @param buffer The buffer to put the data into. */ - void Recv_binary(std::span buffer) + void Recv_binary(std::span buffer) { this->Recv_binary(buffer.data(), buffer.size()); } @@ -331,11 +331,11 @@ public: }; struct BufferSerialiser : public BufferSerialisationHelper { - std::vector &buffer; + std::vector &buffer; - BufferSerialiser(std::vector &buffer) : buffer(buffer) {} + BufferSerialiser(std::vector &buffer) : buffer(buffer) {} - std::vector &GetSerialisationBuffer() { return this->buffer; } + std::vector &GetSerialisationBuffer() { return this->buffer; } size_t GetSerialisationLimit() const { return std::numeric_limits::max(); } }; diff --git a/src/currency.cpp b/src/currency.cpp index 9b6fe502bf..5219b00bf5 100644 --- a/src/currency.cpp +++ b/src/currency.cpp @@ -81,7 +81,7 @@ CurrencySpec _currency_specs[CURRENCY_END]; * When a grf sends currencies, they are based on the order defined by TTDPatch. * So, we must reindex them to our own order. */ -const byte TTDPatch_To_OTTDIndex[] = +const uint8_t TTDPatch_To_OTTDIndex[] = { CURRENCY_GBP, CURRENCY_USD, @@ -112,7 +112,7 @@ const byte TTDPatch_To_OTTDIndex[] = * @param grfcurr_id currency id coming from newgrf * @return the corrected index */ -byte GetNewgrfCurrencyIdConverted(byte grfcurr_id) +uint8_t GetNewgrfCurrencyIdConverted(uint8_t grfcurr_id) { return (grfcurr_id >= lengthof(TTDPatch_To_OTTDIndex)) ? grfcurr_id : TTDPatch_To_OTTDIndex[grfcurr_id]; } diff --git a/src/currency.h b/src/currency.h index 637878265f..cb4d1277c2 100644 --- a/src/currency.h +++ b/src/currency.h @@ -87,12 +87,12 @@ struct CurrencySpec { * It is not a spec from Newgrf, * rather a way to let users do what they want with custom currency */ - byte symbol_pos; + uint8_t symbol_pos; StringID name; CurrencySpec() = default; - CurrencySpec(uint16_t rate, const char *separator, CalTime::Year to_euro, const char *prefix, const char *suffix, const char *code, byte symbol_pos, StringID name) : + CurrencySpec(uint16_t rate, const char *separator, CalTime::Year to_euro, const char *prefix, const char *suffix, const char *code, uint8_t symbol_pos, StringID name) : rate(rate), separator(separator), to_euro(to_euro), prefix(prefix), suffix(suffix), code(code), symbol_pos(symbol_pos), name(name) { } @@ -107,6 +107,6 @@ extern CurrencySpec _currency_specs[CURRENCY_END]; uint64_t GetMaskOfAllowedCurrencies(); void CheckSwitchToEuro(); void ResetCurrencies(bool preserve_custom = true); -byte GetNewgrfCurrencyIdConverted(byte grfcurr_id); +uint8_t GetNewgrfCurrencyIdConverted(uint8_t grfcurr_id); #endif /* CURRENCY_H */ diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 6739f7963a..595f13fc0b 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -1146,7 +1146,7 @@ static void DepotSellAllConfirmationCallback(Window *win, bool confirmed) if (confirmed) { DepotWindow *w = (DepotWindow*)win; TileIndex tile = w->window_number; - byte vehtype = w->type; + uint8_t vehtype = w->type; DoCommandP(tile, vehtype, 0, CMD_DEPOT_SELL_ALL_VEHICLES); } } diff --git a/src/direction_type.h b/src/direction_type.h index 7dc0ea823e..b2161ed8d1 100644 --- a/src/direction_type.h +++ b/src/direction_type.h @@ -21,7 +21,7 @@ * your viewport and not rotated by 45 degrees left or right to get * a "north" used in you games. */ -enum Direction : byte { +enum Direction : uint8_t { DIR_BEGIN = 0, ///< Used to iterate DIR_N = 0, ///< North DIR_NE = 1, ///< Northeast @@ -39,7 +39,7 @@ enum Direction : byte { DECLARE_POSTFIX_INCREMENT(Direction) /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** @@ -59,7 +59,7 @@ template <> struct EnumPropsT : MakeEnumPropsT struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** @@ -119,14 +119,14 @@ DECLARE_POSTFIX_INCREMENT(DiagDirDiff) * (and south-east edge). The Y axis must be so the one which goes * align the north-east edge (and south-west) edge. */ -enum Axis : byte { +enum Axis : uint8_t { AXIS_X = 0, ///< The X axis AXIS_Y = 1, ///< The y axis AXIS_END, ///< Used for iterations INVALID_AXIS = 0xFF, ///< Flag for an invalid Axis }; /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; DECLARE_ENUM_AS_ADDABLE(Axis) #endif /* DIRECTION_TYPE_H */ diff --git a/src/disaster_vehicle.cpp b/src/disaster_vehicle.cpp index 9539384590..7806a5b01c 100644 --- a/src/disaster_vehicle.cpp +++ b/src/disaster_vehicle.cpp @@ -963,11 +963,11 @@ static const Disaster _disasters[] = { void DoDisaster() { - byte buf[lengthof(_disasters)]; + uint8_t buf[lengthof(_disasters)]; - byte j = 0; + uint8_t j = 0; for (size_t i = 0; i != lengthof(_disasters); i++) { - if (CalTime::CurYear() >= _disasters[i].min_year && CalTime::CurYear() < _disasters[i].max_year) buf[j++] = (byte)i; + if (CalTime::CurYear() >= _disasters[i].min_year && CalTime::CurYear() < _disasters[i].max_year) buf[j++] = (uint8_t)i; } if (j == 0) return; diff --git a/src/disaster_vehicle.h b/src/disaster_vehicle.h index 3a55b0db55..37cb4ae069 100644 --- a/src/disaster_vehicle.h +++ b/src/disaster_vehicle.h @@ -37,7 +37,7 @@ enum DisasterSubType { struct DisasterVehicle final : public SpecializedVehicle { SpriteID image_override; ///< Override for the default disaster vehicle sprite. VehicleID big_ufo_destroyer_target; ///< The big UFO that this destroyer is supposed to bomb. - byte flags; ///< Flags about the state of the vehicle, @see AirVehicleFlags + uint8_t flags; ///< Flags about the state of the vehicle, @see AirVehicleFlags uint16_t state; ///< Action stage of the disaster vehicle. /** For use by saveload. */ diff --git a/src/economy.cpp b/src/economy.cpp index a67ae086c0..ec627d456c 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -142,7 +142,7 @@ Money CalculateCompanyValueExcludingShares(const Company *c, bool including_loan uint num = 0; for (const Station *st : Station::Iterate()) { - if (st->owner == owner) num += CountBits((byte)st->facilities); + if (st->owner == owner) num += CountBits((uint8_t)st->facilities); } Money value = num * _price[PR_STATION_VALUE] * 25; @@ -264,7 +264,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) uint num = 0; for (const Station *st : Station::Iterate()) { /* Only count stations that are actually serviced */ - if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num += CountBits((byte)st->facilities); + if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num += CountBits((uint8_t)st->facilities); } _score_part[owner][SCORE_STATIONS] = num; } diff --git a/src/economy_type.h b/src/economy_type.h index 3fc05f1907..ce65d5dba7 100644 --- a/src/economy_type.h +++ b/src/economy_type.h @@ -28,9 +28,9 @@ enum EconomyType : uint8_t { struct Economy { Money max_loan; ///< NOSAVE: Maximum possible loan int16_t fluct; ///< Economy fluctuation status - byte interest_rate; ///< Interest - byte infl_amount; ///< inflation amount - byte infl_amount_pr; ///< inflation rate for payment rates + uint8_t interest_rate; ///< Interest + uint8_t infl_amount; ///< inflation amount + uint8_t infl_amount_pr; ///< inflation rate for payment rates uint32_t industry_daily_change_counter; ///< Bits 31-16 are number of industry to be performed, 15-0 are fractional collected daily uint32_t industry_daily_increment; ///< The value which will increment industry_daily_change_counter. Computed value. NOSAVE uint64_t inflation_prices; ///< Cumulated inflation of prices since game start; 16 bit fractional part @@ -154,7 +154,7 @@ typedef Money Prices[PR_END]; ///< Prices of everything. @see Price typedef int8_t PriceMultipliers[PR_END]; /** Types of expenses. */ -enum ExpensesType : byte { +enum ExpensesType : uint8_t { EXPENSES_CONSTRUCTION = 0, ///< Construction costs. EXPENSES_NEW_VEHICLES, ///< New vehicles. EXPENSES_TRAIN_RUN, ///< Running costs trains. @@ -175,7 +175,7 @@ enum ExpensesType : byte { }; /** Define basic enum properties for ExpensesType */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * Data type for storage of Money for each #ExpensesType category. @@ -241,21 +241,21 @@ static const uint LOCK_DEPOT_TILE_FACTOR = 2; struct CargoPayment; typedef uint32_t CargoPaymentID; -enum CargoPaymentAlgorithm : byte { +enum CargoPaymentAlgorithm : uint8_t { CPA_BEGIN = 0, ///< Used for iterations and limit testing CPA_TRADITIONAL = 0, ///< Traditional algorithm CPA_MODERN, ///< Modern algorithm CPA_END, ///< Used for iterations and limit testing }; -enum TickRateMode : byte { +enum TickRateMode : uint8_t { TRM_BEGIN = 0, ///< Used for iterations and limit testing TRM_TRADITIONAL = 0, ///< Traditional value (30ms) TRM_MODERN, ///< Modern value (27ms) TRM_END, ///< Used for iterations and limit testing }; -enum CargoScalingMode : byte { +enum CargoScalingMode : uint8_t { CSM_BEGIN = 0, ///< Used for iterations and limit testing CSM_MONTHLY = 0, ///< Traditional cargo scaling CSM_DAYLENGTH, ///< Also scale by day length diff --git a/src/effectvehicle.cpp b/src/effectvehicle.cpp index cbd9d5fb83..3c299c4fb1 100644 --- a/src/effectvehicle.cpp +++ b/src/effectvehicle.cpp @@ -267,9 +267,9 @@ static void BulldozerInit(EffectVehicle *v) } struct BulldozerMovement { - byte direction:2; - byte image:2; - byte duration:3; + uint8_t direction:2; + uint8_t image:2; + uint8_t duration:3; }; static const BulldozerMovement _bulldozer_movement[] = { @@ -344,7 +344,7 @@ struct BubbleMovement { int8_t x:4; int8_t y:4; int8_t z:4; - byte image:4; + uint8_t image:4; }; #define MK(x, y, z, i) { x, y, z, i } diff --git a/src/effectvehicle_base.h b/src/effectvehicle_base.h index a5d95c9561..72370e95bd 100644 --- a/src/effectvehicle_base.h +++ b/src/effectvehicle_base.h @@ -22,8 +22,8 @@ * - bubbles (industry) */ struct EffectVehicle final : public SpecializedVehicle { - uint16_t animation_state; ///< State primarily used to change the graphics/behaviour. - byte animation_substate; ///< Sub state to time the change of the graphics/behaviour. + uint16_t animation_state; ///< State primarily used to change the graphics/behaviour. + uint8_t animation_substate; ///< Sub state to time the change of the graphics/behaviour. /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ EffectVehicle() : SpecializedVehicleBase() {} diff --git a/src/elrail.cpp b/src/elrail.cpp index 919a6a61bc..abfc0ed150 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -88,7 +88,7 @@ struct DualTrackBits { * @param override pointer to PCP override, can be nullptr * @return trackbits of tile if it is electrified */ -static DualTrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override) +static DualTrackBits GetRailTrackBitsUniversal(TileIndex t, uint8_t *override) { DualTrackBits out; out.primary = TRACK_BIT_NONE; @@ -326,10 +326,10 @@ static void DrawRailCatenaryRailway(const TileInfo *ti) } TLG tlg = GetTLG(ti->tile); - byte PCPstatus = 0; - byte OverridePCP = 0; - byte PPPpreferred[DIAGDIR_END]; - byte PPPallowed[DIAGDIR_END]; + uint8_t PCPstatus = 0; + uint8_t OverridePCP = 0; + uint8_t PPPpreferred[DIAGDIR_END]; + uint8_t PPPallowed[DIAGDIR_END]; /* Find which rail bits are present, and select the override points. * We don't draw a pylon: @@ -499,7 +499,7 @@ static void DrawRailCatenaryRailway(const TileInfo *ti) if (PPPallowed[i] != 0 && HasBit(PCPstatus, i) && !HasBit(OverridePCP, i) && (!IsRailStationTile(ti->tile) || CanStationTileHavePylons(ti->tile))) { for (Direction k = DIR_BEGIN; k < DIR_END; k++) { - byte temp = PPPorder[i][GetTLG(ti->tile)][k]; + uint8_t temp = PPPorder[i][GetTLG(ti->tile)][k]; if (HasBit(PPPallowed[i], temp)) { uint x = ti->x + x_pcp_offsets[i] + x_ppp_offsets[temp]; @@ -579,7 +579,7 @@ static void DrawRailCatenaryRailway(const TileInfo *ti) /* Drawing of pylons is finished, now draw the wires */ for (Track t : SetTrackBitIterator(wireconfig[TS_HOME])) { SpriteID wire_base = get_wire_sprite(t, (t == halftile_track)); - byte PCPconfig = HasBit(PCPstatus, PCPpositions[t][0]) + + uint8_t PCPconfig = HasBit(PCPstatus, PCPpositions[t][0]) + (HasBit(PCPstatus, PCPpositions[t][1]) << 1); const SortableSpriteStruct *sss; diff --git a/src/engine_base.h b/src/engine_base.h index 1df21183e8..039c39b5fd 100644 --- a/src/engine_base.h +++ b/src/engine_base.h @@ -26,7 +26,7 @@ struct WagonOverride { }; /** Flags used client-side in the purchase/autorenew engine list. */ -enum class EngineDisplayFlags : byte { +enum class EngineDisplayFlags : uint8_t { None = 0, ///< No flag set. HasVariants = (1U << 0), ///< Set if engine has variants. IsFolded = (1U << 1), ///< Set if display of variants should be folded (hidden). @@ -54,10 +54,10 @@ struct Engine : EnginePool::PoolItem<&_engine_pool> { uint16_t duration_phase_1; ///< First reliability phase in months, increasing reliability from #reliability_start to #reliability_max. uint16_t duration_phase_2; ///< Second reliability phase in months, keeping #reliability_max. uint16_t duration_phase_3; ///< Third reliability phase in months, decaying to #reliability_final. - byte flags; ///< Flags of the engine. @see EngineFlags + uint8_t flags; ///< Flags of the engine. @see EngineFlags CompanyMask preview_asked; ///< Bit for each company which has already been offered a preview. CompanyID preview_company; ///< Company which is currently being offered a preview \c INVALID_COMPANY means no company. - byte preview_wait; ///< Daily countdown timer for timeout of offering the engine to the #preview_company company. + uint8_t preview_wait; ///< Daily countdown timer for timeout of offering the engine to the #preview_company company. CompanyMask company_avail; ///< Bit for each company whether the engine is available for that company. CompanyMask company_hidden; ///< Bit for each company whether the engine is normally hidden in the build gui for that company. uint8_t original_image_index; ///< Original vehicle image index, thus the image index of the overridden vehicle diff --git a/src/engine_gui.h b/src/engine_gui.h index f36b2ea900..c8ece98cfe 100644 --- a/src/engine_gui.h +++ b/src/engine_gui.h @@ -45,7 +45,7 @@ void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type); extern bool _engine_sort_direction; -extern byte _engine_sort_last_criteria[]; +extern uint8_t _engine_sort_last_criteria[]; extern bool _engine_sort_last_order[]; extern bool _engine_sort_show_hidden_engines[]; extern const StringID _engine_sort_listing[][14]; diff --git a/src/engine_type.h b/src/engine_type.h index ed84fa3d0c..d04b4a8cd5 100644 --- a/src/engine_type.h +++ b/src/engine_type.h @@ -41,42 +41,42 @@ enum EngineClass { /** Information about a rail vehicle. */ struct RailVehicleInfo { - byte image_index; + uint8_t image_index; RailVehicleTypes railveh_type; - byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices. + uint8_t cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices. RailType railtype; ///< Railtype, mangled if elrail is disabled. RailType intended_railtype; ///< Intended railtype, regardless of elrail being enabled or disabled. uint16_t max_speed; ///< Maximum speed (1 unit = 1/1.6 mph = 1 km-ish/h) uint16_t power; ///< Power of engine (hp); For multiheaded engines the sum of both engine powers. uint16_t weight; ///< Weight of vehicle (tons); For multiheaded engines the weight of each single engine. - byte running_cost; ///< Running cost of engine; For multiheaded engines the sum of both running costs. + uint8_t running_cost; ///< Running cost of engine; For multiheaded engines the sum of both running costs. Price running_cost_class; EngineClass engclass; ///< Class of engine for this vehicle - byte capacity; ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine. - byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only + uint8_t capacity; ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine. + uint8_t ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only uint16_t pow_wag_power; ///< Extra power applied to consist if wagon should be powered - byte pow_wag_weight; ///< Extra weight applied to consist if wagon should be powered - byte visual_effect; ///< Bitstuffed NewGRF visual effect data - byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor - byte tractive_effort; ///< Tractive effort coefficient - byte air_drag; ///< Coefficient of air drag - byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles + uint8_t pow_wag_weight; ///< Extra weight applied to consist if wagon should be powered + uint8_t visual_effect; ///< Bitstuffed NewGRF visual effect data + uint8_t shorten_factor; ///< length on main map for this type is 8 - shorten_factor + uint8_t tractive_effort; ///< Tractive effort coefficient + uint8_t air_drag; ///< Coefficient of air drag + uint8_t user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles int16_t curve_speed_mod; ///< Modifier to maximum speed in curves (fixed-point binary with 8 fractional bits) }; /** Information about a ship vehicle. */ struct ShipVehicleInfo { - byte image_index; - byte cost_factor; - uint8_t acceleration; ///< Acceleration (1 unit = 1/3.2 mph per tick = 0.5 km-ish/h per tick) - uint16_t max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h) + uint8_t image_index; + uint8_t cost_factor; + uint8_t acceleration; ///< Acceleration (1 unit = 1/3.2 mph per tick = 0.5 km-ish/h per tick) + uint16_t max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h) uint16_t capacity; - byte running_cost; + uint8_t running_cost; SoundID sfx; - bool old_refittable; ///< Is ship refittable; only used during initialisation. Later use EngineInfo::refit_mask. - byte visual_effect; ///< Bitstuffed NewGRF visual effect data - byte ocean_speed_frac; ///< Fraction of maximum speed for ocean tiles. - byte canal_speed_frac; ///< Fraction of maximum speed for canal/river tiles. + bool old_refittable; ///< Is ship refittable; only used during initialisation. Later use EngineInfo::refit_mask. + uint8_t visual_effect; ///< Bitstuffed NewGRF visual effect data + uint8_t ocean_speed_frac; ///< Fraction of maximum speed for ocean tiles. + uint8_t canal_speed_frac; ///< Fraction of maximum speed for canal/river tiles. /** Apply ocean/canal speed fraction to a velocity */ uint ApplyWaterClassSpeedFrac(uint raw_speed, bool is_ocean) const @@ -99,33 +99,33 @@ enum AircraftSubTypeBits { /** Information about a aircraft vehicle. */ struct AircraftVehicleInfo { - byte image_index; - byte cost_factor; - byte running_cost; - byte subtype; ///< Type of aircraft. @see AircraftSubTypeBits + uint8_t image_index; + uint8_t cost_factor; + uint8_t running_cost; + uint8_t subtype; ///< Type of aircraft. @see AircraftSubTypeBits SoundID sfx; - byte acceleration; + uint8_t acceleration; uint16_t max_speed; ///< Maximum speed (1 unit = 8 mph = 12.8 km-ish/h) - byte mail_capacity; ///< Mail capacity (bags). + uint8_t mail_capacity; ///< Mail capacity (bags). uint16_t passenger_capacity; ///< Passenger capacity (persons). uint16_t max_range; ///< Maximum range of this aircraft. }; /** Information about a road vehicle. */ struct RoadVehicleInfo { - byte image_index; - byte cost_factor; - byte running_cost; + uint8_t image_index; + uint8_t cost_factor; + uint8_t running_cost; Price running_cost_class; SoundID sfx; uint16_t max_speed; ///< Maximum speed (1 unit = 1/3.2 mph = 0.5 km-ish/h) - byte capacity; + uint8_t capacity; uint8_t weight; ///< Weight in 1/4t units uint8_t power; ///< Power in 10hp units uint8_t tractive_effort; ///< Coefficient of tractive effort uint8_t air_drag; ///< Coefficient of air drag - byte visual_effect; ///< Bitstuffed NewGRF visual effect data - byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor + uint8_t visual_effect; ///< Bitstuffed NewGRF visual effect data + uint8_t shorten_factor; ///< length on main map for this type is 8 - shorten_factor RoadType roadtype; ///< Road type }; @@ -143,17 +143,17 @@ DECLARE_ENUM_AS_BIT_SET(ExtraEngineFlags); * @see table/engines.h */ struct EngineInfo { - CalTime::Date base_intro; ///< Basic date of engine introduction (without random parts). - YearDelta lifelength; ///< Lifetime of a single vehicle - YearDelta base_life; ///< Basic duration of engine availability (without random parts). \c 0xFF means infinite life. - byte decay_speed; - byte load_amount; - byte climates; ///< Climates supported by the engine. + CalTime::Date base_intro; ///< Basic date of engine introduction (without random parts). + YearDelta lifelength; ///< Lifetime of a single vehicle + YearDelta base_life; ///< Basic duration of engine availability (without random parts). \c 0xFF means infinite life. + uint8_t decay_speed; + uint8_t load_amount; + uint8_t climates; ///< Climates supported by the engine. CargoID cargo_type; std::variant cargo_label; CargoTypes refit_mask; - byte refit_cost; - byte misc_flags; ///< Miscellaneous flags. @see EngineMiscFlags + uint8_t refit_cost; + uint8_t misc_flags; ///< Miscellaneous flags. @see EngineMiscFlags uint16_t callback_mask; ///< Bitmask of vehicle callbacks that have to be called int8_t retire_early; ///< Number of years early to retire vehicle StringID string_id; ///< Default name of engine diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index e4b4318372..877688d3e1 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -523,7 +523,7 @@ public: if (tr.top > tr.bottom) return; /* Climate */ - byte landscape = _load_check_data.settings.game_creation.landscape; + uint8_t landscape = _load_check_data.settings.game_creation.landscape; if (landscape < NUM_LANDSCAPE) { SetDParam(0, STR_CLIMATE_TEMPERATE_LANDSCAPE + landscape); DrawString(tr, STR_NETWORK_SERVER_LIST_LANDSCAPE); diff --git a/src/fontcache/spritefontcache.cpp b/src/fontcache/spritefontcache.cpp index 054957c4e0..344dea76af 100644 --- a/src/fontcache/spritefontcache.cpp +++ b/src/fontcache/spritefontcache.cpp @@ -85,7 +85,7 @@ void SpriteFontCache::InitializeUnicodeGlyphMap() } for (uint i = 0; i < lengthof(_default_unicode_map); i++) { - byte key = _default_unicode_map[i].key; + uint8_t key = _default_unicode_map[i].key; if (key == CLRA) { /* Clear the glyph. This happens if the glyph at this code point * is non-standard and should be accessed by an SCC_xxx enum diff --git a/src/fontcache/truetypefontcache.h b/src/fontcache/truetypefontcache.h index 0e37318828..4d311a4a2a 100644 --- a/src/fontcache/truetypefontcache.h +++ b/src/fontcache/truetypefontcache.h @@ -16,8 +16,8 @@ static const int MAX_FONT_SIZE = 72; ///< Maximum font size. -static const byte FACE_COLOUR = 1; -static const byte SHADOW_COLOUR = 2; +static const uint8_t FACE_COLOUR = 1; +static const uint8_t SHADOW_COLOUR = 2; /** Font cache for fonts that are based on a TrueType font. */ class TrueTypeFontCache : public FontCache { @@ -34,7 +34,7 @@ protected: /** Container for information about a glyph. */ struct GlyphEntry { Sprite *sprite; ///< The loaded sprite. - byte width; ///< The width of the glyph. + uint8_t width; ///< The width of the glyph. bool duplicate; ///< Whether this glyph entry is a duplicate, i.e. may this be freed? }; diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 4a3c00281e..d82b574612 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -158,7 +158,7 @@ struct TranslationWriter : LanguageWriter { /* We don't write the length. */ } - void Write(const byte *buffer, size_t length) override + void Write(const uint8_t *buffer, size_t length) override { this->strings.emplace_back((const char *)buffer, length); } diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 64a6eab7c7..017c261e79 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -27,8 +27,8 @@ extern const SaveLoadVersion SAVEGAME_VERSION; ///< current savegame version extern SavegameType _savegame_type; ///< type of savegame we are loading extern uint32_t _ttdp_version; ///< version of TTDP savegame (if applicable) -extern SaveLoadVersion _sl_version; ///< the major savegame version identifier -extern byte _sl_minor_version; ///< the minor savegame version, DO NOT USE! +extern SaveLoadVersion _sl_version; ///< the major savegame version identifier +extern uint8_t _sl_minor_version; ///< the minor savegame version, DO NOT USE! static GamelogActionType _gamelog_action_type = GLAT_NONE; ///< action to record if anything changes @@ -510,7 +510,7 @@ void GamelogTestMode() * @param bug type of bug, @see enum GRFBugs * @param data additional data */ -static void GamelogGRFBug(uint32_t grfid, byte bug, uint64_t data) +static void GamelogGRFBug(uint32_t grfid, uint8_t bug, uint64_t data) { assert(_gamelog_action_type == GLAT_GRFBUG); @@ -667,7 +667,7 @@ static GRFList *GenerateGRFList(const GRFConfig *grfc) if (IsLoggableGrfConfig(g)) n++; } - GRFList *list = (GRFList*)MallocT(sizeof(GRFList) + n * sizeof(GRFConfig*)); + GRFList *list = (GRFList*)MallocT(sizeof(GRFList) + n * sizeof(GRFConfig*)); list->n = 0; for (const GRFConfig *g = grfc; g != nullptr; g = g->next) { @@ -766,7 +766,7 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc) * @param[out] ever_modified Max value of 'modified' from all binaries that ever saved this savegame. * @param[out] removed_newgrfs Set to true if any NewGRFs have been removed. */ -void GamelogInfo(const std::vector &gamelog_actions, uint32_t *last_ottd_rev, byte *ever_modified, bool *removed_newgrfs) +void GamelogInfo(const std::vector &gamelog_actions, uint32_t *last_ottd_rev, uint8_t *ever_modified, bool *removed_newgrfs) { for (const LoggedAction &la : gamelog_actions) { for (const LoggedChange &lc : la.changes) { diff --git a/src/gamelog.h b/src/gamelog.h index 95469153fd..8d557c3724 100644 --- a/src/gamelog.h +++ b/src/gamelog.h @@ -64,7 +64,7 @@ void GamelogTestMode(); bool GamelogGRFBugReverse(uint32_t grfid, uint16_t internal_id); -void GamelogInfo(const std::vector &gamelog_actions, uint32_t *last_ottd_rev, byte *ever_modified, bool *removed_newgrfs); +void GamelogInfo(const std::vector &gamelog_actions, uint32_t *last_ottd_rev, uint8_t *ever_modified, bool *removed_newgrfs); const char *GamelogGetLastRevision(const std::vector &gamelog_actions); #endif /* GAMELOG_H */ diff --git a/src/gamelog_internal.h b/src/gamelog_internal.h index c55f81fe79..901fb92b89 100644 --- a/src/gamelog_internal.h +++ b/src/gamelog_internal.h @@ -39,14 +39,14 @@ struct LoggedChange { GamelogChangeType ct; ///< Type of change logged in this struct union { struct { - byte mode; ///< new game mode - Editor x Game - byte landscape; ///< landscape (temperate, arctic, ...) + uint8_t mode; ///< new game mode - Editor x Game + uint8_t landscape; ///< landscape (temperate, arctic, ...) } mode; struct { - char *text; ///< revision string, _openttd_revision - uint32_t newgrf; ///< _openttd_newgrf_version - uint16_t slver; ///< _sl_version - byte modified; ///< _openttd_revision_modified + char *text; ///< revision string, _openttd_revision + uint32_t newgrf; ///< _openttd_newgrf_version + uint16_t slver; ///< _sl_version + uint8_t modified; ///< _openttd_revision_modified } revision; struct { uint32_t type; ///< type of savegame, @see SavegameType @@ -72,7 +72,7 @@ struct LoggedChange { struct { uint64_t data; ///< additional data uint32_t grfid; ///< ID of problematic GRF - byte bug; ///< type of bug, @see enum GRFBugs + uint8_t bug; ///< type of bug, @see enum GRFBugs } grfbug; }; }; diff --git a/src/genworld.h b/src/genworld.h index ce4b40cfad..3e80d5dfed 100644 --- a/src/genworld.h +++ b/src/genworld.h @@ -92,7 +92,7 @@ bool IsGeneratingWorldAborted(); void HandleGeneratingWorldAbortion(); /* genworld_gui.cpp */ -void SetNewLandscapeType(byte landscape); +void SetNewLandscapeType(uint8_t landscape); void SetGeneratingWorldProgress(GenWorldProgress cls, uint total); void IncreaseGeneratingWorldProgress(GenWorldProgress cls); void PrepareGenerateWorldProgress(); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 4cf78ce24a..c8522826c8 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -62,7 +62,7 @@ static uint GetMapHeightLimit() * Changes landscape type and sets genworld window dirty * @param landscape new landscape type */ -void SetNewLandscapeType(byte landscape) +void SetNewLandscapeType(uint8_t landscape) { _settings_newgame.game_creation.landscape = landscape; InvalidateWindowClassesData(WC_SELECT_GAME); diff --git a/src/gfx.cpp b/src/gfx.cpp index 30560324b3..94f8c6aea5 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -37,9 +37,9 @@ #include "safeguards.h" -byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down +uint8_t _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down bool _fullscreen; -byte _support8bpp; +uint8_t _support8bpp; CursorVars _cursor; bool _ctrl_pressed; ///< Is Ctrl pressed? bool _shift_pressed; ///< Is Shift pressed? @@ -64,13 +64,13 @@ uint32_t _pause_countdown; std::string _switch_baseset; static bool _adjust_gui_zoom_startup_done = false; -static byte _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth() +static uint8_t _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth() DrawPixelInfo *_cur_dpi; struct GfxBlitterCtx { const DrawPixelInfo *dpi; - const byte *colour_remap_ptr = nullptr; - byte string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures that #SpriteType::Font sprites only use colours 0 to 2. + const uint8_t *colour_remap_ptr = nullptr; + uint8_t string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures that #SpriteType::Font sprites only use colours 0 to 2. int sprite_brightness_adjust = 0; GfxBlitterCtx(const DrawPixelInfo *dpi) : dpi(dpi) {} @@ -163,7 +163,7 @@ void GfxFillRect(Blitter *blitter, const DrawPixelInfo *dpi, int left, int top, break; case FILLRECT_CHECKER: { - byte bo = (oleft - left + dpi->left + otop - top + dpi->top) & 1; + uint8_t bo = (oleft - left + dpi->left + otop - top + dpi->top) & 1; do { for (int i = (bo ^= 1); i < right; i += 2) blitter->SetPixel(dst, i, 0, (uint8_t)colour); dst = blitter->MoveTo(dst, 0, 1); @@ -462,7 +462,7 @@ void DrawBox(const DrawPixelInfo *dpi, int x, int y, int dx1, int dy1, int dx2, * ....V. */ - static const byte colour = PC_WHITE; + static const uint8_t colour = PC_WHITE; GfxDrawLineUnscaled(dpi, x, y, x + dx1, y + dy1, colour); GfxDrawLineUnscaled(dpi, x, y, x + dx2, y + dy2, colour); @@ -506,7 +506,7 @@ void GfxBlitterCtx::SetColourRemap(TextColour colour) colour &= ~(TC_NO_SHADE | TC_IS_PALETTE_COLOUR | TC_FORCED); this->string_colourremap[0] = 0; - this->string_colourremap[1] = raw_colour ? (byte)colour : _string_colourmap[colour]; + this->string_colourremap[1] = raw_colour ? (uint8_t)colour : _string_colourmap[colour]; this->string_colourremap[2] = no_shade ? 0 : 1; this->colour_remap_ptr = this->string_colourremap; } @@ -1263,9 +1263,9 @@ std::unique_ptr DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel dim_size = static_cast(dim.width) * dim.height; /* If the current blitter is a paletted blitter, we have to render to an extra buffer and resolve the palette later. */ - std::unique_ptr pal_buffer{}; + std::unique_ptr pal_buffer{}; if (blitter->GetScreenDepth() == 8) { - pal_buffer = std::make_unique(dim_size); + pal_buffer = std::make_unique(dim_size); dpi.dst_ptr = pal_buffer.get(); } @@ -1278,7 +1278,7 @@ std::unique_ptr DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel if (blitter->GetScreenDepth() == 8) { /* Resolve palette. */ uint32_t *dst = result.get(); - const byte *src = pal_buffer.get(); + const uint8_t *src = pal_buffer.get(); for (size_t i = 0; i < dim_size; ++i) { *dst++ = _cur_palette.palette[*src++].data; } @@ -1318,7 +1318,7 @@ void LoadStringWidthTable(bool monospace) * @param key Character code glyph * @return Width of the character glyph */ -byte GetCharacterWidth(FontSize size, char32_t key) +uint8_t GetCharacterWidth(FontSize size, char32_t key) { /* Use _stringwidth_table cache if possible */ if (key >= 32 && key < 256) return _stringwidth_table[size][key - 32]; @@ -1331,9 +1331,9 @@ byte GetCharacterWidth(FontSize size, char32_t key) * @param size Font of the digit * @return Width of the digit. */ -byte GetDigitWidth(FontSize size) +uint8_t GetDigitWidth(FontSize size) { - byte width = 0; + uint8_t width = 0; for (char c = '0'; c <= '9'; c++) { width = std::max(GetCharacterWidth(size, c), width); } diff --git a/src/gfx_func.h b/src/gfx_func.h index ba974ac91d..fc84f1efa5 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -49,9 +49,9 @@ void GameLoop(); void CreateConsole(); -extern byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down +extern uint8_t _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down extern bool _fullscreen; -extern byte _support8bpp; +extern uint8_t _support8bpp; extern CursorVars _cursor; extern bool _ctrl_pressed; ///< Is Ctrl pressed? extern bool _shift_pressed; ///< Is Shift pressed? @@ -210,8 +210,8 @@ void SortResolutions(); bool ToggleFullScreen(bool fs); /* gfx.cpp */ -byte GetCharacterWidth(FontSize size, char32_t key); -byte GetDigitWidth(FontSize size = FS_NORMAL); +uint8_t GetCharacterWidth(FontSize size, char32_t key); +uint8_t GetDigitWidth(FontSize size = FS_NORMAL); void GetBroadestDigit(uint *front, uint *next, FontSize size = FS_NORMAL); uint64_t GetBroadestDigitsValue(uint count, FontSize size = FS_NORMAL); diff --git a/src/gfx_type.h b/src/gfx_type.h index 9ceff3dc54..e4d94206d2 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -110,7 +110,7 @@ enum WindowKeyCodes { struct AnimCursor { static const CursorID LAST = MAX_UVALUE(CursorID); CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop - byte display_time; ///< Amount of ticks this sprite will be shown + uint8_t display_time; ///< Amount of ticks this sprite will be shown }; /** Collection of variables for cursor-display and -animation */ @@ -249,7 +249,7 @@ enum Colours : uint8_t { COLOUR_END, INVALID_COLOUR = 0xFF, }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; DECLARE_POSTFIX_INCREMENT(Colours) DECLARE_ENUM_AS_ADDABLE(Colours) @@ -311,7 +311,7 @@ enum PaletteType { }; /** Types of sprites that might be loaded */ -enum class SpriteType : byte { +enum class SpriteType : uint8_t { Normal = 0, ///< The most basic (normal) sprite MapGen = 1, ///< Special sprite for the map generator Font = 2, ///< A sprite used for fonts diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 4b92097a0a..ee38c98a58 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -56,12 +56,12 @@ static SpriteFile &LoadGrfFile(const std::string &filename, uint load_index, boo DEBUG(sprite, 2, "Reading grf-file '%s'", filename.c_str()); - byte container_ver = file.GetContainerVersion(); + uint8_t container_ver = file.GetContainerVersion(); if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename.c_str()); ReadGRFSpriteOffsets(file); if (container_ver >= 2) { /* Read compression. */ - byte compression = file.ReadByte(); + uint8_t compression = file.ReadByte(); if (compression != 0) usererror("Unsupported compression format"); } @@ -93,12 +93,12 @@ static void LoadGrfFileIndexed(const std::string &filename, const SpriteID *inde DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename.c_str()); - byte container_ver = file.GetContainerVersion(); + uint8_t container_ver = file.GetContainerVersion(); if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename.c_str()); ReadGRFSpriteOffsets(file); if (container_ver >= 2) { /* Read compression. */ - byte compression = file.ReadByte(); + uint8_t compression = file.ReadByte(); if (compression != 0) usererror("Unsupported compression format"); } @@ -434,7 +434,7 @@ static SpriteID GetSpriteIDForClearGround(const ClearGround cg, const Slope slop { switch (cg) { case CLEAR_GRASS: - return GetSpriteIDForClearLand(slope, (byte) multi); + return GetSpriteIDForClearLand(slope, (uint8_t)multi); case CLEAR_ROUGH: return GetSpriteIDForHillyLand(slope, multi); case CLEAR_ROCKS: @@ -467,8 +467,8 @@ void GfxDetermineMainColours() extern uint32_t _vp_map_vegetation_clear_colours[16][6][8]; memset(_vp_map_vegetation_clear_colours, 0, sizeof(_vp_map_vegetation_clear_colours)); const struct { - byte min; - byte max; + uint8_t min; + uint8_t max; } multi[6] = { { 0, 3 }, // CLEAR_GRASS, density { 0, 7 }, // CLEAR_ROUGH, "random" based on position diff --git a/src/goal.cpp b/src/goal.cpp index a368cd7854..e33622f575 100644 --- a/src/goal.cpp +++ b/src/goal.cpp @@ -295,7 +295,7 @@ CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui static_assert(GOAL_QUESTION_BUTTON_COUNT < 29); uint32_t button_mask = GB(p2, 0, GOAL_QUESTION_BUTTON_COUNT); - byte type = GB(p2, 29, 2); + uint8_t type = GB(p2, 29, 2); bool is_client = HasBit(p2, 31); if (_current_company != OWNER_DEITY) return CMD_ERROR; @@ -352,7 +352,7 @@ CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32_t } if (flags & DC_EXEC) { - Game::NewEvent(new ScriptEventGoalQuestionAnswer(p1, (ScriptCompany::CompanyID)(byte)_current_company, (ScriptGoal::QuestionButton)(1 << p2))); + Game::NewEvent(new ScriptEventGoalQuestionAnswer(p1, (ScriptCompany::CompanyID)(uint8_t)_current_company, (ScriptGoal::QuestionButton)(1 << p2))); } return CommandCost(); diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index 01f10301d3..def02cf583 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -483,7 +483,7 @@ static WindowDesc _goal_question_list_desc[] = { * @param button_mask Buttons to display. * @param question Question to ask. */ -void ShowGoalQuestion(uint16_t id, byte type, uint32_t button_mask, const std::string &question) +void ShowGoalQuestion(uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question) { assert(type < GQT_END); new GoalQuestionWindow(&_goal_question_list_desc[type], id, type == 3 ? TC_WHITE : TC_BLACK, button_mask, question); diff --git a/src/goal_type.h b/src/goal_type.h index 5cac9c2b40..379c00a26c 100644 --- a/src/goal_type.h +++ b/src/goal_type.h @@ -14,7 +14,7 @@ static const uint32_t GOAL_QUESTION_BUTTON_COUNT = 18; ///< Amount of buttons available. -enum GoalQuestionType : byte { +enum GoalQuestionType : uint8_t { GQT_QUESTION = 0, GQT_INFORMATION = 1, GQT_WARNING = 2, @@ -23,7 +23,7 @@ enum GoalQuestionType : byte { }; /** Types of goal destinations */ -enum GoalType : byte { +enum GoalType : uint8_t { GT_NONE, ///< Destination is not linked GT_TILE, ///< Destination is a tile GT_INDUSTRY, ///< Destination is an industry diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index adee3faaa1..eeabe32bef 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -185,9 +185,9 @@ protected: static const int MIN_GRID_PIXEL_SIZE = 20; ///< Minimum distance between graph lines. uint64_t excluded_data; ///< bitmask of the datasets that shouldn't be displayed. - byte num_dataset; - byte num_on_x_axis; - byte num_vert_lines; + uint8_t num_dataset; + uint8_t num_on_x_axis; + uint8_t num_vert_lines; /* The starting month and year that values are plotted against. */ EconTime::Month month; @@ -201,7 +201,7 @@ protected: uint16_t x_values_increment; StringID format_str_y_axis; - byte colours[GRAPH_MAX_DATASETS]; + uint8_t colours[GRAPH_MAX_DATASETS]; OverflowSafeInt64 cost[GRAPH_MAX_DATASETS][GRAPH_NUM_MONTHS]; ///< Stored costs for the last #GRAPH_NUM_MONTHS months /** @@ -457,7 +457,7 @@ protected: /* Centre the dot between the grid lines. */ x = r.left + (x_sep / 2); - byte colour = this->colours[i]; + uint8_t colour = this->colours[i]; uint prev_x = INVALID_DATAPOINT_POS; uint prev_y = INVALID_DATAPOINT_POS; @@ -622,7 +622,7 @@ public: if (!Company::IsValidID(c)) SetBit(excluded_companies, c); } - byte nums = 0; + uint8_t nums = 0; for (const Company *c : Company::Iterate()) { nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent)); } @@ -1010,7 +1010,7 @@ struct DeliveredCargoGraphWindow : ExcludingCargoBaseGraphWindow { if (!Company::IsValidID(c)) SetBit(excluded_companies, c); } - byte nums = 0; + uint8_t nums = 0; for (const Company *c : Company::Iterate()) { nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent)); } @@ -1489,7 +1489,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { for (const CargoSpec *cs : _sorted_standard_cargo_specs) { this->colours[i] = cs->legend_colour; for (int j = 0; j != this->num_on_x_axis; j++) { - const byte ctt = _cargo_payment_x_mode ? static_cast(factor / static_cast((j + 1) * this->x_values_increment)) : (j + 1) * 4; + const uint8_t ctt = _cargo_payment_x_mode ? static_cast(factor / static_cast((j + 1) * this->x_values_increment)) : (j + 1) * 4; this->cost[i][j] = GetTransportedGoodsIncome(_cargo_payment_x_mode ? 1 : 10, _cargo_payment_x_mode ? 200 : 20, ctt, cs->Index()); } i++; @@ -1993,7 +1993,7 @@ struct StationCargoGraphWindow final : BaseGraphWindow { /* Redraw box if lowered */ if (lowered) DrawFrameRect(r.left, y, r.right, y + this->line_height - 1, COLOUR_BROWN, lowered ? FR_LOWERED : FR_NONE); - const byte clk_dif = lowered ? 1 : 0; + const uint8_t clk_dif = lowered ? 1 : 0; const int rect_x = clk_dif + (rtl ? ir.right - this->legend_width : ir.left); GfxFillRect(rect_x, y + padding + clk_dif, rect_x + this->legend_width, y + row_height - 1 + clk_dif, PC_BLACK); diff --git a/src/ground_vehicle.cpp b/src/ground_vehicle.cpp index bc481b0a33..e2d9ce94da 100644 --- a/src/ground_vehicle.cpp +++ b/src/ground_vehicle.cpp @@ -42,8 +42,8 @@ void GroundVehicle::PowerChanged() if (track_speed > 0) max_track_speed = std::min(max_track_speed, track_speed); } - byte air_drag; - byte air_drag_value = v->GetAirDrag(); + uint8_t air_drag; + uint8_t air_drag_value = v->GetAirDrag(); /* If air drag is set to zero (default), the resulting air drag coefficient is dependent on max speed. */ if (air_drag_value == 0) { diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp index de806f16fc..2d7b63a1b1 100644 --- a/src/ground_vehicle.hpp +++ b/src/ground_vehicle.hpp @@ -72,9 +72,9 @@ struct GroundVehicleAcceleration { * virtual uint16_t GetWeightWithoutCargo() const = 0; * virtual uint16_t GetCargoWeight() const = 0; * virtual uint16_t GetWeight() const = 0; - * virtual byte GetTractiveEffort() const = 0; - * virtual byte GetAirDrag() const = 0; - * virtual byte GetAirDragArea() const = 0; + * virtual uint8_t GetTractiveEffort() const = 0; + * virtual uint8_t GetAirDrag() const = 0; + * virtual uint8_t GetAirDragArea() const = 0; * virtual AccelStatus GetAccelerationStatus() const = 0; * virtual uint16_t GetCurrentSpeed() const = 0; * virtual uint32_t GetRollingFriction() const = 0; @@ -439,9 +439,9 @@ protected: */ inline uint DoUpdateSpeed(GroundVehicleAcceleration accel, int min_speed, int max_speed, int advisory_max_speed, bool use_realistic_braking) { - const byte initial_subspeed = this->subspeed; + const uint8_t initial_subspeed = this->subspeed; uint spd = this->subspeed + accel.acceleration; - this->subspeed = (byte)spd; + this->subspeed = (uint8_t)spd; if (!use_realistic_braking) { max_speed = std::min(max_speed, advisory_max_speed); @@ -490,7 +490,7 @@ protected: this->subspeed = 0; } else { tempspeed = braking_speed; - this->subspeed = (byte)spd; + this->subspeed = (uint8_t)spd; } } else { tempspeed = advisory_max_speed; diff --git a/src/gui.h b/src/gui.h index 656c20a32d..1cc49db6b6 100644 --- a/src/gui.h +++ b/src/gui.h @@ -64,7 +64,7 @@ void ShowSubsidiesList(); /* goal_gui.cpp */ void ShowGoalsList(CompanyID company); -void ShowGoalQuestion(uint16_t id, byte type, uint32_t button_mask, const std::string &question); +void ShowGoalQuestion(uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question); /* story_gui.cpp */ void ShowStoryBook(CompanyID company, uint16_t page_id = INVALID_STORY_PAGE, bool centered = false); @@ -76,7 +76,7 @@ void ShowExtraViewportWindowForTileUnderCursor(); void ShowModifierKeyToggleWindow(); /* bridge_gui.cpp */ -void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte bridge_type); +void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, uint8_t bridge_type); /* music_gui.cpp */ void ShowMusicWindow(); diff --git a/src/heightmap.cpp b/src/heightmap.cpp index cfd1854c24..ed4439b856 100644 --- a/src/heightmap.cpp +++ b/src/heightmap.cpp @@ -60,7 +60,7 @@ static inline bool IsValidHeightmapDimension(size_t width, size_t height) * Convert RGB colours to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue * (average luminosity formula, NTSC Colour Space) */ -static inline byte RGBToGrayscale(byte red, byte green, byte blue) +static inline uint8_t RGBToGrayscale(uint8_t red, uint8_t green, uint8_t blue) { /* To avoid doubles and stuff, multiply it with a total of 65536 (16bits), then * divide by it to normalize the value to a byte again. */ @@ -75,10 +75,10 @@ static inline byte RGBToGrayscale(byte red, byte green, byte blue) /** * The PNG Heightmap loader. */ -static void ReadHeightmapPNGImageData(byte *map, png_structp png_ptr, png_infop info_ptr) +static void ReadHeightmapPNGImageData(uint8_t *map, png_structp png_ptr, png_infop info_ptr) { uint x, y; - byte gray_palette[256]; + uint8_t gray_palette[256]; png_bytep *row_pointers = nullptr; bool has_palette = png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE; uint channels = png_get_channels(png_ptr, info_ptr); @@ -114,7 +114,7 @@ static void ReadHeightmapPNGImageData(byte *map, png_structp png_ptr, png_infop /* Read the raw image data and convert in 8-bit grayscale */ for (x = 0; x < png_get_image_width(png_ptr, info_ptr); x++) { for (y = 0; y < png_get_image_height(png_ptr, info_ptr); y++) { - byte *pixel = &map[y * png_get_image_width(png_ptr, info_ptr) + x]; + uint8_t *pixel = &map[y * png_get_image_width(png_ptr, info_ptr) + x]; uint x_offset = x * channels; if (has_palette) { @@ -134,7 +134,7 @@ static void ReadHeightmapPNGImageData(byte *map, png_structp png_ptr, png_infop * If map == nullptr only the size of the PNG is read, otherwise a map * with grayscale pixels is allocated and assigned to *map. */ -static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map) +static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, uint8_t **map) { FILE *fp; png_structp png_ptr = nullptr; @@ -188,7 +188,7 @@ static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map) } if (map != nullptr) { - *map = MallocT(static_cast(width) * height); + *map = MallocT(static_cast(width) * height); ReadHeightmapPNGImageData(*map, png_ptr, info_ptr); } @@ -206,10 +206,10 @@ static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map) /** * The BMP Heightmap loader. */ -static void ReadHeightmapBMPImageData(byte *map, BmpInfo *info, BmpData *data) +static void ReadHeightmapBMPImageData(uint8_t *map, BmpInfo *info, BmpData *data) { uint x, y; - byte gray_palette[256]; + uint8_t gray_palette[256]; if (data->palette != nullptr) { uint i; @@ -244,8 +244,8 @@ static void ReadHeightmapBMPImageData(byte *map, BmpInfo *info, BmpData *data) /* Read the raw image data and convert in 8-bit grayscale */ for (y = 0; y < info->height; y++) { - byte *pixel = &map[y * info->width]; - byte *bitmap = &data->bitmap[y * info->width * (info->bpp == 24 ? 3 : 1)]; + uint8_t *pixel = &map[y * info->width]; + uint8_t *bitmap = &data->bitmap[y * info->width * (info->bpp == 24 ? 3 : 1)]; for (x = 0; x < info->width; x++) { if (info->bpp != 24) { @@ -263,7 +263,7 @@ static void ReadHeightmapBMPImageData(byte *map, BmpInfo *info, BmpData *data) * If map == nullptr only the size of the BMP is read, otherwise a map * with grayscale pixels is allocated and assigned to *map. */ -static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, byte **map) +static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, uint8_t **map) { FILE *f; BmpInfo info; @@ -303,7 +303,7 @@ static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, byte **map) return false; } - *map = MallocT(static_cast(info.width) * info.height); + *map = MallocT(static_cast(info.width) * info.height); ReadHeightmapBMPImageData(*map, &info, &data); } @@ -323,7 +323,7 @@ static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, byte **map) * @param img_height the height of the image in pixels/tiles * @param map the input map */ -static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map) +static void GrayscaleToMapHeights(uint img_width, uint img_height, uint8_t *map) { /* Defines the detail of the aspect ratio (to avoid doubles) */ const uint num_div = 16384; @@ -423,7 +423,7 @@ void FixSlopes() { uint width, height; int row, col; - byte current_tile; + uint8_t current_tile; /* Adjust height difference to maximum one horizontal/vertical change. */ width = MapSizeX(); @@ -489,7 +489,7 @@ void FixSlopes() * @param[in,out] map If not \c nullptr, destination to store the loaded block of image data. * @return Whether loading was successful. */ -static bool ReadHeightMap(DetailedFileType dft, const char *filename, uint *x, uint *y, byte **map) +static bool ReadHeightMap(DetailedFileType dft, const char *filename, uint *x, uint *y, uint8_t **map) { switch (dft) { default: @@ -528,7 +528,7 @@ bool GetHeightmapDimensions(DetailedFileType dft, const char *filename, uint *x, bool LoadHeightmap(DetailedFileType dft, const char *filename) { uint x, y; - byte *map = nullptr; + uint8_t *map = nullptr; if (!ReadHeightMap(dft, filename, &x, &y, &map)) { free(map); @@ -548,7 +548,7 @@ bool LoadHeightmap(DetailedFileType dft, const char *filename) * Make an empty world where all tiles are of height 'tile_height'. * @param tile_height of the desired new empty world */ -void FlatEmptyWorld(byte tile_height) +void FlatEmptyWorld(uint8_t tile_height) { int edge_distance = _settings_game.construction.freeform_edges ? 0 : 2; for (uint row = edge_distance; row < MapSizeY() - edge_distance; row++) { diff --git a/src/heightmap.h b/src/heightmap.h index d7c431c2e4..20e7ff5938 100644 --- a/src/heightmap.h +++ b/src/heightmap.h @@ -23,7 +23,7 @@ enum HeightmapRotation { bool GetHeightmapDimensions(DetailedFileType dft, const char *filename, uint *x, uint *y); bool LoadHeightmap(DetailedFileType dft, const char *filename); -void FlatEmptyWorld(byte tile_height); +void FlatEmptyWorld(uint8_t tile_height); void FixSlopes(); #endif /* HEIGHTMAP_H */ diff --git a/src/highscore.cpp b/src/highscore.cpp index 102f268bd7..6c20c9e82c 100644 --- a/src/highscore.cpp +++ b/src/highscore.cpp @@ -129,7 +129,7 @@ void SaveToHighScore() for (int i = 0; i < SP_SAVED_HIGHSCORE_END; i++) { for (HighScore &hs : _highscore_table[i]) { /* This code is weird and old fashioned to keep compatibility with the old high score files. */ - byte name_length = ClampTo(hs.name.size()); + uint8_t name_length = ClampTo(hs.name.size()); if (fwrite(&name_length, sizeof(name_length), 1, fp.get()) != 1 || // Write the string length of the name fwrite(hs.name.data(), name_length, 1, fp.get()) > 1 || // Yes... could be 0 bytes too fwrite(&hs.score, sizeof(hs.score), 1, fp.get()) != 1 || @@ -153,7 +153,7 @@ void LoadFromHighScore() for (int i = 0; i < SP_SAVED_HIGHSCORE_END; i++) { for (HighScore &hs : _highscore_table[i]) { /* This code is weird and old fashioned to keep compatibility with the old high score files. */ - byte name_length; + uint8_t name_length; char buffer[std::numeric_limits::max() + 1]; if (fread(&name_length, sizeof(name_length), 1, fp.get()) != 1 || diff --git a/src/house.h b/src/house.h index f13bdee4ff..e82f7cb3a5 100644 --- a/src/house.h +++ b/src/house.h @@ -20,7 +20,7 @@ * Simple value that indicates the house has reached the final stage of * construction. */ -static const byte TOWN_HOUSE_COMPLETED = 3; +static const uint8_t TOWN_HOUSE_COMPLETED = 3; static const HouseID NUM_HOUSES_PER_GRF = 255; ///< Number of supported houses per NewGRF; limited to 255 to allow extending Action3 with an extended byte later on. @@ -104,31 +104,31 @@ DECLARE_ENUM_AS_BIT_SET(HouseCtrlFlags) struct HouseSpec { /* Standard properties */ - CalTime::Year min_year; ///< introduction year of the house - CalTime::Year max_year; ///< last year it can be built - byte population; ///< population (Zero on other tiles in multi tile house.) - byte removal_cost; ///< cost multiplier for removing it - StringID building_name; ///< building name - uint16_t remove_rating_decrease; ///< rating decrease if removed - byte mail_generation; ///< mail generation multiplier (tile based, as the acceptances below) - byte cargo_acceptance[HOUSE_NUM_ACCEPTS]; ///< acceptance level for the cargo slots - CargoID accepts_cargo[HOUSE_NUM_ACCEPTS]; ///< input cargo slots + CalTime::Year min_year; ///< introduction year of the house + CalTime::Year max_year; ///< last year it can be built + uint8_t population; ///< population (Zero on other tiles in multi tile house.) + uint8_t removal_cost; ///< cost multiplier for removing it + StringID building_name; ///< building name + uint16_t remove_rating_decrease; ///< rating decrease if removed + uint8_t mail_generation; ///< mail generation multiplier (tile based, as the acceptances below) + uint8_t cargo_acceptance[HOUSE_NUM_ACCEPTS]; ///< acceptance level for the cargo slots + CargoID accepts_cargo[HOUSE_NUM_ACCEPTS]; ///< input cargo slots CargoLabel accepts_cargo_label[HOUSE_NUM_ACCEPTS]; ///< input landscape cargo slots - BuildingFlags building_flags; ///< some flags that describe the house (size, stadium etc...) - HouseZones building_availability; ///< where can it be built (climates, zones) - bool enabled; ///< the house is available to build (true by default, but can be disabled by newgrf) + BuildingFlags building_flags; ///< some flags that describe the house (size, stadium etc...) + HouseZones building_availability; ///< where can it be built (climates, zones) + bool enabled; ///< the house is available to build (true by default, but can be disabled by newgrf) /* NewHouses properties */ GRFFileProps grf_prop; ///< Properties related the the grf file uint16_t callback_mask; ///< Bitmask of house callbacks that have to be called Colours random_colour[4]; ///< 4 "random" colours - byte probability; ///< Relative probability of appearing (16 is the standard value) + uint8_t probability; ///< Relative probability of appearing (16 is the standard value) HouseExtraFlags extra_flags; ///< some more flags HouseCtrlFlags ctrl_flags; ///< control flags HouseClassID class_id; ///< defines the class this house has (not grf file based) AnimationInfo animation; ///< information about the animation. - byte processing_time; ///< Periodic refresh multiplier - byte minimum_life; ///< The minimum number of years this house will survive before the town rebuilds it + uint8_t processing_time; ///< Periodic refresh multiplier + uint8_t minimum_life; ///< The minimum number of years this house will survive before the town rebuilds it CargoTypes watched_cargoes; ///< Cargo types watched for acceptance. Money GetRemovalCost() const; diff --git a/src/industry.h b/src/industry.h index 520a6befb4..2aef17135b 100644 --- a/src/industry.h +++ b/src/industry.h @@ -39,7 +39,7 @@ enum ProductionLevels { * Flags to control/override the behaviour of an industry. * These flags are controlled by game scripts. */ -enum IndustryControlFlags : byte { +enum IndustryControlFlags : uint8_t { /** No flags in effect */ INDCTL_NONE = 0, /** When industry production change is evaluated, rolls to decrease are ignored. */ @@ -71,10 +71,10 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> { std::array produced_cargo{}; ///< 16 production cargo slots std::array produced_cargo_waiting{}; ///< amount of cargo produced per cargo std::array incoming_cargo_waiting{}; ///< incoming cargo waiting to be processed - std::array production_rate{}; ///< production rate for each cargo + std::array production_rate{}; ///< production rate for each cargo std::array this_month_production{}; ///< stats of this month's production per cargo std::array this_month_transported{}; ///< stats of this month's transport per cargo - std::array last_month_pct_transported{}; ///< percentage transported per cargo in the last full month + std::array last_month_pct_transported{}; ///< percentage transported per cargo in the last full month std::array last_month_production{}; ///< total units produced per cargo in the last full month std::array last_month_transported{}; ///< total units transported per cargo in the last full month @@ -82,17 +82,17 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> { mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the industry uint16_t counter; ///< used for animation and/or production (if available cargo) - byte prod_level; ///< general production level + uint8_t prod_level; ///< general production level Colours random_colour; ///< randomized colour of the industry, for display purpose EconTime::Year last_prod_year; ///< last year of production - byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry + uint8_t was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry IndustryControlFlags ctlflags; ///< flags overriding standard behaviours PartOfSubsidy part_of_subsidy; ///< NOSAVE: is this industry a source/destination of a subsidy? Owner founder; ///< Founder of the industry uint8_t construction_type; ///< Way the industry was constructed (@see IndustryConstructionType) - byte selected_layout; ///< Which tile layout was used when creating the industry + uint8_t selected_layout; ///< Which tile layout was used when creating the industry Owner exclusive_supplier; ///< Which company has exclusive rights to deliver cargo (INVALID_OWNER = anyone) Owner exclusive_consumer; ///< Which company has exclusive rights to take cargo (INVALID_OWNER = anyone) EconTime::Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]; ///< Last day each cargo type was accepted by this industry @@ -236,7 +236,7 @@ bool IsTileForestIndustry(TileIndex tile); /** Data for managing the number of industries of a single industry type. */ struct IndustryTypeBuildData { uint32_t probability; ///< Relative probability of building this industry. - byte min_number; ///< Smallest number of industries that should exist (either \c 0 or \c 1). + uint8_t min_number; ///< Smallest number of industries that should exist (either \c 0 or \c 1). uint16_t target_count; ///< Desired number of industries of this type. uint16_t max_wait; ///< Starting number of turns to wait (copied to #wait_count). uint16_t wait_count; ///< Number of turns to wait before trying to build again. diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index d0a8db2378..e3be27c961 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -57,7 +57,7 @@ INSTANTIATE_POOL_METHODS(Industry) void ShowIndustryViewWindow(int industry); void BuildOilRig(TileIndex tile); -static byte _industry_sound_ctr; +static uint8_t _industry_sound_ctr; static TileIndex _industry_sound_tile; uint16_t Industry::counts[NUM_INDUSTRYTYPES]; @@ -450,7 +450,7 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, Ca } } - for (byte i = 0; i < std::size(itspec->accepts_cargo); i++) { + for (uint8_t i = 0; i < std::size(itspec->accepts_cargo); i++) { CargoID a = accepts_cargo[i]; if (a == INVALID_CARGO || cargo_acceptance[i] <= 0) continue; // work only with valid cargoes @@ -547,7 +547,7 @@ static bool TransportIndustryGoods(TileIndex tile) static void AnimateSugarSieve(TileIndex tile) { - byte m = GetAnimationFrame(tile) + 1; + uint8_t m = GetAnimationFrame(tile) + 1; if (_settings_client.sound.ambient) { switch (m & 7) { @@ -567,7 +567,7 @@ static void AnimateSugarSieve(TileIndex tile) static void AnimateToffeeQuarry(TileIndex tile) { - byte m = GetAnimationFrame(tile); + uint8_t m = GetAnimationFrame(tile); if (_industry_anim_offs_toffee[m] == 0xFF && _settings_client.sound.ambient) { SndPlayTileFx(SND_30_TOFFEE_QUARRY, tile); @@ -584,7 +584,7 @@ static void AnimateToffeeQuarry(TileIndex tile) static void AnimateBubbleCatcher(TileIndex tile) { - byte m = GetAnimationFrame(tile); + uint8_t m = GetAnimationFrame(tile); if (++m >= 40) { m = 0; @@ -597,7 +597,7 @@ static void AnimateBubbleCatcher(TileIndex tile) static void AnimatePowerPlantSparks(TileIndex tile) { - byte m = GetAnimationFrame(tile); + uint8_t m = GetAnimationFrame(tile); if (m == 6) { SetAnimationFrame(tile, 0); DeleteAnimatedTile(tile); @@ -609,7 +609,7 @@ static void AnimatePowerPlantSparks(TileIndex tile) static void AnimateToyFactory(TileIndex tile) { - byte m = GetAnimationFrame(tile) + 1; + uint8_t m = GetAnimationFrame(tile) + 1; switch (m) { case 1: if (_settings_client.sound.ambient) SndPlayTileFx(SND_2C_TOY_FACTORY_1, tile); break; @@ -641,7 +641,7 @@ static void AnimatePlasticFountain(TileIndex tile, IndustryGfx gfx) static void AnimateOilWell(TileIndex tile, IndustryGfx gfx) { bool b = Chance16(1, 7); - byte m = GetAnimationFrame(tile) + 1; + uint8_t m = GetAnimationFrame(tile) + 1; if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIMATED_3 + 1 && (gfx = GFX_OILWELL_ANIMATED_1, b)) { SetIndustryGfx(tile, GFX_OILWELL_NOT_ANIMATED); SetIndustryConstructionStage(tile, 3); @@ -661,7 +661,7 @@ static void AnimateMineTower(TileIndex tile) if (state < 0x1A0) { if (state < 0x20 || state >= 0x180) { - byte m = GetAnimationFrame(tile); + uint8_t m = GetAnimationFrame(tile); if (!(m & 0x40)) { SetAnimationFrame(tile, m | 0x40); if (_settings_client.sound.ambient) SndPlayTileFx(SND_0B_MINE, tile); @@ -670,7 +670,7 @@ static void AnimateMineTower(TileIndex tile) } else { if (state & 3) return; } - byte m = (GetAnimationFrame(tile) + 1) | 0x40; + uint8_t m = (GetAnimationFrame(tile) + 1) | 0x40; if (m > 0xC2) m = 0xC0; SetAnimationFrame(tile, m); MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE); @@ -678,7 +678,7 @@ static void AnimateMineTower(TileIndex tile) int i = (state < 0x220 || state >= 0x380) ? 7 : 3; if (state & i) return; - byte m = (GetAnimationFrame(tile) & 0xBF) - 1; + uint8_t m = (GetAnimationFrame(tile) & 0xBF) - 1; if (m < 0x80) m = 0x82; SetAnimationFrame(tile, m); MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE); @@ -788,13 +788,13 @@ static void CreateChimneySmoke(TileIndex tile) static void MakeIndustryTileBigger(TileIndex tile) { - byte cnt = GetIndustryConstructionCounter(tile) + 1; + uint8_t cnt = GetIndustryConstructionCounter(tile) + 1; if (cnt != 4) { SetIndustryConstructionCounter(tile, cnt); return; } - byte stage = GetIndustryConstructionStage(tile) + 1; + uint8_t stage = GetIndustryConstructionStage(tile) + 1; SetIndustryConstructionCounter(tile, 0); SetIndustryConstructionStage(tile, stage); StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE); @@ -1031,7 +1031,7 @@ bool IsTileForestIndustry(TileIndex tile) return false; } -static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; +static const uint8_t _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; /** * Check whether the tile can be replaced by a farm field. @@ -1056,7 +1056,7 @@ static bool IsSuitableForFarmField(TileIndex tile, bool allow_fields) * @param type type of fence to set * @param side the side of the tile to attempt placement */ -static void SetupFarmFieldFence(TileIndex tile, int size, byte type, DiagDirection side) +static void SetupFarmFieldFence(TileIndex tile, int size, uint8_t type, DiagDirection side) { TileIndexDiff diff = (DiagDirToAxis(side) == AXIS_Y ? TileDiffXY(1, 0) : TileDiffXY(0, 1)); TileIndexDiff neighbour_diff = TileOffsByDiagDir(side); @@ -1068,7 +1068,7 @@ static void SetupFarmFieldFence(TileIndex tile, int size, byte type, DiagDirecti TileIndex neighbour = tile + neighbour_diff; if (!IsTileType(neighbour, MP_CLEAR) || !IsClearGround(neighbour, CLEAR_FIELDS) || GetFence(neighbour, ReverseDiagDir(side)) == 0) { /* Add fence as long as neighbouring tile does not already have a fence in the same position. */ - byte or_ = type; + uint8_t or_ = type; if (or_ == 1 && Chance16(1, 7)) or_ = 2; @@ -1478,7 +1478,7 @@ static CommandCost FindTownForIndustry(TileIndex tile, int type, Town **t) if (_settings_game.economy.multiple_industry_per_town) return CommandCost(); for (const Industry *i : Industry::Iterate()) { - if (i->type == (byte)type && i->town == *t) { + if (i->type == (uint8_t)type && i->town == *t) { *t = nullptr; return_cmd_error(STR_ERROR_ONLY_ONE_ALLOWED_PER_TOWN); } @@ -1846,7 +1846,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, /* Randomize inital production if non-original economy is used and there are no production related callbacks. */ if (!indspec->UsesOriginalEconomy()) { for (size_t ci = 0; ci < std::size(i->production_rate); ci++) { - i->production_rate[ci] = ClampTo((RandomRange(256) + 128) * i->production_rate[ci] >> 8); + i->production_rate[ci] = ClampTo((RandomRange(256) + 128) * i->production_rate[ci] >> 8); } } @@ -1869,7 +1869,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, /* Adding 1 here makes it conform to specs of var44 of varaction2 for industries * 0 = created prior of newindustries * else, chosen layout + 1 */ - i->selected_layout = (byte)(layout_index + 1); + i->selected_layout = (uint8_t)(layout_index + 1); i->exclusive_supplier = INVALID_OWNER; i->exclusive_consumer = INVALID_OWNER; @@ -2213,7 +2213,7 @@ CommandCost CmdIndustrySetFlags(TileIndex tile, DoCommandFlag flags, uint32_t p1 * @param custom_news Custom news message text. * @return Empty cost or an error. */ -CommandCost CmdIndustrySetProduction(DoCommandFlag flags, IndustryID ind_id, byte prod_level, bool show_news, const std::string &custom_news) +CommandCost CmdIndustrySetProduction(DoCommandFlag flags, IndustryID ind_id, uint8_t prod_level, bool show_news, const std::string &custom_news) { if (_current_company != OWNER_DEITY) return CMD_ERROR; if (prod_level < PRODLEVEL_MINIMUM || prod_level > PRODLEVEL_MAXIMUM) return CMD_ERROR; @@ -2389,7 +2389,7 @@ static uint32_t GetScaledIndustryGenerationProbability(IndustryType it, bool *fo * @param[out] min_number Minimal number of industries that should exist at the map. * @return Relative probability for the industry to appear. */ -static uint16_t GetIndustryGamePlayProbability(IndustryType it, byte *min_number) +static uint16_t GetIndustryGamePlayProbability(IndustryType it, uint8_t *min_number) { if (_settings_game.difficulty.industry_density == ID_FUND_ONLY) { *min_number = 0; @@ -2402,7 +2402,7 @@ static uint16_t GetIndustryGamePlayProbability(IndustryType it, byte *min_number return 0; } - byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape]; + uint8_t chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape]; if (!ind_spc->enabled || ind_spc->layouts.empty() || ((ind_spc->behaviour & INDUSTRYBEH_BEFORE_1950) && CalTime::CurYear() > 1950) || ((ind_spc->behaviour & INDUSTRYBEH_AFTER_1960) && CalTime::CurYear() < 1960) || @@ -2575,10 +2575,10 @@ static void UpdateIndustryStatistics(Industry *i) { for (size_t j = 0; j < std::size(i->produced_cargo); j++) { if (i->produced_cargo[j] != INVALID_CARGO) { - byte pct = 0; + uint8_t pct = 0; if (i->this_month_production[j] != 0) { i->last_prod_year = EconTime::CurYear(); - pct = ClampTo(((uint64_t)i->this_month_transported[j]) * 256 / i->this_month_production[j]); + pct = ClampTo(((uint64_t)i->this_month_transported[j]) * 256 / i->this_month_production[j]); } i->last_month_pct_transported[j] = pct; @@ -2602,7 +2602,7 @@ void Industry::RecomputeProductionMultipliers() /* Rates are rounded up, so e.g. oilrig always produces some passengers */ for (size_t i = 0; i < std::size(this->production_rate); i++) { - this->production_rate[i] = ClampTo(CeilDiv(indspec->production_rate[i] * this->prod_level, PRODLEVEL_DEFAULT)); + this->production_rate[i] = ClampTo(CeilDiv(indspec->production_rate[i] * this->prod_level, PRODLEVEL_DEFAULT)); } } @@ -2626,7 +2626,7 @@ void ClearAllIndustryCachedNames() */ bool IndustryTypeBuildData::GetIndustryTypeData(IndustryType it) { - byte min_number; + uint8_t min_number; uint32_t probability = GetIndustryGamePlayProbability(it, &min_number); bool changed = min_number != this->min_number || probability != this->probability; this->min_number = min_number; @@ -2886,8 +2886,8 @@ static void ChangeIndustryProduction(Industry *i, bool monthly) bool recalculate_multipliers = false; ///< reinitialize production_rate to match prod_level /* use original economy for industries using production related callbacks */ bool original_economy = indspec->UsesOriginalEconomy(); - byte div = 0; - byte mul = 0; + uint8_t div = 0; + uint8_t mul = 0; int8_t increment = 0; bool callback_enabled = HasBit(indspec->callback_mask, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE); diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 92a1b6496c..839c476d5e 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -178,7 +178,7 @@ static inline void GetAllCargoSuffixes(CargoSuffixInOut use_input, CargoSuffixTy /* Reworked behaviour with new many-in-many-out scheme */ for (size_t j = 0; j < std::size(suffixes); j++) { if (cargoes[j] != INVALID_CARGO) { - byte local_id = indspec->grf_prop.grffile->cargo_map[cargoes[j]]; // should we check the value for valid? + uint8_t local_id = indspec->grf_prop.grffile->cargo_map[cargoes[j]]; // should we check the value for valid? uint cargotype = local_id << 16 | use_input; GetCargoSuffix(cargotype, cst, ind, ind_type, indspec, suffixes[j]); } else { @@ -836,7 +836,7 @@ class IndustryViewWindow : public Window Editability editable; ///< Mode for changing production InfoLine editbox_line; ///< The line clicked to open the edit box InfoLine clicked_line; ///< The line of the button that has been clicked - byte clicked_button; ///< The button that has been clicked (to raise) + uint8_t clicked_button; ///< The button that has been clicked (to raise) int production_offset_y; ///< The offset of the production texts/buttons int info_height; ///< Height needed for the #WID_IV_INFO panel int cheat_line_height; ///< Height of each line for the #WID_IV_INFO panel @@ -1081,10 +1081,10 @@ public: case EA_MULTIPLIER: if (decrease) { if (i->prod_level <= PRODLEVEL_MINIMUM) return; - i->prod_level = static_cast(std::max(i->prod_level / 2, PRODLEVEL_MINIMUM)); + i->prod_level = static_cast(std::max(i->prod_level / 2, PRODLEVEL_MINIMUM)); } else { if (i->prod_level >= PRODLEVEL_MAXIMUM) return; - i->prod_level = static_cast(std::min(i->prod_level * 2, PRODLEVEL_MAXIMUM)); + i->prod_level = static_cast(std::min(i->prod_level * 2, PRODLEVEL_MAXIMUM)); } break; @@ -1096,7 +1096,7 @@ public: if (i->production_rate[line - IL_RATE1] >= 255) return; /* a zero production industry is unlikely to give anything but zero, so push it a little bit */ int new_prod = i->production_rate[line - IL_RATE1] == 0 ? 1 : i->production_rate[line - IL_RATE1] * 2; - i->production_rate[line - IL_RATE1] = ClampTo(new_prod); + i->production_rate[line - IL_RATE1] = ClampTo(new_prod); } break; @@ -1584,7 +1584,7 @@ protected: StringID GetIndustryString(const Industry *i) const { const IndustrySpec *indsp = GetIndustrySpec(i->type); - byte p = 0; + uint8_t p = 0; /* Industry name */ SetDParam(p++, i->index); diff --git a/src/industry_map.h b/src/industry_map.h index 98afbf8baa..0ac2ca9da4 100644 --- a/src/industry_map.h +++ b/src/industry_map.h @@ -97,10 +97,10 @@ inline void SetIndustryCompleted(TileIndex tile) * @pre IsTileType(tile, MP_INDUSTRY) * @return the construction stage */ -inline byte GetIndustryConstructionStage(TileIndex tile) +inline uint8_t GetIndustryConstructionStage(TileIndex tile) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); - return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2); + return IsIndustryCompleted(tile) ? (uint8_t)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2); } /** @@ -109,7 +109,7 @@ inline byte GetIndustryConstructionStage(TileIndex tile) * @param value the new construction stage * @pre IsTileType(tile, MP_INDUSTRY) */ -inline void SetIndustryConstructionStage(TileIndex tile, byte value) +inline void SetIndustryConstructionStage(TileIndex tile, uint8_t value) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); SB(_m[tile].m1, 0, 2, value); @@ -159,7 +159,7 @@ inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx) * @pre IsTileType(tile, MP_INDUSTRY) * @return the construction counter */ -inline byte GetIndustryConstructionCounter(TileIndex tile) +inline uint8_t GetIndustryConstructionCounter(TileIndex tile) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); return GB(_m[tile].m1, 2, 2); @@ -171,7 +171,7 @@ inline byte GetIndustryConstructionCounter(TileIndex tile) * @param value the new value for the construction counter * @pre IsTileType(tile, MP_INDUSTRY) */ -inline void SetIndustryConstructionCounter(TileIndex tile, byte value) +inline void SetIndustryConstructionCounter(TileIndex tile, uint8_t value) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); SB(_m[tile].m1, 2, 2, value); @@ -196,7 +196,7 @@ inline void ResetIndustryConstructionStage(TileIndex tile) * @param tile the tile to get the animation loop number of * @pre IsTileType(tile, MP_INDUSTRY) */ -inline byte GetIndustryAnimationLoop(TileIndex tile) +inline uint8_t GetIndustryAnimationLoop(TileIndex tile) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); return _m[tile].m4; @@ -208,7 +208,7 @@ inline byte GetIndustryAnimationLoop(TileIndex tile) * @param count the new animation frame number * @pre IsTileType(tile, MP_INDUSTRY) */ -inline void SetIndustryAnimationLoop(TileIndex tile, byte count) +inline void SetIndustryAnimationLoop(TileIndex tile, uint8_t count) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); _m[tile].m4 = count; @@ -221,7 +221,7 @@ inline void SetIndustryAnimationLoop(TileIndex tile, byte count) * @pre IsTileType(tile, MP_INDUSTRY) * @return requested bits */ -inline byte GetIndustryRandomBits(TileIndex tile) +inline uint8_t GetIndustryRandomBits(TileIndex tile) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); return _m[tile].m3; @@ -234,7 +234,7 @@ inline byte GetIndustryRandomBits(TileIndex tile) * @param bits the random bits * @pre IsTileType(tile, MP_INDUSTRY) */ -inline void SetIndustryRandomBits(TileIndex tile, byte bits) +inline void SetIndustryRandomBits(TileIndex tile, uint8_t bits) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); _m[tile].m3 = bits; @@ -247,7 +247,7 @@ inline void SetIndustryRandomBits(TileIndex tile, byte bits) * @pre IsTileType(tile, MP_INDUSTRY) * @return requested triggers */ -inline byte GetIndustryTriggers(TileIndex tile) +inline uint8_t GetIndustryTriggers(TileIndex tile) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); return GB(_me[tile].m6, 3, 3); @@ -261,7 +261,7 @@ inline byte GetIndustryTriggers(TileIndex tile) * @param triggers the triggers to set * @pre IsTileType(tile, MP_INDUSTRY) */ -inline void SetIndustryTriggers(TileIndex tile, byte triggers) +inline void SetIndustryTriggers(TileIndex tile, uint8_t triggers) { dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile); SB(_me[tile].m6, 3, 3, triggers); diff --git a/src/industrytype.h b/src/industrytype.h index ff740fdead..bf602f6f66 100644 --- a/src/industrytype.h +++ b/src/industrytype.h @@ -112,30 +112,30 @@ struct IndustrySpec { uint32_t removal_cost_multiplier; ///< Base removal cost multiplier. uint32_t prospecting_chance; ///< Chance prospecting succeeds IndustryType conflicting[3]; ///< Industries this industry cannot be close to - byte check_proc; ///< Index to a procedure to check for conflicting circumstances + uint8_t check_proc; ///< Index to a procedure to check for conflicting circumstances std::array produced_cargo{}; std::array, INDUSTRY_NUM_OUTPUTS> produced_cargo_label{}; - std::array production_rate{}; + std::array production_rate{}; /** * minimum amount of cargo transported to the stations. * If the waiting cargo is less than this number, no cargo is moved to it. */ - byte minimal_cargo; + uint8_t minimal_cargo; std::array accepts_cargo{}; ///< 16 accepted cargoes. std::array, INDUSTRY_NUM_INPUTS> accepts_cargo_label{}; uint16_t input_cargo_multiplier[INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes) IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs - byte climate_availability; ///< Bitmask, giving landscape enums as bit position + uint8_t climate_availability; ///< Bitmask, giving landscape enums as bit position IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it - byte map_colour; ///< colour used for the small map + uint8_t map_colour; ///< colour used for the small map StringID name; ///< Displayed name of the industry StringID new_industry_text; ///< Message appearing when the industry is built StringID closure_text; ///< Message appearing when the industry closes StringID production_up_text; ///< Message appearing when the industry's production is increasing StringID production_down_text; ///< Message appearing when the industry's production is decreasing StringID station_name; ///< Default name for nearby station - byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game - byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation + uint8_t appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game + uint8_t appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation uint8_t number_of_sounds; ///< Number of sounds available in the sounds array const uint8_t *random_sounds; ///< array of random sounds. /* Newgrf data */ @@ -162,8 +162,8 @@ struct IndustryTileSpec { std::array, INDUSTRY_NUM_INPUTS> accepts_cargo_label; std::array acceptance; ///< Level of acceptance per cargo type (signed, may be negative!) Slope slopes_refused; ///< slope pattern on which this tile cannot be built - byte anim_production; ///< Animation frame to start when goods are produced - byte anim_next; ///< Next frame in an animation + uint8_t anim_production; ///< Animation frame to start when goods are produced + uint8_t anim_next; ///< Next frame in an animation /** * When true, the tile has to be drawn using the animation * state instead of the construction state diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 59ee8a3692..7f5a8d179a 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -48,13 +48,13 @@ */ struct IntroGameViewportCommand { /** Horizontal alignment value. */ - enum AlignmentH : byte { + enum AlignmentH : uint8_t { LEFT, CENTRE, RIGHT, }; /** Vertical alignment value. */ - enum AlignmentV : byte { + enum AlignmentV : uint8_t { TOP, MIDDLE, BOTTOM, diff --git a/src/landscape.cpp b/src/landscape.cpp index 57464f99be..693a3978e6 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -81,7 +81,7 @@ const TileTypeProcs * const _tile_type_procs[16] = { }; /** landscape slope => sprite */ -extern const byte _slope_to_sprite_offset[32] = { +extern const uint8_t _slope_to_sprite_offset[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 0, 15, 18, 0, }; @@ -105,10 +105,10 @@ static TileIndex _current_estuary = INVALID_TILE; /** Whether the current river is a big river that others flow into */ static bool _is_main_river = false; -byte _cached_snowline = 0; -byte _cached_highest_snowline = 0; -byte _cached_lowest_snowline = 0; -byte _cached_tree_placement_highest_snowline = 0; +uint8_t _cached_snowline = 0; +uint8_t _cached_highest_snowline = 0; +uint8_t _cached_lowest_snowline = 0; +uint8_t _cached_tree_placement_highest_snowline = 0; /** * Map 2D viewport or smallmap coordinate to 3D world or tile coordinate. @@ -407,7 +407,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) if (IsInclinedFoundation(f)) { /* inclined foundation */ - byte inclined = highest_corner * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); + uint8_t inclined = highest_corner * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, f == FOUNDATION_INCLINED_X ? TILE_SIZE : 1, @@ -462,7 +462,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) OffsetGroundSprite(0, 0); } else { /* inclined foundation */ - byte inclined = GetHighestSlopeCorner(ti->tileh) * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); + uint8_t inclined = GetHighestSlopeCorner(ti->tileh) * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, f == FOUNDATION_INCLINED_X ? TILE_SIZE : 1, @@ -530,7 +530,7 @@ bool IsSnowLineSet() * @param table the 12 * 32 byte table containing the snowline for each day * @ingroup SnowLineGroup */ -void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]) +void SetSnowLine(uint8_t table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]) { _snow_line = CallocT(1); _snow_line->lowest_value = 0xFF; @@ -552,7 +552,7 @@ void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]) * @return the snow line height. * @ingroup SnowLineGroup */ -byte GetSnowLineUncached() +uint8_t GetSnowLineUncached() { if (_snow_line == nullptr) return _settings_game.game_creation.snow_line_height; @@ -833,8 +833,8 @@ void InitializeLandscape() for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(MapMaxX(), y)); } -static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 }; -static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 }; +static const uint8_t _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 }; +static const uint8_t _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 }; static void GenerateTerrain(int type, uint flag) { @@ -858,7 +858,7 @@ static void GenerateTerrain(int type, uint flag) if (DiagDirToAxis(direction) == AXIS_Y) Swap(w, h); - const byte *p = templ->data; + const uint8_t *p = templ->data; if ((flag & 4) != 0) { /* This is only executed in secondary/tertiary loops to generate the terrain for arctic and tropic. @@ -1510,7 +1510,7 @@ static uint8_t CalculateDesertLine() return CalculateCoverageLine(100 - _settings_game.game_creation.desert_coverage, 4); } -bool GenerateLandscape(byte mode) +bool GenerateLandscape(uint8_t mode) { /** Number of steps of landscape generation */ enum GenLandscapeSteps { diff --git a/src/landscape.h b/src/landscape.h index 745645f8b7..0236d2ecab 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -22,43 +22,43 @@ static const uint SNOW_LINE_DAYS = 32; ///< Number of days in each month in th * @ingroup SnowLineGroup */ struct SnowLine { - byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; ///< Height of the snow line each day of the year - byte highest_value; ///< Highest snow line of the year - byte lowest_value; ///< Lowest snow line of the year + uint8_t table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; ///< Height of the snow line each day of the year + uint8_t highest_value; ///< Highest snow line of the year + uint8_t lowest_value; ///< Lowest snow line of the year }; bool IsSnowLineSet(); -void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]); -byte GetSnowLineUncached(); +void SetSnowLine(uint8_t table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]); +uint8_t GetSnowLineUncached(); void UpdateCachedSnowLine(); void UpdateCachedSnowLineBounds(); void ClearSnowLine(); -inline byte GetSnowLine() +inline uint8_t GetSnowLine() { - extern byte _cached_snowline; + extern uint8_t _cached_snowline; return _cached_snowline; } -inline byte HighestSnowLine() +inline uint8_t HighestSnowLine() { - extern byte _cached_highest_snowline; + extern uint8_t _cached_highest_snowline; return _cached_highest_snowline; } -inline byte LowestSnowLine() +inline uint8_t LowestSnowLine() { - extern byte _cached_lowest_snowline; + extern uint8_t _cached_lowest_snowline; return _cached_lowest_snowline; } -inline byte HighestTreePlacementSnowLine() +inline uint8_t HighestTreePlacementSnowLine() { - extern byte _cached_tree_placement_highest_snowline; + extern uint8_t _cached_tree_placement_highest_snowline; return _cached_tree_placement_highest_snowline; } -inline byte LowestTreePlacementSnowLine() +inline uint8_t LowestTreePlacementSnowLine() { return LowestSnowLine(); } @@ -169,6 +169,6 @@ void RunTileLoop(bool apply_day_length = false); void RunAuxiliaryTileLoop(); void InitializeLandscape(); -bool GenerateLandscape(byte mode); +bool GenerateLandscape(uint8_t mode); #endif /* LANDSCAPE_H */ diff --git a/src/landscape_type.h b/src/landscape_type.h index 80b541bea4..81bed326e2 100644 --- a/src/landscape_type.h +++ b/src/landscape_type.h @@ -10,7 +10,7 @@ #ifndef LANDSCAPE_TYPE_H #define LANDSCAPE_TYPE_H -typedef byte LandscapeID; ///< Landscape type. @see LandscapeType +typedef uint8_t LandscapeID; ///< Landscape type. @see LandscapeType /** Landscape types */ enum LandscapeType { diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index 6d01f8d923..536f11a225 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -881,14 +881,14 @@ STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_OIL :{BIG_FONT}{BLAC STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM :{BIG_FONT}{BLACK}Métodos agrícolas aperfeiçoados na {INDUSTRY} deverão duplicar a produção! STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_SMOOTH :{BIG_FONT}{BLACK}Produção de {STRING} n{G o a} {INDUSTRY} aumenta {COMMA}%! STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL :{BIG_FONT}{BLACK}A produção de {INDUSTRY} foi reduzida em 50% -STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM :{BIG_FONT}{BLACK}Infestação de insetos causa destruição {G no na} {INDUSTRY}!{}Produção diminui 50% +STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM :{BIG_FONT}{BLACK}Infestação de insetos causa destruição n{G o a} {INDUSTRY}!{}Produção diminui 50% STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_SMOOTH :{BIG_FONT}{BLACK}Produção de {STRING} n{G o a} {INDUSTRY} diminui {COMMA}%! ###length VEHICLE_TYPES STR_NEWS_TRAIN_IS_WAITING :{WHITE}{VEHICLE} está aguardando no depósito STR_NEWS_ROAD_VEHICLE_IS_WAITING :{WHITE}{VEHICLE} está aguardando no depósito STR_NEWS_SHIP_IS_WAITING :{WHITE}{VEHICLE} está aguardando no depósito -STR_NEWS_AIRCRAFT_IS_WAITING :{WHITE}{VEHICLE} está aguardando no hangar +STR_NEWS_AIRCRAFT_IS_WAITING :{WHITE}{VEHICLE} está aguardando no hangar de aeronaves ###next-name-looks-similar # Order review system / warnings @@ -910,23 +910,23 @@ STR_NEWS_AIRCRAFT_DEST_TOO_FAR :{WHITE}{VEHICLE STR_NEWS_ORDER_REFIT_FAILED :{WHITE}{VEHICLE} parou porque uma ordem de adaptação falhou STR_NEWS_VEHICLE_AUTORENEW_FAILED :{WHITE}Renovação automática falhou para {VEHICLE}{}{STRING} -STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE :{BIG_FONT}{BLACK}Novo {STRING} já disponível! +STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE :{BIG_FONT}{BLACK}Nov{G o a} {STRING} já disponível! STR_NEWS_NEW_VEHICLE_TYPE :{BIG_FONT}{BLACK}{ENGINE} -STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Novo {STRING} já disponível! - {ENGINE} +STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nov{G o a} {STRING} já disponível! - {ENGINE} STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}Abrir a janela de grupos focada no grupo do veículo STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST :{WHITE}{STATION} não aceita mais: {CARGO_LIST} STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST :{WHITE}{STATION} agora aceita: {CARGO_LIST} -STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Oferta do subsídio expirou:{}{}{STRING} d{G o a} {STRING} para {STRING} agora não será subsidiado -STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Subsídio retirado:{}{}Transportar {STRING} d{G o a} {STRING} para {STRING} não é mais subsidiado -STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}Subsídio de serviço oferecido:{}{}Primeiro transporte de {STRING} d{G o a} {STRING} para {STRING} irá receber {UNITS_YEARS_OR_MINUTES} de subsídio da autoridade local! +STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Oferta de subsídio expirou:{}{}{STRING} d{G e a} {STRING} para {STRING} agora não será subsidiado +STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Subsídio retirado:{}{}Transportar {STRING} d{G e a} {STRING} para {STRING} não é mais subsidiado +STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}Subsídio de serviço oferecido:{}{}Primeiro transporte de {STRING} d{G e a} {STRING} para {STRING} receberá {UNITS_YEARS_OR_MINUTES} de subsídio da autoridade local! ###length 4 -STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G o a} {STRING} para {STRING} será pago a 150% pelos próximos {UNITS_YEARS_OR_MINUTES}! -STR_NEWS_SERVICE_SUBSIDY_AWARDED_DOUBLE :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G o a} {STRING} para {STRING} será pago a 200% pelos próximos {UNITS_YEARS_OR_MINUTES}! -STR_NEWS_SERVICE_SUBSIDY_AWARDED_TRIPLE :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G o a} {STRING} para {STRING} será pago a 300% pelos próximos {UNITS_YEARS_OR_MINUTES}! -STR_NEWS_SERVICE_SUBSIDY_AWARDED_QUADRUPLE :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G o a} {STRING} para {STRING} será pago a 400% pelos próximos {UNITS_YEARS_OR_MINUTES}! +STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G e a} {STRING} para {STRING} será pago a 150% pelos próximos {UNITS_YEARS_OR_MINUTES}! +STR_NEWS_SERVICE_SUBSIDY_AWARDED_DOUBLE :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G e a} {STRING} para {STRING} será pago a 200% pelos próximos {UNITS_YEARS_OR_MINUTES}! +STR_NEWS_SERVICE_SUBSIDY_AWARDED_TRIPLE :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G e a} {STRING} para {STRING} será pago a 300% pelos próximos {UNITS_YEARS_OR_MINUTES}! +STR_NEWS_SERVICE_SUBSIDY_AWARDED_QUADRUPLE :{BIG_FONT}{BLACK}Subsídio de serviço concedido a {STRING}!{}{}{STRING} d{G e a} {STRING} para {STRING} será pago a 400% pelos próximos {UNITS_YEARS_OR_MINUTES}! STR_NEWS_ROAD_REBUILDING_MONTHS :{BIG_FONT}{BLACK}Tráfego caótico em {TOWN}!{}{}Programa de reconstrução de estradas financiado por {STRING} provoca 6 meses de sofrimento aos motoristas! STR_NEWS_ROAD_REBUILDING_MINUTES :{BIG_FONT}{BLACK}Tráfego caótico em {TOWN}!{}{}Programa de reconstrução de estradas financiado por {STRING} provoca 6 minutos de sofrimento aos motoristas! @@ -1066,7 +1066,7 @@ STR_GAME_OPTIONS_GUI_SCALE_4X :4x STR_GAME_OPTIONS_GUI_SCALE_5X :5x STR_GAME_OPTIONS_PARTICIPATE_SURVEY_FRAME :{BLACK}Pesquisa automatizada -STR_GAME_OPTIONS_PARTICIPATE_SURVEY :{BLACK}Participar de pesquisa automatizada +STR_GAME_OPTIONS_PARTICIPATE_SURVEY :{BLACK}Participar da pesquisa automatizada STR_GAME_OPTIONS_PARTICIPATE_SURVEY_TOOLTIP :{BLACK}Quando ativado, o OpenTTD enviará uma pesquisa ao sair de um jogo STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK :{BLACK}Sobre pesquisa e privacidade STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK_TOOLTIP :{BLACK}Abrir um navegador com mais informações sobre a pesquisa automatizada @@ -1405,7 +1405,7 @@ STR_CONFIG_SETTING_SHOWFINANCES_PERIOD :Mostrar janela STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :Se ativado, a janela de finanças será exibida no fim de cada ano, permitindo uma inspeção fácil da situação financeira da empresa STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT_PERIOD :Se ativado, a janela de finanças será exibida no fim de cada período, permitindo uma inspeção fácil da situação financeira da empresa -STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Novas ordens, por padrão, são 'sem parar' : {STRING} +STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Novas ordens são 'sem parar', por padrão: {STRING} STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :Normalmente, um veículo irá parar em cada estação por onde passa. Ativando esta configuração, o veículo passará por todas as estações na sua rota, sem parar, até o destino final. Esta opção só define um modo padrão para novas ordens. Ordens individuais podem ser definidas explicitamente para qualquer um dos dois comportamentos STR_CONFIG_SETTING_STOP_LOCATION :Novas ordens de trem, por padrão, têm parada no {STRING} da plataforma @@ -1547,7 +1547,7 @@ STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS :Mostrar as carg STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS_HELPTEXT :Se ativado, a carga transportável pelo veículo aparecerá acima dele nas listas de veículos STR_CONFIG_SETTING_LANDSCAPE :Clima: {STRING} -STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Os climas definem a jogabilidade básica dos cenários, com diferentes cargas e necessidades para o crescimento das localidades. NewGRFs e Scripts de Jogo permitem um controle mais preciso sobre isso +STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Os climas definem a jogabilidade básica dos cenários, com diferentes cargas e requisitos para crescimento das localidades. NewGRFs e Scripts de Jogo permitem um controle mais preciso sobre isso STR_CONFIG_SETTING_LAND_GENERATOR :Gerador de Terreno: {STRING} STR_CONFIG_SETTING_LAND_GENERATOR_HELPTEXT :O gerador 'Original' depende do conjunto gráfico base e produz formas de terreno pré-definidas. 'TerraGenesis' é um gerador baseado no algoritmo de ruído de Perlin, que permite configurações mais refinadas @@ -1565,14 +1565,14 @@ STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE :Distância máx STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :Limite de distância entre a borda do mapa e o local de construção de refinarias e plataformas de petróleo. Em mapas de ilhas isso garante que elas fiquem perto da costa. Em mapas com mais de 256 quadrados esse valor é aumentado STR_CONFIG_SETTING_SNOWLINE_HEIGHT :Altura da linha de neve: {STRING} -STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Escolher em que latitude a neve começa na paisagem subártica. A neve também afeta a geração de indústrias e os requisitos de crescimento das localidades. Só pode ser modificado no Editor de Cenário ou então é calculado usando a "cobertura de neve" +STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Escolher em que latitude a neve começa na paisagem subártica. A neve também afeta a geração de indústrias e os requisitos para crescimento das localidades. Só pode ser modificado no Editor de Cenário ou então é calculado usando a "cobertura de neve" STR_CONFIG_SETTING_SNOW_COVERAGE :Cobertura de neve: {STRING} -STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :Escolher a quantidade aproximada de neve na paisagem subártica. A neve também afeta a geração de indústrias e os requisitos para crescimento das localidades. Usado apenas durante a geração do mapa. O nível do mar e as suas encostas nunca têm neve +STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :Escolher a quantidade aproximada de neve na paisagem subártica. A neve também afeta a geração de indústrias e os requisitos para crescimento das localidades. Usado somente durante a geração do mapa. O nível do mar e as suas encostas nunca têm neve STR_CONFIG_SETTING_SNOW_COVERAGE_VALUE :{NUM}% STR_CONFIG_SETTING_DESERT_COVERAGE :Cobertura do deserto: {STRING} -STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :Escolher a quantidade aproximada de deserto na paisagem tropical. O deserto também afeta a geração de indústrias. Usado somente durante a geração do mapa +STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :Escolher a quantidade aproximada de deserto na paisagem tropical. O deserto também afeta a geração de indústrias e os requisitos para crescimento das localidades. Usado somente durante a geração do mapa STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE :{NUM}% STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :Irregularidade do terreno: {STRING} @@ -1663,10 +1663,10 @@ STR_CONFIG_SETTING_PREFER_TEAMCHAT :Preferência de STR_CONFIG_SETTING_PREFER_TEAMCHAT_HELPTEXT :Trocar o mapeamento entre o chat interno da empresa e o chat público para e , respectivamente STR_CONFIG_SETTING_SCROLLWHEEL_MULTIPLIER :Velocidade da roda do mouse no mapa: {STRING} -STR_CONFIG_SETTING_SCROLLWHEEL_MULTIPLIER_HELPTEXT :Controlar a sensibilidade da roda do mouse na rolagem +STR_CONFIG_SETTING_SCROLLWHEEL_MULTIPLIER_HELPTEXT :Controlar a sensibilidade do deslocamento com a roda do mouse STR_CONFIG_SETTING_SCROLLWHEEL_SCROLLING :Função da roda do mouse: {STRING} -STR_CONFIG_SETTING_SCROLLWHEEL_SCROLLING_HELPTEXT :Ativar o rolamento com rodas de mouse bidimensionais +STR_CONFIG_SETTING_SCROLLWHEEL_SCROLLING_HELPTEXT :Permitir o deslocamento com rodas de mouse bidimensionais ###length 3 STR_CONFIG_SETTING_SCROLLWHEEL_ZOOM :Ampliar o mapa STR_CONFIG_SETTING_SCROLLWHEEL_SCROLL :Mover o mapa @@ -1802,16 +1802,16 @@ STR_CONFIG_SETTING_MAX_SHIPS :Número máximo STR_CONFIG_SETTING_MAX_SHIPS_HELPTEXT :Número máximo de embarcações que uma empresa pode ter STR_CONFIG_SETTING_AI_BUILDS_TRAINS :Desativar trens para o computador: {STRING} -STR_CONFIG_SETTING_AI_BUILDS_TRAINS_HELPTEXT :Quando ativada, esta configuração não permite a construção de trens por um competidor controlado por IA +STR_CONFIG_SETTING_AI_BUILDS_TRAINS_HELPTEXT :Ativando esta configuração, um competidor controlado por IA não poderá construir trens STR_CONFIG_SETTING_AI_BUILDS_ROAD_VEHICLES :Desativar veículos para o computador: {STRING} -STR_CONFIG_SETTING_AI_BUILDS_ROAD_VEHICLES_HELPTEXT :Quando ativada, esta configuração não permite a construção de veículos rodoviários por um competidor controlado por IA +STR_CONFIG_SETTING_AI_BUILDS_ROAD_VEHICLES_HELPTEXT :Ativando esta configuração, um competidor controlado por IA não poderá construir veículos rodoviários STR_CONFIG_SETTING_AI_BUILDS_AIRCRAFT :Desativar aeronaves para o computador: {STRING} -STR_CONFIG_SETTING_AI_BUILDS_AIRCRAFT_HELPTEXT :Quando ativada, esta configuração não permite a construção de aeronaves por um competidor controlado por IA +STR_CONFIG_SETTING_AI_BUILDS_AIRCRAFT_HELPTEXT :Ativando esta configuração, um competidor controlado por IA não poderá construir aeronaves STR_CONFIG_SETTING_AI_BUILDS_SHIPS :Desativar embarcações para o computador: {STRING} -STR_CONFIG_SETTING_AI_BUILDS_SHIPS_HELPTEXT :Quando ativada, esta configuração não permite a construção de embarcações por um competidor controlado por IA +STR_CONFIG_SETTING_AI_BUILDS_SHIPS_HELPTEXT :Ativando esta configuração, um competidor controlado por IA não poderá construir embarcações STR_CONFIG_SETTING_AI_IN_MULTIPLAYER :Permitir IAs em multijogador: {STRING} STR_CONFIG_SETTING_AI_IN_MULTIPLAYER_HELPTEXT :Permitir que competidores controlados por IA participem de jogos multijogador @@ -1847,7 +1847,7 @@ STR_CONFIG_SETTING_WAGONSPEEDLIMITS :Ativar limite d STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :Quando ativado, usa o limite de velocidade dos vagões para definir a velocidade máxima de um trem STR_CONFIG_SETTING_DISABLE_ELRAILS :Desativar ferrovias elétricas: {STRING} -STR_CONFIG_SETTING_DISABLE_ELRAILS_HELPTEXT :Quando ativada, esta configuração elimina a necessidade de eletrificar os trilhos para que locomotivas elétricas possam utilizá-los +STR_CONFIG_SETTING_DISABLE_ELRAILS_HELPTEXT :Ativando esta configuração, não será necessário eletrificar os trilhos para que locomotivas elétricas possam utilizá-los STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN :Chegada do primeiro veículo na estação do jogador: {STRING} STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN_HELPTEXT :Mostrar um jornal quando o primeiro veículo chegar a uma estação nova do jogador @@ -1954,13 +1954,13 @@ STR_CONFIG_SETTING_TOWN_LAYOUT_RANDOM :Aleatória STR_CONFIG_SETTING_ALLOW_TOWN_ROADS :Localidades podem construir estradas: {STRING} STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :Permitir que localidades construam estradas para crescimento. Desative para prevenir a construção de estradas pelas autoridades locais STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :Localidades podem construir passagens de nível: {STRING} -STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :Quando ativada, esta configuração permite que as localidades construam passagens de nível +STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :Ativando esta configuração, as localidades poderão construir passagens de nível STR_CONFIG_SETTING_NOISE_LEVEL :Limitar a localização do aeroporto em função do nível de ruído: {STRING} STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :Permitir que as localidades impeçam a construção de aeroportos em função do nível de aceitação de ruído, que é baseado no total de habitantes da localidade e no tamanho e distância do aeroporto. Se esta configuração estiver desativada, as localidades permitirão somente dois aeroportos, a menos que a atitude da autoridade local esteja definida como "Permissiva" STR_CONFIG_SETTING_TOWN_FOUNDING :Fundar localidades no jogo: {STRING} -STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :Quando ativada, esta configuração permite aos jogadores fundar novas localidades no jogo +STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :Ativando esta configuração, os jogadores poderão fundar novas localidades no jogo ###length 3 STR_CONFIG_SETTING_TOWN_FOUNDING_FORBIDDEN :Proibido STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED :Permitido @@ -1996,7 +1996,7 @@ STR_CONFIG_SETTING_SOFT_LIMIT_VALUE :{COMMA} STR_CONFIG_SETTING_SOFT_LIMIT_DISABLED :desativado STR_CONFIG_SETTING_ZOOM_MIN :Nível máximo de ampliação: {STRING} -STR_CONFIG_SETTING_ZOOM_MIN_HELPTEXT :Nível máximo de ampliação para visualizações. Níveis de ampliação muito grandes aumentam os requisitos de memória +STR_CONFIG_SETTING_ZOOM_MIN_HELPTEXT :Nível máximo de ampliação para visualizações. Níveis de ampliação muito grandes aumentam o uso de memória STR_CONFIG_SETTING_ZOOM_MAX :Nível máximo de redução: {STRING} STR_CONFIG_SETTING_ZOOM_MAX_HELPTEXT :Nível máximo de redução para visualizações. Níveis de redução muito grandes podem causar atrasos quando utilizados ###length 6 @@ -2058,11 +2058,11 @@ STR_CONFIG_SETTING_DEMAND_SIZE :Quantidade de c STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Definir isto para menos de 100% faz com que a distribuição simétrica comporte-se mais como a assimétrica. Menos carga será forçadamente devolvida se uma certa quantidade for enviada a uma estação. Se você definir em 0% a distribuição simétrica se comportará exatamente como a assimétrica STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Saturação de rotas curtas antes de usar rotas de grande capacidade: {STRING} -STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Frequentemente há diversas rotas entre duas estações. Cargodist irá saturar a rota mais curta primeiro, depois usar a segunda rota mais curta até saturá-la, e assim por diante. A saturação é determinada por uma estimativa da capacidade e da utilização prevista. Ao saturar todas as rotas, se ainda existir demanda não atendida, Cargodist irá sobrecarregar todas as rotas, dando preferência àquelas de maior capacidade. Entretanto, na maioria das vezes o algoritmo não irá estimar corretamente a capacidade. Esta configuração permite definir até que porcentagem uma rota mais curta deverá ser saturada na primeira passada antes do algoritmo selecionar a próxima rota mais longa. Defina-o para menos de 100% para evitar estações sobrecarregadas no caso de capacidade superestimada +STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Frequentemente há diversas rotas entre duas estações. Cargodist irá saturar a rota mais curta primeiro, depois usar a segunda rota mais curta até saturá-la, e assim por diante. A saturação é determinada por uma estimativa da capacidade e da utilização prevista. Ao saturar todas as rotas, se ainda existir demanda não atendida, Cargodist irá sobrecarregar todas as rotas, dando preferência àquelas de maior capacidade. Entretanto, na maioria das vezes o algoritmo não irá estimar corretamente a capacidade. Esta configuração permite definir até que porcentagem uma rota mais curta deverá ser saturada na primeira passada, antes do algoritmo selecionar a próxima rota mais longa. Defina para menos de 100% para evitar estações sobrecarregadas no caso de capacidade superestimada STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Unidades de velocidade (terrestre): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Unidades de velocidade (náutica): {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Sempre que uma velocidade for exibida na interface do usuário, mostrar na unidade selecionada +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Sempre que uma velocidade for exibida na interface do usuário, mostrar nessas unidades STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperial (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Métrico (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) @@ -2071,35 +2071,35 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS_SECS :Unidades do jog STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Nós STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Unidade de potência veicular: {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Sempre que a potência de um veículo for exibida na interface de usuário, mostrar na unidade selecionada +STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Sempre que a potência de um veículo for exibida na interface de usuário, mostrar nessas unidades ###length 3 STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_IMPERIAL :Imperial (hp) STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_METRIC :Métrico (hp) STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_SI :SI (kW) STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT :Unidades de peso: {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_HELPTEXT :Sempre que um peso for exibido na interface de usuário, mostrar na unidade selecionada +STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_HELPTEXT :Sempre que um peso for exibido na interface de usuário, mostrar nessas unidades ###length 3 STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_IMPERIAL :Imperial (t/ton curta) STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_METRIC :Métrico (t/tonelada) STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_SI :SI (kg) STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME :Unidades volumétricas: {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME_HELPTEXT :Sempre que um volume for exibido na interface de usuário, mostrar na unidade selecionada +STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME_HELPTEXT :Sempre que um volume for exibido na interface de usuário, mostrar nessas unidades ###length 3 STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME_IMPERIAL :Imperial (gal) STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME_METRIC :Métrico (l) STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME_SI :SI (m³) STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE :Unidade de força de tração: {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE_HELPTEXT :Sempre que o esforço de tração (ou força de tração) for exibido na interface de usuário, mostrar na unidade selecionada +STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE_HELPTEXT :Sempre que o esforço de tração (ou força de tração) for exibido na interface de usuário, mostrar nessas unidades ###length 3 STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE_IMPERIAL :Imperial (lbf) STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE_METRIC :Métrico (kgf) STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE_SI :SI (kN) STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT :Unidades de altura: {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_HELPTEXT :Sempre que uma altura for exibida na interface do usuário, mostrar na unidade selecionada +STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_HELPTEXT :Sempre que uma altura for exibida na interface do usuário, mostrar nessas unidades ###length 3 STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_IMPERIAL :Imperial (ft) STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_METRIC :Métrico (m) @@ -2134,11 +2134,11 @@ STR_CONFIG_SETTING_AI_NPC :Competidores IA STR_CONFIG_SETTING_NETWORK :Rede STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS :Gerador de rotas para trens: {STRING} -STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS_HELPTEXT :Algoritmo usado para gerar as rotas dos trens +STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS_HELPTEXT :Algoritmo usado para estabelecer as rotas dos trens STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES :Gerador de rotas para veículos: {STRING} -STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES_HELPTEXT :Algoritmo usado para gerar as rotas dos veículos rodoviários +STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES_HELPTEXT :Algoritmo usado para estabelecer as rotas dos veículos rodoviários STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS :Gerador de rotas para embarcações: {STRING} -STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS_HELPTEXT :Algoritmo usado para gerar as rotas das embarcações +STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS_HELPTEXT :Algoritmo usado para estabelecer as rotas das embarcações STR_CONFIG_SETTING_REVERSE_AT_SIGNALS :Reversão automática em sinais: {STRING} STR_CONFIG_SETTING_REVERSE_AT_SIGNALS_HELPTEXT :Permitir que os trens invertam a direção em um sinal, se eles esperaram lá muito tempo ###length 2 @@ -2165,7 +2165,7 @@ STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... igno STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignorando conjunto de Sons Base '{STRING}': não encontrado STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignorando conjunto de Músicas Base '{STRING}': não encontrado STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Memória insuficiente -STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Falha ao alocar {BYTES} de memória para sprites. A memória reservada para sprites foi reduzida para {BYTES}. Isto irá reduzir o desempenho do OpenTTD. Para diminuir os requisitos de memória você pode desabilitar gráficos de 32bpp e/ou diminuir os níveis de ampliação das visualizações +STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Falha ao alocar {BYTES} de memória para sprites. A memória reservada para sprites foi reduzida para {BYTES}. Isto irá reduzir o desempenho do OpenTTD. Para diminuir o uso de memória você pode desabilitar gráficos de 32bpp e/ou diminuir os níveis de ampliação das visualizações # Video initalization errors STR_VIDEO_DRIVER_ERROR :{WHITE}Erro nas configurações de vídeo... @@ -2176,7 +2176,7 @@ STR_VIDEO_DRIVER_ERROR_HARDWARE_ACCELERATION_CRASH :{WHITE}... O co STR_INTRO_CAPTION :{WHITE}OpenTTD {REV} STR_INTRO_NEW_GAME :{BLACK}Novo Jogo -STR_INTRO_LOAD_GAME :{BLACK}Abrir um Jogo +STR_INTRO_LOAD_GAME :{BLACK}Abrir Jogo STR_INTRO_PLAY_SCENARIO :{BLACK}Jogar em Cenário STR_INTRO_PLAY_HEIGHTMAP :{BLACK}Jogar em Mapa Topográfico STR_INTRO_SCENARIO_EDITOR :{BLACK}Editor de Cenário @@ -2525,8 +2525,8 @@ STR_NETWORK_ASK_RELAY_NO :{BLACK}Não STR_NETWORK_ASK_RELAY_YES_ONCE :{BLACK}Sim, desta vez STR_NETWORK_ASK_RELAY_YES_ALWAYS :{BLACK}Sim, não perguntar novamente -STR_NETWORK_ASK_SURVEY_CAPTION :Participar de pesquisa automatizada? -STR_NETWORK_ASK_SURVEY_TEXT :Você gostaria de participar da pesquisa automatizada?{}O OpenTTD enviará uma pesquisa ao sair de um jogo.{}Você pode alterar isso a qualquer momento em "Opções do Jogo". +STR_NETWORK_ASK_SURVEY_CAPTION :Participar da pesquisa automatizada? +STR_NETWORK_ASK_SURVEY_TEXT :Você gostaria de participar da pesquisa automatizada?{}O OpenTTD enviará uma pesquisa quando sair de um jogo.{}Você pode alterar isso a qualquer momento em "Opções do Jogo". STR_NETWORK_ASK_SURVEY_PREVIEW :Pré-visualizar resultado da pesquisa STR_NETWORK_ASK_SURVEY_LINK :Sobre pesquisa e privacidade STR_NETWORK_ASK_SURVEY_NO :Não @@ -3618,10 +3618,10 @@ STR_TOWN_VIEW_POPULATION_HOUSES :{BLACK}Populaç STR_TOWN_VIEW_CARGO_LAST_MONTH_MAX :{BLACK}{CARGO_LIST} no último mês: {ORANGE}{COMMA}{BLACK} máx: {ORANGE}{COMMA} STR_TOWN_VIEW_CARGO_LAST_MINUTE_MAX :{BLACK}{CARGO_LIST} no último minuto: {ORANGE}{COMMA}{BLACK} máx: {ORANGE}{COMMA} STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH :{BLACK}Carga necessária para o crescimento da localidade: -STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_GENERAL :{ORANGE}{STRING}{RED} é necessário -STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_WINTER :{ORANGE}{STRING}{BLACK} é necessário no inverno -STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED_GENERAL :{ORANGE}{STRING}{GREEN} foi entregado -STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{RED} (ainda é necessário) +STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_GENERAL :{ORANGE}{STRING}{RED} necessário +STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_WINTER :{ORANGE}{STRING}{BLACK} necessário no inverno +STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED_GENERAL :{ORANGE}{STRING}{GREEN} entregado +STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{RED} (ainda necessário) STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{GREEN} (entregado) STR_TOWN_VIEW_TOWN_GROWS_EVERY :{BLACK}Localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS} STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED :{BLACK}Localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS} (financiada) @@ -3647,8 +3647,8 @@ STR_LOCAL_AUTHORITY_COMPANY_RATINGS :{BLACK}Classifi STR_LOCAL_AUTHORITY_COMPANY_RATING :{YELLOW}{COMPANY} {COMPANY_NUM}: {ORANGE}{STRING} STR_LOCAL_AUTHORITY_ACTIONS_TITLE :{BLACK}Ações disponíveis: STR_LOCAL_AUTHORITY_ACTIONS_TOOLTIP :{BLACK}Lista de ações disponíveis nesta localidade - Clique no item para mais detalhes -STR_LOCAL_AUTHORITY_DO_IT_BUTTON :{BLACK}Aplicar -STR_LOCAL_AUTHORITY_DO_IT_TOOLTIP :{BLACK}Realizar a ação selecionada na lista acima +STR_LOCAL_AUTHORITY_DO_IT_BUTTON :{BLACK}Executar +STR_LOCAL_AUTHORITY_DO_IT_TOOLTIP :{BLACK}Executar a ação selecionada na lista acima ###length 8 STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN :Campanha publicitária pequena @@ -4255,16 +4255,16 @@ STR_DEPOT_SELL_CONFIRMATION_TEXT :{YELLOW}Você e STR_ENGINE_PREVIEW_CAPTION :{WHITE}Mensagem de um fabricante de veículos STR_ENGINE_PREVIEW_MESSAGE :{GOLD}Desenvolvemos um novo modelo de {STRING} - você gostaria de ter um ano de uso exclusivo deste veículo, para que possamos avaliar o desempenho dele antes de ser globalmente disponibilizado? -STR_ENGINE_PREVIEW_RAILROAD_LOCOMOTIVE :locomotiva ferroviária -STR_ENGINE_PREVIEW_ELRAIL_LOCOMOTIVE :locomotiva ferroviária eletrificada -STR_ENGINE_PREVIEW_MONORAIL_LOCOMOTIVE :locomotiva monotrilho -STR_ENGINE_PREVIEW_MAGLEV_LOCOMOTIVE :locomotiva maglev +STR_ENGINE_PREVIEW_RAILROAD_LOCOMOTIVE :{G=f}locomotiva ferroviária +STR_ENGINE_PREVIEW_ELRAIL_LOCOMOTIVE :{G=f}locomotiva ferroviária elétrica +STR_ENGINE_PREVIEW_MONORAIL_LOCOMOTIVE :{G=f}locomotiva monotrilho +STR_ENGINE_PREVIEW_MAGLEV_LOCOMOTIVE :{G=f}locomotiva maglev -STR_ENGINE_PREVIEW_ROAD_VEHICLE :veículo rodoviário -STR_ENGINE_PREVIEW_TRAM_VEHICLE :bonde +STR_ENGINE_PREVIEW_ROAD_VEHICLE :{G=m}veículo rodoviário +STR_ENGINE_PREVIEW_TRAM_VEHICLE :{G=m}bonde -STR_ENGINE_PREVIEW_AIRCRAFT :aeronave -STR_ENGINE_PREVIEW_SHIP :embarcação +STR_ENGINE_PREVIEW_AIRCRAFT :{G=f}aeronave +STR_ENGINE_PREVIEW_SHIP :{G=f}embarcação STR_ENGINE_PREVIEW_TEXT3 :{BLACK}{STRING}{}{5:STRING}{}{STRING} STR_ENGINE_PREVIEW_TEXT4 :{BLACK}{STRING}{}{STRING}{}{STRING}{}{STRING} @@ -4624,8 +4624,8 @@ STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP :{BLACK}Mostrar STR_ORDER_GO_TO_WAYPOINT :Ir via {WAYPOINT} STR_ORDER_GO_NON_STOP_TO_WAYPOINT :Ir, sem parar, via {WAYPOINT} -STR_ORDER_SERVICE_AT :Manutenção em -STR_ORDER_SERVICE_NON_STOP_AT :Manutenção, sem parar, em +STR_ORDER_SERVICE_AT :Manutenção no +STR_ORDER_SERVICE_NON_STOP_AT :Manutenção, sem parar, no STR_ORDER_NEAREST_DEPOT :o mais próximo STR_ORDER_NEAREST_HANGAR :o hangar mais próximo @@ -4708,9 +4708,9 @@ STR_TIMETABLE_TRAVEL_FOR :Viajar por {STR STR_TIMETABLE_TRAVEL_FOR_SPEED :Viajar por {STRING} no máximo a {VELOCITY} STR_TIMETABLE_TRAVEL_FOR_ESTIMATED :Viajar (por {STRING}, não programado) STR_TIMETABLE_TRAVEL_FOR_SPEED_ESTIMATED :Viajar (por {STRING}, não programado) no máximo a {VELOCITY} -STR_TIMETABLE_STAY_FOR_ESTIMATED :(aguardar por {STRING}, não programado) +STR_TIMETABLE_STAY_FOR_ESTIMATED :(ficar por {STRING}, não programado) STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :(viajar por {STRING}, não programado) -STR_TIMETABLE_STAY_FOR :e aguardar por {STRING} +STR_TIMETABLE_STAY_FOR :e ficar por {STRING} STR_TIMETABLE_AND_TRAVEL_FOR :e viajar por {STRING} STR_TIMETABLE_TOTAL_TIME :{BLACK}Este horário levará {STRING} para ser concluído @@ -4817,7 +4817,7 @@ STR_AI_CONFIG_CONFIGURE :{BLACK}Configur STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Configurar os parâmetros do Script # Available AIs window -STR_AI_LIST_CAPTION :{WHITE}Disponíveis {STRING} +STR_AI_LIST_CAPTION :{WHITE}{STRING} Disponíveis STR_AI_LIST_CAPTION_AI :IAs STR_AI_LIST_CAPTION_GAMESCRIPT :Scripts de jogo STR_AI_LIST_TOOLTIP :{BLACK}Clique para selecionar um script @@ -5320,7 +5320,7 @@ STR_ERROR_NO_DOCK :{WHITE}Não exi STR_ERROR_NO_AIRPORT :{WHITE}Não existe um aeroporto/heliporto STR_ERROR_NO_STOP_COMPATIBLE_ROAD_TYPE :{WHITE}Não existem paradas com um tipo de estrada compatível STR_ERROR_NO_STOP_COMPATIBLE_TRAM_TYPE :{WHITE}Não existem paradas com um tipo de bonde compatível -STR_ERROR_NO_STOP_ARTICULATED_VEHICLE :{WHITE}Não existem paradas adequadas para veículos rodoviários articulados.{}Os veículos rodoviários articulados precisam parar em estações de passagem e não em estações padrão +STR_ERROR_NO_STOP_ARTICULATED_VEHICLE :{WHITE}Não existem paradas adequadas para veículos rodoviários articulados.{}Os veículos rodoviários articulados só podem parar em estações de passagem e não em estações padrão STR_ERROR_AIRPORT_NO_PLANES :{WHITE}Este avião não pode pousar neste heliporto STR_ERROR_AIRPORT_NO_HELICOPTERS :{WHITE}Este helicóptero não pode pousar neste aeroporto STR_ERROR_NO_RAIL_WAYPOINT :{WHITE}Não existe um ponto de controle ferroviário diff --git a/src/lang/greek.txt b/src/lang/greek.txt index cf2d3459b2..c2e494b892 100644 --- a/src/lang/greek.txt +++ b/src/lang/greek.txt @@ -253,6 +253,8 @@ STR_COLOUR_RANDOM :Τυχαία ###length 17 STR_COLOUR_SECONDARY_DARK_BLUE :Σκούρο Μπλε STR_COLOUR_SECONDARY_PALE_GREEN :Ανοικτό Πράσινο +STR_COLOUR_SECONDARY_SECONDARY_PINK :Ροζ +STR_COLOUR_SECONDARY_YELLOW :Κίτρινο STR_COLOUR_SECONDARY_RED :Κόκκινο STR_COLOUR_SECONDARY_LIGHT_BLUE :Γαλάζιο STR_COLOUR_SECONDARY_GREEN :Πράσινο @@ -264,6 +266,7 @@ STR_COLOUR_SECONDARY_PURPLE :Πορφυρό STR_COLOUR_SECONDARY_ORANGE :Πορτοκαλί STR_COLOUR_SECONDARY_BROWN :Καφέ STR_COLOUR_SECONDARY_GREY :Γκρι +STR_COLOUR_SECONDARY_WHITE :Άσπρο STR_COLOUR_SECONDARY_SAME_AS_PRIMARY :Ίδιο με το πρωταρχικό @@ -975,6 +978,7 @@ STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Ένα STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}Ανοίξτε το παράθυρο ομάδων εστιασμένος στην ομάδα του οχήματος +STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST :{WHITE}{STATION} δεν δέχεται πλέον: {CARGO_LIST} STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Έληξε η προσφορά επιδότησης:{}{}{STRING} από {G τον τη το} {STRING} πρός {G τον τη το} {STRING} δεν θα επιδοτείται πλέον. STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Η επιδότηση αποσύρθηκε:{}{}Η υπηρεσια για {STRING.subs} απο το {STRING} προς το {STRING} δεν επιδοτείται πλέον. @@ -1123,7 +1127,10 @@ STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}Βασι STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP :{BLACK}Επιλέξτε το βασικό σετ μουσικής για χρήση STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}Επιπλέον πληροφορίες σχετικά με το βασικό σετ μουσικής +STR_GAME_OPTIONS_SOCIAL_PLUGINS_NONE :{LTBLUE}(δεν έχουν εγκατασταθεί plugins για ενοποίηση με πλατφόρμες κοινωνικής δικτύωσης) +STR_GAME_OPTIONS_SOCIAL_PLUGIN_PLATFORM :{BLACK}Πλατφόρμα: +STR_GAME_OPTIONS_SOCIAL_PLUGIN_STATE :{BLACK}Plugin state: @@ -1138,6 +1145,8 @@ STR_CURRENCY_DECREASE_EXCHANGE_RATE_TOOLTIP :{BLACK}Μείω STR_CURRENCY_INCREASE_EXCHANGE_RATE_TOOLTIP :{BLACK}Αυξήστε το ποσό της ισοτιμίας σας για μία Λίρα (£) STR_CURRENCY_SET_EXCHANGE_RATE_TOOLTIP :{BLACK}Ρυθμίστε τη συναλλαγματική ισοτιμία του νομίσματος για μια λίρα (£) +STR_CURRENCY_SEPARATOR :{LTBLUE}Διαχωριστής: {ORANGE}{STRING} +STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP :{BLACK}Ορίστε το διαχωριστικό για το νόμισμά σας STR_CURRENCY_PREFIX :{LTBLUE}Πρόθεμα: {ORANGE}{STRING} STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP :{BLACK}Ορίστε το πρόθεμα για το νόμισμά σας @@ -2710,6 +2719,8 @@ STR_LINKGRAPH_LEGEND_SATURATED :{TINY_FONT}{BLA STR_LINKGRAPH_LEGEND_OVERLOADED :{TINY_FONT}{BLACK}υπερφορτωμένο # Linkgraph tooltip +STR_LINKGRAPH_STATS_TOOLTIP_MONTH :{BLACK}{CARGO_LONG} προς μεταφορά ανά μήνα από {STATION} προς {STATION} ({COMMA}% of capacity){STRING} +STR_LINKGRAPH_STATS_TOOLTIP_MINUTE :{BLACK}{CARGO_LONG} προς μεταφορά ανά λεπτό από {STATION} προς {STATION} ({COMMA}% of capacity){STRING} STR_LINKGRAPH_STATS_TOOLTIP_RETURN_EXTENSION :{}{CARGO_LONG} προς μεταφορά πίσω ({COMMA}% της χωρητικότητας) STR_LINKGRAPH_STATS_TOOLTIP_TIME_EXTENSION :{}Μέσος χρόνος ταξιδιού: {UNITS_DAYS_OR_SECONDS} @@ -3235,10 +3246,12 @@ STR_MAPGEN_MAPSIZE :{BLACK}Διάσ STR_MAPGEN_MAPSIZE_TOOLTIP :{BLACK}Επιλέξτε το μέγεθος του χάρτη σε τετραγωνίδια. Ο αριθμός των τετραγωνίδιων διαθέσιμα για κτίσιμο θα είναι λίγο χαμηλότερος STR_MAPGEN_BY :{BLACK}* STR_MAPGEN_NUMBER_OF_TOWNS :{BLACK}Αριθμός πόλεων: +STR_MAPGEN_NUMBER_OF_TOWNS_TOOLTIP :Επιλέξτε την πυκνότητα των πόλεων ή έναν προσαρμοσμένο αριθμό STR_MAPGEN_TOWN_NAME_LABEL :{BLACK}Ονόματα πόλεων: STR_MAPGEN_TOWN_NAME_DROPDOWN_TOOLTIP :{BLACK}Επιλογή στυλ ονομάτων πόλεων STR_MAPGEN_DATE :{BLACK}Ημερομηνία: STR_MAPGEN_NUMBER_OF_INDUSTRIES :{BLACK}Αριθμός βιομηχανιών: +STR_MAPGEN_NUMBER_OF_INDUSTRIES_TOOLTIP :{BLACK}Επιλέξτε την πυκνότητα των βιομηχανιών ή έναν προσαρμοσμένο αριθμό STR_MAPGEN_HEIGHTMAP_HEIGHT :{BLACK}Υψηλότερη κορυφή: STR_MAPGEN_HEIGHTMAP_HEIGHT_UP :{BLACK}Αύξηση του μέγιστου ύψους της υψηλότερης κορυφής στον χάρτη κατά ένα STR_MAPGEN_HEIGHTMAP_HEIGHT_DOWN :{BLACK}Μειώστε το μέγιστο ύψος της υψηλότερης κορυφής στον χάρτη κατά ένα @@ -3598,6 +3611,8 @@ STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_MEDIUM_ADVERTISING :{YELLOW}Ένα STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_LARGE_ADVERTISING :{PUSH_COLOUR}{YELLOW}Έναρξη μεγάλης τοπικής διαφημιστικής καμπάνιας, για να προσελκύσετε περισσότερους επιβάτες και εμπορεύματα στις μεταφορικές σας υπηρεσίες.{}Παρέχει μία προσωρινή ώθηση στην βαθμολογία σταθμού σε μία μεγάλη ακτίνα γύρω από το κέντρο της πόλης.{}{POP_COLOUR} Κόστος: {CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_STATUE_OF_COMPANY :{PUSH_COLOUR}{YELLOW}Χτίστε ένα άγαλμα προς τιμήν της εταιρίας σας.{}Παρέχει μία μόνιμη ώθηση στην βαθμολογία σταθμών σε αυτή την πόλη.{}{POP_COLOUR}Κόστος: {CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_NEW_BUILDINGS :{YELLOW}Χρηματοδοτήστε την κατασκευή νέων κτιρίων στην πόλη.{}Παρέχει μία προσωρινή ώθηση στην ανάπτυξη αυτής της πόλης.{} Κόστος: {CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT_MONTHS :{PUSH_COLOUR}{YELLOW}Αγοράστε αποκλειστικά δικαιώματα μεταφοράς στην πόλη για 12 μήνες.{}Η δημοτική αρχή δεν θα επιτρέψει στους επιβάτες και στο φορτίο να χρησιμοποιούν τους σταθμούς των ανταγωνιστών σας. Μια επιτυχημένη δωροδοκία από έναν ανταγωνιστή θα ακυρώσει αυτό το συμβόλαιο.{}{POP_COLOUR}Κόστος: {CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT_MINUTES :{PUSH_COLOUR}{YELLOW}Αγοράστε αποκλειστικά δικαιώματα μεταφοράς στην πόλη για 12 λεπτά.{}Η δημοτική αρχή δεν θα επιτρέψει στους επιβάτες και στο φορτίο να χρησιμοποιούν τους σταθμούς των ανταγωνιστών σας. Μια επιτυχημένη δωροδοκία από έναν ανταγωνιστή θα ακυρώσει αυτό το συμβόλαιο.{}{POP_COLOUR}Κόστος: {CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{YELLOW}Δωροδοκήστε τις τοπικές αρχές για να αυξήσετε τα ποσοστά αποδοχής σας, με ρίσκο ένα μεγάλο πρόστιμο εάν συλληφθείτε.{}Κόστος: {CURRENCY_LONG} # Goal window @@ -4347,6 +4362,7 @@ STR_VEHICLE_DETAILS_SERVICING_INTERVAL_MINUTES :{BLACK}Διάσ STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT :{BLACK}Διάστημα επισκευών: {LTBLUE}{COMMA}%{BLACK} {STRING} STR_VEHICLE_DETAILS_DECREASE_SERVICING_INTERVAL_TOOLTIP_DAYS :Μειώστε το διάστημα μεταξύ των σέρβις κατά 10 ημέρες. Ctrl+Click για να μειώσετε το διάστημα συντήρησης κατά 5 ημέρες STR_VEHICLE_DETAILS_DECREASE_SERVICING_INTERVAL_TOOLTIP_MINUTES :Μειώστε το διάστημα μεταξύ των σέρβις κατά 5 λεπτά. Ctrl+Click για να μειώσετε το διάστημα συντήρησης κατά 1 λεπτό +STR_VEHICLE_DETAILS_DECREASE_SERVICING_INTERVAL_TOOLTIP_PERCENT :Μειώστε το διάστημα μεταξύ των σέρβις κατά 10 τοις εκατό. Ctrl+Click για να μειώσετε το διάστημα συντήρησης κατά 5 τοις εκατό. STR_SERVICE_INTERVAL_DROPDOWN_TOOLTIP :{BLACK}Αλλάξτε τον τύπο διαστήματος επισκευών STR_VEHICLE_DETAILS_DEFAULT :Προκαθορισμένο @@ -4888,6 +4904,7 @@ STR_ERROR_CAN_ONLY_BE_BUILT_ABOVE_SNOW_LINE :{WHITE}... μπ STR_ERROR_CAN_ONLY_BE_BUILT_BELOW_SNOW_LINE :{WHITE}... μπορεί να κτιστεί μόνο κάτω από τη γραμμή του χιονιού STR_ERROR_PROSPECTING_WAS_UNLUCKY :{WHITE}Η χρηματοδότηση απέτυχε να προσκομήσει αποτελέσματα λόγω κακής τύχης· δοκιμάστε ξάνα +STR_ERROR_NO_SUITABLE_PLACES_FOR_PROSPECTING :{WHITE}Δεν υπήρχαν κατάλληλα μέρη για προοπτική για αυτόν τον κλάδο STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES :{WHITE}Δεν υπήρχαν διαθέσιμες τοποθεσίες για βιομηχανίες τύπου '{STRING}' STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION :{WHITE}Αλλαγή παραμέτρων δημιουργίας χάρτη για καλύτερα αποτελέσματα @@ -5656,6 +5673,10 @@ STR_TOWN_NAME :{TOWN} STR_VEHICLE_NAME :{VEHICLE} STR_WAYPOINT_NAME :{WAYPOINT} +STR_CURRENCY_SHORT_KILO :{NBSP}k +STR_CURRENCY_SHORT_MEGA :{NBSP}m +STR_CURRENCY_SHORT_GIGA :{NBSP}Δις +STR_CURRENCY_SHORT_TERA :{NBSP}tn STR_JUST_CARGO :{CARGO_LONG} STR_JUST_CHECKMARK :{CHECKMARK} diff --git a/src/lang/lithuanian.txt b/src/lang/lithuanian.txt index b362a60834..e8ea2d2590 100644 --- a/src/lang/lithuanian.txt +++ b/src/lang/lithuanian.txt @@ -682,6 +682,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Pašalinti visa # About menu STR_ABOUT_MENU_LAND_BLOCK_INFO :Žemės ploto informacija +STR_ABOUT_MENU_HELP :Pagalba ir gidai STR_ABOUT_MENU_TOGGLE_CONSOLE :Perjungti konsolę STR_ABOUT_MENU_AI_DEBUG :AI / GameScript derinimas STR_ABOUT_MENU_SCREENSHOT :Ekrano nuotrauka @@ -1067,6 +1068,7 @@ STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Naujas{S STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}Atverti grupių langą, susijusį su šia transporto priemone +STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST :{WHITE}{STATION} dabar priima: {CARGO_LIST} STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Subsidijų pasiūlymas baigėsi:{}{}{STRING.ko} pervežimas iš {STRING.ko} į {STRING.ka} daugiau nebesubsidijuojamas. STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Subsidijų laikas baigėsi:{}{}{STRING.ko} transportavimas iš {STRING} į {STRING} daugiau nebesubsidijuojamas. @@ -2501,6 +2503,7 @@ STR_NETWORK_CLIENT_LIST_SERVER_CONNECTION_TYPE_TURN :{BLACK}Per rel STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_KICK :Atjungti STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_BAN :Blokuoti +STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_RESET :Ištrinti/Pašalinti STR_NETWORK_CLIENT_LIST_ASK_CAPTION :{WHITE}Administratoriaus veiksmas STR_NETWORK_CLIENT_LIST_ASK_COMPANY_UNLOCK :{YELLOW}Ar tikrai norite iš naujo nustatyti įmonės slaptažodį '{COMPANY}'? @@ -3152,7 +3155,7 @@ STR_LAI_OBJECT_DESCRIPTION_COMPANY_OWNED_LAND :Kompanijos žem STR_ABOUT_OPENTTD :{WHITE}Apie OpenTTD STR_ABOUT_ORIGINAL_COPYRIGHT :{BLACK}Pradinės versijos teisės priklauso {COPYRIGHT} 1995 Chris Sawyer, Visos teisės saugomos STR_ABOUT_VERSION :{BLACK}OpenTTD versija {REV} -STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT}2002-{STRING} OpenTTD komanda +STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}„OpenTTD“ {COPYRIGHT}2002-{STRING} „OpenTTD“ komanda # Framerate display window STR_FRAMERATE_CAPTION :Kadrų dažniai @@ -3678,6 +3681,8 @@ STR_STATION_LIST_STATION :{YELLOW}{STATIO STR_STATION_LIST_WAYPOINT :{YELLOW}{WAYPOINT} STR_STATION_LIST_NONE :{YELLOW}- Nieko - STR_STATION_LIST_SELECT_ALL_FACILITIES :{BLACK}Pažymėti visus pastatus +STR_STATION_LIST_CARGO_FILTER_ALL_AND_NO_RATING :Visi kargo tipai ir jokio reitingo +STR_STATION_LIST_CARGO_FILTER_EXPAND :Rodyti daugiau... # Station view window STR_STATION_VIEW_CAPTION :{WHITE}{STATION} {STATION_FEATURES} @@ -5188,6 +5193,7 @@ STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION :{WHITE}... per STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... lėktuvui paskirties vieta yra per toli # Extra messages which go on the third line of errors, explaining why orders failed +STR_ERROR_NO_AIRPORT :{WHITE}Nėra jokio oro ar sraigtasparnio uosto # Timetable related errors STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Neįmanoma sudaryti grafiko... diff --git a/src/lang/norwegian_bokmal.txt b/src/lang/norwegian_bokmal.txt index 4ef26062a3..8c1d2dd9eb 100644 --- a/src/lang/norwegian_bokmal.txt +++ b/src/lang/norwegian_bokmal.txt @@ -572,18 +572,18 @@ STR_DAY_NUMBER_30TH :30. STR_DAY_NUMBER_31ST :31. ###length 12 -STR_MONTH_ABBREV_JAN :Jan -STR_MONTH_ABBREV_FEB :Feb -STR_MONTH_ABBREV_MAR :Mar -STR_MONTH_ABBREV_APR :Apr -STR_MONTH_ABBREV_MAY :Mai -STR_MONTH_ABBREV_JUN :Jun -STR_MONTH_ABBREV_JUL :Jul -STR_MONTH_ABBREV_AUG :Aug -STR_MONTH_ABBREV_SEP :Sep -STR_MONTH_ABBREV_OCT :Okt -STR_MONTH_ABBREV_NOV :Nov -STR_MONTH_ABBREV_DEC :Des +STR_MONTH_ABBREV_JAN :jan +STR_MONTH_ABBREV_FEB :feb +STR_MONTH_ABBREV_MAR :mar +STR_MONTH_ABBREV_APR :apr +STR_MONTH_ABBREV_MAY :mai +STR_MONTH_ABBREV_JUN :jun +STR_MONTH_ABBREV_JUL :jul +STR_MONTH_ABBREV_AUG :aug +STR_MONTH_ABBREV_SEP :sep +STR_MONTH_ABBREV_OCT :okt +STR_MONTH_ABBREV_NOV :nov +STR_MONTH_ABBREV_DEC :des ###length 12 STR_MONTH_JAN :januar @@ -908,8 +908,8 @@ STR_NEWS_VEHICLE_UNPROFITABLE_YEAR :{WHITE}{VEHICLE STR_NEWS_VEHICLE_UNPROFITABLE_PERIOD :{WHITE}{VEHICLE}s fortjeneste forrige periode var {CURRENCY_LONG} STR_NEWS_AIRCRAFT_DEST_TOO_FAR :{WHITE}{VEHICLE} kan ikke kjøre til neste destinasjon fordi den er utenfor rekkevidde -STR_NEWS_ORDER_REFIT_FAILED :{WHITE}{VEHICLE} stoppet fordi ombyggingsordre feilet -STR_NEWS_VEHICLE_AUTORENEW_FAILED :{WHITE}Kunne ikke autofornye {VEHICLE}{}{STRING} +STR_NEWS_ORDER_REFIT_FAILED :{WHITE}{VEHICLE} stoppet fordi ombyggingsordre mislyktes +STR_NEWS_VEHICLE_AUTORENEW_FAILED :{WHITE}Kunne ikke fornye {VEHICLE}{}{STRING} automatisk STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE :{BIG_FONT}{BLACK}Ny{G "" "" tt} {STRING} er nå tilgjengelig! STR_NEWS_NEW_VEHICLE_TYPE :{BIG_FONT}{BLACK}{ENGINE} @@ -971,7 +971,7 @@ STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRI ###length 44 STR_GAME_OPTIONS_CURRENCY_GBP :Britiske pund -STR_GAME_OPTIONS_CURRENCY_USD :Amerikansk dollar +STR_GAME_OPTIONS_CURRENCY_USD :Amerikanske dollar STR_GAME_OPTIONS_CURRENCY_EUR :Euro STR_GAME_OPTIONS_CURRENCY_JPY :Japanske yen STR_GAME_OPTIONS_CURRENCY_ATS :Østerrikske shilling @@ -1049,7 +1049,7 @@ STR_GAME_OPTIONS_VIDEO_DRIVER_INFO :{BLACK}Aktiv dr STR_GAME_OPTIONS_GUI_SCALE_FRAME :{BLACK}Grensesnittstørrelse STR_GAME_OPTIONS_GUI_SCALE_TOOLTIP :{BLACK}Dra for å endre grensesnittstørrelse. Ctrl+dra for kontinuerlig justering -STR_GAME_OPTIONS_GUI_SCALE_AUTO :{BLACK}Autodetekter størrelse +STR_GAME_OPTIONS_GUI_SCALE_AUTO :{BLACK}Detekter størrelse automatisk STR_GAME_OPTIONS_GUI_SCALE_AUTO_TOOLTIP :{BLACK}Kryss av denne knappen for å detektere grensesnittstørrelsen automatisk STR_GAME_OPTIONS_GUI_SCALE_BEVELS :{BLACK}Skaler faser @@ -1093,7 +1093,7 @@ STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}Musikkse STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP :{BLACK}Velg musikksett som skal brukes STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}Ytterligere informasjon om det originale musikksettet -STR_GAME_OPTIONS_SOCIAL_PLUGINS_NONE :{LTBLUE}(ingen tillegg for integrere med sosiale plattformer er installert) +STR_GAME_OPTIONS_SOCIAL_PLUGINS_NONE :{LTBLUE}(ingen moduler for integrasjon med sosiale plattformer er installert) STR_GAME_OPTIONS_SOCIAL_PLUGIN_TITLE :{BLACK}{STRING} ({STRING}) STR_GAME_OPTIONS_SOCIAL_PLUGIN_PLATFORM :{BLACK}Plattform: @@ -1515,10 +1515,10 @@ STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE :Skaler en indus STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_HELPTEXT :Skaler vareproduksjonen til industrier med denne prosenten STR_CONFIG_SETTING_CARGO_SCALE_VALUE :{NUM}% -STR_CONFIG_SETTING_AUTORENEW_VEHICLE :Forny transportmiddel automatisk når den blir gammel: {STRING} +STR_CONFIG_SETTING_AUTORENEW_VEHICLE :Forny transportmiddel automatisk når det blir gammelt: {STRING} STR_CONFIG_SETTING_AUTORENEW_VEHICLE_HELPTEXT :Når aktivert, blir et transportmiddel som nærmer seg slutten av sin levetid automatisk erstattet når betingelsene for fornyelse er oppfylt -STR_CONFIG_SETTING_AUTORENEW_MONTHS :Forny transportmiddel automatisk når den er {STRING} høyeste alder +STR_CONFIG_SETTING_AUTORENEW_MONTHS :Forny transportmiddel automatisk når det er {STRING} høyeste alder STR_CONFIG_SETTING_AUTORENEW_MONTHS_HELPTEXT :Relativ alder når et transportmiddel bør bli vurdert fornyet automatisk ###length 2 STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE :{COMMA} måned{P 0 "" er} før @@ -1723,7 +1723,7 @@ STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_ACTIONS :Alle handlinger STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS :Bruk grupper i kjøretøyliste: {STRING} STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT :Aktiver bruk av avanserte kjøretøylister for guppering av kjøretøy -STR_CONFIG_SETTING_LOADING_INDICATORS :Bruk lastingsindikatorer: {STRING} +STR_CONFIG_SETTING_LOADING_INDICATORS :Bruk lasteindikatorer: {STRING} STR_CONFIG_SETTING_LOADING_INDICATORS_HELPTEXT :Velg hvorvidt lasteindikatorer vises over kjøretøy som lastes eller losses STR_CONFIG_SETTING_TIMETABLE_MODE :Tidsenhet for rutetabeller: {STRING} @@ -2166,7 +2166,7 @@ STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... igno STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignorerer Grunn Lyd set '{STRING}': ikke funnet STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignorerer Grunn Musikk set '{STRING}': ikke funnet STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Tomt for minne -STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Tildeling av {BYTES} fra spritecachen feilet. Spritecachen ble redusert til {BYTES}. Dette senke ytelsen av OpenTTD. For å redusere minneforbruken kan du forsøke å slå av 32bpp grafikk og/eller zoomnivå. +STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Tildeling av {BYTES} fra spritecachen mislyktes. Spritecachen ble redusert til {BYTES}. Dette senke ytelsen av OpenTTD. For å redusere minneforbruken kan du forsøke å slå av 32bpp grafikk og/eller zoomnivå. # Video initalization errors STR_VIDEO_DRIVER_ERROR :{WHITE}Feil med skjerminstillingene... @@ -2567,7 +2567,7 @@ STR_NETWORK_CHAT_OSKTITLE :{BLACK}Skriv in STR_NETWORK_ERROR_NOTAVAILABLE :{WHITE}Ingen nettverksadapter funnet STR_NETWORK_ERROR_NOCONNECTION :{WHITE}Tilkoblingen til tjeneren ble tidsavbrutt eller avslått STR_NETWORK_ERROR_NEWGRF_MISMATCH :{WHITE}Kunne ikke koble til pga. ulike versjoner av NewGRF -STR_NETWORK_ERROR_DESYNC :{WHITE}Synkronisering av nettverksspill feilet. +STR_NETWORK_ERROR_DESYNC :{WHITE}Synkronisering av nettverksspill mislyktes STR_NETWORK_ERROR_LOSTCONNECTION :{WHITE}Mistet tilkobling til nettverksspill STR_NETWORK_ERROR_SAVEGAMEERROR :{WHITE}Kunne ikke laste inn lagret spill STR_NETWORK_ERROR_SERVER_START :{WHITE}Kunne ikke starte tjeneren @@ -2724,7 +2724,7 @@ STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}OpenTTD STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}Ja, last ned grafikken STR_MISSING_GRAPHICS_NO_QUIT :{BLACK}Nei, avslutt OpenTTD -STR_MISSING_GRAPHICS_ERROR_TITLE :{WHITE}Nedlasting feilet +STR_MISSING_GRAPHICS_ERROR_TITLE :{WHITE}Nedlasting mislyktes STR_MISSING_GRAPHICS_ERROR :{BLACK}Kunne ikke laste ned grafikkpakken.{}Vennligst last den ned manuelt. STR_MISSING_GRAPHICS_ERROR_QUIT :{BLACK}Avslutt OpenTTD @@ -3325,27 +3325,27 @@ STR_MAPGEN_GS_SETTINGS :{BLACK}Game Scr STR_MAPGEN_GS_SETTINGS_TOOLTIP :{BLACK}Åpne Game Script-innstillinger ###length 21 -STR_MAPGEN_TOWN_NAME_ORIGINAL_ENGLISH :Engelsk (Original) -STR_MAPGEN_TOWN_NAME_FRENCH :Fransk -STR_MAPGEN_TOWN_NAME_GERMAN :Tysk -STR_MAPGEN_TOWN_NAME_ADDITIONAL_ENGLISH :Engelsk (utvidet) -STR_MAPGEN_TOWN_NAME_LATIN_AMERICAN :Latinamerikansk +STR_MAPGEN_TOWN_NAME_ORIGINAL_ENGLISH :Engelske (Original) +STR_MAPGEN_TOWN_NAME_FRENCH :Franske +STR_MAPGEN_TOWN_NAME_GERMAN :Tyske +STR_MAPGEN_TOWN_NAME_ADDITIONAL_ENGLISH :Engelske (Utvidet) +STR_MAPGEN_TOWN_NAME_LATIN_AMERICAN :Latinamerikanske STR_MAPGEN_TOWN_NAME_SILLY :Tåpelige -STR_MAPGEN_TOWN_NAME_SWEDISH :Svensk -STR_MAPGEN_TOWN_NAME_DUTCH :Nederlandsk -STR_MAPGEN_TOWN_NAME_FINNISH :Finsk -STR_MAPGEN_TOWN_NAME_POLISH :Polsk -STR_MAPGEN_TOWN_NAME_SLOVAK :Slovakisk -STR_MAPGEN_TOWN_NAME_NORWEGIAN :Norsk -STR_MAPGEN_TOWN_NAME_HUNGARIAN :Ungarsk -STR_MAPGEN_TOWN_NAME_AUSTRIAN :Østeriske -STR_MAPGEN_TOWN_NAME_ROMANIAN :Rumensk -STR_MAPGEN_TOWN_NAME_CZECH :Tsjekkisk -STR_MAPGEN_TOWN_NAME_SWISS :Sveitsisk -STR_MAPGEN_TOWN_NAME_DANISH :Dansk -STR_MAPGEN_TOWN_NAME_TURKISH :Tyrkisk -STR_MAPGEN_TOWN_NAME_ITALIAN :Italiensk -STR_MAPGEN_TOWN_NAME_CATALAN :Katalansk +STR_MAPGEN_TOWN_NAME_SWEDISH :Svenske +STR_MAPGEN_TOWN_NAME_DUTCH :Nederlandske +STR_MAPGEN_TOWN_NAME_FINNISH :Finske +STR_MAPGEN_TOWN_NAME_POLISH :Polske +STR_MAPGEN_TOWN_NAME_SLOVAK :Slovakiske +STR_MAPGEN_TOWN_NAME_NORWEGIAN :Norske +STR_MAPGEN_TOWN_NAME_HUNGARIAN :Ungarske +STR_MAPGEN_TOWN_NAME_AUSTRIAN :Østerrikske +STR_MAPGEN_TOWN_NAME_ROMANIAN :Rumenske +STR_MAPGEN_TOWN_NAME_CZECH :Tsjekkiske +STR_MAPGEN_TOWN_NAME_SWISS :Sveitsiske +STR_MAPGEN_TOWN_NAME_DANISH :Danske +STR_MAPGEN_TOWN_NAME_TURKISH :Tyrkiske +STR_MAPGEN_TOWN_NAME_ITALIAN :Italienske +STR_MAPGEN_TOWN_NAME_CATALAN :Katalanske # Strings for map borders at game generation STR_MAPGEN_BORDER_TYPE :{BLACK}Kartkanter: @@ -3357,8 +3357,8 @@ STR_MAPGEN_SOUTHWEST :{BLACK}Sørvest STR_MAPGEN_BORDER_FREEFORM :{BLACK}Frihånds STR_MAPGEN_BORDER_WATER :{BLACK}Sjø STR_MAPGEN_BORDER_RANDOM :{BLACK}Tilfeldig -STR_MAPGEN_BORDER_RANDOMIZE :{BLACK}Tilfeldig -STR_MAPGEN_BORDER_MANUAL :{BLACK}Manuell +STR_MAPGEN_BORDER_RANDOMIZE :{BLACK}Tilfeldige +STR_MAPGEN_BORDER_MANUAL :{BLACK}Manuelle STR_MAPGEN_HEIGHTMAP_ROTATION :{BLACK}Høydekartrotering: STR_MAPGEN_HEIGHTMAP_NAME :{BLACK}Høydekartnavn: @@ -4137,10 +4137,10 @@ STR_BUY_VEHICLE_SHIP_RENAME_BUTTON :{BLACK}Endre na STR_BUY_VEHICLE_AIRCRAFT_RENAME_BUTTON :{BLACK}Endre navn ###length VEHICLE_TYPES -STR_BUY_VEHICLE_TRAIN_RENAME_TOOLTIP :{BLACK}Gi nytt navn til jernbanemateriellet -STR_BUY_VEHICLE_ROAD_VEHICLE_RENAME_TOOLTIP :{BLACK}Gi nytt navn til kjøretøytypen -STR_BUY_VEHICLE_SHIP_RENAME_TOOLTIP :{BLACK}Gi nytt navn til skipstypen -STR_BUY_VEHICLE_AIRCRAFT_RENAME_TOOLTIP :{BLACK}Gi nytt navn til luftfartøytypen +STR_BUY_VEHICLE_TRAIN_RENAME_TOOLTIP :{BLACK}Endre navn på jernbanemateriell +STR_BUY_VEHICLE_ROAD_VEHICLE_RENAME_TOOLTIP :{BLACK}Endre navn på kjøretøytype +STR_BUY_VEHICLE_SHIP_RENAME_TOOLTIP :{BLACK}Endre navn på skipstype +STR_BUY_VEHICLE_AIRCRAFT_RENAME_TOOLTIP :{BLACK}Endre navn på luftfartøytype ###length VEHICLE_TYPES STR_BUY_VEHICLE_TRAIN_HIDE_TOGGLE_BUTTON :{BLACK}Skjul @@ -4169,7 +4169,7 @@ STR_QUERY_RENAME_AIRCRAFT_TYPE_CAPTION :{WHITE}Gi luftf # Depot window STR_DEPOT_CAPTION :{WHITE}{DEPOT} -STR_DEPOT_RENAME_TOOLTIP :{BLACK}Endre navn på garasje/stall/hangar/dokk +STR_DEPOT_RENAME_TOOLTIP :{BLACK}Gi nytt navn til garasje/stall/hangar/dokk STR_DEPOT_RENAME_DEPOT_CAPTION :Endre navn på garasje/stall/hangar/dokk STR_DEPOT_NO_ENGINE :{BLACK}- @@ -4196,10 +4196,10 @@ STR_DEPOT_SELL_ALL_BUTTON_SHIP_TOOLTIP :{BLACK}Selg all STR_DEPOT_SELL_ALL_BUTTON_AIRCRAFT_TOOLTIP :{BLACK}Selg alle luftfartøy i hangaren ###length VEHICLE_TYPES -STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP :{BLACK}Autoerstatt alle tog i togstallen -STR_DEPOT_AUTOREPLACE_ROAD_VEHICLE_TOOLTIP :{BLACK}Autoerstatt alle kjøretøy i garasjen -STR_DEPOT_AUTOREPLACE_SHIP_TOOLTIP :{BLACK}Autoerstatt alle skip i skipsdokken -STR_DEPOT_AUTOREPLACE_AIRCRAFT_TOOLTIP :{BLACK}Autoerstatt alle luftfartøy i hangaren +STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP :{BLACK}Erstatt alle tog i togstallen automatisk +STR_DEPOT_AUTOREPLACE_ROAD_VEHICLE_TOOLTIP :{BLACK}Erstatt alle kjøretøy i garasjen automatisk +STR_DEPOT_AUTOREPLACE_SHIP_TOOLTIP :{BLACK}Erstatt alle skip i skipsdokken automatisk +STR_DEPOT_AUTOREPLACE_AIRCRAFT_TOOLTIP :{BLACK}Erstatt alle luftfartøy i hangaren automatisk ###length VEHICLE_TYPES STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON :{BLACK}Nytt jernbanemateriell @@ -4897,11 +4897,11 @@ STR_MESSAGE_ESTIMATED_INCOME :{WHITE}Anslått # Saveload messages STR_ERROR_SAVE_STILL_IN_PROGRESS :{WHITE}Lagring pågår enda,{}vennligst vent til den er klar! -STR_ERROR_AUTOSAVE_FAILED :{WHITE}Autolagring feilet +STR_ERROR_AUTOSAVE_FAILED :{WHITE}Automatisk lagring mislyktes STR_ERROR_UNABLE_TO_READ_DRIVE :{BLACK}Kan ikke lese fra disk STR_ERROR_GAME_SAVE_FAILED :{WHITE}Lagring av spillet mislyktes{}{STRING} STR_ERROR_UNABLE_TO_DELETE_FILE :{WHITE}Kan ikke slette fil -STR_ERROR_GAME_LOAD_FAILED :{WHITE}Feil ved lasting av spill{}{STRING} +STR_ERROR_GAME_LOAD_FAILED :{WHITE}Lasting av spill mislyktes{}{STRING} STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR :Intern feil: {STRING} STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME :Ødelagt lagret spill - {STRING} STR_GAME_SAVELOAD_ERROR_TOO_NEW_SAVEGAME :Spillet er lagret i en nyere versjon @@ -5121,10 +5121,10 @@ STR_ERROR_UNBUNCHING_NO_UNBUNCHING_CONDITIONAL :{WHITE}... kan # Autoreplace related errors STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} er for langt etter utskiftning -STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Ingen autoerstatt/fornyelseregler satt. +STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Ingen autoerstatning/fornyelseregler satt STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(pengegrense) STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}Nytt kjøretøy kan ikke frakte {STRING} -STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Nytt kjøretøy kan ikke bygges på nytt {NUM} +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Nytt transportmiddel kan ikke bygges om i ordre {NUM} # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Umulig sporkombinasjon diff --git a/src/lang/polish.txt b/src/lang/polish.txt index f02052db39..739003bf28 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -1851,7 +1851,7 @@ STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :Początkowy kol STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :Wybierz początkowy kolor dla firmy STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY :Początkowy kolor dodatkowy firmy: {STRING} -STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :Wybierz początkowy kolor dodatkowy dla firmy, jeśli używany jest NewGRF, który go wykorzystuje. +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :Wybierz początkowy kolor dodatkowy dla firmy, jeśli używany jest NewGRF, który go wykorzystuje STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :Pozwól budować stare lotniska: {STRING} STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :Włączona opcja sprawia, że każdy typ lotniska będzie dostępny na zawsze od chwili wprowadzenia @@ -1881,16 +1881,16 @@ STR_CONFIG_SETTING_TIMEKEEPING_UNITS_CALENDAR :Kalendarz STR_CONFIG_SETTING_TIMEKEEPING_UNITS_WALLCLOCK :Tarcza zegara STR_CONFIG_SETTING_MINUTES_PER_YEAR :Minuty na rok: {STRING} -STR_CONFIG_SETTING_MINUTES_PER_YEAR_HELPTEXT :Wybierz liczbę minut trwania jednego roku kalendarzowego. Domyślnie jest to 12 minut. Ustaw na 0, aby wstrzymać zmianę daty kalendarza. To ustawienie nie ma wpływu na symulację ekonomiczną gry i jest dostępne tylko w przypadku korzystania z zegarowej miary czasu. +STR_CONFIG_SETTING_MINUTES_PER_YEAR_HELPTEXT :Wybierz liczbę minut trwania jednego roku kalendarzowego. Domyślnie jest to 12 minut. Ustaw na 0, aby wstrzymać zmianę daty kalendarza. To ustawienie nie ma wpływu na symulację ekonomiczną gry i jest dostępne tylko w przypadku korzystania z zegarowej miary czasu STR_CONFIG_SETTING_MINUTES_PER_YEAR_VALUE :{NUM} ###setting-zero-is-special STR_CONFIG_SETTING_MINUTES_PER_YEAR_FROZEN :0 (zamrożenie czasu kalendarza) STR_CONFIG_SETTING_TOWN_CARGO_SCALE :Skala produkcji w miastach: {STRING} -STR_CONFIG_SETTING_TOWN_CARGO_SCALE_HELPTEXT :Skaluj produkcję ładunków w miastach w oparciu o ten procent. +STR_CONFIG_SETTING_TOWN_CARGO_SCALE_HELPTEXT :Skaluj produkcję ładunków w miastach w oparciu o ten procent STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE :Skala produkcji w przedsiębiorstwach: {STRING} -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_HELPTEXT :Skaluj produkcję ładunków w przedsiębiorstwach w oparciu o ten procent. +STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_HELPTEXT :Skaluj produkcję ładunków w przedsiębiorstwach w oparciu o ten procent STR_CONFIG_SETTING_CARGO_SCALE_VALUE :{NUM}% STR_CONFIG_SETTING_AUTORENEW_VEHICLE :Automatyczne odnawianie pojazdów, gdy stają się stare: {STRING} @@ -1921,7 +1921,7 @@ STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :Grubość linii STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :Grubość linii na wykresach. Cienka linia jest dokładniejsza, grubsza linia jest bardziej widoczna a kolory łatwiejsze do odróżnienia STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :Pokaż nazwę NewGRF-a w oknie budowy pojazdu: {STRING} -STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :Dodaj wiersz do okna budowy pojazdów, pokazujący z którego NewGRF-a wybrany pojazd pochodzi. +STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :Dodaj wiersz do okna budowy pojazdów, pokazujący z którego NewGRF-a wybrany pojazd pochodzi STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS :Pokaż w oknach list jakie ładunki mogą być przewożone przez pojazdy: {STRING} STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS_HELPTEXT :Jeśli włączone, ładunek możliwy do przewiezienia przez pojazd będzie wyświetlany nad nim na listach pojazdów. @@ -1955,7 +1955,7 @@ STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :Wybierz przybli STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE :{NUM}% STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :Gładkość terenu: {STRING} -STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :Wybierz kształt i ilość wzniesień. Łagodny teren ma mniejszą liczbę szerszych wzniesień, natomiast teren pofałdowany ma więcej mniejszych wzniesień. +STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :Wybierz kształt i ilość wzniesień. Łagodny teren ma mniejszą liczbę szerszych wzniesień, natomiast teren pofałdowany ma więcej mniejszych wzniesień ###length 4 STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH :Bardzo łagodny STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH :Łagodny @@ -2010,7 +2010,7 @@ STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_DARK_GREEN :ciemnozielony STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_VIOLET :fioletowy STR_CONFIG_SETTING_LINKGRAPH_COLOURS :Kolorystyka przepływu ładunków: {STRING} -STR_CONFIG_SETTING_LINKGRAPH_COLOURS_HELPTEXT :Ustaw kolorystykę używaną do wyświetlania przepływu ładunków. +STR_CONFIG_SETTING_LINKGRAPH_COLOURS_HELPTEXT :Ustaw kolorystykę używaną do wyświetlania przepływu ładunków ###length 4 STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREEN_TO_RED :Od zielonego do czerwonego (oryginalna) STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREEN_TO_BLUE :Od zielonego do niebieskiego @@ -2131,7 +2131,7 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Pozostaw aktywn STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Zachowaj narzędzia budowy mostów, tuneli, itp. po użyciu STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Automatycznie usuwaj sygnały podczas budowy torów: {STRING} -STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Automatycznie usuwaj sygnały, które przeszkadzają w budowie toru. Pamiętaj, że może to doprowadzić do zderzenia pociągów, w przypadku usunięcia ważnych sygnałów. +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Automatycznie usuwaj sygnały, które przeszkadzają w budowie toru. Pamiętaj, że może to doprowadzić do zderzenia pociągów, w przypadku usunięcia ważnych sygnałów STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT :Ograniczenie prędkości przyspieszonego czasu w grze: {STRING} STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT_HELPTEXT :Ograniczenie prędkości gry, kiedy przyspieszenie czasu jest włączone. 0 = bez ograniczenia (tak szybko, jak pozwoli na to komputer). Wartości poniżej 100% spowolnią grę. Górny limit jest zależny od specyfikacji komputera i może się różnić w zależności od rozgrywki. @@ -2220,7 +2220,7 @@ STR_CONFIG_SETTING_NOSERVICE :Wyłącz serwis STR_CONFIG_SETTING_NOSERVICE_HELPTEXT :Kiedy włączone, pojazdy nie są serwisowane, jeśli nie mogą się popsuć STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY :Obniżenie prędkości załadunku pociągów dłuższych niż stacja: {STRING} -STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :Gdy opcja ta jest włączona, pociągi dłuższe od stacji ładują się wolniej niż pociągi, które mieszczą się na stacji. To ustawienie nie wpływa na znajdowanie tras. +STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :Gdy opcja ta jest włączona, pociągi dłuższe od stacji ładują się wolniej niż pociągi, które mieszczą się na stacji. To ustawienie nie wpływa na znajdowanie tras STR_CONFIG_SETTING_WAGONSPEEDLIMITS :Włącz limity prędkości wagonów: {STRING} STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :Kiedy włączone, użyj także ograniczenia prędkości dla wagonów do obliczenia maksymalnej prędkości pociągu @@ -2346,7 +2346,7 @@ STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED :Dozwolone STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED_CUSTOM_LAYOUT :Dozwolone, dowolny układ miasta STR_CONFIG_SETTING_TOWN_CARGOGENMODE :Generowanie ładunku przez miasta: {STRING} -STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT :Ilość ładunku produkowana przez domy w mieście względem ogólnej populacji miasta.{}Wzrost kwadratowy: miasto o podwojonej wielkości generuje czterokrotnie więcej pasażerów.{}Wzrost liniowy: miasto o podwojonej wielkości generuje dwukrotnie więcej pasażerów. +STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT :Ilość ładunku produkowana przez domy w mieście względem ogólnej populacji miasta.{}Wzrost kwadratowy: miasto o podwojonej wielkości generuje czterokrotnie więcej pasażerów.{}Wzrost liniowy: miasto o podwojonej wielkości generuje dwukrotnie więcej pasażerów ###length 2 STR_CONFIG_SETTING_TOWN_CARGOGENMODE_ORIGINAL :Kwadratowy (originalny) STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BITCOUNT :Liniowy @@ -2387,7 +2387,7 @@ STR_CONFIG_SETTING_ZOOM_LVL_OUT_4X :4x STR_CONFIG_SETTING_ZOOM_LVL_OUT_8X :8x STR_CONFIG_SETTING_SPRITE_ZOOM_MIN :Najwyższa używana rozdzielczość sprite'ów: {STRING} -STR_CONFIG_SETTING_SPRITE_ZOOM_MIN_HELPTEXT :Ogranicz maksymalną rozdzielczość dla sprite'ów. Ograniczenie rozdzielczości sprite'ów spowoduje brak użycia grafiki w wysokiej rozdzielczości, nawet, jeśli jest ona dostępna. Może to pomóc w utrzymaniu jednolitego wyglądu gry, gdy używasz mieszanki plików GRF z grafiką w wysokiej rozdzielczości i bez niej. +STR_CONFIG_SETTING_SPRITE_ZOOM_MIN_HELPTEXT :Ogranicz maksymalną rozdzielczość dla sprite'ów. Ograniczenie rozdzielczości sprite'ów spowoduje brak użycia grafiki w wysokiej rozdzielczości, nawet, jeśli jest ona dostępna. Może to pomóc w utrzymaniu jednolitego wyglądu gry, gdy używasz mieszanki plików GRF z grafiką w wysokiej rozdzielczości i bez niej ###length 3 STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_MIN :4x STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_IN_2X :2x @@ -2411,9 +2411,9 @@ STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Początkowy mno STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Średni rozmiar metropolii w porównaniu do normalnych miast na początku gry STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Aktualizuj graf dystrybucji co {STRING} -STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Czas pomiędzy kolejnymi przeliczeniami grafu połączeń. Każde przeliczenie oblicza plany dla jednego komponentu grafu. Wartość X dla tego ustawienia nie oznacza, że cały graf będzie aktualizowany co X sekund. Aktualizowane będą tylko niektóre komponenty. Im mniejszą wartość ustawisz, tym więcej czasu będzie potrzebował procesor, aby wykonać obliczenia. Im większą wartość ustawisz, tym więcej czasu upłynie, zanim rozpocznie się dystrybucja ładunków po nowych trasach. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Czas pomiędzy kolejnymi przeliczeniami grafu połączeń. Każde przeliczenie oblicza plany dla jednego komponentu grafu. Wartość X dla tego ustawienia nie oznacza, że cały graf będzie aktualizowany co X sekund. Aktualizowane będą tylko niektóre komponenty. Im mniejszą wartość ustawisz, tym więcej czasu będzie potrzebował procesor, aby wykonać obliczenia. Im większą wartość ustawisz, tym więcej czasu upłynie, zanim rozpocznie się dystrybucja ładunków po nowych trasach STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Przeznacz {STRING} na przeliczenie grafu dystrybucji -STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Czas potrzebny na każde przeliczenie komponentu grafu połączeń. Po rozpoczęciu przeliczania, tworzony jest wątek, który może działać przez podaną liczbę sekund. Im mniejszą wartość ustawisz, tym większe prawdopodobieństwo, że wątek nie zostanie ukończony w wyznaczonym czasie. Wtedy gra zatrzymuje się do czasu jego zakończenia („lag”). Im większą wartość ustawisz, tym dłużej będzie trwała aktualizacja dystrybucji, gdy zmienią się trasy. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Czas potrzebny na każde przeliczenie komponentu grafu połączeń. Po rozpoczęciu przeliczania, tworzony jest wątek, który może działać przez podaną liczbę sekund. Im mniejszą wartość ustawisz, tym większe prawdopodobieństwo, że wątek nie zostanie ukończony w wyznaczonym czasie. Wtedy gra zatrzymuje się do czasu jego zakończenia („lag”). Im większą wartość ustawisz, tym dłużej będzie trwała aktualizacja dystrybucji, gdy zmienią się trasy STR_CONFIG_SETTING_DISTRIBUTION_PAX :Tryb dystrybucji dla pasażerów: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :Tryb „symetryczny” oznacza, że mniej więcej tyle samo pasażerów będzie podróżować ze stacji A do stacji B, co z B do A. Tryb „asymetryczny” oznacza, że w obu kierunkach może podróżować różna liczba pasażerów. Tryb „ręczny” oznacza, że dla pasażerów nie będzie przeprowadzana dystrybucja automatyczna. @@ -2429,12 +2429,12 @@ STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :asymetryczny STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :symetryczny STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :Dokładność dystrybucji: {STRING} -STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Im wyższą wartość ustawisz, tym więcej czasu procesor będzie potrzebował na obliczenie grafu połączeń. Jeśli będzie to trwało zbyt długo, możesz zauważyć opóźnienia. Jeśli jednak ustawisz niską wartość, dystrybucja będzie niedokładna i możesz zauważyć, że ładunki nie są wysyłane do miejsc, gdzie się ich spodziewasz. +STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Im wyższą wartość ustawisz, tym więcej czasu procesor będzie potrzebował na obliczenie grafu połączeń. Jeśli będzie to trwało zbyt długo, możesz zauważyć opóźnienia. Jeśli jednak ustawisz niską wartość, dystrybucja będzie niedokładna i możesz zauważyć, że ładunki nie są wysyłane do miejsc, gdzie się ich spodziewasz STR_CONFIG_SETTING_DEMAND_DISTANCE :Wpływ odległości na dystrybucję: {STRING} STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT :Jeśli ładunki z jednej stacji trafiają na kilka różnych stacji, na ich dystrybucję wpływ ma odległość. Im wyższą wartość ustawisz, tym bliższe stacje będą preferowane. Zerowa wartość ustawienia sprawi, że odległość nie będzie wpływała na podział dystrybucji. STR_CONFIG_SETTING_DEMAND_SIZE :Ilość powracającego ładunku dla trybu symetrycznego: {STRING} -STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Ustawienie tego na mniej niż 100% powoduje, że symetryczna dystrybucja zachowuje się podobnie do asymetrycznej. Mniej ładunku będzie zwróconego jeśli określona ilość zostanie wysłana do stacji. Jeśli ustawisz to na 0%, to symetryczna dystrybucja zachowuje się jak asymetryczna. +STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Ustawienie tego na mniej niż 100% powoduje, że symetryczna dystrybucja zachowuje się podobnie do asymetrycznej. Mniej ładunku będzie zwróconego jeśli określona ilość zostanie wysłana do stacji. Jeśli ustawisz to na 0%, to symetryczna dystrybucja zachowuje się jak asymetryczna STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Nasycenie krótkich tras przed wybraniem tras o dużej przepustowości: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Często istnieje wiele możliwych tras pomiędzy dwiema danymi stacjami. Mechanizm dystrybucji ładunków najpierw nasyci najkrótszą trasę, następnie użyje drugiej najkrótszej trasy, aż do jej nasycenia itd. Nasycenie jest ustalane na podstawie szacunkowej oceny przepustowości i planowanego wykorzystania. Po nasyceniu wszystkich tras, jeśli nadal istnieje zapotrzebowanie, algorytm przeciąży wszystkie trasy, preferując te o dużej przepustowości. W większości przypadków algorytm nie oszacuje jednak dokładnie przepustowości. To ustawienie pozwala określić, do jakiej wartości procentowej krótsza trasa musi zostać nasycona w pierwszym kroku, zanim zostanie wybrana kolejna, dłuższa trasa. Ustaw wartość mniejszą niż 100%, aby uniknąć przepełnionych stacji w przypadku przeszacowania przepustowości. @@ -3359,11 +3359,11 @@ STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Posadź STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Losowe drzewa STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Pokryj losowo krajobraz drzewami STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Normalny -STR_TREES_MODE_NORMAL_TOOLTIP :Sadź pojedyncze drzewa, przeciągając nad terenem. +STR_TREES_MODE_NORMAL_TOOLTIP :{BLACK}Sadź pojedyncze drzewa, przeciągając nad terenem STR_TREES_MODE_FOREST_SM_BUTTON :Zagajnik -STR_TREES_MODE_FOREST_SM_TOOLTIP :Sadź niewielkie lasy, przeciągając nad terenem. +STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Sadź niewielkie lasy, przeciągając nad terenem STR_TREES_MODE_FOREST_LG_BUTTON :Las -STR_TREES_MODE_FOREST_LG_TOOLTIP :Sadź duże lasy, przeciągając nad terenem. +STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Sadź duże lasy, przeciągając nad terenem # Land generation window (SE) STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Tworzenie terenu @@ -3578,9 +3578,9 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD STR_FRAMERATE_CAPTION :{WHITE}Klatkaż STR_FRAMERATE_CAPTION_SMALL :{STRING}{WHITE} ({DECIMAL}x) STR_FRAMERATE_RATE_GAMELOOP :{BLACK}Tempo symulacji: {STRING} -STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Liczba ticków gry symulowanych na sekundę. +STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Liczba ticków gry symulowanych na sekundę STR_FRAMERATE_RATE_BLITTER :{BLACK}Klatki na sekundę: {STRING} -STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Liczba renderowanych klatek wideo na sekundę. +STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Liczba renderowanych klatek wideo na sekundę STR_FRAMERATE_SPEED_FACTOR :{BLACK}Obecny współczynnik szybkości gry: {DECIMAL}x STR_FRAMERATE_SPEED_FACTOR_TOOLTIP :{BLACK}Jak szybko gra obecnie działa, w porównaniu do oczekiwanej prędkości przy normalnym tempie symulacji. STR_FRAMERATE_CURRENT :{WHITE}Obecny @@ -4406,7 +4406,7 @@ STR_GROUP_DEFAULT_AIRCRAFTS :Samoloty bez gr STR_GROUP_COUNT_WITH_SUBGROUP :{TINY_FONT}{COMMA} (+{COMMA}) -STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP :{BLACK}Grupy - kliknij na grupę, aby wyświetlić wszystkie pojazdy z grupy. Przeciągnij i upuść grupy, aby dostosować hierarchię. +STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP :{BLACK}Grupy - kliknij na grupę, aby wyświetlić wszystkie pojazdy z grupy. Przeciągnij i upuść grupy, aby dostosować hierarchię STR_GROUP_CREATE_TOOLTIP :{BLACK}Kliknij aby stworzyć grupę STR_GROUP_DELETE_TOOLTIP :{BLACK}Usuń zaznaczoną grupę STR_GROUP_RENAME_TOOLTIP :{BLACK}Zmień nazwę zaznaczonej grupy diff --git a/src/lang/tamil.txt b/src/lang/tamil.txt index c3f1be4026..3029dc33b7 100644 --- a/src/lang/tamil.txt +++ b/src/lang/tamil.txt @@ -920,7 +920,9 @@ STR_GAME_OPTIONS_TAB_GENERAL_TT :{BLACK}பொ STR_GAME_OPTIONS_TAB_GRAPHICS :அசைவூட்டங்கள் STR_GAME_OPTIONS_TAB_GRAPHICS_TT :{BLACK}அசைவூட்ட அமைப்புகளைத் தேர்ந்தெடு STR_GAME_OPTIONS_TAB_SOUND :ஒலி +STR_GAME_OPTIONS_TAB_SOUND_TT :{BLACK}ஒலி மற்றும் இசை அமைப்புகளைத் தேர்ந்தெடு STR_GAME_OPTIONS_TAB_SOCIAL :சமூக +STR_GAME_OPTIONS_TAB_SOCIAL_TT :{BLACK}சமூக இணைப்பு அமைப்புகளைத் தேர்ந்தெடு STR_GAME_OPTIONS_VOLUME :ஒலி அளவு STR_GAME_OPTIONS_SFX_VOLUME :ஒலி விளைவுகள் @@ -1355,12 +1357,15 @@ STR_CONFIG_SETTING_AUTOSCROLL_MAIN_VIEWPORT_FULLSCREEN :முக்க STR_CONFIG_SETTING_AUTOSCROLL_MAIN_VIEWPORT :முக்கிய திரைபார்வை STR_CONFIG_SETTING_AUTOSCROLL_EVERY_VIEWPORT :ஒவ்வொரு திரைபார்வையும் -STR_CONFIG_SETTING_BRIBE :நகராட்சிக்கு கையூட்டுத் தர அனுமதி: {STRING} +STR_CONFIG_SETTING_BRIBE :நகராட்சிக்கு லஞ்சம் தர அனுமதி: {STRING} ###length 2 -STR_CONFIG_SETTING_BRIBE_HELPTEXT :உள்ளூர் நகர அதிகாரத்திற்கு லஞ்சம் கொடுக்க நிறுவனங்களை அனுமதிக்கவும். லஞ்சம் ஒரு ஆய்வாளரால் கவனிக்கப்பட்டால், நிறுவனம் ஆறு மாதங்களுக்கு நகரத்தில் செயல்பட முடியாது +STR_CONFIG_SETTING_BRIBE_HELPTEXT :நகராட்சிக்கு லஞ்சம் கொடுக்க நிறுவனங்களை அனுமதிக்கவும். லஞ்சம் ஒரு ஆய்வாளரால் கவனிக்கப்பட்டால், நிறுவனம் ஆறு மாதங்களுக்கு நகரத்தில் நடவடிக்கை எடுக்க முடியாது +STR_CONFIG_SETTING_BRIBE_HELPTEXT_MINUTES :நகராட்சிக்கு லஞ்சம் கொடுக்க நிறுவனங்களை அனுமதிக்கவும். லஞ்சம் ஒரு ஆய்வாளரால் கவனிக்கப்பட்டால், நிறுவனம் ஆறு நிமிடங்களுக்கு நகரத்தில் நடவடிக்கை எடுக்க முடியாது STR_CONFIG_SETTING_ALLOW_EXCLUSIVE :போக்குவரத்து உரிமைகளை விற்க அனுமதிக்கவும்: {STRING} ###length 2 +STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT :ஒரு நிருவனம் நகரத்தில் பிரத்தியேக போக்குவரத்து உரிமைகளை வாங்கினால், எதிராளிகளின் நிலையங்கள் 12 மாதங்களுக்கு எந்த பயணிகள் அல்லது சரக்குகளையும் பெறாது +STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT_MINUTES :ஒரு நிருவனம் நகரத்தில் பிரத்தியேக போக்குவரத்து உரிமைகளை வாங்கினால், எதிராளிகளின் நிலையங்கள் 12 நிமிடங்களுக்கு எந்த பயணிகள் அல்லது சரக்குகளையும் பெறாது STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS :கட்டடங்களை கட்ட அனுமதி: {STRING} STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT :நிறுவனங்கள் நகரங்களுக்கு பணம் வழங்க அனுமதிக்கவும், புதிய வீடுகள் கட்ட @@ -1991,6 +1996,7 @@ STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}அம STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF அமைப்புகள் STR_INTRO_ONLINE_CONTENT :{BLACK}கோப்புகளை இணையத்தில் தேடு STR_INTRO_AI_SETTINGS :{BLACK}செயற்கை நுண்ணறிவு அமைப்புகள் +STR_INTRO_GAMESCRIPT_SETTINGS :{BLACK}விளையாட்டு ஸ்கிரிப்ட் அமைப்புகள் STR_INTRO_QUIT :{BLACK}வெளியேறு STR_INTRO_TOOLTIP_NEW_GAME :{BLACK}புதிய ஆட்டத்தினைத் தொடங்கும். Ctrl+Click அழுத்தினால் வரைபட அமைப்புவடிவாக்கம் தவிர்க்கப்படும் @@ -2015,6 +2021,7 @@ STR_INTRO_TOOLTIP_AI_SETTINGS :{BLACK}AI அ STR_INTRO_TOOLTIP_GAMESCRIPT_SETTINGS :{BLACK}விளையாட்டு ஸ்கிரிப்ட் அமைப்புகளைத் திற STR_INTRO_TOOLTIP_QUIT :{BLACK} 'OpenTTD'ஐ விட்டு வெளியேறு +STR_INTRO_BASESET :{BLACK}தேர்ந்தெடுக்கப்பட்ட அடிப்படை வரைகலை தொகுப்பில் {NUM}{P படம் படங்கள்} காணவில்லை. தயவுசெய்து அடிப்படை வரைகலை தொகுப்பிற்கான மேம்படுத்தல்களுக்கு தேடவும். STR_INTRO_TRANSLATION :{BLACK}இந்த மொழிபெயர்ப்பில் {NUM} இல்லை {P "" s}.மொழிபெயர்பாளராக பதிவு செய்து OpenTTDவிற்கு உதவவும். மேலும் விவரங்கள் அறிய readme.txt ஐ பார்க்கவும்.. # Quit window @@ -2437,6 +2444,7 @@ STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP :{BLACK}அன STR_CONTENT_SEARCH_EXTERNAL :{BLACK}வெளி இணையதளங்களில் தேடு STR_CONTENT_SEARCH_EXTERNAL_TOOLTIP :{BLACK}OpenTTDஇன் கோப்பு சேவையில் கிடைக்காத கோப்புகளுக்கு OpenTTDஉடன் தொடர்பில்லாத இணையதளங்களில் தேடவும் STR_CONTENT_SEARCH_EXTERNAL_DISCLAIMER_CAPTION :{WHITE}நீங்கள் OpenTTD ஐ விட்டு வெளியேறுகிறீர்கள்! +STR_CONTENT_SEARCH_EXTERNAL_DISCLAIMER :{WHITE}வெளி இணையதளங்களிரிந்து கோப்புகளை பதிவிறக்குவதற்கான விதிமுறைகள் மற்றும் நிபந்தனைகள் மாறுபடலாம்.{}நீங்கள் கோப்புகளை நிறுவுவதற்கான வழிமுறைகளுக்கு அந்த வெளி இணையதளங்களை பார்க்க வேண்டும்.{}தொடர விருப்பமா? STR_CONTENT_FILTER_TITLE :{BLACK}குறியீடு/பெயர் வடிகட்டி: STR_CONTENT_OPEN_URL :{BLACK}இணையதளத்தினை பார்வையிடு STR_CONTENT_OPEN_URL_TOOLTIP :{BLACK}இந்த கோப்பின் விவரங்களினை அதன் இணையதளத்தில் பார்க்க @@ -2501,8 +2509,10 @@ STR_MISSING_GRAPHICS_ERROR_QUIT :{BLACK}OpenTTD- # Transparency settings window STR_TRANSPARENCY_CAPTION :{WHITE}ஒளி அமைப்புகள் STR_TRANSPARENT_HOUSES_TOOLTIP :{BLACK}வீடுகளுக்கான வெளிப்படைத்தன்மையை நிலைமாற்று. Ctrl+Click செய்தால் அதனைப் பூட்டும் +STR_TRANSPARENT_BUILDINGS_TOOLTIP :{BLACK}நிறுத்தங்கள், பணிமனைகள், வழிப்புள்ளிகள் போன்ற கட்டிகங்களுக்கான வெளிப்படைத்தன்மையை நிலைமாற்று. Ctrl+Click செய்தால் அதனைப் பூட்டும் STR_TRANSPARENT_BRIDGES_TOOLTIP :{BLACK}பாலத்திற்கான வெளிப்படைத்தன்மையை நிலைமாற்று. Ctrl+Click செய்தால் அதனைப் பூட்டும் STR_TRANSPARENT_STRUCTURES_TOOLTIP :கலங்கரைவிளக்கம் மற்றும் ஆண்டெனா போல கட்டடங்களின் வெளிப்படைத்தன்மையை நிலைமாற்று. Ctrl+கிளிக் பூட்ட செய்ய +STR_TRANSPARENT_CATENARY_TOOLTIP :{BLACK}மின்சார இரயில் கம்பிக்ளுக்கான வெளிப்படைத்தன்மையை நிலைமாற்று. Ctrl+Click செய்தால் அதனைப் பூட்டும் STR_TRANSPARENT_INVISIBLE_TOOLTIP :{BLACK}வெளிப்படையானதற்கு பதிலாக கண்ணுக்கு தெரியாததாக பொருட்களை அமைக்கவும் # Linkgraph legend window @@ -3243,10 +3253,16 @@ STR_NEWGRF_LIST_COMPATIBLE :{YELLOW}பய STR_NEWGRF_LIST_MISSING :{RED}கோப்புகள் இல்லை # NewGRF 'it's broken' warnings +STR_NEWGRF_BROKEN :{WHITE}'{0:STRING} என்ற NewGRFஇன் நடத்தையால் இணைப்பு பீழைகள் மற்றும் செயலிழப்புகள் ஏற்பட வாய்ப்புள்ளது +STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}பணிமனையின் வெளியே '{1:ENGINE}'இன் இயங்கும் நிலையை மாற்றியது +STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}பணிமனையின் வெளியே '{1:ENGINE}'இன் வாகன நீளத்தை மாற்றியது +STR_NEWGRF_BROKEN_CAPACITY :{WHITE}பணிமனை அல்லது மாற்றியமைப்பின் வெளியே '{1:ENGINE}'இன் வாகன கொள்ளளவை மாற்றியது +STR_BROKEN_VEHICLE_LENGTH :{WHITE}{1:COMPANY}உடன் இரயில் {0:VEHICLE}இன் நீளம் செல்லாது. இதற்கான காரணம் அநேகமாக NewGRFகளுடன் சிக்கல் இருக்கலாம். இணைப்பு பிழை அல்லது செயலிழப்பு ஏற்படலாம். STR_NEWGRF_BUGGY :{WHITE}NewGRF '{0:STRING}' தவரான தகவல்களினைத் தருகின்றது STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' தயாரிப்பு பின் அழைப்பில் முடிவில்லாத வட்டத்தினை உண்டாக்கியது STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}பின் அழைப்பு {1:HEX} திருப்பட்டது தெரியவில்லை/செல்லுபடியாகாத முடிவு {2:HEX} +STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}{2:HEX}ல் உற்பத்தி பின் அழைப்பில் {1:STRING} செல்லுபடியாகாத சரக்கு விதம் வழங்கியது # 'User removed essential NewGRFs'-placeholders for stuff without specs STR_NEWGRF_INVALID_CARGO :<செல்லுபடியாகாத சரக்கு> @@ -3328,13 +3344,16 @@ STR_LOCAL_AUTHORITY_ACTION_ROAD_RECONSTRUCTION :நகர ச STR_LOCAL_AUTHORITY_ACTION_STATUE_OF_COMPANY :நிறுவன தலைவரின் சிலையினை கட்டு STR_LOCAL_AUTHORITY_ACTION_NEW_BUILDINGS :புதிய கட்டடங்களை கட்ட நிதியுதவி செய் STR_LOCAL_AUTHORITY_ACTION_EXCLUSIVE_TRANSPORT :சிறப்பு போக்குவரத்து உரிமைகளை வாங்கு -STR_LOCAL_AUTHORITY_ACTION_BRIBE :நகராட்சியிற்கு கையூட்டு கொடு +STR_LOCAL_AUTHORITY_ACTION_BRIBE :நகராட்சியிற்கு லஞ்சம் கொடு ###next-name-looks-similar STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_SMALL_ADVERTISING :{YELLOW}சிறிய விளம்பர பிரசாரத்தினைத் தொடங்கு, இதனால் பயணிகள் மற்றும் சரக்குகள் உங்களது போக்குவரத்து நிறுவனத்தினைப் பயன்படுத்துவர்.{}செலவு: {CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_MEDIUM_ADVERTISING :{YELLOW}சராசரி விளம்பர பிரசாரத்தினைத் தொடங்கு, இதனால் பயணிகள் மற்றும் சரக்குகள் உங்களது போக்குவரத்து நிறுவனத்தினைப் பயன்படுத்துவர்.{}செலவு: {CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_LARGE_ADVERTISING :{YELLOW}பெரிய விளம்பர பிரசாரத்தினைத் தொடங்கு, இதனால் பயணிகள் மற்றும் சரக்குகள் உங்களது போக்குவரத்து நிறுவனத்தினைப் பயன்படுத்துவர்.{}செலவு: {CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_STATUE_OF_COMPANY :{YELLOW}தங்கள் நிறுவனத்தின் பெருமைக்காக ஓர் சிலையினைக் கட்டவும்.{}நிலையத்திற்கு நிரந்தர ஊக்கத்தை அளிக்கிறது.{}செலவு: {CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT_MONTHS :{PUSH_COLOUR}{YELLOW}12 மாதங்களுக்கு நகரத்தில் பிரத்தியேக போக்குவரத்து உரிமை வாங்கவும்.{}நகராட்சி பயணிகள் மற்றும் சரக்குகளை உங்கள் எதிராளிகளின் நிலையங்களை பயன்படுத்த அனுமதிக்காது. எதிராளியின் வெற்றிகரமான லஞ்சம் இந்த ஒப்பந்தத்தை ரத்து செய்யும்.{}{POP_COLOUR}செலவு: {CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT_MINUTES :{PUSH_COLOUR}{YELLOW}12 நிமிடங்களுக்கு நகரத்தில் பிரத்தியேக போக்குவரத்து உரிமை வாங்கவும்.{}நகராட்சி பயணிகள் மற்றும் சரக்குகளை உங்கள் எதிராளிகளின் நிலையங்களை பயன்படுத்த அனுமதிக்காது. எதிராளியின் வெற்றிகரமான லஞ்சம் இந்த ஒப்பந்தத்தை ரத்து செய்யும்.{}{POP_COLOUR}செலவு: {CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{PUSH_COLOUR}{YELLOW}மாட்டிக்கொண்டால் கடுமையான அபராதம் ஆபத்தில், உங்கள் மதிப்பீட்டை அதிகரிக்க மற்றும் எதிராளியின் பிரத்தியேக போக்குவரத்து உரிமைகளின் ரத்து செய்ய நகராட்சிக்கு லஞ்சம் தரவும்.{}{POP_COLOUR}செலவு: {CURRENCY_LONG} # Goal window STR_GOALS_CAPTION :{WHITE}{COMPANY} குறிக்கோள்கள் @@ -3593,6 +3612,7 @@ STR_INDUSTRY_DIRECTORY_ITEM_PROD1 :{ORANGE}{INDUST STR_INDUSTRY_DIRECTORY_ITEM_PROD2 :{ORANGE}{INDUSTRY} {STRING}, {STRING} STR_INDUSTRY_DIRECTORY_ITEM_PROD3 :{ORANGE}{INDUSTRY} {STRING}, {STRING}, {STRING} STR_INDUSTRY_DIRECTORY_ITEM_PRODMORE :{ORANGE}{INDUSTRY} {STRING}, {STRING}, {STRING} மற்றும் {NUM} மேலும்... +STR_INDUSTRY_DIRECTORY_LIST_CAPTION :{BLACK}தொழிற்சாலைகளின் பெயர்கள் - தொழிற்சாலயை முக்கிய காட்சியில் நடுவில் காட்ட பெயரில் கிளிக் செய்யவும். தொழிற்சாலையின் இடத்தில் புதிய காட்சியை திறக்க Ctrl+கிளிக் செய்யவும். STR_INDUSTRY_DIRECTORY_ACCEPTED_CARGO_FILTER :{BLACK}ஏற்றுக்கொள்ளப்படும் சரக்குகள்: {SILVER}{STRING} STR_INDUSTRY_DIRECTORY_PRODUCED_CARGO_FILTER :{BLACK}உற்பத்தி செய்யப்பட்ட சரக்குகள்: {SILVER}{STRING} STR_INDUSTRY_DIRECTORY_FILTER_ALL_TYPES :அனைத்து சரக்கு வகைகள் @@ -4142,6 +4162,7 @@ STR_ORDER_GO_TO :இங்கே STR_ORDER_GO_NON_STOP_TO :எங்கும் நிற்காமல் இங்கே செல் STR_ORDER_GO_VIA :இதன் வழியாக இங்கே செல் STR_ORDER_GO_NON_STOP_VIA :எங்கும் நிற்காமல் இதன் வழியாக செல் +STR_ORDER_TOOLTIP_NON_STOP :{BLACK}இந்தக் கட்டளையின் நிறுத்துதல் நடத்தையை மாற்றவும் STR_ORDER_TOGGLE_FULL_LOAD :{BLACK}எந்த சரக்கினையும் முழுமையாக ஏற்று STR_ORDER_DROP_LOAD_IF_POSSIBLE :கிடைத்தால் ஏற்று diff --git a/src/lang/ukrainian.txt b/src/lang/ukrainian.txt index 95a22362c4..9e99e76294 100644 --- a/src/lang/ukrainian.txt +++ b/src/lang/ukrainian.txt @@ -4660,7 +4660,7 @@ STR_ORDERS_CAPTION :{WHITE}{VEHICLE STR_ORDERS_TIMETABLE_VIEW :{BLACK}Розклад STR_ORDERS_TIMETABLE_VIEW_TOOLTIP :{BLACK}Переключитись на розклад -STR_ORDERS_LIST_TOOLTIP :{BLACK}Маршрутний лист - клацніть на завданні для його вибору. Ctrl+клац мишою показує станцію призначення +STR_ORDERS_LIST_TOOLTIP :{BLACK}Маршрутний лист - клацніть на завданні для його вибору. Ctrl+клац переміщує головний екран на пункт призначення STR_ORDER_INDEX :{COMMA}:{NBSP} STR_ORDER_TEXT :{STRING} {STRING} {STRING} {STRING} @@ -4699,6 +4699,7 @@ STR_ORDER_DROP_REFIT_AUTO_ANY :Доступн STR_ORDER_DROP_GO_ALWAYS_DEPOT :Завжди прямувати STR_ORDER_DROP_SERVICE_DEPOT :Прямувати при потребі в техогляді STR_ORDER_DROP_HALT_DEPOT :Прямувати і зупинитись +STR_ORDER_DROP_UNBUNCH :Звільнити # Depot action tooltips, one per vehicle type ###length VEHICLE_TYPES @@ -4736,13 +4737,13 @@ STR_ORDER_CONDITIONAL_VALUE_TOOLTIP :{BLACK}Знач STR_ORDER_CONDITIONAL_VALUE_CAPT :{WHITE}Введіть значення для порівняння STR_ORDERS_SKIP_BUTTON :{BLACK}Пропуск -STR_ORDERS_SKIP_TOOLTIP :{BLACK}Пропустити поточний наказ, і виконувати наступний. Ctrl+клац мишою переходить до вибраного наказу +STR_ORDERS_SKIP_TOOLTIP :{BLACK}Пропустити поточний наказ, і виконувати наступний. Ctrl+клац для переходу до обраного наказу STR_ORDERS_DELETE_BUTTON :{BLACK}Видалити STR_ORDERS_DELETE_TOOLTIP :{BLACK}Видалити виділене завдання STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}Видалити всі накази STR_ORDERS_STOP_SHARING_BUTTON :{BLACK}Скасувати спільні накази -STR_ORDERS_STOP_SHARING_TOOLTIP :{BLACK}Припинити використовути спільні накази. Ctrl+клац мишою видаляє всі накази для цього транспорту +STR_ORDERS_STOP_SHARING_TOOLTIP :{BLACK}Припинити використовути спільні накази. Ctrl+клац видаляє всі накази для цього транспорту STR_ORDERS_GO_TO_BUTTON :{BLACK}Прямувати STR_ORDER_GO_TO_NEAREST_DEPOT :Прямувати до найближчого депо @@ -4863,7 +4864,7 @@ STR_TIMETABLE_START :{BLACK}Поча STR_TIMETABLE_START_SECONDS_QUERY :Секунд до початку розкладу STR_TIMETABLE_CHANGE_TIME :{BLACK}Змінити час -STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Змінити час, впродовж якого має виконуватись наказ. Ctrl+клац змінить час в усіх завданнях +STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Змінити час, впродовж якого має виконуватись наказ. Ctrl+клац змінить час в усіх наказах STR_TIMETABLE_CLEAR_TIME :{BLACK}Скасувати час STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Скасувати час виконання виділеного наказу. Ctrl+клац скасує обмеження часу в усіх наказах diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index 723d5e8206..1791df5591 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -1011,6 +1011,7 @@ STR_GAME_OPTIONS_CURRENCY_INR :Rupee Ấn Đ STR_GAME_OPTIONS_CURRENCY_IDR :Rupiah Indonesia STR_GAME_OPTIONS_CURRENCY_MYR :Ringgit Malaysia STR_GAME_OPTIONS_CURRENCY_LVL :Lát-vi-a Lats +STR_GAME_OPTIONS_CURRENCY_PTE :Escudo Bồ Đào Nha STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Lưu tự động STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Lựa chọn khoảng thời gian tự động lưu @@ -1053,7 +1054,7 @@ STR_GAME_OPTIONS_GUI_SCALE_BEVELS :Tỷ lệ góc STR_GAME_OPTIONS_GUI_SCALE_BEVELS_TOOLTIP :{BLACK}Đánh dấu vào ô này để điều chỉnh tỷ lệ góc xiên theo kích thước giao diện STR_GAME_OPTIONS_GUI_FONT_SPRITE :{BLACK}Sử dụng sprite phông truyền thống -STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP :{BLACK}Tuỳ chọn này nếu bạn muốn sử dụng sprite phông cố định truyền thống. +STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP :{BLACK}Tuỳ chọn này nếu bạn muốn sử dụng sprite phông cố định truyền thống STR_GAME_OPTIONS_GUI_FONT_AA :{BLACK}Phông chữ chống răng cưa STR_GAME_OPTIONS_GUI_FONT_AA_TOOLTIP :{BLACK}Tuỳ chọn này để chống răng cưa phông chữ co dãn được @@ -1117,6 +1118,8 @@ STR_CURRENCY_DECREASE_EXCHANGE_RATE_TOOLTIP :{BLACK}Giảm t STR_CURRENCY_INCREASE_EXCHANGE_RATE_TOOLTIP :{BLACK}Tăng tỉ giá tiền của bạn đối với 1 Pound (£) STR_CURRENCY_SET_EXCHANGE_RATE_TOOLTIP :{BLACK}Điều chỉnh tỉ giá tiền của bạn đối với 1 Pound (£) +STR_CURRENCY_SEPARATOR :{LTBLUE}Ký tự phân cách: {ORANGE}{STRING} +STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP :{BLACK}Thiết lập ký tự phân cách cho tiền tệ của bạn STR_CURRENCY_PREFIX :{LTBLUE}Tiền tố: {ORANGE}{STRING} STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP :{BLACK}Chỉnh tiếp đầu ngữ cho tiền tệ của bạn @@ -1272,7 +1275,7 @@ STR_CONFIG_SETTING_INFINITE_MONEY :Tiền vô hạ STR_CONFIG_SETTING_INFINITE_MONEY_HELPTEXT :Cho phép chi tiêu không giới hạn và tắt bỏ việc phá sản của các công ty STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN :Khoảng vay khởi nghiệp tối đa: {STRING} -STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT :Hạn mức vay khởi nghiệp tối đa một công ty có thể vay (không tính lạm phát). Nếu chọn "Không có khoản vay", tiền sẽ không có sẵn trừ khi được cung cấp bằng Game Script hoặc thiêt lập "Tiền vô hạn". +STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT :Hạn mức vay khởi nghiệp tối đa một công ty có thể vay (không tính lạm phát). Nếu chọn "Không có khoản vay", tiền sẽ không có sẵn trừ khi được cung cấp bằng Game Script hoặc thiêt lập "Tiền vô hạn" STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_VALUE :{CURRENCY_LONG} ###setting-zero-is-special STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_DISABLED :Không có khoản vay @@ -1356,7 +1359,7 @@ STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :Sự giảm t STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT :Sự giảm tốc cho ôtô tại một ô dốc. Giá trị càng cao thì càng khó leo dốc STR_CONFIG_SETTING_FORBID_90_DEG :Ngăn tàu hỏa chuyển hướng 90 độ: {STRING} -STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :Chuyển hướng 90 độ chỉ xảy ra khi một ray ngang nối với một ray dọc ở 2 ô liền kề, khiến cho tàu hỏa cua 90 độ khi đến ô rẽ thay vì 45 độ như bình thường. +STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :Chuyển hướng 90 độ chỉ xảy ra khi một ray ngang nối với một ray dọc ở 2 ô liền kề, khiến cho tàu hỏa cua 90 độ khi đến ô rẽ thay vì 45 độ như bình thường STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS :Cho phép gộp ga, bến, cảng không sát nhau: {STRING} STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT :Cho phép thêm đoạn vào ga mà không phải sửa cái hiện có. Phải bấm Ctrl+Click để thêm đoạn vào ga @@ -1468,7 +1471,7 @@ STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :Màu chủ đ STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :Thay đổi màu sắc chủ đạo của công ty STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY :Màu phụ của công ty: {STRING} -STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :Thay đổi màu sắc phụ khi bắt đầu công ty, nếu sử dụng NewGRF bật tính năng này +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :Thay đổi màu sắc phụ khi bắt đầu công ty, nếu sử dụng NewGRF có bật tính năng này STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :Sân bay không bao giờ hết hạn sử dụng: {STRING} STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :Bật tùy chọn này cho phép tất cả các loại sân bay không bị lỗi thời @@ -1492,22 +1495,22 @@ STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES :Phương tiện STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT :Nếu bật, tất cả các model phương tiện sẽ không bị lỗi thời STR_CONFIG_SETTING_TIMEKEEPING_UNITS :Giữ nhịp: {STRING} -STR_CONFIG_SETTING_TIMEKEEPING_UNITS_HELPTEXT :Lựa chọn đơn vị giữ nhịp thời gian trong trò chơi. Điều này không thể thay đổi sau đó.{}{}Dựa trên lịch là kiểu cổ điển của OpenTTD, với mỗi năm là 12 tháng, và mỗi tháng có 28-31 ngày.{}{}Theo kiểu nhịp đồng hồ, thì dịch chuyển xe cộ, sản lượng vận tải, và các chỉ số tài chính sẽ theo nhịp mỗi phút tăng lên, nó tương đương với 30 ngày trong tháng của kiểu lịch. Những nhịp này sẽ nhóm thành kỳ 12 phút, tương đương một năm của kiểu lịch.{}{}Ở cả 2 chế độ thì luôn áp dụng lịch cổ điển cho ngày giới thiệu xe mới, nhà và các hạ tầng khác. +STR_CONFIG_SETTING_TIMEKEEPING_UNITS_HELPTEXT :Lựa chọn đơn vị giữ nhịp thời gian trong trò chơi. Điều này không thể thay đổi sau đó.{}{}Dựa trên lịch là kiểu cổ điển của OpenTTD, với mỗi năm là 12 tháng, và mỗi tháng có 28-31 ngày.{}{}Theo kiểu nhịp đồng hồ, thì dịch chuyển xe cộ, sản lượng vận tải, và các chỉ số tài chính sẽ theo nhịp mỗi phút tăng lên, nó tương đương với 30 ngày trong tháng của kiểu lịch. Những nhịp này sẽ nhóm thành kỳ 12 phút, tương đương một năm của kiểu lịch.{}{}Ở cả 2 chế độ thì luôn áp dụng lịch cổ điển cho ngày giới thiệu xe mới, nhà và các hạ tầng khác ###length 2 STR_CONFIG_SETTING_TIMEKEEPING_UNITS_CALENDAR :Lịch STR_CONFIG_SETTING_TIMEKEEPING_UNITS_WALLCLOCK :Đồng hồ tính giờ STR_CONFIG_SETTING_MINUTES_PER_YEAR :Số phút tính cho mỗi năm: {STRING} -STR_CONFIG_SETTING_MINUTES_PER_YEAR_HELPTEXT :Chọn số phút trong mỗi lịch năm. Mặc định là 12 phút/năm. Đặt bằng 0 để ngưng lịch thời gian. Tuỳ chọn này sẽ không ảnh hưởng đến việc giả lập kinh tế trong trò chơi, và nó chỉ sẵn có khi sử dụng đồng hồ giữ nhịp. +STR_CONFIG_SETTING_MINUTES_PER_YEAR_HELPTEXT :Chọn số phút trong mỗi lịch năm. Mặc định là 12 phút/năm. Đặt bằng 0 để ngưng lịch thời gian. Tuỳ chọn này sẽ không ảnh hưởng đến việc giả lập kinh tế trong trò chơi, và nó chỉ sẵn có khi sử dụng đồng hồ giữ nhịp STR_CONFIG_SETTING_MINUTES_PER_YEAR_VALUE :{NUM} ###setting-zero-is-special STR_CONFIG_SETTING_MINUTES_PER_YEAR_FROZEN :0 (lịch thời gian ngưng đọng) STR_CONFIG_SETTING_TOWN_CARGO_SCALE :Co dãn sản lượng vận tải địa phương: {STRING} -STR_CONFIG_SETTING_TOWN_CARGO_SCALE_HELPTEXT :Co dãn sản lượng vận tải của các địa phương bởi tỉ lệ phần trăm này. +STR_CONFIG_SETTING_TOWN_CARGO_SCALE_HELPTEXT :Co dãn sản lượng vận tải của các địa phương bởi tỉ lệ phần trăm này STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE :Dãn tỉ lệ vận chuyển sản lượng của nhà máy: {STRING} -STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_HELPTEXT :Dãn sản lượng vận chuyển của các nhà máy bằng tỉ lệ phần trăm này. +STR_CONFIG_SETTING_INDUSTRY_CARGO_SCALE_HELPTEXT :Dãn sản lượng vận chuyển của các nhà máy bằng tỉ lệ phần trăm này STR_CONFIG_SETTING_CARGO_SCALE_VALUE :{NUM}% STR_CONFIG_SETTING_AUTORENEW_VEHICLE :Tự thay mới phương tiện nếu hết hạn sử dụng: {STRING} @@ -1526,7 +1529,7 @@ STR_CONFIG_SETTING_ERRMSG_DURATION :Khoảng thời STR_CONFIG_SETTING_ERRMSG_DURATION_HELPTEXT :Khoảng thời gian hiện thị thông báo trong cửa sổ màu đỏ. Lưu ý rằng cửa sổ thông báo sẽ tự đóng khi sau khoảng thời gian này, hoặc là được đóng bằng tay STR_CONFIG_SETTING_HOVER_DELAY :Hiện chú thích: {STRING} -STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT :Khoảng thời gian trễ mà hướng dẫn hiện lên khi di chuột tới đối tượng, có thể hiện hướng dẫn bằng bấm nút phải chuột khi giá trị này bằng 0. +STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT :Khoảng thời gian trễ mà hướng dẫn hiện lên khi di chuột tới đối tượng, có thể hiện hướng dẫn bằng bấm nút phải chuột khi giá trị này bằng 0 STR_CONFIG_SETTING_HOVER_DELAY_VALUE :Thời gian để con trỏ lên đối tượng {COMMA} mili giây ###setting-zero-is-special STR_CONFIG_SETTING_HOVER_DELAY_DISABLED :Bấm phải chuột @@ -1538,8 +1541,8 @@ STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :Độ đậm c STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :Độ đậm của đường vẽ trên đồ thị. Một đường mảnh sẽ chính xác hơn, trong khi đó đường đậm sẽ dễ nhìn hơn và màu sắc dễ phân biệt hơn STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :Hiển thị tên NewGRF trong cửa sổ xây phương tiện: {STRING} -STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :Thêm một dòng vào cửa sổ xây phương tiện, hiển thị phương tiện đến từ NewGRF nào. -STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS :Liệt kê hàng hoá mà phương tiện có thể chuyên chở trong cửa sổ danh sách {STRING} +STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :Thêm một dòng vào cửa sổ xây phương tiện, hiển thị phương tiện đến từ NewGRF nào +STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS :Liệt kê hàng hoá mà phương tiện có thể chuyên chở trong cửa sổ danh sách: {STRING} STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS_HELPTEXT :Nếu được bật, những hàng hóa có thể vận chuyển của phương tiện sẽ được hiển thị phía trên chúng trong danh sách phương tiện STR_CONFIG_SETTING_LANDSCAPE :Nền đất: {STRING} @@ -1572,7 +1575,7 @@ STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :Điều chỉnh STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE :{NUM}% STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :Độ gồ ghề của địa chất: {STRING} -STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :Chọn hình dạng và số lượng đồi núi. Địa hình bằng phẳng có ít núi nhưng chúng sẽ rộng hơn, trong khi địa hình gồ ghề có nhiều núi với kích cỡ nhỏ. +STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :Chọn hình dạng và số lượng đồi núi. Địa hình bằng phẳng có ít núi nhưng chúng sẽ rộng hơn, trong khi địa hình gồ ghề có nhiều núi với kích cỡ nhỏ ###length 4 STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH :Rất Phẳng STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH :Phẳng @@ -1580,7 +1583,7 @@ STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH :Gồ Ghề STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH :Rất Gồ Ghề STR_CONFIG_SETTING_VARIETY :Phân bổ sự đa dạng: {STRING} -STR_CONFIG_SETTING_VARIETY_HELPTEXT :Điều chỉnh liệu rằng bản đồ gồm cả vùng núi cao và vùng đồng bằng. Độ đa dạng càng cao thì sự chênh lệch về độ cao giữa vùng núi và vùng đồng bằng càng nhiều. +STR_CONFIG_SETTING_VARIETY_HELPTEXT :Điều chỉnh liệu rằng bản đồ gồm cả vùng núi cao và vùng đồng bằng. Độ đa dạng càng cao thì sự chênh lệch về độ cao giữa vùng núi và vùng đồng bằng càng nhiều STR_CONFIG_SETTING_RIVER_AMOUNT :Số lượng sông ngòi: {STRING} STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Chọn số lượng sông ngòi được khởi tạo @@ -1748,10 +1751,10 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Vẫn giữ cô STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Giữ cho công cụ xây dựng đối với cầu, hầm... vẫn mở sau khi dùng. STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Tự động loại bỏ đèn tín hiệu khi xây dựng đường ray: {STRING} -STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Tự động loại bỏ đèn tín hiệu trên đường khi xây dựng đường ray. Lưu ý điều này có khả năng gây ra tai nạn tàu hỏa. +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Tự động loại bỏ đèn tín hiệu trên đường khi xây dựng đường ray. Lưu ý điều này có khả năng gây ra tai nạn tàu hỏa STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT :Giới hạn tốc độ tua nhanh: {STRING} -STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT_HELPTEXT :Giới hạn tốc độ của trò chơi khi dùng chế độ tua nhanh. 0 = không có giới hạn (dùng tốc độ nhanh nhất mà máy tính cho phép). Giá trị dưới 100% sẽ làm chậm trò chơi lại. Cận trên phụ thuộc vào cấu hình máy tính và tùy thuộc vào ván chơi. +STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT_HELPTEXT :Giới hạn tốc độ của trò chơi khi dùng chế độ tua nhanh. 0 = không có giới hạn (dùng tốc độ nhanh nhất mà máy tính cho phép). Giá trị dưới 100% sẽ làm chậm trò chơi lại. Cận trên phụ thuộc vào cấu hình máy tính và tùy thuộc vào ván chơi STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT_VAL :{NUM}% tốc độ bình thường của trò chơi ###setting-zero-is-special STR_CONFIG_SETTING_FAST_FORWARD_SPEED_LIMIT_ZERO :Không giới hạn (theo tốc độ của máy tính cho phép) @@ -1815,11 +1818,11 @@ STR_CONFIG_SETTING_AI_IN_MULTIPLAYER_HELPTEXT :Cho phép ngư STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES :#mã lệnh trước kịch bản tạm ngưng: {STRING} STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES_HELPTEXT :Số lượng tối đa các tính toán mà một kịch bản AI được phép chạy mỗi lần STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY :Bộ nhớ sử dụng tối đa mỗi kích bản: {STRING} -STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Số lượng bộ nhớ tối đa mà kịch bản có thể tiêu thụ trước khi nó bị từ chối hoạt động. Số lượng này có thể phải tăng lên nếu bản đồ lớn hơn. +STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Số lượng bộ nhớ tối đa mà kịch bản có thể tiêu thụ trước khi nó bị từ chối hoạt động. Số lượng này có thể phải tăng lên nếu bản đồ lớn hơn STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Tần suất bảo trì theo đơn vị phần trăm: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Khi được bật, việc bảo trì phương tiện sẽ được thực thực hiện khi độ tin cậy của phương tiện giảm xuống so với độ tin cậy tối đa.{}{}Ví dụ, nếu độ tin cậy tối đa của phương tiện là 90% và tần suất bảo trì là 20%, phương tiện sẽ được bảo trì khi độ tin cậy giảm xuống 72%. +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Khi được bật, việc bảo trì phương tiện sẽ được thực thực hiện khi độ tin cậy của phương tiện giảm xuống so với độ tin cậy tối đa.{}{}Ví dụ, nếu độ tin cậy tối đa của phương tiện là 90% và tần suất bảo trì là 20%, phương tiện sẽ được bảo trì khi độ tin cậy giảm xuống 72% STR_CONFIG_SETTING_SERVINT_TRAINS :Tần suất bảo trì mặc định đối với tàu hỏa: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Thiết lập khoảng thời gian bảo trì tùy chọn đối với các tàu hỏa, nếu phương tiện không có riêng thời gian bảo trì này @@ -1837,7 +1840,7 @@ STR_CONFIG_SETTING_NOSERVICE :Tắt bảo tr STR_CONFIG_SETTING_NOSERVICE_HELPTEXT :Nếu bật, phương tiện sẽ không cần bảo trì nếu chúng không thể bị hỏng STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY :Tốc độ nạp hàng bị suy giảm cho tàu hoả dài hơn độ dài của ga tàu: {STRING} -STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :Khi bật, đoàn tàu quá dài sẽ nạp hàng chậm hơn một đoàn tàu dài vừa với độ dài ga tàu. Tuỳ chọn. này không ảnh hưởng tới việc tìm đường. +STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :Khi bật, đoàn tàu quá dài sẽ nạp hàng chậm hơn một đoàn tàu dài vừa với độ dài ga tàu. Tuỳ chọn. này không ảnh hưởng tới việc tìm đường STR_CONFIG_SETTING_WAGONSPEEDLIMITS :Bật giới hạn tốc độ toa tàu: {STRING} STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :Nếu bật, sử dụng giới hạn tốc độ của toa xe để hạn chế tốc độ của cả đoàn tàu @@ -1902,13 +1905,13 @@ STR_CONFIG_SETTING_COLOURED_NEWS_YEAR_HELPTEXT :Năm mà các b STR_CONFIG_SETTING_STARTING_YEAR :Năm bắt đầu: {STRING} STR_CONFIG_SETTING_ENDING_YEAR :Năm kết thúc để tính điểm: {STRING} -STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT :Năm mà ván chơi sẽ kết thúc và tính điểm. Khi năm đó kết thúc, điểm số của công ty sẽ được lưu lại và hiển thị bảng điểm chơi cao nhất, sau đó người chơi vẫn có thể tiếp tục ván chơi.{} Nếu năm được đặt nhỏ hơn năm bắt đầu, bảng điểm chơi cao nhất sẽ không bao giờ được hiển thị. +STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT :Năm mà ván chơi sẽ kết thúc và tính điểm. Khi năm đó kết thúc, điểm số của công ty sẽ được lưu lại và hiển thị bảng điểm chơi cao nhất, sau đó người chơi vẫn có thể tiếp tục ván chơi.{} Nếu năm được đặt nhỏ hơn năm bắt đầu, bảng điểm chơi cao nhất sẽ không bao giờ được hiển thị STR_CONFIG_SETTING_ENDING_YEAR_VALUE :{NUM} ###setting-zero-is-special STR_CONFIG_SETTING_ENDING_YEAR_ZERO :Không bao giờ STR_CONFIG_SETTING_ECONOMY_TYPE :Nền kinh tế: {STRING} -STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :Nền kinh tế vận hành trơn tru sẽ có nhiều thay đổi về mặt sản xuất, ở từng bước nhỏ. Nền kinh tế đóng băng sẽ không có thay đổi về mặt sản xuất và nhà máy sẽ không đóng cửa. Thiết lập này có thể không có tác dụng nếu các loại hình công nghiệp được cung cấp bởi NewGRF. +STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :Nền kinh tế vận hành trơn tru sẽ có nhiều thay đổi về mặt sản xuất, ở từng bước nhỏ. Nền kinh tế đóng băng sẽ không có thay đổi về mặt sản xuất và nhà máy sẽ không đóng cửa. Thiết lập này có thể không có tác dụng nếu các loại hình công nghiệp được cung cấp bởi NewGRF ###length 3 STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL :Nguyên gốc STR_CONFIG_SETTING_ECONOMY_TYPE_SMOOTH :Vận hành trơn tru @@ -1963,7 +1966,7 @@ STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED :cho phép STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED_CUSTOM_LAYOUT :cho phép, tùy chọn bố trí đô thị STR_CONFIG_SETTING_TOWN_CARGOGENMODE :Nhu cầu vận chuyển hàng đô thị: {STRING} -STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT :Lượng hàng hoá cần vận chuyển ở trong đô thị, tỉ lệ với tổng dân số của độ thị.{}Tăng tỉ lệ bình phương: một đô thị to gấp 2 sẽ tăng 4 lần số hành khách.{}Tăng tỉ lệ thuận: một đô thị tăng gấp 2 sẽ tăng gấp 2 lần số hành khách. +STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT :Lượng hàng hoá cần vận chuyển ở trong đô thị, tỉ lệ với tổng dân số của độ thị.{}Tăng tỉ lệ bình phương: một đô thị to gấp 2 sẽ tăng 4 lần số hành khách.{}Tăng tỉ lệ thuận: một đô thị tăng gấp 2 sẽ tăng gấp 2 lần số hành khách ###length 2 STR_CONFIG_SETTING_TOWN_CARGOGENMODE_ORIGINAL :Tỉ lệ bình phương (nguyên bản) STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BITCOUNT :Tuyến tính @@ -2004,7 +2007,7 @@ STR_CONFIG_SETTING_ZOOM_LVL_OUT_4X :4x STR_CONFIG_SETTING_ZOOM_LVL_OUT_8X :8x STR_CONFIG_SETTING_SPRITE_ZOOM_MIN :Độ phân giải sprite lớn nhất sẽ dùng: {STRING} -STR_CONFIG_SETTING_SPRITE_ZOOM_MIN_HELPTEXT :Giới hạn độ phân giải tối đa sử dụng cho sprite. Giới hạn độ phân giải của sprite sẽ ngưng việc sử dụng các gói đồ họa phân giải cao ngay cả khi đã cài. Điều này có thể giúp cho đồ họa của trò chơi được đồng nhất khi sử dụng lẫn lộn các GRF có và không có phân giải cao. +STR_CONFIG_SETTING_SPRITE_ZOOM_MIN_HELPTEXT :Giới hạn độ phân giải tối đa sử dụng cho sprite. Giới hạn độ phân giải của sprite sẽ ngưng việc sử dụng các gói đồ họa phân giải cao ngay cả khi đã cài. Điều này có thể giúp cho đồ họa của trò chơi được đồng nhất khi sử dụng lẫn lộn các GRF có và không có phân giải cao ###length 3 STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_MIN :4x STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_IN_2X :2x @@ -2028,33 +2031,33 @@ STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Hệ số quy m STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Kích thước trung bình của thành phố tỉ lệ với đô thị lúc bắt đầu trò chơi STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Cập nhật biểu đồ phân phối mỗi {STRING} -STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Thời gian giữa các lần tính toán lại tiếp theo của biểu đồ liên kết. Mỗi lần tính toán lại sẽ tính toán các kế hoạch cho một thành phần của biểu đồ. Điều đó có nghĩa là giá trị X cho cài đặt này không có nghĩa là toàn bộ biểu đồ sẽ được cập nhật X giây một lần. Chỉ một số thành phần sẽ làm như vậy. Bạn đặt nó càng ngắn thì càng cần nhiều thời gian CPU để tính toán nó. Bạn đặt càng lâu thì càng mất nhiều thời gian cho đến khi việc phân phối hàng hóa bắt đầu trên các tuyến đường mới. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Thời gian giữa các lần tính toán lại tiếp theo của biểu đồ liên kết. Mỗi lần tính toán lại sẽ tính toán các kế hoạch cho một thành phần của biểu đồ. Điều đó có nghĩa là giá trị X cho cài đặt này không có nghĩa là toàn bộ biểu đồ sẽ được cập nhật X giây một lần. Chỉ một số thành phần sẽ làm như vậy. Bạn đặt nó càng ngắn thì càng cần nhiều thời gian CPU để tính toán nó. Bạn đặt càng lâu thì càng mất nhiều thời gian cho đến khi việc phân phối hàng hóa bắt đầu trên các tuyến đường mới STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Mất {STRING} để tính toán lại biểu đồ phân phối -STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Thời gian tiêu tốn cho mỗi lần tính toán lại một thành phần biểu đồ liên kết. Khi bắt đầu tính toán lại, một luồng sẽ được sinh ra và chạy trong số giây được thiết lập. Bạn đặt thông số này càng ngắn thì càng có nhiều khả luồng được tạo chưa hoàn thành công việc của nó. Sau đó, trò chơi dừng lại cho đến khi nó ("lag"). Bạn đặt càng lâu thì biểu đồ phân phối càng mất nhiều thời gian để cập nhật khi các tuyến thay đổi. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Thời gian tiêu tốn cho mỗi lần tính toán lại một thành phần biểu đồ liên kết. Khi bắt đầu tính toán lại, một luồng sẽ được sinh ra và chạy trong số giây được thiết lập. Bạn đặt thông số này càng ngắn thì càng có nhiều khả luồng được tạo chưa hoàn thành công việc của nó. Sau đó, trò chơi dừng lại cho đến khi nó ("lag"). Bạn đặt càng lâu thì biểu đồ phân phối càng mất nhiều thời gian để cập nhật khi các tuyến thay đổi STR_CONFIG_SETTING_DISTRIBUTION_PAX :Chế độ phân phối đối với hành khách: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Đối xứng" có nghĩa là số lượng hành khách đi từ nhà ga A đến nhà ga B và từ B đến A sẽ tương đương nhau . "Không đối xứng" có nghĩa là số lượng hành khách tùy ý có thể đi theo một trong hai hướng. "Thủ công" có nghĩa là hành khách sẽ không được phân phối tự động. +STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Đối xứng" có nghĩa là số lượng hành khách đi từ nhà ga A đến nhà ga B và từ B đến A sẽ tương đương nhau . "Không đối xứng" có nghĩa là số lượng hành khách tùy ý có thể đi theo một trong hai hướng. "Thủ công" có nghĩa là hành khách sẽ không được phân phối tự động STR_CONFIG_SETTING_DISTRIBUTION_MAIL :Chế độ phân phối đối với thư tín: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"Đối xứng" có nghĩa là cùng một lượng thư sẽ được gửi từ trạm A đến trạm B cũng như từ B đến A. "Không đối xứng" có nghĩa là lượng thư tùy ý có thể được gửi theo một trong hai hướng. "Thủ công" có nghĩa là thư sẽ không được phân phối tự động. +STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"Đối xứng" có nghĩa là cùng một lượng thư sẽ được gửi từ trạm A đến trạm B cũng như từ B đến A. "Không đối xứng" có nghĩa là lượng thư tùy ý có thể được gửi theo một trong hai hướng. "Thủ công" có nghĩa là thư sẽ không được phân phối tự động STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED :Chế độ phân phối đối với hàng hóa đóng két: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :Loại hàng hóa "ARMORED" chứa các vật có giá trị ở vùng ôn đới, kim cương ở vùng cận nhiệt đới hoặc vàng ở vùng khí hậu cận Bắc Cực. NewGRF có thể thay đổi điều đó. "Đối xứng" có nghĩa là cùng một lượng hàng hóa đó sẽ được gửi từ nhà ga A đến nhà ga B cũng như từ B đến A. "Không đối xứng" có nghĩa là lượng hàng hóa đó có thể được gửi tùy ý theo một trong hai hướng. "Thủ công" có nghĩa là sẽ không có hoạt động phân phối tự động nào đối với hàng hóa đó. Bạn nên đặt chế độ này thành bất đối xứng hoặc thủ công khi chơi ở vùng cận Bắc cực hoặc cận nhiệt đới, vì các ngân hàng chỉ nhận hàng ở những vùng khí hậu này. Đối với ôn hòa, bạn cũng có thể chọn đối xứng vì các ngân hàng sẽ gửi các vật có giá trị trở lại ngân hàng gốc. +STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :Loại hàng hóa "ARMORED" chứa các vật có giá trị ở vùng ôn đới, kim cương ở vùng cận nhiệt đới hoặc vàng ở vùng khí hậu cận Bắc Cực. NewGRF có thể thay đổi điều đó. "Đối xứng" có nghĩa là cùng một lượng hàng hóa đó sẽ được gửi từ nhà ga A đến nhà ga B cũng như từ B đến A. "Không đối xứng" có nghĩa là lượng hàng hóa đó có thể được gửi tùy ý theo một trong hai hướng. "Thủ công" có nghĩa là sẽ không có hoạt động phân phối tự động nào đối với hàng hóa đó. Bạn nên đặt chế độ này thành bất đối xứng hoặc thủ công khi chơi ở vùng cận Bắc cực hoặc cận nhiệt đới, vì các ngân hàng chỉ nhận hàng ở những vùng khí hậu này. Đối với ôn hòa, bạn cũng có thể chọn đối xứng vì các ngân hàng sẽ gửi các vật có giá trị trở lại ngân hàng gốc STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :Chế độ phân phối đối với các loại hàng hóa mặc định: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Không đối xứng" có nghĩa là số lượng hàng hóa tùy ý có thể được gửi theo một trong hai hướng. "Thủ công" có nghĩa là những loại hàng hóa đó sẽ không được phân phối tự động. +STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Không đối xứng" có nghĩa là số lượng hàng hóa tùy ý có thể được gửi theo một trong hai hướng. "Thủ công" có nghĩa là những loại hàng hóa đó sẽ không được phân phối tự động ###length 3 STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :bằng tay STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :bất đối xứng STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :đối xứng STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :Độ chính xác phân phối: {STRING} -STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Mức chính xác tính toán đồ thị, nếu giá trị càng cao càng tốn CPU và trò chơi có thể chậm phản ứng, tuy nhiên giá trị thấp sẽ khiến việc phân phối sẽ giảm sự chính xác và bạn sẽ thấy sự khác biệt là hàng hóa không gửi đến chỗ cần đến. +STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Mức chính xác tính toán đồ thị, nếu giá trị càng cao càng tốn CPU và trò chơi có thể chậm phản ứng, tuy nhiên giá trị thấp sẽ khiến việc phân phối sẽ giảm sự chính xác và bạn sẽ thấy sự khác biệt là hàng hóa không gửi đến chỗ cần đến STR_CONFIG_SETTING_DEMAND_DISTANCE :Ảnh hưởng bởi khoảng cách đến nhu cầu gửi: {STRING} -STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT :Nếu bạn đặt giá trị này lớn hơn 0, thì khoảng chênh lượng hàng hóa gửi từ ga A đến B sẽ ảnh hưởng bởi khoảng cách, giá trị càng cao thì càng ít hàng gửi đến ga xa và nhiều hàng gửi đến ga gần và ngược lại. +STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT :Nếu bạn đặt giá trị này lớn hơn 0, thì khoảng chênh lượng hàng hóa gửi từ ga A đến B sẽ ảnh hưởng bởi khoảng cách, giá trị càng cao thì càng ít hàng gửi đến ga xa và nhiều hàng gửi đến ga gần và ngược lại STR_CONFIG_SETTING_DEMAND_SIZE :Khối lượng hàng hóa trả về đối với chế độ đối xứng: {STRING} -STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Thiết lập giá trị này ít hơn 100% sẽ khiến vận tải hai chiều đối xứng sẽ giống như bất đối xứng. Sẽ có ít hàng hóa hơn chuyển ngược lại nếu như số lượng hàng chuyển tới vượt ngưỡng nào đó. Nếu đặt là 0% thì là bất đối xứng hoàn toàn. +STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Thiết lập giá trị này ít hơn 100% sẽ khiến vận tải hai chiều đối xứng sẽ giống như bất đối xứng. Sẽ có ít hàng hóa hơn chuyển ngược lại nếu như số lượng hàng chuyển tới vượt ngưỡng nào đó. Nếu đặt là 0% thì là bất đối xứng hoàn toàn STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Tỉ lệ bảo hòa (hết tải) của đường tắt trước khi chuyển sang đường khác dài hơn: {STRING} -STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Thường sẽ có nhiều con đường giữa 2 ga/bến. Việc vận tải hàng hóa sẽ chọn con đường ngắn nhất trước cho đến khi hết tải. Sau đó chọn con đường ngắn thứ 2, 3... cho đến khi hết tải. Việc hết tải được tính toán bằng khối lượng vận chuyển thực tế so với dự tính. Khi hết tải tất cả các con đường, nếu vẫn còn hàng hóa cần chuyển, thì nó có thể gây quá tải. Dầu vậy thuật toán này không phải lúc nào cũng chính xác trong việc tính toán năng lực vận tải. Thiết lập này cho phép bạn tinh chỉnh tỉ lệ mà một con đường sẽ hết tải trước khi chọn con đường kế tiếp. Nhỏ hơn 100% sẽ giúp tránh việc một ga bến quá đông đúc và bù trừ việc tính toán sai lệch này. +STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Thường sẽ có nhiều con đường giữa 2 ga/bến. Việc vận tải hàng hóa sẽ chọn con đường ngắn nhất trước cho đến khi hết tải. Sau đó chọn con đường ngắn thứ 2, 3... cho đến khi hết tải. Việc hết tải được tính toán bằng khối lượng vận chuyển thực tế so với dự tính. Khi hết tải tất cả các con đường, nếu vẫn còn hàng hóa cần chuyển, thì nó có thể gây quá tải. Dầu vậy thuật toán này không phải lúc nào cũng chính xác trong việc tính toán năng lực vận tải. Thiết lập này cho phép bạn tinh chỉnh tỉ lệ mà một con đường sẽ hết tải trước khi chọn con đường kế tiếp. Nhỏ hơn 100% sẽ giúp tránh việc một ga bến quá đông đúc và bù trừ việc tính toán sai lệch này STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Đơn vị tốc độ (đất liền): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Đơn vị tốc độ (hàng hải): {STRING} @@ -2978,9 +2981,9 @@ STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Trồng STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Bình thường STR_TREES_MODE_NORMAL_TOOLTIP :{BLACK}Trồng cây bằng cách kéo giữ chuột trên khoảnh đất STR_TREES_MODE_FOREST_SM_BUTTON :{BLACK}Lùm cây -STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Trồng các bụi rừng nhỏ bằng cách kéo giữ chuột trên khoảnh đất. +STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Trồng các bụi rừng nhỏ bằng cách kéo giữ chuột trên khoảnh đất STR_TREES_MODE_FOREST_LG_BUTTON :{BLACK}Rừng -STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Trồng rừng lớn bằng cách kéo giữ chuột trên khoảnh đất. +STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Trồng rừng lớn bằng cách kéo giữ chuột trên khoảnh đất # Land generation window (SE) STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}San Lấp Đất @@ -3077,6 +3080,7 @@ STR_LAND_AREA_INFORMATION_RAIL_OWNER :{BLACK}Chủ đ STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY :{BLACK}Thuộc về địa phương: {LTBLUE}{STRING} STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE :Không STR_LAND_AREA_INFORMATION_LANDINFO_COORDS :{BLACK}Toạ độ: {LTBLUE}{NUM} x {NUM} x {NUM} +STR_LAND_AREA_INFORMATION_LANDINFO_INDEX :{BLACK}Chỉ mục của ô: {LTBLUE}{NUM} ({HEX}) STR_LAND_AREA_INFORMATION_BUILD_DATE :{BLACK}Xây/tân trang ngày: {LTBLUE}{DATE_LONG} STR_LAND_AREA_INFORMATION_STATION_CLASS :{BLACK}Loại ga,bến: {LTBLUE}{STRING} STR_LAND_AREA_INFORMATION_STATION_TYPE :{BLACK}Kiểu ga,bến: {LTBLUE}{STRING} @@ -3196,7 +3200,7 @@ STR_FRAMERATE_CAPTION_SMALL :{STRING}{WHITE} STR_FRAMERATE_RATE_GAMELOOP :{BLACK}Tốc độ khung giả lập game: {STRING} STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Số nhịp đếm giả lập trong mỗi giây STR_FRAMERATE_RATE_BLITTER :{BLACK}Tốc độ khung hình: {STRING} -STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Số khu hình vẽ lại mỗi giây. +STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Số khung hình vẽ lại mỗi giây STR_FRAMERATE_SPEED_FACTOR :{BLACK}Chỉ số vận tốc game hiện tại: {DECIMAL}x STR_FRAMERATE_SPEED_FACTOR_TOOLTIP :{BLACK}Tốc độ chạy game hiện tại, so với tốc độ bình thường STR_FRAMERATE_CURRENT :{WHITE}Hiện tại @@ -4022,12 +4026,12 @@ STR_GROUP_DEFAULT_AIRCRAFTS :Máy bay chưa STR_GROUP_COUNT_WITH_SUBGROUP :{TINY_FONT}{COMMA} (+{COMMA}) -STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP :{BLACK}Nhóm - chọn nhóm để hiển thị các phương tiện thuộc nhóm. Kéo thả nhóm để sắp xếp lại danh sách. +STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP :{BLACK}Nhóm - chọn nhóm để hiển thị các phương tiện thuộc nhóm. Kéo thả nhóm để sắp xếp lại danh sách STR_GROUP_CREATE_TOOLTIP :{BLACK}Ấn vào để tạo nhóm STR_GROUP_DELETE_TOOLTIP :{BLACK}Xoá nhóm đã chọn STR_GROUP_RENAME_TOOLTIP :{BLACK}Đổi tên nhóm STR_GROUP_LIVERY_TOOLTIP :{BLACK}Thay đổi phục trang cho nhóm được chọn -STR_GROUP_REPLACE_PROTECTION_TOOLTIP :{BLACK}Không để nhóm này tự thay thế (thiết lập chung) khi hết hạn. Ctrl+Click để áp dụng lên nhóm con. +STR_GROUP_REPLACE_PROTECTION_TOOLTIP :{BLACK}Không để nhóm này tự thay thế (thiết lập chung) khi hết hạn. Ctrl+Click để áp dụng lên nhóm con STR_QUERY_GROUP_DELETE_CAPTION :{WHITE}Xóa Nhóm STR_GROUP_DELETE_QUERY_TEXT :{WHITE}Bạn có chắc chắn muốn xóa nhóm này và tất cả con của nó? @@ -5806,6 +5810,10 @@ STR_TOWN_NAME :{TOWN} STR_VEHICLE_NAME :{VEHICLE} STR_WAYPOINT_NAME :{WAYPOINT} +STR_CURRENCY_SHORT_KILO :{NBSP}k +STR_CURRENCY_SHORT_MEGA :{NBSP}tr +STR_CURRENCY_SHORT_GIGA :{NBSP}tỷ +STR_CURRENCY_SHORT_TERA :{NBSP}ktỷ STR_JUST_CARGO :{CARGO_LONG} STR_JUST_RIGHT_ARROW :{RIGHT_ARROW} diff --git a/src/language.h b/src/language.h index b70367d3be..2afaa1487f 100644 --- a/src/language.h +++ b/src/language.h @@ -37,9 +37,9 @@ struct LanguagePackHeader { char digit_group_separator_currency[8]; /** Decimal separator */ char digit_decimal_separator[8]; - uint16_t missing; ///< number of missing strings. - byte plural_form; ///< plural form index - byte text_dir; ///< default direction of the text + uint16_t missing; ///< number of missing strings. + uint8_t plural_form; ///< plural form index + uint8_t text_dir; ///< default direction of the text /** * Windows language ID: * Windows cannot and will not convert isocodes to something it can use to @@ -52,7 +52,7 @@ struct LanguagePackHeader { uint8_t newgrflangid; ///< newgrf language id uint8_t num_genders; ///< the number of genders of this language uint8_t num_cases; ///< the number of cases of this language - byte pad[3]; ///< pad header to be a multiple of 4 + uint8_t pad[3]; ///< pad header to be a multiple of 4 char genders[MAX_NUM_GENDERS][CASE_GENDER_LEN]; ///< the genders used by this translation char cases[MAX_NUM_CASES][CASE_GENDER_LEN]; ///< the cases used by this translation @@ -108,6 +108,6 @@ extern std::unique_ptr _current_collator; #endif /* WITH_ICU_I18N */ bool ReadLanguagePack(const LanguageMetadata *lang); -const LanguageMetadata *GetLanguage(byte newgrflangid); +const LanguageMetadata *GetLanguage(uint8_t newgrflangid); #endif /* LANGUAGE_H */ diff --git a/src/league_type.h b/src/league_type.h index 335edd78b3..8954d66e5f 100644 --- a/src/league_type.h +++ b/src/league_type.h @@ -11,7 +11,7 @@ #define LEAGUE_TYPE_H /** Types of the possible link targets. */ -enum LinkType : byte { +enum LinkType : uint8_t { LT_NONE = 0, ///< No link LT_TILE = 1, ///< Link a tile LT_INDUSTRY = 2, ///< Link an industry diff --git a/src/linkgraph/linkgraph_type.h b/src/linkgraph/linkgraph_type.h index 4456f20c36..6a782a4a94 100644 --- a/src/linkgraph/linkgraph_type.h +++ b/src/linkgraph/linkgraph_type.h @@ -19,7 +19,7 @@ static const LinkGraphJobID INVALID_LINK_GRAPH_JOB = UINT16_MAX; typedef uint16_t NodeID; static const NodeID INVALID_NODE = UINT16_MAX; -enum DistributionType : byte { +enum DistributionType : uint8_t { DT_MANUAL = 0, ///< Manual distribution. No link graph calculations are run. DT_ASYMMETRIC = 1, ///< Asymmetric distribution. Usually cargo will only travel in one direction. DT_SYMMETRIC = 2, ///< Symmetric distribution. The same amount of cargo travels in each direction between each pair of nodes. diff --git a/src/linkgraph/refresh.cpp b/src/linkgraph/refresh.cpp index ef35de42a1..08808cc6f2 100644 --- a/src/linkgraph/refresh.cpp +++ b/src/linkgraph/refresh.cpp @@ -109,7 +109,7 @@ bool LinkRefresher::HandleRefit(CargoID refit_cargo) /* Back up the vehicle's cargo type */ CargoID temp_cid = v->cargo_type; - byte temp_subtype = v->cargo_subtype; + uint8_t temp_subtype = v->cargo_subtype; v->cargo_type = this->cargo; if (e->refit_capacity_values == nullptr || !(e->callbacks_used & SGCU_REFIT_CB_ALL_CARGOES) || this->cargo == e->GetDefaultCargoType() || (e->type == VEH_AIRCRAFT && IsCargoInClass(this->cargo, CC_PASSENGERS))) { /* This can be omitted when the refit capacity values are already determined, and the capacity is definitely from the refit callback */ diff --git a/src/livery.h b/src/livery.h index dac0378754..f10eee6fd9 100644 --- a/src/livery.h +++ b/src/livery.h @@ -13,12 +13,12 @@ #include "company_type.h" #include "gfx_type.h" -static const byte LIT_NONE = 0; ///< Don't show the liveries at all -static const byte LIT_COMPANY = 1; ///< Show the liveries of your own company -static const byte LIT_ALL = 2; ///< Show the liveries of all companies +static const uint8_t LIT_NONE = 0; ///< Don't show the liveries at all +static const uint8_t LIT_COMPANY = 1; ///< Show the liveries of your own company +static const uint8_t LIT_ALL = 2; ///< Show the liveries of all companies /** List of different livery schemes. */ -enum LiveryScheme { +enum LiveryScheme : uint8_t { LS_BEGIN = 0, LS_DEFAULT = 0, @@ -59,10 +59,10 @@ enum LiveryScheme { DECLARE_POSTFIX_INCREMENT(LiveryScheme) /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** List of different livery classes, used only by the livery GUI. */ -enum LiveryClass : byte { +enum LiveryClass : uint8_t { LC_OTHER, LC_RAIL, LC_ROAD, @@ -78,7 +78,7 @@ DECLARE_ENUM_AS_ADDABLE(LiveryClass) /** Information about a particular livery. */ struct Livery { - byte in_use; ///< Bit 0 set if this livery should override the default livery first colour, Bit 1 for the second colour. + uint8_t in_use; ///< Bit 0 set if this livery should override the default livery first colour, Bit 1 for the second colour. Colours colour1; ///< First colour, for all vehicles. Colours colour2; ///< Second colour, for vehicles with 2CC support. }; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 0798448cfa..f4aa06cd2d 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -361,7 +361,7 @@ struct MainWindow : Window case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break; case GHK_CRASH: // Crash the game - *(volatile byte *)nullptr = 0; + *(volatile uint8_t *)nullptr = 0; break; case GHK_MONEY: // Gimme money @@ -641,7 +641,7 @@ void ShowSelectGameWindow(); void SetupColoursAndInitialWindow() { for (Colours i = COLOUR_BEGIN; i != COLOUR_END; i++) { - const byte *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour) + 1; + const uint8_t *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour) + 1; assert(b != nullptr); for (ColourShade j = SHADE_BEGIN; j < SHADE_END; j++) { SetColourGradient(i, j, b[0xC6 + j]); diff --git a/src/map.cpp b/src/map.cpp index 57ce44b26e..9b57237ce8 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -93,7 +93,7 @@ void AllocateMap(uint size_x, uint size_y) const size_t total_size = (sizeof(Tile) + sizeof(TileExtended)) * _map_size; - byte *buf = nullptr; + uint8_t *buf = nullptr; #if defined(__linux__) && defined(MADV_HUGEPAGE) const size_t alignment = 2 * 1024 * 1024; /* First try mmap with a 2MB alignment, if that fails, just use calloc */ @@ -106,7 +106,7 @@ void AllocateMap(uint size_x, uint size_y) /* target is now aligned, allocated has been adjusted accordingly */ - const size_t remove_front = static_cast(target) - static_cast(ret); + const size_t remove_front = static_cast(target) - static_cast(ret); if (remove_front != 0) { munmap(ret, remove_front); } @@ -119,13 +119,13 @@ void AllocateMap(uint size_x, uint size_y) madvise(target, total_size, MADV_HUGEPAGE); DEBUG(map, 2, "Using mmap for map allocation"); - buf = static_cast(target); + buf = static_cast(target); _munmap_size = total_size; } } #endif - if (buf == nullptr) buf = CallocT(total_size); + if (buf == nullptr) buf = CallocT(total_size); _m = reinterpret_cast(buf); _me = reinterpret_cast(buf + (_map_size * sizeof(Tile))); diff --git a/src/map_type.h b/src/map_type.h index eb3bdbda9c..da2a6fef9a 100644 --- a/src/map_type.h +++ b/src/map_type.h @@ -15,13 +15,13 @@ * Look at docs/landscape.html for the exact meaning of the members. */ struct Tile { - byte type; ///< The type (bits 4..7), bridges (2..3), rainforest/desert (0..1) - byte height; ///< The height of the northern corner. - uint16_t m2; ///< Primarily used for indices to towns, industries and stations - byte m1; ///< Primarily used for ownership information - byte m3; ///< General purpose - byte m4; ///< General purpose - byte m5; ///< General purpose + uint8_t type; ///< The type (bits 4..7), bridges (2..3), rainforest/desert (0..1) + uint8_t height; ///< The height of the northern corner. + uint16_t m2; ///< Primarily used for indices to towns, industries and stations + uint8_t m1; ///< Primarily used for ownership information + uint8_t m3; ///< General purpose + uint8_t m4; ///< General purpose + uint8_t m5; ///< General purpose }; static_assert(sizeof(Tile) == 8); @@ -31,8 +31,8 @@ static_assert(sizeof(Tile) == 8); * Look at docs/landscape.html for the exact meaning of the members. */ struct TileExtended { - byte m6; ///< General purpose - byte m7; ///< Primarily used for newgrf support + uint8_t m6; ///< General purpose + uint8_t m7; ///< Primarily used for newgrf support uint16_t m8; ///< General purpose }; @@ -80,7 +80,7 @@ static const uint MAX_MAP_TILES = 1U << MAX_MAP_TILES_BITS; ///< Maximal nu #define STRAIGHT_TRACK_LENGTH 7071/10000 /** Argument for CmdLevelLand describing what to do. */ -enum LevelMode { +enum LevelMode : uint8_t { LM_LEVEL, ///< Level the land. LM_LOWER, ///< Lower the land. LM_RAISE, ///< Raise the land. diff --git a/src/misc/fixedsizearray.hpp b/src/misc/fixedsizearray.hpp index 7a2c97b58b..f06492ff13 100644 --- a/src/misc/fixedsizearray.hpp +++ b/src/misc/fixedsizearray.hpp @@ -41,13 +41,13 @@ protected: /** return reference to the array header (non-const) */ inline ArrayHeader &Hdr() { - return *(ArrayHeader*)(((byte*)data) - HeaderSize); + return *(ArrayHeader*)(((uint8_t*)data) - HeaderSize); } /** return reference to the array header (const) */ inline const ArrayHeader &Hdr() const { - return *(ArrayHeader*)(((byte*)data) - HeaderSize); + return *(ArrayHeader*)(((uint8_t*)data) - HeaderSize); } /** return reference to the block reference counter */ @@ -70,7 +70,7 @@ public: static_assert(C < (SIZE_MAX - HeaderSize) / Tsize); /* allocate block for header + items (don't construct items) */ - data = (T*)((MallocT(HeaderSize + C * Tsize)) + HeaderSize); + data = (T*)((MallocT(HeaderSize + C * Tsize)) + HeaderSize); SizeRef() = 0; // initial number of items RefCnt() = 1; // initial reference counter } @@ -91,7 +91,7 @@ public: Clear(); /* free the memory block occupied by items */ - free(((byte*)data) - HeaderSize); + free(((uint8_t*)data) - HeaderSize); data = nullptr; } diff --git a/src/misc/getoptdata.h b/src/misc/getoptdata.h index 858d61f10e..b62d20c2db 100644 --- a/src/misc/getoptdata.h +++ b/src/misc/getoptdata.h @@ -20,7 +20,7 @@ enum OptionDataFlags { /** Data of an option. */ struct OptionData { - byte id; ///< Unique identification of this option data, often the same as #shortname. + uint8_t id; ///< Unique identification of this option data, often the same as #shortname. char shortname; ///< Short option letter if available, else use \c '\0'. uint16_t flags; ///< Option data flags. @see OptionDataFlags const char *longname; ///< Long option name including '-'/'--' prefix, use \c nullptr if not available. diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 4e1bbf866e..c81014ce24 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -213,7 +213,7 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t PauseMode prev_mode = _pause_mode; if ((p2 & 1) == 0) { - _pause_mode = static_cast(_pause_mode & (byte)~p1); + _pause_mode = static_cast(_pause_mode & (uint8_t)~p1); _pause_countdown = (p2 >> 1); /* If the only remaining reason to be paused is that we saw a command during pause, unpause. */ @@ -221,7 +221,7 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint32_t _pause_mode = PM_UNPAUSED; } } else { - _pause_mode = static_cast(_pause_mode | (byte)p1); + _pause_mode = static_cast(_pause_mode | (uint8_t)p1); } NetworkHandlePauseChange(prev_mode, (PauseMode)p1); diff --git a/src/music.cpp b/src/music.cpp index 7e597c187f..f602f2cadc 100644 --- a/src/music.cpp +++ b/src/music.cpp @@ -35,7 +35,7 @@ char *GetMusicCatEntryName(const std::string &filename, size_t entrynum) if (entrynum < entry_count) { file.SeekTo(entrynum * 8, SEEK_SET); file.SeekTo(file.ReadDword(), SEEK_SET); - byte namelen = file.ReadByte(); + uint8_t namelen = file.ReadByte(); char *name = MallocT(namelen + 1); file.ReadBlock(name, namelen); name[namelen] = '\0'; @@ -52,7 +52,7 @@ char *GetMusicCatEntryName(const std::string &filename, size_t entrynum) * @return Pointer to buffer with data read, caller is responsible for freeind memory, * nullptr if entrynum does not exist. */ -byte *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen) +uint8_t *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen) { entrylen = 0; if (!FioCheckFileExists(filename, BASESET_DIR)) return nullptr; @@ -66,7 +66,7 @@ byte *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t entrylen = file.ReadDword(); file.SeekTo(entrypos, SEEK_SET); file.SkipBytes(file.ReadByte()); - byte *data = MallocT(entrylen); + uint8_t *data = MallocT(entrylen); file.ReadBlock(data, entrylen); return data; } diff --git a/src/music/allegro_m.cpp b/src/music/allegro_m.cpp index 61edf81091..4b2b540498 100644 --- a/src/music/allegro_m.cpp +++ b/src/music/allegro_m.cpp @@ -80,7 +80,7 @@ bool MusicDriver_Allegro::IsSongPlaying() return midi_pos >= 0; } -void MusicDriver_Allegro::SetVolume(byte vol) +void MusicDriver_Allegro::SetVolume(uint8_t vol) { set_volume(-1, vol); } diff --git a/src/music/allegro_m.h b/src/music/allegro_m.h index b07a7073b6..697fad4661 100644 --- a/src/music/allegro_m.h +++ b/src/music/allegro_m.h @@ -25,7 +25,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "allegro"; } }; diff --git a/src/music/bemidi.cpp b/src/music/bemidi.cpp index 3e4f5b311c..6fda4cfe06 100644 --- a/src/music/bemidi.cpp +++ b/src/music/bemidi.cpp @@ -69,7 +69,7 @@ bool MusicDriver_BeMidi::IsSongPlaying() return !this->midi_synth_file->IsFinished(); } -void MusicDriver_BeMidi::SetVolume(byte vol) +void MusicDriver_BeMidi::SetVolume(uint8_t vol) { this->current_volume = vol / 128.0; if (this->midi_synth_file != nullptr) this->midi_synth_file->SetVolume(this->current_volume); diff --git a/src/music/bemidi.h b/src/music/bemidi.h index c4ab1f3599..52e9d7bd68 100644 --- a/src/music/bemidi.h +++ b/src/music/bemidi.h @@ -28,7 +28,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "bemidi"; } private: diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp index 3dae967f6c..ecdfb06e59 100644 --- a/src/music/cocoa_m.cpp +++ b/src/music/cocoa_m.cpp @@ -37,7 +37,7 @@ static MusicPlayer _player = nullptr; static MusicSequence _sequence = nullptr; static MusicTimeStamp _seq_length = 0; static bool _playing = false; -static byte _volume = 127; +static uint8_t _volume = 127; /** Set the volume of the current sequence. */ @@ -193,7 +193,7 @@ void MusicDriver_Cocoa::StopSong() * * @param vol The desired volume, range of the value is @c 0-127 */ -void MusicDriver_Cocoa::SetVolume(byte vol) +void MusicDriver_Cocoa::SetVolume(uint8_t vol) { _volume = vol; DoSetVolume(); diff --git a/src/music/cocoa_m.h b/src/music/cocoa_m.h index 046a60c386..ffa87b00fc 100644 --- a/src/music/cocoa_m.h +++ b/src/music/cocoa_m.h @@ -24,7 +24,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "cocoa"; } }; diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index e22de5152f..2146542859 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -128,7 +128,7 @@ struct DMusicPlayback { bool do_stop; ///< flag for stopping playback at next opportunity int preload_time; ///< preload time for music blocks. - byte new_volume; ///< volume setting to change to + uint8_t new_volume; ///< volume setting to change to MidiFile next_file; ///< upcoming file to play PlaybackSegment next_segment; ///< segment info for upcoming file @@ -534,12 +534,12 @@ bool DLSFile::LoadFile(const wchar_t *file) } -static byte ScaleVolume(byte original, byte scale) +static uint8_t ScaleVolume(uint8_t original, uint8_t scale) { return original * scale / 127; } -static void TransmitChannelMsg(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte status, byte p1, byte p2 = 0) +static void TransmitChannelMsg(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, uint8_t status, uint8_t p1, uint8_t p2 = 0) { if (buffer->PackStructured(rt, 0, status | (p1 << 8) | (p2 << 16)) == E_OUTOFMEMORY) { /* Buffer is full, clear it and try again. */ @@ -550,10 +550,10 @@ static void TransmitChannelMsg(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, by } } -static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const byte *&msg_start, size_t &remaining) +static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const uint8_t *&msg_start, size_t &remaining) { /* Find end of message. */ - const byte *msg_end = msg_start; + const uint8_t *msg_end = msg_start; while (*msg_end != MIDIST_ENDSYSEX) msg_end++; msg_end++; // Also include SysEx end byte. @@ -573,7 +573,7 @@ static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const b static void TransmitStandardSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, MidiSysexMessage msg) { size_t length = 0; - const byte *data = MidiGetStandardSysexMessage(msg, length); + const uint8_t *data = MidiGetStandardSysexMessage(msg, length); TransmitSysex(buffer, rt, data, length); } @@ -609,8 +609,8 @@ static void MidiThreadProc() MidiFile current_file; // file currently being played from PlaybackSegment current_segment; // segment info for current playback size_t current_block = 0; // next block index to send - byte current_volume = 0; // current effective volume setting - byte channel_volumes[16]; // last seen volume controller values in raw data + uint8_t current_volume = 0; // current effective volume setting + uint8_t channel_volumes[16]; // last seen volume controller values in raw data /* Get pointer to the reference clock of our output port. */ IReferenceClock *clock; @@ -665,7 +665,7 @@ static void MidiThreadProc() clock->GetTime(&cur_time); TransmitNotesOff(_buffer, block_time, cur_time); - MemSetT(channel_volumes, 127, lengthof(channel_volumes)); + MemSetT(channel_volumes, 127, lengthof(channel_volumes)); /* Invalidate current volume. */ current_volume = UINT8_MAX; last_volume_time = 0; @@ -750,13 +750,13 @@ static void MidiThreadProc() block_time = playback_start_time + block.realtime * MIDITIME_TO_REFTIME; DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME)); - const byte *data = block.data.data(); + const uint8_t *data = block.data.data(); size_t remaining = block.data.size(); - byte last_status = 0; + uint8_t last_status = 0; while (remaining > 0) { /* MidiFile ought to have converted everything out of running status, * but handle it anyway just to be safe */ - byte status = data[0]; + uint8_t status = data[0]; if (status & 0x80) { last_status = status; data++; @@ -1248,7 +1248,7 @@ bool MusicDriver_DMusic::IsSongPlaying() } -void MusicDriver_DMusic::SetVolume(byte vol) +void MusicDriver_DMusic::SetVolume(uint8_t vol) { _playback.new_volume = vol; } diff --git a/src/music/dmusic.h b/src/music/dmusic.h index 616bf01208..9c2e009dcd 100644 --- a/src/music/dmusic.h +++ b/src/music/dmusic.h @@ -27,7 +27,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "dmusic"; } }; diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index e40d565e02..e12440bf7e 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -98,7 +98,7 @@ bool MusicDriver_ExtMidi::IsSongPlaying() return this->pid != -1; } -void MusicDriver_ExtMidi::SetVolume(byte) +void MusicDriver_ExtMidi::SetVolume(uint8_t) { DEBUG(driver, 1, "extmidi: set volume not implemented"); } diff --git a/src/music/extmidi.h b/src/music/extmidi.h index d9bb243826..fdd7f8ca08 100644 --- a/src/music/extmidi.h +++ b/src/music/extmidi.h @@ -33,7 +33,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "extmidi"; } bool IsInFailedState() override { return this->failed; } diff --git a/src/music/fluidsynth.cpp b/src/music/fluidsynth.cpp index cdb8584aaf..be5f52c4e3 100644 --- a/src/music/fluidsynth.cpp +++ b/src/music/fluidsynth.cpp @@ -183,7 +183,7 @@ bool MusicDriver_FluidSynth::IsSongPlaying() return fluid_player_get_status(_midi.player) == FLUID_PLAYER_PLAYING; } -void MusicDriver_FluidSynth::SetVolume(byte vol) +void MusicDriver_FluidSynth::SetVolume(uint8_t vol) { std::lock_guard lock{ _midi.synth_mutex }; if (_midi.settings == nullptr) return; diff --git a/src/music/fluidsynth.h b/src/music/fluidsynth.h index 91543662d0..8eac4c000a 100644 --- a/src/music/fluidsynth.h +++ b/src/music/fluidsynth.h @@ -25,7 +25,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "fluidsynth"; } }; diff --git a/src/music/midi.h b/src/music/midi.h index 38f82220f4..a0546a8e88 100644 --- a/src/music/midi.h +++ b/src/music/midi.h @@ -152,6 +152,6 @@ enum class MidiSysexMessage { RolandSetReverb, }; -const byte *MidiGetStandardSysexMessage(MidiSysexMessage msg, size_t &length); +const uint8_t *MidiGetStandardSysexMessage(MidiSysexMessage msg, size_t &length); #endif /* MUSIC_MIDI_H */ diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp index 32edc42841..bcaa5a4475 100644 --- a/src/music/midifile.cpp +++ b/src/music/midifile.cpp @@ -30,12 +30,12 @@ static MidiFile *_midifile_instance = nullptr; * @param[out] length Receives the length of the returned buffer * @return Pointer to byte buffer with sysex message */ -const byte *MidiGetStandardSysexMessage(MidiSysexMessage msg, size_t &length) +const uint8_t *MidiGetStandardSysexMessage(MidiSysexMessage msg, size_t &length) { - static byte reset_gm_sysex[] = { 0xF0, 0x7E, 0x7F, 0x09, 0x01, 0xF7 }; - static byte reset_gs_sysex[] = { 0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7F, 0x00, 0x41, 0xF7 }; - static byte reset_xg_sysex[] = { 0xF0, 0x43, 0x10, 0x4C, 0x00, 0x00, 0x7E, 0x00, 0xF7 }; - static byte roland_reverb_sysex[] = { 0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x30, 0x02, 0x04, 0x00, 0x40, 0x40, 0x00, 0x00, 0x09, 0xF7 }; + static uint8_t reset_gm_sysex[] = { 0xF0, 0x7E, 0x7F, 0x09, 0x01, 0xF7 }; + static uint8_t reset_gs_sysex[] = { 0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7F, 0x00, 0x41, 0xF7 }; + static uint8_t reset_xg_sysex[] = { 0xF0, 0x43, 0x10, 0x4C, 0x00, 0x00, 0x7E, 0x00, 0xF7 }; + static uint8_t roland_reverb_sysex[] = { 0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x30, 0x02, 0x04, 0x00, 0x40, 0x40, 0x00, 0x00, 0x09, 0xF7 }; switch (msg) { case MidiSysexMessage::ResetGM: @@ -60,7 +60,7 @@ const byte *MidiGetStandardSysexMessage(MidiSysexMessage msg, size_t &length) * RAII-compliant to make teardown in error situations easier. */ class ByteBuffer { - std::vector buf; + std::vector buf; size_t pos; public: /** @@ -104,7 +104,7 @@ public: * @param[out] b returns the read value * @return true if a byte was available for reading */ - bool ReadByte(byte &b) + bool ReadByte(uint8_t &b) { if (this->IsEnd()) return false; b = this->buf[this->pos++]; @@ -121,7 +121,7 @@ public: bool ReadVariableLength(uint32_t &res) { res = 0; - byte b = 0; + uint8_t b = 0; do { if (this->IsEnd()) return false; b = this->buf[this->pos++]; @@ -136,7 +136,7 @@ public: * @param length number of bytes to read * @return true if the requested number of bytes were available */ - bool ReadBuffer(byte *dest, size_t length) + bool ReadBuffer(uint8_t *dest, size_t length) { if (this->IsEnd()) return false; if (this->buf.size() - this->pos < length) return false; @@ -188,9 +188,9 @@ public: static bool ReadTrackChunk(FILE *file, MidiFile &target) { - byte buf[4]; + uint8_t buf[4]; - const byte magic[] = { 'M', 'T', 'r', 'k' }; + const uint8_t magic[] = { 'M', 'T', 'r', 'k' }; if (fread(buf, sizeof(magic), 1, file) != 1) { return false; } @@ -213,7 +213,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target) target.blocks.push_back(MidiFile::DataBlock()); MidiFile::DataBlock *block = &target.blocks.back(); - byte last_status = 0; + uint8_t last_status = 0; bool running_sysex = false; while (!chunk.IsEnd()) { /* Read deltatime for event, start new block */ @@ -227,7 +227,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target) } /* Read status byte */ - byte status; + uint8_t status; if (!chunk.ReadByte(status)) { return false; } @@ -422,13 +422,13 @@ bool MidiFile::ReadSMFHeader(const char *filename, SMFHeader &header) bool MidiFile::ReadSMFHeader(FILE *file, SMFHeader &header) { /* Try to read header, fixed size */ - byte buffer[14]; + uint8_t buffer[14]; if (fread(buffer, sizeof(buffer), 1, file) != 1) { return false; } /* Check magic, 'MThd' followed by 4 byte length indicator (always = 6 in SMF) */ - const byte magic[] = { 'M', 'T', 'h', 'd', 0x00, 0x00, 0x00, 0x06 }; + const uint8_t magic[] = { 'M', 'T', 'h', 'd', 0x00, 0x00, 0x00, 0x06 }; if (MemCmpT(buffer, magic, sizeof(magic)) != 0) { return false; } @@ -505,12 +505,12 @@ cleanup: struct MpsMachine { /** Starting parameter and playback status for one channel/track */ struct Channel { - byte cur_program; ///< program selected, used for velocity scaling (lookup into programvelocities array) - byte running_status; ///< last midi status code seen - uint16_t delay; ///< frames until next command - uint32_t playpos; ///< next byte to play this channel from - uint32_t startpos; ///< start position of master track - uint32_t returnpos; ///< next return position after playing a segment + uint8_t cur_program; ///< program selected, used for velocity scaling (lookup into programvelocities array) + uint8_t running_status; ///< last midi status code seen + uint16_t delay; ///< frames until next command + uint32_t playpos; ///< next byte to play this channel from + uint32_t startpos; ///< start position of master track + uint32_t returnpos; ///< next return position after playing a segment Channel() : cur_program(0xFF), running_status(0), delay(0), playpos(0), startpos(0), returnpos(0) { } }; Channel channels[16]; ///< playback status for each MIDI channel @@ -521,9 +521,9 @@ struct MpsMachine { bool shouldplayflag; ///< not-end-of-song flag static const int TEMPO_RATE; - static const byte programvelocities[128]; + static const uint8_t programvelocities[128]; - const byte *songdata; ///< raw data array + const uint8_t *songdata; ///< raw data array size_t songdatalen; ///< length of song data MidiFile ⌖ ///< recipient of data @@ -534,12 +534,12 @@ struct MpsMachine { MPSMIDIST_ENDSONG = 0xFF, ///< immediately end the song }; - static void AddMidiData(MidiFile::DataBlock &block, byte b1, byte b2) + static void AddMidiData(MidiFile::DataBlock &block, uint8_t b1, uint8_t b2) { block.data.push_back(b1); block.data.push_back(b2); } - static void AddMidiData(MidiFile::DataBlock &block, byte b1, byte b2, byte b3) + static void AddMidiData(MidiFile::DataBlock &block, uint8_t b1, uint8_t b2, uint8_t b3) { block.data.push_back(b1); block.data.push_back(b2); @@ -552,7 +552,7 @@ struct MpsMachine { * @param length Length of the data buffer in bytes * @param target MidiFile object to add decoded data to */ - MpsMachine(const byte *data, size_t length, MidiFile &target) + MpsMachine(const uint8_t *data, size_t length, MidiFile &target) : songdata(data), songdatalen(length), target(target) { uint32_t pos = 0; @@ -580,7 +580,7 @@ struct MpsMachine { /* Similar structure to segments list, but also has * the MIDI channel number as a byte before the offset * to next track. */ - byte ch = this->songdata[pos++]; + uint8_t ch = this->songdata[pos++]; this->channels[ch].startpos = pos + 4; pos += FROM_LE16(*(const int16_t *)(this->songdata + pos)); } @@ -593,7 +593,7 @@ struct MpsMachine { */ uint16_t ReadVariableLength(uint32_t &pos) { - byte b = 0; + uint8_t b = 0; uint16_t res = 0; do { b = this->songdata[pos++]; @@ -627,7 +627,7 @@ struct MpsMachine { uint16_t PlayChannelFrame(MidiFile::DataBlock &outblock, int channel) { uint16_t newdelay = 0; - byte b1, b2; + uint8_t b1, b2; Channel &chandata = this->channels[channel]; do { @@ -811,7 +811,7 @@ struct MpsMachine { /** Frames/ticks per second for music playback */ const int MpsMachine::TEMPO_RATE = 148; /** Base note velocities for various GM programs */ -const byte MpsMachine::programvelocities[128] = { +const uint8_t MpsMachine::programvelocities[128] = { 100, 100, 100, 100, 100, 90, 100, 100, 100, 100, 100, 90, 100, 100, 100, 100, 100, 100, 85, 100, 100, 100, 100, 100, 100, 100, 100, 100, 90, 90, 110, 80, 100, 100, 100, 90, 70, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, @@ -828,7 +828,7 @@ const byte MpsMachine::programvelocities[128] = { * @param length size of data in bytes * @return true if the data could be loaded */ -bool MidiFile::LoadMpsData(const byte *data, size_t length) +bool MidiFile::LoadMpsData(const uint8_t *data, size_t length) { _midifile_instance = this; @@ -844,7 +844,7 @@ bool MidiFile::LoadSong(const MusicSongInfo &song) case MTT_MPSMIDI: { size_t songdatalen = 0; - byte *songdata = GetMusicCatEntryData(song.filename, song.cat_index, songdatalen); + uint8_t *songdata = GetMusicCatEntryData(song.filename, song.cat_index, songdatalen); if (songdata != nullptr) { bool result = this->LoadMpsData(songdata, songdatalen); free(songdata); @@ -878,21 +878,21 @@ void MidiFile::MoveFrom(MidiFile &other) static void WriteVariableLen(FILE *f, uint32_t value) { if (value <= 0x7F) { - byte tb = value; + uint8_t tb = value; fwrite(&tb, 1, 1, f); } else if (value <= 0x3FFF) { - byte tb[2]; + uint8_t tb[2]; tb[1] = value & 0x7F; value >>= 7; tb[0] = (value & 0x7F) | 0x80; value >>= 7; fwrite(tb, 1, sizeof(tb), f); } else if (value <= 0x1FFFFF) { - byte tb[3]; + uint8_t tb[3]; tb[2] = value & 0x7F; value >>= 7; tb[1] = (value & 0x7F) | 0x80; value >>= 7; tb[0] = (value & 0x7F) | 0x80; value >>= 7; fwrite(tb, 1, sizeof(tb), f); } else if (value <= 0x0FFFFFFF) { - byte tb[4]; + uint8_t tb[4]; tb[3] = value & 0x7F; value >>= 7; tb[2] = (value & 0x7F) | 0x80; value >>= 7; tb[1] = (value & 0x7F) | 0x80; value >>= 7; @@ -914,17 +914,17 @@ bool MidiFile::WriteSMF(const char *filename) } /* SMF header */ - const byte fileheader[] = { + const uint8_t fileheader[] = { 'M', 'T', 'h', 'd', // block name 0x00, 0x00, 0x00, 0x06, // BE32 block length, always 6 bytes 0x00, 0x00, // writing format 0 (all in one track) 0x00, 0x01, // containing 1 track (BE16) - (byte)(this->tickdiv >> 8), (byte)this->tickdiv, // tickdiv in BE16 + (uint8_t)(this->tickdiv >> 8), (uint8_t)this->tickdiv, // tickdiv in BE16 }; fwrite(fileheader, sizeof(fileheader), 1, f); /* Track header */ - const byte trackheader[] = { + const uint8_t trackheader[] = { 'M', 'T', 'r', 'k', // block name 0, 0, 0, 0, // BE32 block length, unknown at this time }; @@ -953,7 +953,7 @@ bool MidiFile::WriteSMF(const char *filename) /* Write tempo change if there is one */ if (nexttempo.ticktime <= block.ticktime) { - byte tempobuf[6] = { MIDIST_SMF_META, 0x51, 0x03, 0, 0, 0 }; + uint8_t tempobuf[6] = { MIDIST_SMF_META, 0x51, 0x03, 0, 0, 0 }; tempobuf[3] = (nexttempo.tempo & 0x00FF0000) >> 16; tempobuf[4] = (nexttempo.tempo & 0x0000FF00) >> 8; tempobuf[5] = (nexttempo.tempo & 0x000000FF); @@ -970,7 +970,7 @@ bool MidiFile::WriteSMF(const char *filename) } /* Write each block data command */ - byte *dp = block.data.data(); + uint8_t *dp = block.data.data(); while (dp < block.data.data() + block.data.size()) { /* Always zero delta time inside blocks */ if (needtime) { @@ -999,7 +999,7 @@ bool MidiFile::WriteSMF(const char *filename) if (*dp == MIDIST_SYSEX) { fwrite(dp, 1, 1, f); dp++; - byte *sysexend = dp; + uint8_t *sysexend = dp; while (*sysexend != MIDIST_ENDSYSEX) sysexend++; ptrdiff_t sysexlen = sysexend - dp; WriteVariableLen(f, sysexlen); @@ -1015,7 +1015,7 @@ bool MidiFile::WriteSMF(const char *filename) } /* End of track marker */ - static const byte track_end_marker[] = { 0x00, MIDIST_SMF_META, 0x2F, 0x00 }; + static const uint8_t track_end_marker[] = { 0x00, MIDIST_SMF_META, 0x2F, 0x00 }; fwrite(&track_end_marker, sizeof(track_end_marker), 1, f); /* Fill out the RIFF block length */ @@ -1073,7 +1073,7 @@ std::string MidiFile::GetSMFFile(const MusicSongInfo &song) return output_filename; } - byte *data; + uint8_t *data; size_t datalen; data = GetMusicCatEntryData(song.filename, song.cat_index, datalen); if (data == nullptr) return std::string(); @@ -1093,7 +1093,7 @@ std::string MidiFile::GetSMFFile(const MusicSongInfo &song) } -static bool CmdDumpSMF(byte argc, char *argv[]) +static bool CmdDumpSMF(uint8_t argc, char *argv[]) { if (argc == 0) { IConsolePrint(CC_WARNING, "Write the current song to a Standard MIDI File. Usage: 'dumpsmf '"); diff --git a/src/music/midifile.hpp b/src/music/midifile.hpp index d81869bb4d..2044f6353f 100644 --- a/src/music/midifile.hpp +++ b/src/music/midifile.hpp @@ -19,9 +19,9 @@ struct MusicSongInfo; struct MidiFile { struct DataBlock { - uint32_t ticktime; ///< tick number since start of file this block should be triggered at - uint32_t realtime = 0; ///< real-time (microseconds) since start of file this block should be triggered at - std::vector data; ///< raw midi data contained in block + uint32_t ticktime; ///< tick number since start of file this block should be triggered at + uint32_t realtime = 0; ///< real-time (microseconds) since start of file this block should be triggered at + std::vector data; ///< raw midi data contained in block DataBlock(uint32_t _ticktime = 0) : ticktime(_ticktime) { } }; struct TempoChange { @@ -38,7 +38,7 @@ struct MidiFile { ~MidiFile(); bool LoadFile(const char *filename); - bool LoadMpsData(const byte *data, size_t length); + bool LoadMpsData(const uint8_t *data, size_t length); bool LoadSong(const MusicSongInfo &song); void MoveFrom(MidiFile &other); diff --git a/src/music/music_driver.hpp b/src/music/music_driver.hpp index d49cf568a8..2c79e0b57a 100644 --- a/src/music/music_driver.hpp +++ b/src/music/music_driver.hpp @@ -43,7 +43,7 @@ public: * Set the volume, if possible. * @param vol The new volume. */ - virtual void SetVolume(byte vol) = 0; + virtual void SetVolume(uint8_t vol) = 0; /** * Is playback in a failed state? diff --git a/src/music/null_m.h b/src/music/null_m.h index 5754f55642..da6e5dd92c 100644 --- a/src/music/null_m.h +++ b/src/music/null_m.h @@ -25,7 +25,7 @@ public: bool IsSongPlaying() override { return true; } - void SetVolume(byte) override { } + void SetVolume(uint8_t) override { } const char *GetName() const override { return "null"; } }; diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index 69301bcaf3..eadf3828d7 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -37,8 +37,8 @@ static struct { bool playing; ///< flag indicating that playback is active int do_start; ///< flag for starting playback of next_file at next opportunity bool do_stop; ///< flag for stopping playback at next opportunity - byte current_volume; ///< current effective volume setting - byte new_volume; ///< volume setting to change to + uint8_t current_volume; ///< current effective volume setting + uint8_t new_volume; ///< volume setting to change to MidiFile current_file; ///< file currently being played from PlaybackSegment current_segment; ///< segment info for current playback @@ -47,13 +47,13 @@ static struct { MidiFile next_file; ///< upcoming file to play PlaybackSegment next_segment; ///< segment info for upcoming file - byte channel_volumes[16]; ///< last seen volume controller values in raw data + uint8_t channel_volumes[16]; ///< last seen volume controller values in raw data } _midi; static FMusicDriver_Win32 iFMusicDriver_Win32; -static byte ScaleVolume(byte original, byte scale) +static uint8_t ScaleVolume(uint8_t original, uint8_t scale) { return original * scale / 127; } @@ -68,21 +68,21 @@ void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR, DWORD_PTR dwParam1 } } -static void TransmitChannelMsg(byte status, byte p1, byte p2 = 0) +static void TransmitChannelMsg(uint8_t status, uint8_t p1, uint8_t p2 = 0) { midiOutShortMsg(_midi.midi_out, status | (p1 << 8) | (p2 << 16)); } -static void TransmitSysex(const byte *&msg_start, size_t &remaining) +static void TransmitSysex(const uint8_t *&msg_start, size_t &remaining) { /* find end of message */ - const byte *msg_end = msg_start; + const uint8_t *msg_end = msg_start; while (*msg_end != MIDIST_ENDSYSEX) msg_end++; msg_end++; /* also include sysex end byte */ /* prepare header */ MIDIHDR *hdr = CallocT(1); - hdr->lpData = reinterpret_cast(const_cast(msg_start)); + hdr->lpData = reinterpret_cast(const_cast(msg_start)); hdr->dwBufferLength = msg_end - msg_start; if (midiOutPrepareHeader(_midi.midi_out, hdr, sizeof(*hdr)) == MMSYSERR_NOERROR) { /* transmit - just point directly into the data buffer */ @@ -100,7 +100,7 @@ static void TransmitSysex(const byte *&msg_start, size_t &remaining) static void TransmitStandardSysex(MidiSysexMessage msg) { size_t length = 0; - const byte *data = MidiGetStandardSysexMessage(msg, length); + const uint8_t *data = MidiGetStandardSysexMessage(msg, length); TransmitSysex(data, length); } @@ -164,7 +164,7 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR _midi.do_start = 0; _midi.current_block = 0; - MemSetT(_midi.channel_volumes, 127, lengthof(_midi.channel_volumes)); + MemSetT(_midi.channel_volumes, 127, lengthof(_midi.channel_volumes)); /* Invalidate current volume. */ _midi.current_volume = UINT8_MAX; volume_throttle = 0; @@ -184,7 +184,7 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR _midi.current_volume = _midi.new_volume; volume_throttle = 20 / _midi.time_period; for (int ch = 0; ch < 16; ch++) { - byte vol = ScaleVolume(_midi.channel_volumes[ch], _midi.current_volume); + uint8_t vol = ScaleVolume(_midi.channel_volumes[ch], _midi.current_volume); TransmitChannelMsg(MIDIST_CONTROLLER | ch, MIDICT_CHANVOLUME, vol); } } else { @@ -242,13 +242,13 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR break; } - const byte *data = block.data.data(); + const uint8_t *data = block.data.data(); size_t remaining = block.data.size(); - byte last_status = 0; + uint8_t last_status = 0; while (remaining > 0) { /* MidiFile ought to have converted everything out of running status, * but handle it anyway just to be safe */ - byte status = data[0]; + uint8_t status = data[0]; if (status & 0x80) { last_status = status; data++; @@ -361,7 +361,7 @@ bool MusicDriver_Win32::IsSongPlaying() return _midi.playing || (_midi.do_start != 0); } -void MusicDriver_Win32::SetVolume(byte vol) +void MusicDriver_Win32::SetVolume(uint8_t vol) { std::lock_guard mutex_lock(_midi.lock); _midi.new_volume = vol; diff --git a/src/music/win32_m.h b/src/music/win32_m.h index 5101d29321..74c0b938a6 100644 --- a/src/music/win32_m.h +++ b/src/music/win32_m.h @@ -25,7 +25,7 @@ public: bool IsSongPlaying() override; - void SetVolume(byte vol) override; + void SetVolume(uint8_t vol) override; const char *GetName() const override { return "win32"; } }; diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 91586c7495..84f4df805c 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -436,7 +436,7 @@ void MusicSystem::ChangePlaylistPosition(int ofs) */ void MusicSystem::SaveCustomPlaylist(PlaylistChoices pl) { - byte *settings_pl; + uint8_t *settings_pl; if (pl == PLCH_CUSTOM1) { settings_pl = _settings_client.music.custom_1; } else if (pl == PLCH_CUSTOM2) { @@ -450,7 +450,7 @@ void MusicSystem::SaveCustomPlaylist(PlaylistChoices pl) for (const auto &song : this->standard_playlists[pl]) { /* Music set indices in the settings playlist are 1-based, 0 means unused slot */ - settings_pl[num++] = (byte)song.set_index + 1; + settings_pl[num++] = (uint8_t)song.set_index + 1; } } @@ -833,7 +833,7 @@ struct MusicWindow : public Window { break; case WID_M_MUSIC_VOL: case WID_M_EFFECT_VOL: { // volume sliders - byte &vol = (widget == WID_M_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; + uint8_t &vol = (widget == WID_M_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; if (ClickSliderWidget(this->GetWidget(widget)->GetCurrentRect(), pt, 0, INT8_MAX, vol)) { if (widget == WID_M_MUSIC_VOL) { MusicDriver::GetInstance()->SetVolume(vol); diff --git a/src/network/core/config.h b/src/network/core/config.h index d88535fbb4..d9335fa854 100644 --- a/src/network/core/config.h +++ b/src/network/core/config.h @@ -46,10 +46,10 @@ static const std::string NETWORK_SURVEY_DETAILS_LINK = "https://survey.openttd.o static const size_t TCP_MTU = 32767; ///< Number of bytes we can pack in a single TCP packet static const size_t COMPAT_MTU = 1460; ///< Number of bytes we can pack in a single packet for backward compatibility -static const byte NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use? -static const byte NETWORK_GAME_INFO_VERSION = 7; ///< What version of game-info do we use? -static const byte NETWORK_COORDINATOR_VERSION = 6; ///< What version of game-coordinator-protocol do we use? -static const byte NETWORK_SURVEY_VERSION = 2; ///< What version of the survey do we use? +static const uint8_t NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use? +static const uint8_t NETWORK_GAME_INFO_VERSION = 7; ///< What version of game-info do we use? +static const uint8_t NETWORK_COORDINATOR_VERSION = 6; ///< What version of game-coordinator-protocol do we use? +static const uint8_t NETWORK_SURVEY_VERSION = 2; ///< What version of the survey do we use? static const uint NETWORK_NAME_LENGTH = 80; ///< The maximum length of the server name and map name, in bytes including '\0' static const uint NETWORK_COMPANY_NAME_LENGTH = 128; ///< The maximum length of the company name, in bytes including '\0' diff --git a/src/network/core/network_game_info.cpp b/src/network/core/network_game_info.cpp index 5ad6abf40f..9d64bf87de 100644 --- a/src/network/core/network_game_info.cpp +++ b/src/network/core/network_game_info.cpp @@ -155,7 +155,7 @@ const NetworkServerGameInfo &GetCurrentNetworkServerGameInfo() * - invite_code * These don't need to be updated manually here. */ - _network_game_info.companies_on = (byte)Company::GetNumItems(); + _network_game_info.companies_on = (uint8_t)Company::GetNumItems(); _network_game_info.spectators_on = NetworkSpectatorCount(); _network_game_info.calendar_date = CalTime::CurDate(); _network_game_info.ticks_playing = _scaled_tick_counter; @@ -338,7 +338,7 @@ void DeserializeNetworkGameInfo(Packet &p, NetworkGameInfo &info, const GameInfo { static const CalTime::Date MAX_DATE = CalTime::ConvertYMDToDate(CalTime::MAX_YEAR, 11, 31); // December is month 11 - byte game_info_version = p.Recv_uint8(); + uint8_t game_info_version = p.Recv_uint8(); NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5; /* diff --git a/src/network/core/network_game_info.h b/src/network/core/network_game_info.h index d30e38e06e..01ad8c1767 100644 --- a/src/network/core/network_game_info.h +++ b/src/network/core/network_game_info.h @@ -103,12 +103,12 @@ struct NetworkServerGameInfo { std::string server_revision; ///< The version number the server is using (e.g.: 'r304' or 0.5.0) bool dedicated; ///< Is this a dedicated server? bool use_password; ///< Is this server passworded? - byte clients_on; ///< Current count of clients on server - byte clients_max; ///< Max clients allowed on server - byte companies_on; ///< How many started companies do we have - byte companies_max; ///< Max companies allowed on server - byte spectators_on; ///< How many spectators do we have? - byte landscape; ///< The used landscape + uint8_t clients_on; ///< Current count of clients on server + uint8_t clients_max; ///< Max clients allowed on server + uint8_t companies_on; ///< How many started companies do we have + uint8_t companies_max; ///< Max companies allowed on server + uint8_t spectators_on; ///< How many spectators do we have? + uint8_t landscape; ///< The used landscape int gamescript_version; ///< Version of the gamescript. std::string gamescript_name; ///< Name of the gamescript. }; diff --git a/src/network/core/packet.h b/src/network/core/packet.h index f9d2a9a7d8..ba861d99dd 100644 --- a/src/network/core/packet.h +++ b/src/network/core/packet.h @@ -49,7 +49,7 @@ private: /** The current read/write position in the packet */ PacketSize pos; /** The buffer of this packet. */ - std::vector buffer; + std::vector buffer; /** The limit for the packet size. */ size_t limit; @@ -65,10 +65,10 @@ public: /* Sending/writing of packets */ void PrepareToSend(); - std::vector &GetSerialisationBuffer() { return this->buffer; } + std::vector &GetSerialisationBuffer() { return this->buffer; } size_t GetSerialisationLimit() const { return this->limit; } - const byte *GetDeserialisationBuffer() const { return this->buffer.data(); } + const uint8_t *GetDeserialisationBuffer() const { return this->buffer.data(); } size_t GetDeserialisationBufferSize() const { return this->buffer.size(); } PacketSize &GetDeserialisationPosition() { return this->pos; } bool CanDeserialiseBytes(size_t bytes_to_read, bool raise_error) { return this->CanReadFromPacket(bytes_to_read, raise_error); } @@ -89,7 +89,7 @@ public: size_t RemainingBytesToTransfer() const; - const byte *GetBufferData() const { return this->buffer.data(); } + const uint8_t *GetBufferData() const { return this->buffer.data(); } PacketSize GetRawPos() const { return this->pos; } void ReserveBuffer(size_t size) { this->buffer.reserve(size); } @@ -194,14 +194,14 @@ public: struct SubPacketDeserialiser : public BufferDeserialisationHelper { NetworkSocketHandler *cs; - const byte *data; + const uint8_t *data; size_t size; PacketSize pos; - SubPacketDeserialiser(Packet &p, const byte *data, size_t size, PacketSize pos = 0) : cs(p.GetParentSocket()), data(data), size(size), pos(pos) {} - SubPacketDeserialiser(Packet &p, const std::vector &buffer, PacketSize pos = 0) : cs(p.GetParentSocket()), data(buffer.data()), size(buffer.size()), pos(pos) {} + SubPacketDeserialiser(Packet &p, const uint8_t *data, size_t size, PacketSize pos = 0) : cs(p.GetParentSocket()), data(data), size(size), pos(pos) {} + SubPacketDeserialiser(Packet &p, const std::vector &buffer, PacketSize pos = 0) : cs(p.GetParentSocket()), data(buffer.data()), size(buffer.size()), pos(pos) {} - const byte *GetDeserialisationBuffer() const { return this->data; } + const uint8_t *GetDeserialisationBuffer() const { return this->data; } size_t GetDeserialisationBufferSize() const { return this->size; } PacketSize &GetDeserialisationPosition() { return this->pos; } bool CanDeserialiseBytes(size_t bytes_to_read, bool raise_error); diff --git a/src/network/core/tcp_content.h b/src/network/core/tcp_content.h index d47601870c..15a0ac52a6 100644 --- a/src/network/core/tcp_content.h +++ b/src/network/core/tcp_content.h @@ -25,7 +25,7 @@ protected: /** * Client requesting a list of content info: - * byte type + * uint8_t type * uint32_t openttd version (or 0xFFFFFFFF if using a list) * Only if the above value is 0xFFFFFFFF: * uint8_t count @@ -76,7 +76,7 @@ protected: /** * Server sending list of content info: - * byte type (invalid ID == does not exist) + * uint8_t type (invalid ID == does not exist) * uint32_t id * uint32_t file_size * string name (max 32 characters) diff --git a/src/network/core/tcp_coordinator.h b/src/network/core/tcp_coordinator.h index fe87fc5736..4635847df2 100644 --- a/src/network/core/tcp_coordinator.h +++ b/src/network/core/tcp_coordinator.h @@ -277,8 +277,8 @@ protected: * uint16_t Number of NewGRFs in the packet, with for each of the NewGRFs: * uint32_t Lookup table index for the NewGRF. * uint32_t Unique NewGRF ID. - * byte[16] MD5 checksum of the NewGRF - * string Name of the NewGRF. + * uint8_t[16] MD5 checksum of the NewGRF + * string Name of the NewGRF. * * The lookup table built using these packets are used by the deserialisation * of the NewGRFs for servers in the GC_LISTING. These updates are additive, diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp index d88021a65b..99723b59d1 100644 --- a/src/network/core/udp.cpp +++ b/src/network/core/udp.cpp @@ -239,7 +239,7 @@ void NetworkUDPSocketHandler::Receive_EX_MULTI(Packet &p, NetworkAddress &client Packet merged(this, TCP_MTU, 0); merged.ReserveBuffer(total_payload); for (auto &frag : fs.fragments) { - merged.Send_binary((const byte *)frag.data(), frag.size()); + merged.Send_binary((const uint8_t *)frag.data(), frag.size()); } merged.ParsePacketSize(); merged.PrepareToRead(); diff --git a/src/network/network.cpp b/src/network/network.cpp index 708f1389ab..7ad6d6a8d4 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -101,7 +101,7 @@ bool _record_sync_records = false; static_assert((int)NETWORK_COMPANY_NAME_LENGTH == MAX_LENGTH_COMPANY_NAME_CHARS * MAX_CHAR_LENGTH); /** The amount of clients connected */ -byte _network_clients_connected = 0; +uint8_t _network_clients_connected = 0; extern std::string GenerateUid(std::string_view subject); @@ -151,9 +151,9 @@ NetworkClientInfo::~NetworkClientInfo() return nullptr; } -byte NetworkSpectatorCount() +uint8_t NetworkSpectatorCount() { - byte count = 0; + uint8_t count = 0; for (const NetworkClientInfo *ci : NetworkClientInfo::Iterate()) { if (ci->client_playas == COMPANY_SPECTATOR) count++; @@ -233,7 +233,7 @@ std::vector GenerateGeneralPasswordHash(const std::string &password, co { if (password.empty()) return {}; - std::vector data; + std::vector data; data.reserve(password_server_id.size() + password.size() + 10); BufferSerialiser buffer(data); @@ -241,7 +241,7 @@ std::vector GenerateGeneralPasswordHash(const std::string &password, co buffer.Send_string(password_server_id); buffer.Send_string(password); - std::vector output; + std::vector output; output.resize(64); crypto_blake2b(output.data(), output.size(), data.data(), data.size()); @@ -295,8 +295,8 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, SetDParam(1, data.auxdata >> 16); SetDParamStr(0, GetString(STR_NETWORK_MESSAGE_MONEY_GIVE_SRC_DESCRIPTION)); - extern byte GetCurrentGrfLangID(); - byte lang_id = GetCurrentGrfLangID(); + extern uint8_t GetCurrentGrfLangID(); + uint8_t lang_id = GetCurrentGrfLangID(); bool use_specific_string = lang_id <= 2 || lang_id == 0x15 || lang_id == 0x3A || lang_id == 0x3D; // English, German, Korean, Czech if (use_specific_string && self_send) { strid = STR_NETWORK_MESSAGE_GAVE_MONEY_AWAY; @@ -1254,7 +1254,7 @@ void NetworkGameLoop() if (aux_str[0] == '<' && aux_str[1] != '>') { auto aux = std::make_unique(); for (const char *data = aux_str + 1; data[0] != 0 && data[1] != 0 && data[0] != '>'; data += 2) { - byte e = 0; + uint8_t e = 0; std::from_chars(data, data + 2, e, 16); aux->serialised_data.emplace_back(e); } diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp index 2f003dc540..39f7612a2d 100644 --- a/src/network/network_admin.cpp +++ b/src/network/network_admin.cpp @@ -33,7 +33,7 @@ AdminIndex _redirect_console_to_admin = INVALID_ADMIN_ID; /** The amount of admins connected. */ -byte _network_admins_connected = 0; +uint8_t _network_admins_connected = 0; /** The pool with sockets/clients. */ NetworkAdminSocketPool _networkadminsocket_pool("NetworkAdminSocket"); diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 955c7da089..0c231c507a 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -51,10 +51,10 @@ static void ResetClientConnectionKeyStates(); struct PacketReader : LoadFilter { static const size_t CHUNK = 32 * 1024; ///< 32 KiB chunks of memory. - std::vector blocks; ///< Buffer with blocks of allocated memory. - byte *buf; ///< Buffer we're going to write to/read from. - byte *bufe; ///< End of the buffer we write to/read from. - byte **block; ///< The block we're reading from/writing to. + std::vector blocks; ///< Buffer with blocks of allocated memory. + uint8_t *buf; ///< Buffer we're going to write to/read from. + uint8_t *bufe; ///< End of the buffer we write to/read from. + uint8_t **block; ///< The block we're reading from/writing to. size_t written_bytes; ///< The total number of bytes we've written. size_t read_bytes; ///< The total number of read bytes. @@ -98,18 +98,18 @@ struct PacketReader : LoadFilter { if (p.RemainingBytesToTransfer() == 0) return; /* Allocate a new chunk and add the remaining data. */ - this->blocks.push_back(this->buf = CallocT(CHUNK)); + this->blocks.push_back(this->buf = CallocT(CHUNK)); this->bufe = this->buf + CHUNK; p.TransferOutWithLimit(TransferOutMemCopy, this->bufe - this->buf, this); } - size_t Read(byte *rbuf, size_t size) override + size_t Read(uint8_t *rbuf, size_t size) override { /* Limit the amount to read to whatever we still have. */ size_t ret_size = size = std::min(this->written_bytes - this->read_bytes, size); this->read_bytes += ret_size; - const byte *rbufe = rbuf + ret_size; + const uint8_t *rbufe = rbuf + ret_size; while (rbuf != rbufe) { if (this->buf == this->bufe) { @@ -396,7 +396,7 @@ static uint32_t last_ack_frame; /** One bit of 'entropy' used to generate a salt for the company passwords. */ static uint32_t _company_password_game_seed; /** Network server's x25519 public key, used for key derivation */ -static std::array _server_x25519_pub_key; +static std::array _server_x25519_pub_key; /** Key message ID counter */ static uint64_t _next_key_message_id; /** The other bit of 'entropy' used to generate a salt for the server, rcon, and settings passwords. */ @@ -431,14 +431,14 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendKeyPasswordPacket(PacketTy crypto_blake2b_update(&ctx, shared_secret.data(), shared_secret.size()); // Shared secret crypto_blake2b_update(&ctx, keys.x25519_pub_key.data(), keys.x25519_pub_key.size()); // Client pub key crypto_blake2b_update(&ctx, _server_x25519_pub_key.data(), _server_x25519_pub_key.size()); // Server pub key - crypto_blake2b_update(&ctx, (const byte *)password.data(), password.size()); // Password + crypto_blake2b_update(&ctx, (const uint8_t *)password.data(), password.size()); // Password crypto_blake2b_final (&ctx, ss.shared_data.data()); /* NetworkSharedSecrets::shared_data now contains 2 keys worth of hash, first key is used for up direction, second key for down direction (if any) */ crypto_wipe(shared_secret.data(), shared_secret.size()); - std::vector message; + std::vector message; BufferSerialiser buffer(message); /* Put monotonically increasing counter in message */ @@ -623,7 +623,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendDesyncLog(const std::strin auto p = std::make_unique(PACKET_CLIENT_DESYNC_LOG, TCP_MTU); size_t size = std::min(log.size() - offset, TCP_MTU - 2 - p->Size()); p->Send_uint16((uint16_t)size); - p->Send_binary((const byte *)(log.data() + offset), size); + p->Send_binary((const uint8_t *)(log.data() + offset), size); my_client->SendPacket(std::move(p)); offset += size; @@ -1239,7 +1239,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_DESYNC_LOG(Pack { uint size = p.Recv_uint16(); this->server_desync_log.resize(this->server_desync_log.size() + size); - p.Recv_binary((byte *)(this->server_desync_log.data() + this->server_desync_log.size() - size), size); + p.Recv_binary((uint8_t *)(this->server_desync_log.data() + this->server_desync_log.size() - size), size); DEBUG(net, 2, "Received %u bytes of server desync log", size); return NETWORK_RECV_STATUS_OKAY; } @@ -1324,7 +1324,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_RCON(Packet &p) p.Recv_binary(nonce); p.Recv_binary(mac); - std::vector message = p.Recv_binary(p.RemainingBytesToTransfer()); + std::vector message = p.Recv_binary(p.RemainingBytesToTransfer()); static_assert(std::tuple_size::value == 64); if (crypto_aead_unlock(message.data(), mac.data(), this->last_rcon_shared_secrets.shared_data.data() + 32, nonce.data(), nullptr, 0, message.data(), message.size()) == 0) { diff --git a/src/network/network_client.h b/src/network/network_client.h index 50b502de4c..a01af2959a 100644 --- a/src/network/network_client.h +++ b/src/network/network_client.h @@ -15,9 +15,9 @@ /** Class for handling the client side of the game connection. */ class ClientNetworkGameSocketHandler : public NetworkGameSocketHandler { private: - std::string connection_string; ///< Address we are connected to. + std::string connection_string; ///< Address we are connected to. std::shared_ptr savegame; ///< Packet reader for reading the savegame. - byte token; ///< The token we need to send back to the server to prove we're the right client. + uint8_t token; ///< The token we need to send back to the server to prove we're the right client. NetworkSharedSecrets last_rcon_shared_secrets; ///< Keys for last rcon (and incoming replies) /** Status of the connection with the server. */ diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp index 029892a499..b441addcec 100644 --- a/src/network/network_command.cpp +++ b/src/network/network_command.cpp @@ -275,7 +275,7 @@ const char *NetworkGameSocketHandler::ReceiveCommand(Packet &p, CommandPacket &c StringValidationSettings settings = (!_network_server && GetCommandFlags(cp.cmd) & CMD_STR_CTRL) != 0 ? SVS_ALLOW_CONTROL_CODE | SVS_REPLACE_WITH_QUESTION_MARK : SVS_REPLACE_WITH_QUESTION_MARK; p.Recv_string(cp.text, settings); - byte callback = p.Recv_uint8(); + uint8_t callback = p.Recv_uint8(); if (callback >= lengthof(_callback_table)) return "invalid callback"; cp.callback = _callback_table[callback]; @@ -306,7 +306,7 @@ void NetworkGameSocketHandler::SendCommand(Packet &p, const CommandPacket &cp) p.Send_uint32(cp.tile); p.Send_string(cp.text.c_str()); - byte callback = 0; + uint8_t callback = 0; while (callback < lengthof(_callback_table) && _callback_table[callback] != cp.callback) { callback++; } diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 2c99167f71..29d14a26c0 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -205,7 +205,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentType type) this->Connect(); auto p = std::make_unique(PACKET_CONTENT_CLIENT_INFO_LIST); - p->Send_uint8 ((byte)type); + p->Send_uint8 ((uint8_t)type); p->Send_uint32(0xffffffff); p->Send_uint8 (2); p->Send_string("vanilla"); @@ -237,7 +237,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con * A packet begins with the packet size and a byte for the type. * Then this packet adds a uint16_t for the count in this packet. * The rest of the packet can be used for the IDs. */ - uint p_count = std::min(count, (TCP_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16_t)) / sizeof(uint32_t)); + uint p_count = std::min(count, (TCP_MTU - sizeof(PacketSize) - sizeof(uint8_t) - sizeof(uint16_t)) / sizeof(uint32_t)); auto p = std::make_unique(PACKET_CONTENT_CLIENT_INFO_ID, TCP_MTU); p->Send_uint16(p_count); @@ -263,7 +263,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo this->Connect(); - const uint max_per_packet = std::min(255, (TCP_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8_t)) / + const uint max_per_packet = std::min(255, (TCP_MTU - sizeof(PacketSize) - sizeof(uint8_t) - sizeof(uint8_t)) / (sizeof(uint8_t) + sizeof(uint32_t) + (send_md5sum ? MD5_HASH_BYTES : 0))) - 1; uint offset = 0; @@ -275,7 +275,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo for (uint i = 0; i < to_send; i++) { const ContentInfo *ci = (*cv)[offset + i]; - p->Send_uint8((byte)ci->type); + p->Send_uint8((uint8_t)ci->type); p->Send_uint32(ci->unique_id); if (!send_md5sum) continue; @@ -369,7 +369,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(const Co * A packet begins with the packet size and a byte for the type. * Then this packet adds a uint16_t for the count in this packet. * The rest of the packet can be used for the IDs. */ - uint p_count = std::min(count, (TCP_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16_t)) / sizeof(uint32_t)); + uint p_count = std::min(count, (TCP_MTU - sizeof(PacketSize) - sizeof(uint8_t) - sizeof(uint16_t)) / sizeof(uint32_t)); auto p = std::make_unique(PACKET_CONTENT_CLIENT_CONTENT, TCP_MTU); p->Send_uint16(p_count); @@ -426,7 +426,7 @@ static bool GunzipFile(const ContentInfo *ci) if (fin == nullptr || fout == nullptr) { ret = false; } else { - byte buff[8192]; + uint8_t buff[8192]; for (;;) { int read = gzread(fin, buff, sizeof(buff)); if (read == 0) { diff --git a/src/network/network_func.h b/src/network/network_func.h index a7f2e03fd0..5a2c5f1459 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -36,7 +36,7 @@ extern StringList _network_bind_list; extern StringList _network_host_list; extern StringList _network_ban_list; -byte NetworkSpectatorCount(); +uint8_t NetworkSpectatorCount(); uint NetworkClientCount(); bool NetworkIsValidClientName(const std::string_view client_name); bool NetworkValidateOurClientName(); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 2814daa4b5..5007646793 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -139,7 +139,7 @@ struct PacketWriter : SaveFilter { return last_packet; } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { std::lock_guard lock(this->mutex); @@ -148,7 +148,7 @@ struct PacketWriter : SaveFilter { if (this->current == nullptr) this->current = std::make_unique(PACKET_SERVER_MAP_DATA, TCP_MTU); - byte *bufe = buf + size; + uint8_t *bufe = buf + size; while (buf != bufe) { size_t written = this->current->Send_binary_until_full(buf, bufe); buf += written; @@ -240,14 +240,14 @@ bool ServerNetworkGameSocketHandler::ParseKeyPasswordPacket(Packet &p, NetworkSh crypto_blake2b_update(&ctx, shared_secret.data(), shared_secret.size()); // Shared secret crypto_blake2b_update(&ctx, client_pub_key.data(), client_pub_key.size()); // Client pub key crypto_blake2b_update(&ctx, keys.x25519_pub_key.data(), keys.x25519_pub_key.size()); // Server pub key - crypto_blake2b_update(&ctx, (const byte *)password.data(), password.size()); // Password + crypto_blake2b_update(&ctx, (const uint8_t *)password.data(), password.size()); // Password crypto_blake2b_final (&ctx, ss.shared_data.data()); /* NetworkSharedSecrets::shared_data now contains 2 keys worth of hash, first key is used for up direction, second key for down direction (if any) */ crypto_wipe(shared_secret.data(), shared_secret.size()); - std::vector message = p.Recv_binary(p.RemainingBytesToTransfer()); + std::vector message = p.Recv_binary(p.RemainingBytesToTransfer()); if (message.size() < 8) return false; if ((message.size() == 8) != (payload == nullptr)) { /* Payload expected but not present, or vice versa, just give up */ @@ -329,7 +329,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta /* We just lost one client :( */ if (this->status >= STATUS_AUTHORIZED) _network_game_info.clients_on--; - extern byte _network_clients_connected; + extern uint8_t _network_clients_connected; _network_clients_connected--; this->SendPackets(true); @@ -347,7 +347,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta */ /* static */ bool ServerNetworkGameSocketHandler::AllowConnection() { - extern byte _network_clients_connected; + extern uint8_t _network_clients_connected; bool accept = _network_clients_connected < MAX_CLIENTS; /* We can't go over the MAX_CLIENTS limit here. However, the @@ -476,7 +476,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendDesyncLog(const std::strin auto p = std::make_unique(PACKET_SERVER_DESYNC_LOG, TCP_MTU); size_t size = std::min(log.size() - offset, TCP_MTU - 2 - p->Size()); p->Send_uint16(static_cast(size)); - p->Send_binary((const byte *)(log.data() + offset), size); + p->Send_binary((const uint8_t *)(log.data() + offset), size); this->SendPacket(std::move(p)); offset += size; @@ -845,7 +845,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendRConResult(uint16_t colour { assert(this->rcon_reply_key != nullptr); - std::vector message; + std::vector message; BufferSerialiser buffer(message); buffer.Send_uint16(colour); buffer.Send_string(command); @@ -1294,7 +1294,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_DESYNC_LOG(Pack { uint size = p.Recv_uint16(); this->desync_log.resize(this->desync_log.size() + size); - p.Recv_binary((byte *)(this->desync_log.data() + this->desync_log.size() - size), size); + p.Recv_binary((uint8_t *)(this->desync_log.data() + this->desync_log.size() - size), size); DEBUG(net, 2, "Received %u bytes of client desync log", size); this->receive_limit += p.Size(); return NETWORK_RECV_STATUS_OKAY; @@ -1760,7 +1760,7 @@ void NetworkPopulateCompanyStats(NetworkCompanyStats *stats) /* Go through all vehicles and count the type of vehicles */ for (const Vehicle *v : Vehicle::IterateFrontOnly()) { if (!Company::IsValidID(v->owner) || !v->IsPrimaryVehicle() || HasBit(v->subtype, GVSF_VIRTUAL)) continue; - byte type = 0; + uint8_t type = 0; switch (v->type) { case VEH_TRAIN: type = NETWORK_VEH_TRAIN; break; case VEH_ROAD: type = RoadVehicle::From(v)->IsBus() ? NETWORK_VEH_BUS : NETWORK_VEH_LORRY; break; diff --git a/src/network/network_server.h b/src/network/network_server.h index 7603ebcb52..8014215c98 100644 --- a/src/network/network_server.h +++ b/src/network/network_server.h @@ -24,7 +24,7 @@ extern NetworkClientSocketPool _networkclientsocket_pool; class ServerNetworkGameSocketHandler : public NetworkClientSocketPool::PoolItem<&_networkclientsocket_pool>, public NetworkGameSocketHandler, public TCPListenHandler { NetworkGameKeys intl_keys; uint64_t min_key_message_id = 0; - byte *rcon_reply_key = nullptr; + uint8_t *rcon_reply_key = nullptr; protected: NetworkRecvStatus Receive_CLIENT_JOIN(Packet &p) override; @@ -76,8 +76,8 @@ public: static const char *GetClientStatusName(ClientStatus status); - byte lag_test; ///< Byte used for lag-testing the client - byte last_token; ///< The last random token we did send to verify the client is listening + uint8_t lag_test; ///< Byte used for lag-testing the client + uint8_t last_token; ///< The last random token we did send to verify the client is listening uint32_t last_token_frame; ///< The last frame we received the right token ClientStatus status; ///< Status of this client CommandQueue outgoing_queue; ///< The command-queue awaiting delivery; conceptually more a bucket to gather commands in, after which the whole bucket is sent to the client. diff --git a/src/network/network_type.h b/src/network/network_type.h index 9eb7996107..0d1a3bfb6d 100644 --- a/src/network/network_type.h +++ b/src/network/network_type.h @@ -88,7 +88,7 @@ enum NetworkPasswordType { * Destination of our chat messages. * @warning The values of the enum items are part of the admin network API. Only append at the end. */ -enum DestType : byte { +enum DestType : uint8_t { DESTTYPE_BROADCAST, ///< Send message/notice to all clients (All) DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team) DESTTYPE_CLIENT, ///< Send message/notice to only a certain client (Private) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index fdad9afda2..6651e1d01a 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -82,7 +82,7 @@ const std::vector &GetAllGRFFiles() static btree::btree_map _callback_result_cache; /** Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E */ -byte _misc_grf_features = 0; +uint8_t _misc_grf_features = 0; /** 32 * 8 = 256 flags. Apparently TTDPatch uses this many.. */ static uint32_t _ttdpatch_flags[8]; @@ -111,13 +111,13 @@ class OTTDByteReaderSignal { }; /** Class to read from a NewGRF file */ class ByteReader { protected: - byte *data; - byte *end; + uint8_t *data; + uint8_t *end; public: - ByteReader(byte *data, byte *end) : data(data), end(end) { } + ByteReader(uint8_t *data, uint8_t *end) : data(data), end(end) { } - inline byte *ReadBytes(size_t size) + inline uint8_t *ReadBytes(size_t size) { if (data + size >= end) { /* Put data at the end, as would happen if every byte had been individually read. */ @@ -125,12 +125,12 @@ public: throw OTTDByteReaderSignal(); } - byte *ret = data; + uint8_t *ret = data; data += size; return ret; } - inline byte ReadByte() + inline uint8_t ReadByte() { if (data < end) return *(data)++; throw OTTDByteReaderSignal(); @@ -154,7 +154,7 @@ public: return val | (ReadWord() << 16); } - uint32_t ReadVarSize(byte size) + uint32_t ReadVarSize(uint8_t size) { switch (size) { case 1: return ReadByte(); @@ -194,7 +194,7 @@ public: return data + count <= end; } - inline byte *Data() + inline uint8_t *Data() { return data; } @@ -207,7 +207,7 @@ public: if (data > end) throw OTTDByteReaderSignal(); } - inline void ResetReadPosition(byte *pos) + inline void ResetReadPosition(uint8_t *pos) { data = pos; } @@ -281,7 +281,7 @@ struct GRFLocation { }; static btree::btree_map _grm_sprites; -typedef btree::btree_map> GRFLineToSpriteOverride; +typedef btree::btree_map> GRFLineToSpriteOverride; static GRFLineToSpriteOverride _grf_line_to_action6_sprite_override; static bool _action6_override_active = false; @@ -768,7 +768,7 @@ static void ReadSpriteLayoutRegisters(ByteReader *buf, TileLayoutFlags flags, bo * @param dts Layout container to output into * @return True on error (GRF was disabled). */ -static bool ReadSpriteLayout(ByteReader *buf, uint num_building_sprites, bool use_cur_spritesets, byte feature, bool allow_var10, bool no_z_position, NewGRFSpriteLayout *dts) +static bool ReadSpriteLayout(ByteReader *buf, uint num_building_sprites, bool use_cur_spritesets, uint8_t feature, bool allow_var10, bool no_z_position, NewGRFSpriteLayout *dts) { bool has_flags = HasBit(num_building_sprites, 6); ClrBit(num_building_sprites, 6); @@ -1209,7 +1209,7 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop break; case 0x24: { // High byte of vehicle weight - byte weight = buf->ReadByte(); + uint8_t weight = buf->ReadByte(); if (weight > 4) { grfmsg(2, "RailVehicleChangeInfo: Nonsensical weight of %d tons, ignoring", weight << 8); @@ -1983,15 +1983,15 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons case 0x0E: // Define custom layout while (buf->HasData()) { - byte length = buf->ReadByte(); - byte number = buf->ReadByte(); + uint8_t length = buf->ReadByte(); + uint8_t number = buf->ReadByte(); if (length == 0 || number == 0) break; if (statspec->layouts.size() < length) statspec->layouts.resize(length); if (statspec->layouts[length - 1].size() < number) statspec->layouts[length - 1].resize(number); - const byte *layout = buf->ReadBytes(length * number); + const uint8_t *layout = buf->ReadBytes(length * number); statspec->layouts[length - 1][number - 1].assign(layout, layout + length * number); /* Validate tile values are only the permitted 00, 02, 04 and 06. */ @@ -2176,7 +2176,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, const switch (prop) { case 0x08: { // Year of availability /* We treat '0' as always available */ - byte year = buf->ReadByte(); + uint8_t year = buf->ReadByte(); bridge->avail_year = (year > 0 ? CalTime::ORIGINAL_BASE_YEAR + year : 0); break; } @@ -2200,8 +2200,8 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, const break; case 0x0D: { // Bridge sprite tables - byte tableid = buf->ReadByte(); - byte numtables = buf->ReadByte(); + uint8_t tableid = buf->ReadByte(); + uint8_t numtables = buf->ReadByte(); if (bridge->sprite_table == nullptr) { /* Allocate memory for sprite table pointers and zero out */ @@ -2211,7 +2211,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, const for (; numtables-- != 0; tableid++) { if (tableid >= 7) { // skip invalid data grfmsg(1, "BridgeChangeInfo: Table %d >= 7, skipping", tableid); - for (byte sprite = 0; sprite < 32; sprite++) buf->ReadDWord(); + for (uint8_t sprite = 0; sprite < 32; sprite++) buf->ReadDWord(); continue; } @@ -2219,7 +2219,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, const bridge->sprite_table[tableid] = MallocT(32); } - for (byte sprite = 0; sprite < 32; sprite++) { + for (uint8_t sprite = 0; sprite < 32; sprite++) { SpriteID image = buf->ReadWord(); PaletteID pal = buf->ReadWord(); @@ -2277,7 +2277,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, const case A0RPI_BRIDGE_AVAILABILITY_FLAGS: { if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break; - byte flags = buf->ReadByte(); + uint8_t flags = buf->ReadByte(); SB(bridge->ctrl_flags, BSCF_NOT_AVAILABLE_TOWN, 1, HasBit(flags, 0) ? 1 : 0); SB(bridge->ctrl_flags, BSCF_NOT_AVAILABLE_AI_GS, 1, HasBit(flags, 1) ? 1 : 0); break; @@ -2341,8 +2341,8 @@ static ChangeInfoResult IgnoreTownHouseProperty(int prop, ByteReader *buf) break; case 0x20: { - byte count = buf->ReadByte(); - for (byte j = 0; j < count; j++) buf->ReadByte(); + uint8_t count = buf->ReadByte(); + for (uint8_t j = 0; j < count; j++) buf->ReadByte(); break; } @@ -2389,7 +2389,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con switch (prop) { case 0x08: { // Substitute building type, and definition of a new house - byte subs_id = buf->ReadByte(); + uint8_t subs_id = buf->ReadByte(); if (subs_id == 0xFF) { /* Instead of defining a new house, a substitute house id * of 0xFF disables the old house with the current id. */ @@ -2495,7 +2495,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con break; case 0x15: { // House override byte - byte override = buf->ReadByte(); + uint8_t override = buf->ReadByte(); /* The house being overridden must be an original house. */ if (override >= NEW_HOUSE_OFFSET) { @@ -2508,7 +2508,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con } case 0x16: // Periodic refresh multiplier - housespec->processing_time = std::min(buf->ReadByte(), 63u); + housespec->processing_time = std::min(buf->ReadByte(), 63u); break; case 0x17: // Four random colours to use @@ -2567,8 +2567,8 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con break; case 0x20: { // Cargo acceptance watch list - byte count = buf->ReadByte(); - for (byte j = 0; j < count; j++) { + uint8_t count = buf->ReadByte(); + for (uint8_t j = 0; j < count; j++) { CargoID cargo = GetCargoTranslation(buf->ReadByte(), _cur.grffile); if (cargo != INVALID_CARGO) SetBit(housespec->watched_cargoes, cargo); } @@ -2794,7 +2794,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, co } else if (buf->Remaining() < SNOW_LINE_MONTHS * SNOW_LINE_DAYS) { grfmsg(1, "GlobalVarChangeInfo: Not enough entries set in the snowline table (" PRINTF_SIZE ")", buf->Remaining()); } else { - byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; + uint8_t table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; for (uint i = 0; i < SNOW_LINE_MONTHS; i++) { for (uint j = 0; j < SNOW_LINE_DAYS; j++) { @@ -2851,7 +2851,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, co break; } - byte newgrf_id = buf->ReadByte(); // The NewGRF (custom) identifier. + uint8_t newgrf_id = buf->ReadByte(); // The NewGRF (custom) identifier. while (newgrf_id != 0) { const char *name = buf->ReadString(); // The name for the OpenTTD identifier. @@ -3290,7 +3290,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr switch (prop) { case 0x08: { // Substitute industry tile type - byte subs_id = buf->ReadByte(); + uint8_t subs_id = buf->ReadByte(); if (subs_id >= NEW_INDUSTRYTILEOFFSET) { /* The substitute id must be one of the original industry tile. */ grfmsg(2, "IndustryTilesChangeInfo: Attempt to use new industry tile %u as substitute industry tile for %u. Ignoring.", subs_id, indtid + i); @@ -3319,7 +3319,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr } case 0x09: { // Industry tile override - byte ovrid = buf->ReadByte(); + uint8_t ovrid = buf->ReadByte(); /* The industry being overridden must be an original industry. */ if (ovrid >= NEW_INDUSTRYTILEOFFSET) { @@ -3366,7 +3366,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr break; case 0x13: { // variable length cargo acceptance - byte num_cargoes = buf->ReadByte(); + uint8_t num_cargoes = buf->ReadByte(); if (num_cargoes > std::size(tsp->acceptance)) { GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); error->param_value[1] = prop; @@ -3441,20 +3441,20 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader *buf) break; case 0x0A: { - byte num_table = buf->ReadByte(); - for (byte j = 0; j < num_table; j++) { + uint8_t num_table = buf->ReadByte(); + for (uint8_t j = 0; j < num_table; j++) { for (uint k = 0;; k++) { - byte x = buf->ReadByte(); + uint8_t x = buf->ReadByte(); if (x == 0xFE && k == 0) { buf->ReadByte(); buf->ReadByte(); break; } - byte y = buf->ReadByte(); + uint8_t y = buf->ReadByte(); if (x == 0 && y == 0x80) break; - byte gfx = buf->ReadByte(); + uint8_t gfx = buf->ReadByte(); if (gfx == 0xFE) buf->ReadWord(); } } @@ -3462,7 +3462,7 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader *buf) } case 0x16: - for (byte j = 0; j < 3; j++) buf->ReadByte(); + for (uint8_t j = 0; j < 3; j++) buf->ReadByte(); break; case 0x15: @@ -3547,7 +3547,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, switch (prop) { case 0x08: { // Substitute industry type - byte subs_id = buf->ReadByte(); + uint8_t subs_id = buf->ReadByte(); if (subs_id == 0xFF) { /* Instead of defining a new industry, a substitute industry id * of 0xFF disables the old industry with the current id. */ @@ -3578,7 +3578,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x09: { // Industry type override - byte ovrid = buf->ReadByte(); + uint8_t ovrid = buf->ReadByte(); /* The industry being overridden must be an original industry. */ if (ovrid >= NEW_INDUSTRYOFFSET) { @@ -3591,13 +3591,13 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x0A: { // Set industry layout(s) - byte new_num_layouts = buf->ReadByte(); + uint8_t new_num_layouts = buf->ReadByte(); uint32_t definition_size = buf->ReadDWord(); uint32_t bytes_read = 0; std::vector new_layouts; IndustryTileLayout layout; - for (byte j = 0; j < new_num_layouts; j++) { + for (uint8_t j = 0; j < new_num_layouts; j++) { layout.clear(); for (uint k = 0;; k++) { @@ -3616,7 +3616,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, if (it.ti.x == 0xFE && k == 0) { /* This means we have to borrow the layout from an old industry */ IndustryType type = buf->ReadByte(); - byte laynbr = buf->ReadByte(); + uint8_t laynbr = buf->ReadByte(); bytes_read += 2; if (type >= lengthof(_origin_industry_specs)) { @@ -3710,14 +3710,14 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, break; case 0x10: // Production cargo types - for (byte j = 0; j < 2; j++) { + for (uint8_t j = 0; j < 2; j++) { indsp->produced_cargo[j] = GetCargoTranslation(buf->ReadByte(), _cur.grffile); indsp->produced_cargo_label[j] = CT_INVALID; } break; case 0x11: // Acceptance cargo types - for (byte j = 0; j < 3; j++) { + for (uint8_t j = 0; j < 3; j++) { indsp->accepts_cargo[j] = GetCargoTranslation(buf->ReadByte(), _cur.grffile); indsp->accepts_cargo_label[j] = CT_INVALID; } @@ -3755,7 +3755,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x16: // Conflicting industry types - for (byte j = 0; j < 3; j++) indsp->conflicting[j] = buf->ReadByte(); + for (uint8_t j = 0; j < 3; j++) indsp->conflicting[j] = buf->ReadByte(); break; case 0x17: // Probability in random game @@ -3797,7 +3797,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, case 0x21: // Callback mask case 0x22: { // Callback additional mask - byte aflag = buf->ReadByte(); + uint8_t aflag = buf->ReadByte(); SB(indsp->callback_mask, (prop - 0x21) * 8, 8, aflag); break; } @@ -3817,7 +3817,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x25: { // variable length produced cargoes - byte num_cargoes = buf->ReadByte(); + uint8_t num_cargoes = buf->ReadByte(); if (num_cargoes > std::size(indsp->produced_cargo)) { GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); error->param_value[1] = prop; @@ -3836,7 +3836,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x26: { // variable length accepted cargoes - byte num_cargoes = buf->ReadByte(); + uint8_t num_cargoes = buf->ReadByte(); if (num_cargoes > std::size(indsp->accepts_cargo)) { GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); error->param_value[1] = prop; @@ -3855,7 +3855,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x27: { // variable length production rates - byte num_cargoes = buf->ReadByte(); + uint8_t num_cargoes = buf->ReadByte(); if (num_cargoes > std::size(indsp->production_rate)) { GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); error->param_value[1] = prop; @@ -3872,8 +3872,8 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } case 0x28: { // variable size input/output production multiplier table - byte num_inputs = buf->ReadByte(); - byte num_outputs = buf->ReadByte(); + uint8_t num_inputs = buf->ReadByte(); + uint8_t num_outputs = buf->ReadByte(); if (num_inputs > std::size(indsp->accepts_cargo) || num_outputs > std::size(indsp->produced_cargo)) { GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); error->param_value[1] = prop; @@ -3957,7 +3957,7 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c switch (prop) { case 0x08: { // Modify original airport - byte subs_id = buf->ReadByte(); + uint8_t subs_id = buf->ReadByte(); if (subs_id == 0xFF) { /* Instead of defining a new airport, an airport id * of 0xFF disables the old airport with the current id. */ @@ -3989,7 +3989,7 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c } case 0x0A: { // Set airport layout - byte old_num_table = as->num_table; + uint8_t old_num_table = as->num_table; as->num_table = buf->ReadByte(); // Number of layouts free(as->rotation); as->rotation = MallocT(as->num_table); @@ -3999,7 +3999,7 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c int size; const AirportTileTable *copy_from; try { - for (byte j = 0; j < as->num_table; j++) { + for (uint8_t j = 0; j < as->num_table; j++) { const_cast(as->rotation[j]) = (Direction)buf->ReadByte(); for (int k = 0;; k++) { att[k].ti.x = buf->ReadByte(); // Offsets from northermost tile @@ -4038,11 +4038,11 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c } if (as->rotation[j] == DIR_E || as->rotation[j] == DIR_W) { - as->size_x = std::max(as->size_x, att[k].ti.y + 1); - as->size_y = std::max(as->size_y, att[k].ti.x + 1); + as->size_x = std::max(as->size_x, att[k].ti.y + 1); + as->size_y = std::max(as->size_y, att[k].ti.x + 1); } else { - as->size_x = std::max(as->size_x, att[k].ti.x + 1); - as->size_y = std::max(as->size_y, att[k].ti.y + 1); + as->size_x = std::max(as->size_x, att[k].ti.x + 1); + as->size_y = std::max(as->size_y, att[k].ti.y + 1); } } tile_table[j] = CallocT(size); @@ -4139,7 +4139,7 @@ static ChangeInfoResult SignalsChangeInfo(uint id, int numinfo, int prop, const case A0RPI_SIGNALS_EXTRA_ASPECTS: if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break; - _cur.grffile->new_signal_extra_aspects = std::min(buf->ReadByte(), NEW_SIGNALS_MAX_EXTRA_ASPECT); + _cur.grffile->new_signal_extra_aspects = std::min(buf->ReadByte(), NEW_SIGNALS_MAX_EXTRA_ASPECT); break; case A0RPI_SIGNALS_NO_DEFAULT_STYLE: @@ -4638,7 +4638,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, const case A0RPI_RAILTYPE_EXTRA_ASPECTS: if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break; - rti->signal_extra_aspects = std::min(buf->ReadByte(), NEW_SIGNALS_MAX_EXTRA_ASPECT); + rti->signal_extra_aspects = std::min(buf->ReadByte(), NEW_SIGNALS_MAX_EXTRA_ASPECT); break; default: @@ -5007,7 +5007,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro switch (prop) { case 0x08: { // Substitute airport tile type - byte subs_id = buf->ReadByte(); + uint8_t subs_id = buf->ReadByte(); if (subs_id >= NEW_AIRPORTTILE_OFFSET) { /* The substitute id must be one of the original airport tiles. */ grfmsg(2, "AirportTileChangeInfo: Attempt to use new airport tile %u as substitute airport tile for %u. Ignoring.", subs_id, airtid + i); @@ -5032,7 +5032,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro } case 0x09: { // Airport tile override - byte override = buf->ReadByte(); + uint8_t override = buf->ReadByte(); /* The airport tile being overridden must be an original airport tile. */ if (override >= NEW_AIRPORTTILE_OFFSET) { @@ -5449,10 +5449,10 @@ static GRFFilePropertyDescriptor ReadAction0PropertyID(ByteReader *buf, uint8_t } else if (prop == A0RPI_UNKNOWN_IGNORE) { grfmsg(2, "Ignoring unimplemented mapped property: %s, feature: %s, mapped to: %X", def.name, GetFeatureString(def.feature), raw_prop); } else if (prop == A0RPI_ID_EXTENSION) { - byte *outer_data = buf->Data(); + uint8_t *outer_data = buf->Data(); size_t outer_length = buf->ReadExtendedByte(); uint16_t mapped_id = buf->ReadWord(); - byte *inner_data = buf->Data(); + uint8_t *inner_data = buf->Data(); size_t inner_length = buf->ReadExtendedByte(); if (inner_length + (inner_data - outer_data) != outer_length) { grfmsg(2, "Ignoring extended ID property with malformed lengths: %s, feature: %s, mapped to: %X", def.name, GetFeatureString(def.feature), raw_prop); @@ -5722,7 +5722,7 @@ static const CallbackResultSpriteGroup *NewCallbackResultSpriteGroup(uint16_t gr return NewCallbackResultSpriteGroupNoTransform(result); } -static const SpriteGroup *GetGroupFromGroupIDNoCBResult(uint16_t setid, byte type, uint16_t groupid) +static const SpriteGroup *GetGroupFromGroupIDNoCBResult(uint16_t setid, uint8_t type, uint16_t groupid) { if ((size_t)groupid >= _cur.spritegroups.size() || _cur.spritegroups[groupid] == nullptr) { grfmsg(1, "GetGroupFromGroupID(0x%04X:0x%02X): Groupid 0x%04X does not exist, leaving empty", setid, type, groupid); @@ -5736,7 +5736,7 @@ static const SpriteGroup *GetGroupFromGroupIDNoCBResult(uint16_t setid, byte typ /* Helper function to either create a callback or link to a previously * defined spritegroup. */ -static const SpriteGroup *GetGroupFromGroupID(uint16_t setid, byte type, uint16_t groupid) +static const SpriteGroup *GetGroupFromGroupID(uint16_t setid, uint8_t type, uint16_t groupid) { if (HasBit(groupid, 15)) { return NewCallbackResultSpriteGroup(groupid); @@ -5761,7 +5761,7 @@ static const SpriteGroup *GetGroupByID(uint16_t groupid) * @param spriteid Raw value from the GRF for the new spritegroup; describes either the return value or the referenced spritegroup. * @return Created spritegroup. */ -static const SpriteGroup *CreateGroupFromGroupID(byte feature, uint16_t setid, byte type, uint16_t spriteid) +static const SpriteGroup *CreateGroupFromGroupID(uint8_t feature, uint16_t setid, uint8_t type, uint16_t spriteid) { if (HasBit(spriteid, 15)) { return NewCallbackResultSpriteGroup(spriteid); @@ -5822,7 +5822,7 @@ static void ProcessDeterministicSpriteGroupRanges(const std::vectorobserved_feature_tests, GFTOF_MORE_VARACTION2_TYPES)) { - byte subtype = buf->ReadByte(); + uint8_t subtype = buf->ReadByte(); switch (subtype) { case 0: stype = STYPE_CB_FAILURE; @@ -5948,8 +5948,8 @@ static void NewSpriteGroup(ByteReader *buf) var_scope_count = (mode << 8) | offset; } - byte varadjust; - byte varsize; + uint8_t varadjust; + uint8_t varsize; bool first_adjust = true; @@ -6118,7 +6118,7 @@ static void NewSpriteGroup(ByteReader *buf) group->cmp_mode = HasBit(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY; group->lowest_randbit = buf->ReadByte(); - byte num_groups = buf->ReadByte(); + uint8_t num_groups = buf->ReadByte(); if (!HasExactlyOneBit(num_groups)) { grfmsg(1, "NewSpriteGroup: Random Action 2 nrand should be power of 2"); } @@ -6162,8 +6162,8 @@ static void NewSpriteGroup(ByteReader *buf) case GSF_SIGNALS: case GSF_NEWLANDSCAPE: { - byte num_loaded = type; - byte num_loading = buf->ReadByte(); + uint8_t num_loaded = type; + uint8_t num_loading = buf->ReadByte(); if (!_cur.HasValidSpriteSets(feature)) { grfmsg(0, "NewSpriteGroup: No sprite set to work on! Skipping"); @@ -6238,7 +6238,7 @@ static void NewSpriteGroup(ByteReader *buf) case GSF_OBJECTS: case GSF_INDUSTRYTILES: case GSF_ROADSTOPS: { - byte num_building_sprites = std::max((uint8_t)1, type); + uint8_t num_building_sprites = std::max((uint8_t)1, type); assert(TileLayoutSpriteGroup::CanAllocateItem()); TileLayoutSpriteGroup *group = new TileLayoutSpriteGroup(); @@ -6291,7 +6291,7 @@ static void NewSpriteGroup(ByteReader *buf) return; } for (uint i = 0; i < group->num_input; i++) { - byte rawcargo = buf->ReadByte(); + uint8_t rawcargo = buf->ReadByte(); CargoID cargo = GetCargoTranslation(rawcargo, _cur.grffile); if (cargo == INVALID_CARGO) { /* The mapped cargo is invalid. This is permitted at this point, @@ -6313,7 +6313,7 @@ static void NewSpriteGroup(ByteReader *buf) return; } for (uint i = 0; i < group->num_output; i++) { - byte rawcargo = buf->ReadByte(); + uint8_t rawcargo = buf->ReadByte(); CargoID cargo = GetCargoTranslation(rawcargo, _cur.grffile); if (cargo == INVALID_CARGO) { /* Mark this result as invalid to use */ @@ -6405,7 +6405,7 @@ static bool IsValidGroupID(uint16_t groupid, const char *function) return true; } -static void VehicleMapSpriteGroup(ByteReader *buf, byte feature, uint8_t idcount) +static void VehicleMapSpriteGroup(ByteReader *buf, uint8_t feature, uint8_t idcount) { static EngineID *last_engines; static uint last_engines_count; @@ -7433,7 +7433,7 @@ static void SkipAct5(ByteReader *buf) * @param grffile NewGRF querying the variable * @return true iff the variable is known and the value is returned in 'value'. */ -bool GetGlobalVariable(byte param, uint32_t *value, const GRFFile *grffile) +bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile) { if (_sprite_group_resolve_check_veh_check) { switch (param) { @@ -7546,7 +7546,7 @@ bool GetGlobalVariable(byte param, uint32_t *value, const GRFFile *grffile) /* case 0x1F: // locale dependent settings not implemented to avoid desync */ case 0x20: { // snow line height - byte snowline = GetSnowLine(); + uint8_t snowline = GetSnowLine(); if (_settings_game.game_creation.landscape == LT_ARCTIC && snowline <= _settings_game.construction.map_height_limit) { *value = Clamp(snowline * (grffile->grf_version >= 8 ? 1 : TILE_HEIGHT), 0, 0xFE); } else { @@ -7576,7 +7576,7 @@ bool GetGlobalVariable(byte param, uint32_t *value, const GRFFile *grffile) } } -static uint32_t GetParamVal(byte param, uint32_t *cond_val) +static uint32_t GetParamVal(uint8_t param, uint32_t *cond_val) { /* First handle variable common with VarAction2 */ uint32_t value; @@ -7656,11 +7656,11 @@ static void CfgApply(ByteReader *buf) /* Get (or create) the override for the next sprite. */ GRFLocation location(_cur.grfconfig->ident.grfid, _cur.nfo_line + 1); - std::unique_ptr &preload_sprite = _grf_line_to_action6_sprite_override[location]; + std::unique_ptr &preload_sprite = _grf_line_to_action6_sprite_override[location]; /* Load new sprite data if it hasn't already been loaded. */ if (preload_sprite == nullptr) { - preload_sprite = std::make_unique(num); + preload_sprite = std::make_unique(num); file.ReadBlock(preload_sprite.get(), num); } @@ -8073,9 +8073,9 @@ static void GRFLoadError(ByteReader *buf) STR_NEWGRF_ERROR_MSG_FATAL }; - byte severity = buf->ReadByte(); - byte lang = buf->ReadByte(); - byte message_id = buf->ReadByte(); + uint8_t severity = buf->ReadByte(); + uint8_t lang = buf->ReadByte(); + uint8_t message_id = buf->ReadByte(); /* Skip the error if it isn't valid for the current language. */ if (!CheckGrfLangID(lang, _cur.grffile->grf_version)) return; @@ -8219,10 +8219,10 @@ static uint32_t GetPatchVariable(uint8_t param) * SS : combination of both X and Y, thus giving the size(log2) of the map */ case 0x13: { - byte map_bits = 0; - byte log_X = MapLogX() - 6; // subtraction is required to make the minimal size (64) zero based - byte log_Y = MapLogY() - 6; - byte max_edge = std::max(log_X, log_Y); + uint8_t map_bits = 0; + uint8_t log_X = MapLogX() - 6; // subtraction is required to make the minimal size (64) zero based + uint8_t log_Y = MapLogY() - 6; + uint8_t max_edge = std::max(log_X, log_Y); if (log_X == log_Y) { // we have a squared map, since both edges are identical SetBit(map_bits, 0); @@ -8669,7 +8669,7 @@ static void FeatureTownName(ByteReader *buf) GRFTownName *townname = AddGRFTownName(grfid); - byte id = buf->ReadByte(); + uint8_t id = buf->ReadByte(); grfmsg(6, "FeatureTownName: definition 0x%02X", id & 0x7F); if (HasBit(id, 7)) { @@ -8677,7 +8677,7 @@ static void FeatureTownName(ByteReader *buf) ClrBit(id, 7); bool new_scheme = _cur.grffile->grf_version >= 7; - byte lang = buf->ReadByte(); + uint8_t lang = buf->ReadByte(); StringID style = STR_UNDEFINED; do { @@ -8713,7 +8713,7 @@ static void FeatureTownName(ByteReader *buf) part.prob = buf->ReadByte(); if (HasBit(part.prob, 7)) { - byte ref_id = buf->ReadByte(); + uint8_t ref_id = buf->ReadByte(); if (ref_id >= GRFTownName::MAX_LISTS || townname->partlists[ref_id].empty()) { grfmsg(0, "FeatureTownName: definition 0x%02X doesn't exist, deactivating", ref_id); DelGRFTownName(grfid); @@ -8741,7 +8741,7 @@ static void DefineGotoLabel(ByteReader *buf) * B label The label to define * V comment Optional comment - ignored */ - byte nfo_label = buf->ReadByte(); + uint8_t nfo_label = buf->ReadByte(); _cur.grffile->labels.emplace_back(nfo_label, _cur.nfo_line, _cur.file->GetPos()); @@ -8817,7 +8817,7 @@ static void GRFSound(ByteReader *buf) } SpriteFile &file = *_cur.file; - byte grf_container_version = file.GetContainerVersion(); + uint8_t grf_container_version = file.GetContainerVersion(); for (int i = 0; i < num; i++) { _cur.nfo_line++; @@ -8828,7 +8828,7 @@ static void GRFSound(ByteReader *buf) size_t offs = file.GetPos(); uint32_t len = grf_container_version >= 2 ? file.ReadDword() : file.ReadWord(); - byte type = file.ReadByte(); + uint8_t type = file.ReadByte(); if (grf_container_version >= 2 && type == 0xFD) { /* Reference to sprite section. */ @@ -8857,7 +8857,7 @@ static void GRFSound(ByteReader *buf) file.SkipBytes(len); } - byte action = file.ReadByte(); + uint8_t action = file.ReadByte(); switch (action) { case 0xFF: /* Allocate sound only in init stage. */ @@ -8991,8 +8991,8 @@ static void TranslateGRFStrings(ByteReader *buf) * new_scheme has to be true as well, which will also be implicitly the case for version 8 * and higher. A language id of 0x7F will be overridden by a non-generic id, so this will * not change anything if a string has been provided specifically for this language. */ - byte language = _cur.grffile->grf_version >= 8 ? buf->ReadByte() : 0x7F; - byte num_strings = buf->ReadByte(); + uint8_t language = _cur.grffile->grf_version >= 8 ? buf->ReadByte() : 0x7F; + uint8_t num_strings = buf->ReadByte(); uint16_t first_id = buf->ReadWord(); if (!((first_id >= 0xD000 && first_id + num_strings <= 0xD400) || (first_id >= 0xD800 && first_id + num_strings <= 0xE000))) { @@ -9013,21 +9013,21 @@ static void TranslateGRFStrings(ByteReader *buf) } /** Callback function for 'INFO'->'NAME' to add a translation to the newgrf name. */ -static bool ChangeGRFName(byte langid, const char *str) +static bool ChangeGRFName(uint8_t langid, const char *str) { AddGRFTextToList(_cur.grfconfig->name, langid, _cur.grfconfig->ident.grfid, false, str); return true; } /** Callback function for 'INFO'->'DESC' to add a translation to the newgrf description. */ -static bool ChangeGRFDescription(byte langid, const char *str) +static bool ChangeGRFDescription(uint8_t langid, const char *str) { AddGRFTextToList(_cur.grfconfig->info, langid, _cur.grfconfig->ident.grfid, true, str); return true; } /** Callback function for 'INFO'->'URL_' to set the newgrf url. */ -static bool ChangeGRFURL(byte langid, const char *str) +static bool ChangeGRFURL(uint8_t langid, const char *str) { AddGRFTextToList(_cur.grfconfig->url, langid, _cur.grfconfig->ident.grfid, false, str); return true; @@ -9129,14 +9129,14 @@ static bool ChangeGRFMinVersion(size_t len, ByteReader *buf) static GRFParameterInfo *_cur_parameter; ///< The parameter which info is currently changed by the newgrf. /** Callback function for 'INFO'->'PARAM'->param_num->'NAME' to set the name of a parameter. */ -static bool ChangeGRFParamName(byte langid, const char *str) +static bool ChangeGRFParamName(uint8_t langid, const char *str) { AddGRFTextToList(_cur_parameter->name, langid, _cur.grfconfig->ident.grfid, false, str); return true; } /** Callback function for 'INFO'->'PARAM'->param_num->'DESC' to set the description of a parameter. */ -static bool ChangeGRFParamDescription(byte langid, const char *str) +static bool ChangeGRFParamDescription(uint8_t langid, const char *str) { AddGRFTextToList(_cur_parameter->desc, langid, _cur.grfconfig->ident.grfid, true, str); return true; @@ -9188,14 +9188,14 @@ static bool ChangeGRFParamMask(size_t len, ByteReader *buf) grfmsg(2, "StaticGRFInfo: expected 1 to 3 bytes for 'INFO'->'PARA'->'MASK' but got " PRINTF_SIZE ", ignoring this field", len); buf->Skip(len); } else { - byte param_nr = buf->ReadByte(); + uint8_t param_nr = buf->ReadByte(); if (param_nr >= _cur.grfconfig->param.size()) { grfmsg(2, "StaticGRFInfo: invalid parameter number in 'INFO'->'PARA'->'MASK', param %d, ignoring this field", param_nr); buf->Skip(len - 1); } else { _cur_parameter->param_nr = param_nr; - if (len >= 2) _cur_parameter->first_bit = std::min(buf->ReadByte(), 31); - if (len >= 3) _cur_parameter->num_bit = std::min(buf->ReadByte(), 32 - _cur_parameter->first_bit); + if (len >= 2) _cur_parameter->first_bit = std::min(buf->ReadByte(), 31); + if (len >= 3) _cur_parameter->num_bit = std::min(buf->ReadByte(), 32 - _cur_parameter->first_bit); } } @@ -9215,9 +9215,9 @@ static bool ChangeGRFParamDefault(size_t len, ByteReader *buf) return true; } -typedef bool (*DataHandler)(size_t, ByteReader *); ///< Type of callback function for binary nodes -typedef bool (*TextHandler)(byte, const char *str); ///< Type of callback function for text nodes -typedef bool (*BranchHandler)(ByteReader *); ///< Type of callback function for branch nodes +typedef bool (*DataHandler)(size_t, ByteReader *); ///< Type of callback function for binary nodes +typedef bool (*TextHandler)(uint8_t, const char *str); ///< Type of callback function for text nodes +typedef bool (*BranchHandler)(ByteReader *); ///< Type of callback function for branch nodes /** * Data structure to store the allowed id/type combinations for action 14. The @@ -9283,8 +9283,8 @@ struct AllowedSubtags { this->handler.u.subtags = subtags; } - uint32_t id; ///< The identifier for this node - byte type; ///< The type of the node, must be one of 'C', 'B' or 'T'. + uint32_t id; ///< The identifier for this node + uint8_t type; ///< The type of the node, must be one of 'C', 'B' or 'T'. union { DataHandler data; ///< Callback function for a binary node, only valid if type == 'B'. TextHandler text; ///< Callback function for a text node, only valid if type == 'T'. @@ -9298,7 +9298,7 @@ struct AllowedSubtags { } handler; }; -static bool SkipUnknownInfo(ByteReader *buf, byte type); +static bool SkipUnknownInfo(ByteReader *buf, uint8_t type); static bool HandleNodes(ByteReader *buf, AllowedSubtags *tags); /** @@ -9309,7 +9309,7 @@ static bool HandleNodes(ByteReader *buf, AllowedSubtags *tags); */ static bool SkipInfoChunk(ByteReader *buf) { - byte type = buf->ReadByte(); + uint8_t type = buf->ReadByte(); while (type != 0) { buf->ReadDWord(); // chunk ID if (!SkipUnknownInfo(buf, type)) return false; @@ -9326,7 +9326,7 @@ static bool SkipInfoChunk(ByteReader *buf) */ static bool ChangeGRFParamValueNames(ByteReader *buf) { - byte type = buf->ReadByte(); + uint8_t type = buf->ReadByte(); while (type != 0) { uint32_t id = buf->ReadDWord(); if (type != 'T' || id > _cur_parameter->max_value) { @@ -9336,7 +9336,7 @@ static bool ChangeGRFParamValueNames(ByteReader *buf) continue; } - byte langid = buf->ReadByte(); + uint8_t langid = buf->ReadByte(); const char *name_string = buf->ReadString(); auto val_name = _cur_parameter->value_names.find(id); @@ -9373,7 +9373,7 @@ AllowedSubtags _tags_parameters[] = { */ static bool HandleParameterInfo(ByteReader *buf) { - byte type = buf->ReadByte(); + uint8_t type = buf->ReadByte(); while (type != 0) { uint32_t id = buf->ReadDWord(); if (type != 'C' || id >= _cur.grfconfig->num_valid_params) { @@ -9457,7 +9457,7 @@ struct GRFFeatureTest { static GRFFeatureTest _current_grf_feature_test; /** Callback function for 'FTST'->'NAME' to set the name of the feature being tested. */ -static bool ChangeGRFFeatureTestName(byte langid, const char *str) +static bool ChangeGRFFeatureTestName(uint8_t langid, const char *str) { extern const GRFFeatureInfo _grf_feature_list[]; for (const GRFFeatureInfo *info = _grf_feature_list; info->name != nullptr; info++) { @@ -9794,7 +9794,7 @@ struct GRFPropertyMapAction { static GRFPropertyMapAction _current_grf_property_map_action; /** Callback function for ->'NAME' to set the name of the item to be mapped. */ -static bool ChangePropertyRemapName(byte langid, const char *str) +static bool ChangePropertyRemapName(uint8_t langid, const char *str) { _current_grf_property_map_action.name = str; return true; @@ -10113,12 +10113,12 @@ AllowedSubtags _tags_root_feature_tests[] = { * @param type The node type to skip. * @return True if we could skip the node, false if an error occurred. */ -static bool SkipUnknownInfo(ByteReader *buf, byte type) +static bool SkipUnknownInfo(ByteReader *buf, uint8_t type) { /* type and id are already read */ switch (type) { case 'C': { - byte new_type = buf->ReadByte(); + uint8_t new_type = buf->ReadByte(); while (new_type != 0) { buf->ReadDWord(); // skip the id if (!SkipUnknownInfo(buf, new_type)) return false; @@ -10153,7 +10153,7 @@ static bool SkipUnknownInfo(ByteReader *buf, byte type) * @param subtags Allowed subtags. * @return Whether all tags could be handled. */ -static bool HandleNode(byte type, uint32_t id, ByteReader *buf, AllowedSubtags subtags[]) +static bool HandleNode(uint8_t type, uint32_t id, ByteReader *buf, AllowedSubtags subtags[]) { uint i = 0; AllowedSubtags *tag; @@ -10163,7 +10163,7 @@ static bool HandleNode(byte type, uint32_t id, ByteReader *buf, AllowedSubtags s default: NOT_REACHED(); case 'T': { - byte langid = buf->ReadByte(); + uint8_t langid = buf->ReadByte(); return tag->handler.text(langid, buf->ReadString()); } @@ -10193,7 +10193,7 @@ static bool HandleNode(byte type, uint32_t id, ByteReader *buf, AllowedSubtags s */ static bool HandleNodes(ByteReader *buf, AllowedSubtags subtags[]) { - byte type = buf->ReadByte(); + uint8_t type = buf->ReadByte(); while (type != 0) { uint32_t id = buf->ReadDWord(); if (!HandleNode(type, id, buf, subtags)) return false; @@ -10682,12 +10682,12 @@ static void CalculateRefitMasks() if (_gted[engine].defaultcargo_grf == nullptr) { /* If the vehicle has any capacity, apply the default refit masks */ if (e->type != VEH_TRAIN || e->u.rail.capacity != 0) { - static constexpr byte T = 1 << LT_TEMPERATE; - static constexpr byte A = 1 << LT_ARCTIC; - static constexpr byte S = 1 << LT_TROPIC; - static constexpr byte Y = 1 << LT_TOYLAND; + static constexpr uint8_t T = 1 << LT_TEMPERATE; + static constexpr uint8_t A = 1 << LT_ARCTIC; + static constexpr uint8_t S = 1 << LT_TROPIC; + static constexpr uint8_t Y = 1 << LT_TOYLAND; static const struct DefaultRefitMasks { - byte climate; + uint8_t climate; CargoLabel cargo_label; CargoTypes cargo_allowed; CargoTypes cargo_disallowed; @@ -10805,9 +10805,9 @@ static void CalculateRefitMasks() if (file == nullptr) file = e->GetGRF(); if (file != nullptr && file->grf_version >= 8 && !file->cargo_list.empty()) { /* Use first refittable cargo from cargo translation table */ - byte best_local_slot = UINT8_MAX; + uint8_t best_local_slot = UINT8_MAX; for (CargoID cargo_type : SetCargoBitIterator(ei->refit_mask)) { - byte local_slot = file->cargo_map[cargo_type]; + uint8_t local_slot = file->cargo_map[cargo_type]; if (local_slot < best_local_slot) { best_local_slot = local_slot; ei->cargo_type = cargo_type; @@ -11212,7 +11212,7 @@ static void FinaliseAirportsArray() * XXX: We consider GRF files trusted. It would be trivial to exploit OTTD by * a crafted invalid GRF file. We should tell that to the user somehow, or * better make this more robust in the future. */ -static void DecodeSpecialSprite(byte *buf, uint num, GrfLoadingStage stage) +static void DecodeSpecialSprite(uint8_t *buf, uint num, GrfLoadingStage stage) { /* XXX: There is a difference between staged loading in TTDPatch and * here. In TTDPatch, for some reason actions 1 and 2 are carried out @@ -11271,7 +11271,7 @@ static void DecodeSpecialSprite(byte *buf, uint num, GrfLoadingStage stage) ByteReader *bufp = &br; try { - byte action = bufp->ReadByte(); + uint8_t action = bufp->ReadByte(); if (action == 0xFF) { grfmsg(2, "DecodeSpecialSprite: Unexpected data block, skipping"); @@ -11304,7 +11304,7 @@ static void LoadNewGRFFileFromFile(GRFConfig *config, GrfLoadingStage stage, Spr DEBUG(grf, 2, "LoadNewGRFFile: Reading NewGRF-file '%s'", config->GetDisplayPath()); - byte grf_container_version = file.GetContainerVersion(); + uint8_t grf_container_version = file.GetContainerVersion(); if (grf_container_version == 0) { DEBUG(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format"); return; @@ -11321,7 +11321,7 @@ static void LoadNewGRFFileFromFile(GRFConfig *config, GrfLoadingStage stage, Spr if (grf_container_version >= 2) { /* Read compression value. */ - byte compression = file.ReadByte(); + uint8_t compression = file.ReadByte(); if (compression != 0) { DEBUG(grf, 7, "LoadNewGRFFile: Unsupported compression format"); return; @@ -11341,10 +11341,10 @@ static void LoadNewGRFFileFromFile(GRFConfig *config, GrfLoadingStage stage, Spr _cur.ClearDataForNextFile(); - ReusableBuffer buf; + ReusableBuffer buf; while ((num = (grf_container_version >= 2 ? file.ReadDword() : file.ReadWord())) != 0) { - byte type = file.ReadByte(); + uint8_t type = file.ReadByte(); _cur.nfo_line++; if (type == 0xFF) { @@ -11727,7 +11727,7 @@ void LoadNewGRF(uint load_index, uint num_baseset) uint64_t scaled_tick_counter = _scaled_tick_counter; StateTicks state_ticks = _state_ticks; StateTicksDelta state_ticks_offset = DateDetail::_state_ticks_offset; - byte display_opt = _display_opt; + uint8_t display_opt = _display_opt; if (_networking) { CalTime::Detail::now = CalTime::Detail::NewState(_settings_game.game_creation.starting_year); diff --git a/src/newgrf.h b/src/newgrf.h index 22df7952da..33951ab4cd 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -107,11 +107,11 @@ enum GrfSpecFeature : uint8_t { static const uint32_t INVALID_GRFID = 0xFFFFFFFF; struct GRFLabel { - byte label; + uint8_t label; uint32_t nfo_line; size_t pos; - GRFLabel(byte label, uint32_t nfo_line, size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {} + GRFLabel(uint8_t label, uint32_t nfo_line, size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {} }; enum GRFPropertyMapFallbackMode { @@ -327,7 +327,7 @@ struct NewSignalStyle; struct GRFFile : ZeroedMemoryAllocator { std::string filename; uint32_t grfid; - byte grf_version; + uint8_t grf_version; uint sound_offset; uint16_t num_sounds; @@ -382,15 +382,15 @@ struct GRFFile : ZeroedMemoryAllocator { uint32_t observed_feature_tests; ///< Observed feature test bits (see: GRFFeatureTestObservationFlag) const SpriteGroup *new_signals_group; ///< New signals sprite group - byte new_signal_ctrl_flags; ///< Ctrl flags for new signals - byte new_signal_extra_aspects; ///< Number of extra aspects for new signals + uint8_t new_signal_ctrl_flags; ///< Ctrl flags for new signals + uint8_t new_signal_extra_aspects; ///< Number of extra aspects for new signals uint16_t new_signal_style_mask; ///< New signal styles usable with this GRF NewSignalStyle *current_new_signal_style; ///< Current new signal style being defined by this GRF const SpriteGroup *new_rocks_group; ///< New landscape rocks group - byte new_landscape_ctrl_flags; ///< Ctrl flags for new landscape + uint8_t new_landscape_ctrl_flags; ///< Ctrl flags for new landscape - byte ctrl_flags; ///< General GRF control flags + uint8_t ctrl_flags; ///< General GRF control flags btree::btree_map string_map; ///< Map of local GRF string ID to string ID @@ -434,7 +434,7 @@ struct GRFLoadedFeatures { */ inline bool HasGrfMiscBit(GrfMiscBit bit) { - extern byte _misc_grf_features; + extern uint8_t _misc_grf_features; return HasBit(_misc_grf_features, bit); } @@ -450,7 +450,7 @@ void ResetPersistentNewGRFData(); #define grfmsg(severity, ...) if ((severity) == 0 || _debug_grf_level >= (severity)) _intl_grfmsg(severity, __VA_ARGS__) void CDECL _intl_grfmsg(int severity, const char *str, ...) WARN_FORMAT(2, 3); -bool GetGlobalVariable(byte param, uint32_t *value, const GRFFile *grffile); +bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile); StringID MapGRFStringID(uint32_t grfid, StringID str); void ShowNewGRFError(); diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index 28db942970..a4d25e0409 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -51,13 +51,13 @@ AirportSpec AirportSpec::specs[NUM_AIRPORTS]; ///< Airport specifications. * @param type index of airport * @return A pointer to the corresponding AirportSpec */ -/* static */ const AirportSpec *AirportSpec::Get(byte type) +/* static */ const AirportSpec *AirportSpec::Get(uint8_t type) { assert(type < lengthof(AirportSpec::specs)); const AirportSpec *as = &AirportSpec::specs[type]; if (type >= NEW_AIRPORT_OFFSET && !as->enabled) { if (_airport_mngr.GetGRFID(type) == 0) return as; - byte subst_id = _airport_mngr.GetSubstituteID(type); + uint8_t subst_id = _airport_mngr.GetSubstituteID(type); if (subst_id == AT_INVALID) return as; as = &AirportSpec::specs[subst_id]; } @@ -71,7 +71,7 @@ AirportSpec AirportSpec::specs[NUM_AIRPORTS]; ///< Airport specifications. * @param type index of airport * @return A pointer to the corresponding AirportSpec */ -/* static */ AirportSpec *AirportSpec::GetWithoutOverride(byte type) +/* static */ AirportSpec *AirportSpec::GetWithoutOverride(uint8_t type) { assert(type < lengthof(AirportSpec::specs)); return &AirportSpec::specs[type]; @@ -92,12 +92,12 @@ bool AirportSpec::IsAvailable() const * @param tile Top corner of the airport. * @return true iff the airport would be within the map bounds at the given tile. */ -bool AirportSpec::IsWithinMapBounds(byte table, TileIndex tile) const +bool AirportSpec::IsWithinMapBounds(uint8_t table, TileIndex tile) const { if (table >= this->num_table) return false; - byte w = this->size_x; - byte h = this->size_y; + uint8_t w = this->size_x; + uint8_t h = this->size_y; if (this->rotation[table] == DIR_E || this->rotation[table] == DIR_W) Swap(w, h); return TileX(tile) + w < MapSizeX() && @@ -131,7 +131,7 @@ void BindAirportSpecs() void AirportOverrideManager::SetEntitySpec(AirportSpec *as) { - byte airport_id = this->AddEntityID(as->grf_prop.local_id, as->grf_prop.grffile->grfid, as->grf_prop.subst_id); + uint8_t airport_id = this->AddEntityID(as->grf_prop.local_id, as->grf_prop.grffile->grfid, as->grf_prop.subst_id); if (airport_id == this->invalid_id) { grfmsg(1, "Airport.SetEntitySpec: Too many airports allocated. Ignoring."); @@ -241,14 +241,14 @@ TownScopeResolver *AirportResolverObject::GetTown() * @param param1 First parameter (var 10) of the callback. * @param param2 Second parameter (var 18) of the callback. */ -AirportResolverObject::AirportResolverObject(TileIndex tile, Station *st, byte airport_id, byte layout, +AirportResolverObject::AirportResolverObject(TileIndex tile, Station *st, uint8_t airport_id, uint8_t layout, CallbackID callback, uint32_t param1, uint32_t param2) : ResolverObject(AirportSpec::Get(airport_id)->grf_prop.grffile, callback, param1, param2), airport_scope(*this, tile, st, airport_id, layout) { this->root_spritegroup = AirportSpec::Get(airport_id)->grf_prop.spritegroup[0]; } -SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout) +SpriteID GetCustomAirportSprite(const AirportSpec *as, uint8_t layout) { AirportResolverObject object(INVALID_TILE, nullptr, as->GetIndex(), layout); const SpriteGroup *group = object.Resolve(); @@ -270,7 +270,7 @@ uint16_t GetAirportCallback(CallbackID callback, uint32_t param1, uint32_t param * @param callback The callback to call. * @return The custom text. */ -StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16_t callback) +StringID GetAirportTextCallback(const AirportSpec *as, uint8_t layout, uint16_t callback) { AirportResolverObject object(INVALID_TILE, nullptr, as->GetIndex(), layout, (CallbackID)callback); uint16_t cb_res = object.ResolveCallback(); diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index 0517e35dfa..b5e1fbfe19 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -19,7 +19,7 @@ #include "tilearea_type.h" /** Copy from station_map.h */ -typedef byte StationGfx; +typedef uint8_t StationGfx; /** Tile-offset / AirportTileID pair. */ struct AirportTileTable { @@ -91,7 +91,7 @@ enum TTDPAirportType { struct HangarTileTable { TileIndexDiffC ti; ///< Tile offset from the top-most airport tile. Direction dir; ///< Direction of the exit. - byte hangar_num; ///< The hangar to which this tile belongs. + uint8_t hangar_num; ///< The hangar to which this tile belongs. }; /** @@ -101,13 +101,13 @@ struct AirportSpec { const struct AirportFTAClass *fsm; ///< the finite statemachine for the default airports const AirportTileTable * const *table; ///< list of the tiles composing the airport const Direction *rotation; ///< the rotation of each tiletable - byte num_table; ///< number of elements in the table + uint8_t num_table; ///< number of elements in the table const HangarTileTable *depot_table; ///< gives the position of the depots on the airports - byte nof_depots; ///< the number of hangar tiles in this airport - byte size_x; ///< size of airport in x direction - byte size_y; ///< size of airport in y direction - byte noise_level; ///< noise that this airport generates - byte catchment; ///< catchment area of this airport + uint8_t nof_depots; ///< the number of hangar tiles in this airport + uint8_t size_x; ///< size of airport in x direction + uint8_t size_y; ///< size of airport in y direction + uint8_t noise_level; ///< noise that this airport generates + uint8_t catchment; ///< catchment area of this airport CalTime::Year min_year; ///< first year the airport is available CalTime::Year max_year; ///< last year the airport is available StringID name; ///< name of this airport @@ -119,19 +119,19 @@ struct AirportSpec { bool enabled; ///< Entity still available (by default true). Newgrf can disable it, though. struct GRFFileProps grf_prop; ///< Properties related to the grf file. - static const AirportSpec *Get(byte type); - static AirportSpec *GetWithoutOverride(byte type); + static const AirportSpec *Get(uint8_t type); + static AirportSpec *GetWithoutOverride(uint8_t type); bool IsAvailable() const; - bool IsWithinMapBounds(byte table, TileIndex index) const; + bool IsWithinMapBounds(uint8_t table, TileIndex index) const; static void ResetAirports(); /** Get the index of this spec. */ - byte GetIndex() const + uint8_t GetIndex() const { assert(this >= specs && this < endof(specs)); - return (byte)(this - specs); + return (uint8_t)(this - specs); } static const AirportSpec dummy; ///< The dummy airport. @@ -148,8 +148,8 @@ void BindAirportSpecs(); /** Resolver for the airport scope. */ struct AirportScopeResolver : public ScopeResolver { struct Station *st; ///< Station of the airport for which the callback is run, or \c nullptr for build gui. - byte airport_id; ///< Type of airport for which the callback is run. - byte layout; ///< Layout of the airport to build. + uint8_t airport_id; ///< Type of airport for which the callback is run. + uint8_t layout; ///< Layout of the airport to build. TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks. /** @@ -160,7 +160,7 @@ struct AirportScopeResolver : public ScopeResolver { * @param airport_id Type of airport for which the callback is run. * @param layout Layout of the airport to build. */ - AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout) + AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, uint8_t airport_id, uint8_t layout) : ScopeResolver(ro), st(st), airport_id(airport_id), layout(layout), tile(tile) { } @@ -176,7 +176,7 @@ struct AirportResolverObject : public ResolverObject { AirportScopeResolver airport_scope; std::unique_ptr town_scope; ///< The town scope resolver (created on the first call). - AirportResolverObject(TileIndex tile, Station *st, byte airport_id, byte layout, + AirportResolverObject(TileIndex tile, Station *st, uint8_t airport_id, uint8_t layout, CallbackID callback = CBID_NO_CALLBACK, uint32_t callback_param1 = 0, uint32_t callback_param2 = 0); TownScopeResolver *GetTown(); @@ -199,6 +199,6 @@ struct AirportResolverObject : public ResolverObject { uint32_t GetDebugID() const override; }; -StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16_t callback); +StringID GetAirportTextCallback(const AirportSpec *as, uint8_t layout, uint16_t callback); #endif /* NEWGRF_AIRPORT_H */ diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index 32c21f4534..8261df07f0 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -108,7 +108,7 @@ StationGfx GetTranslatedAirportTileID(StationGfx gfx) * @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8. * @return a construction of bits obeying the newgrf format */ -static uint32_t GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8, uint32_t mask) +static uint32_t GetNearbyAirportTileInformation(uint8_t parameter, TileIndex tile, StationID index, bool grf_version8, uint32_t mask) { if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required bool is_same_airport = (IsTileType(tile, MP_STATION) && IsAirport(tile) && GetStationIndex(tile) == index); @@ -225,7 +225,7 @@ AirportTileResolverObject::AirportTileResolverObject(const AirportTileSpec *ats, CallbackID callback, uint32_t callback_param1, uint32_t callback_param2) : ResolverObject(ats->grf_prop.grffile, callback, callback_param1, callback_param2), tiles_scope(*this, ats, tile, st), - airport_scope(*this, tile, st, st != nullptr ? st->airport.type : (byte)AT_DUMMY, st != nullptr ? st->airport.layout : 0) + airport_scope(*this, tile, st, st != nullptr ? st->airport.type : (uint8_t)AT_DUMMY, st != nullptr ? st->airport.layout : 0) { this->root_spritegroup = ats->grf_prop.spritegroup[0]; } @@ -246,7 +246,7 @@ uint16_t GetAirportTileCallback(CallbackID callback, uint32_t param1, uint32_t p return object.ResolveCallback(); } -static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour) +static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, uint8_t colour) { const DrawTileSprites *dts = group->ProcessRegisters(nullptr); diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h index 94c539ac70..29cd0351cc 100644 --- a/src/newgrf_airporttiles.h +++ b/src/newgrf_airporttiles.h @@ -20,7 +20,7 @@ /** Scope resolver for handling the tiles of an airport. */ struct AirportTileScopeResolver : public ScopeResolver { struct Station *st; ///< %Station of the airport for which the callback is run, or \c nullptr for build gui. - byte airport_id; ///< Type of airport for which the callback is run. + uint8_t airport_id; ///< Type of airport for which the callback is run. TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks. const AirportTileSpec *ats; diff --git a/src/newgrf_animation_base.h b/src/newgrf_animation_base.h index c64836baec..1a57008474 100644 --- a/src/newgrf_animation_base.h +++ b/src/newgrf_animation_base.h @@ -19,10 +19,10 @@ template struct TileAnimationFrameAnimationHelper { - static byte Get(Tobj *obj, TileIndex tile) { return GetAnimationFrame(tile); } - static bool Set(Tobj *obj, TileIndex tile, byte frame) + static uint8_t Get(Tobj *obj, TileIndex tile) { return GetAnimationFrame(tile); } + static bool Set(Tobj *obj, TileIndex tile, uint8_t frame) { - byte prev = GetAnimationFrame(tile); + uint8_t prev = GetAnimationFrame(tile); if (frame != prev) { SetAnimationFrame(tile, frame); return true; diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index c412c1d3d4..2cceea95f4 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -403,7 +403,7 @@ uint32_t GetTerrainType(TileIndex tile, TileContext context) * @param axis Axis of a railways station. * @return The tile at the offset. */ -TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis) +TileIndex GetNearbyTile(uint8_t parameter, TileIndex tile, bool signed_offsets, Axis axis) { int8_t x = GB(parameter, 0, 4); int8_t y = GB(parameter, 4, 4); @@ -443,7 +443,7 @@ uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8, uint32_t ma } if (mask & 0xFE00) { /* Return 0 if the tile is a land tile */ - byte terrain_type = (HasTileWaterClass(tile) ? (GetWaterClass(tile) + 1) & 3 : 0) << 5 | GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1; + uint8_t terrain_type = (HasTileWaterClass(tile) ? (GetWaterClass(tile) + 1) & 3 : 0) << 5 | GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1; result |= terrain_type << 8; } if (mask & 0xFF00FF) { diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index 4fc00e7602..0da8f02315 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -294,7 +294,7 @@ extern AirportTileOverrideManager _airporttile_mngr; extern ObjectOverrideManager _object_mngr; uint32_t GetTerrainType(TileIndex tile, TileContext context = TCX_NORMAL); -TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets = true, Axis axis = INVALID_AXIS); +TileIndex GetNearbyTile(uint8_t parameter, TileIndex tile, bool signed_offsets = true, Axis axis = INVALID_AXIS); uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8, uint32_t mask); uint32_t GetCompanyInfo(CompanyID owner, const struct Livery *l = nullptr); CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, const GRFFile *grffile, StringID default_error); diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index b32c684170..86eb580edc 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -260,10 +260,10 @@ void UpdateNewGRFConfigPalette(int32_t new_value) */ size_t GRFGetSizeOfDataSection(FILE *f) { - extern const byte _grf_cont_v2_sig[]; + extern const uint8_t _grf_cont_v2_sig[]; static const uint header_len = 14; - byte data[header_len]; + uint8_t data[header_len]; if (fread(data, 1, header_len, f) == header_len) { if (data[0] == 0 && data[1] == 0 && MemCmpT(data + 2, _grf_cont_v2_sig, 8) == 0) { /* Valid container version 2, get data section size. */ diff --git a/src/newgrf_config.h b/src/newgrf_config.h index e51d33f93d..bd742ab1b2 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -137,9 +137,9 @@ struct GRFParameterInfo { uint32_t min_value; ///< The minimal value this parameter can have uint32_t max_value; ///< The maximal value of this parameter uint32_t def_value; ///< Default value of this parameter - byte param_nr; ///< GRF parameter to store content in - byte first_bit; ///< First bit to use in the GRF parameter - byte num_bit; ///< Number of bits to use for this parameter + uint8_t param_nr; ///< GRF parameter to store content in + uint8_t first_bit; ///< First bit to use in the GRF parameter + uint8_t num_bit; ///< Number of bits to use for this parameter btree::btree_map value_names; ///< Names for each value. bool complete_labels; ///< True if all values have a label. diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 00e4c06ceb..394eeee897 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -111,9 +111,9 @@ enum NIType { struct NIProperty { const char *name; ///< A (human readable) name for the property ptrdiff_t offset; ///< Offset of the variable in the class - byte read_size; ///< Number of bytes (i.e. byte, word, dword etc) - byte prop; ///< The number of the property - byte type; + uint8_t read_size; ///< Number of bytes (i.e. byte, word, dword etc) + uint8_t prop; ///< The number of the property + uint8_t type; }; @@ -122,11 +122,11 @@ struct NIProperty { * information on when they actually apply. */ struct NICallback { - const char *name; ///< The human readable name of the callback - ptrdiff_t offset; ///< Offset of the variable in the class - byte read_size; ///< The number of bytes (i.e. byte, word, dword etc) to read - byte cb_bit; ///< The bit that needs to be set for this callback to be enabled - uint16_t cb_id; ///< The number of the callback + const char *name; ///< The human readable name of the callback + ptrdiff_t offset; ///< Offset of the variable in the class + uint8_t read_size; ///< The number of bytes (i.e. byte, word, dword etc) to read + uint8_t cb_bit; ///< The bit that needs to be set for this callback to be enabled + uint16_t cb_id; ///< The number of the callback }; /** Mask to show no bit needs to be enabled for the callback. */ static const int CBM_NO_BIT = UINT8_MAX; @@ -800,7 +800,7 @@ struct NewGRFInspectWindow : Window { if (nif->properties != nullptr) { this->DrawString(r, i++, "Properties:"); for (const NIProperty *nip = nif->properties; nip->name != nullptr; nip++) { - const void *ptr = (const byte *)base + nip->offset; + const void *ptr = (const uint8_t *)base + nip->offset; uint value; switch (nip->read_size) { case 1: value = *(const uint8_t *)ptr; break; @@ -832,7 +832,7 @@ struct NewGRFInspectWindow : Window { this->DrawString(r, i++, "Callbacks:"); for (const NICallback *nic = nif->callbacks; nic->name != nullptr; nic++) { if (nic->cb_bit != CBM_NO_BIT) { - const void *ptr = (const byte *)base_spec + nic->offset; + const void *ptr = (const uint8_t *)base_spec + nic->offset; uint value; switch (nic->read_size) { case 1: value = *(const uint8_t *)ptr; break; diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index aaf9e61160..a79a83336d 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -57,7 +57,7 @@ const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, Eng return nullptr; } -void SetCustomEngineSprites(EngineID engine, byte cargo, const SpriteGroup *group) +void SetCustomEngineSprites(EngineID engine, uint8_t cargo, const SpriteGroup *group) { Engine *e = Engine::Get(engine); assert(cargo < lengthof(e->grf_prop.spritegroup)); @@ -137,7 +137,7 @@ enum TTDPAircraftMovementStates { * Map OTTD aircraft movement states to TTDPatch style movement states * (VarAction 2 Variable 0xE2) */ -byte MapAircraftMovementState(const Aircraft *v) +uint8_t MapAircraftMovementState(const Aircraft *v) { const Station *st = GetTargetAirportIfValid(v); if (st == nullptr) return AMS_TTDP_FLIGHT_TO_TOWER; @@ -264,7 +264,7 @@ enum TTDPAircraftMovementActions { * (VarAction 2 Variable 0xE6) * This is not fully supported yet but it's enough for Planeset. */ -static byte MapAircraftMovementAction(const Aircraft *v) +static uint8_t MapAircraftMovementAction(const Aircraft *v) { switch (v->state) { case HANGAR: @@ -412,8 +412,8 @@ static const Livery *LiveryHelper(EngineID engine, const Vehicle *v) static uint32_t PositionHelper(const Vehicle *v, bool consecutive) { const Vehicle *u; - byte chain_before = 0; - byte chain_after = 0; + uint8_t chain_before = 0; + uint8_t chain_after = 0; for (u = v->First(); u != v; u = u->Next()) { chain_before++; @@ -563,7 +563,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec case 0x42: { // Consist cargo information if ((extra->mask & 0x00FFFFFF) == 0) { if (!HasBit(v->grf_cache.cache_valid, NCVV_CONSIST_CARGO_INFORMATION_UD)) { - byte user_def_data = 0; + uint8_t user_def_data = 0; if (v->type == VEH_TRAIN) { for (const Vehicle *u = v; u != nullptr; u = u->Next()) { user_def_data |= Train::From(u)->tcache.user_def_data; @@ -576,8 +576,8 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec } if (!HasBit(v->grf_cache.cache_valid, NCVV_CONSIST_CARGO_INFORMATION)) { std::array common_cargoes{}; - byte cargo_classes = 0; - byte user_def_data = 0; + uint8_t cargo_classes = 0; + uint8_t user_def_data = 0; for (const Vehicle *u = v; u != nullptr; u = u->Next()) { if (v->type == VEH_TRAIN) user_def_data |= Train::From(u)->tcache.user_def_data; @@ -647,7 +647,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec const Vehicle *w = v->Next(); assert(w != nullptr); uint16_t altitude = ClampTo(v->z_pos - w->z_pos); // Aircraft height - shadow height - byte airporttype = ATP_TTDP_LARGE; + uint8_t airporttype = ATP_TTDP_LARGE; const Station *st = GetTargetAirportIfValid(Aircraft::From(v)); @@ -737,9 +737,9 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec case 0x4D: // Position within articulated vehicle if (!HasBit(v->grf_cache.cache_valid, NCVV_POSITION_IN_VEHICLE)) { - byte artic_before = 0; + uint8_t artic_before = 0; for (const Vehicle *u = v; u->IsArticulatedPart(); u = u->Previous()) artic_before++; - byte artic_after = 0; + uint8_t artic_after = 0; for (const Vehicle *u = v; u->HasArticulatedPart(); u = u->Next()) artic_after++; v->grf_cache.position_in_vehicle = artic_before | artic_after << 8; SetBit(v->grf_cache.cache_valid, NCVV_POSITION_IN_VEHICLE); @@ -1413,7 +1413,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, uint16_t base_r } /* Rerandomise bits. Scopes other than SELF are invalid for rerandomisation. For bug-to-bug-compatibility with TTDP we ignore the scope. */ - byte new_random_bits = Random(); + uint8_t new_random_bits = Random(); v->random_bits &= ~reseed; v->random_bits |= (first ? new_random_bits : base_random_bits) & reseed; diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h index 6bd33f603a..93ee564188 100644 --- a/src/newgrf_engine.h +++ b/src/newgrf_engine.h @@ -78,7 +78,7 @@ struct VehicleSpriteSeq; void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains); const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine); -void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group); +void SetCustomEngineSprites(EngineID engine, uint8_t cargo, const struct SpriteGroup *group); void GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction direction, EngineImageType image_type, VehicleSpriteSeq *result); #define GetCustomVehicleSprite(v, direction, image_type, result) GetCustomEngineSprite(v->engine_type, v, direction, image_type, result) diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index 8d9bec0e64..5b3bebe4d8 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -110,7 +110,7 @@ void ResetHouseClassIDs() _class_mapping = {}; } -HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid) +HouseClassID AllocateHouseClassID(uint8_t grf_class_id, uint32_t grfid) { /* Start from 1 because 0 means that no class has been assigned. */ for (size_t i = 1; i != std::size(_class_mapping); i++) { @@ -207,7 +207,7 @@ static uint32_t GetNumHouses(HouseID house_id, const Town *town) * @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8. * @return a construction of bits obeying the newgrf format */ -static uint32_t GetNearbyTileInformation(byte parameter, TileIndex tile, bool grf_version8, uint32_t mask) +static uint32_t GetNearbyTileInformation(uint8_t parameter, TileIndex tile, bool grf_version8, uint32_t mask) { tile = GetNearbyTile(parameter, tile); return GetNearbyTileInformation(tile, grf_version8, mask); @@ -561,7 +561,7 @@ static inline PaletteID GetHouseColour(HouseID house_id, TileIndex tile = INVALI return GENERAL_SPRITE_COLOUR(hs->random_colour[TileHash2Bit(TileX(tile), TileY(tile))]); } -static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte stage, HouseID house_id) +static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, uint8_t stage, HouseID house_id) { const DrawTileSprites *dts = group->ProcessRegisters(&stage); @@ -582,7 +582,7 @@ static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *grou static void DrawTileLayoutInGUI(int x, int y, const TileLayoutSpriteGroup *group, HouseID house_id, bool ground) { - byte stage = TOWN_HOUSE_COMPLETED; + uint8_t stage = TOWN_HOUSE_COMPLETED; const DrawTileSprites *dts = group->ProcessRegisters(&stage); PaletteID palette = GetHouseColour(house_id); @@ -621,7 +621,7 @@ void DrawNewHouseTile(TileInfo *ti, HouseID house_id) if (group != nullptr && group->type == SGT_TILELAYOUT) { /* Limit the building stage to the number of stages supplied. */ const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; - byte stage = GetHouseBuildingStage(ti->tile); + uint8_t stage = GetHouseBuildingStage(ti->tile); DrawTileLayout(ti, tlgroup, stage, house_id); } } @@ -683,7 +683,7 @@ uint8_t GetNewHouseTileAnimationSpeed(TileIndex tile) * @param random_bits feature random bits for the house * @return false if callback 17 disallows construction, true in other cases */ -bool HouseAllowsConstruction(HouseID house_id, TileIndex tile, Town *t, byte random_bits) +bool HouseAllowsConstruction(HouseID house_id, TileIndex tile, Town *t, uint8_t random_bits) { const HouseSpec *hs = HouseSpec::Get(house_id); if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) { @@ -771,7 +771,7 @@ bool NewHouseTileLoop(TileIndex tile) return true; } -static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_random, bool first) +static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, uint8_t base_random, bool first) { /* We can't trigger a non-existent building... */ assert_tile(IsTileType(tile, MP_HOUSE), tile); @@ -792,8 +792,8 @@ static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_rando SetHouseTriggers(tile, object.GetRemainingTriggers()); /* Rerandomise bits. Scopes other than SELF are invalid for houses. For bug-to-bug-compatibility with TTDP we ignore the scope. */ - byte new_random_bits = Random(); - byte random_bits = GetHouseRandomBits(tile); + uint8_t new_random_bits = Random(); + uint8_t random_bits = GetHouseRandomBits(tile); uint32_t reseed = object.GetReseedSum(); random_bits &= ~reseed; random_bits |= (first ? new_random_bits : base_random) & reseed; diff --git a/src/newgrf_house.h b/src/newgrf_house.h index 960c8d3414..d261a08ddf 100644 --- a/src/newgrf_house.h +++ b/src/newgrf_house.h @@ -135,7 +135,7 @@ struct HouseClassMapping { }; void ResetHouseClassIDs(); -HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid); +HouseClassID AllocateHouseClassID(uint8_t grf_class_id, uint32_t grfid); void InitializeBuildingCounts(); void IncreaseBuildingCount(Town *t, HouseID house_id); @@ -151,7 +151,7 @@ uint16_t GetHouseCallback(CallbackID callback, uint32_t param1, uint32_t param2, bool not_yet_constructed = false, uint8_t initial_random_bits = 0, CargoTypes watched_cargo_triggers = 0); void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes); -bool HouseAllowsConstruction(HouseID house_id, TileIndex tile, Town *t, byte random_bits); +bool HouseAllowsConstruction(HouseID house_id, TileIndex tile, Town *t, uint8_t random_bits); bool CanDeleteHouse(TileIndex tile); bool NewHouseTileLoop(TileIndex tile); diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 4b9c78eac9..bcecca8262 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -114,7 +114,7 @@ uint32_t IndustriesScopeResolver::GetClosestIndustry(IndustryType type) const * @param town_filter Do we filter on the same town as the current industry? * @return the formatted answer to the callback : rr(reserved) cc(count) dddd(manhattan distance of closest sister) */ -uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout_filter, bool town_filter, uint32_t mask) const +uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(uint8_t param_setID, uint8_t layout_filter, bool town_filter, uint32_t mask) const { uint32_t GrfID = GetRegister(0x100); ///< Get the GRFID of the definition to look for in register 100h IndustryType ind_index; @@ -144,7 +144,7 @@ uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(byte para /* If the filter is 0, it could be because none was specified as well as being really a 0. * In either case, just do the regular var67 */ if (mask & 0xFFFF) closest_dist = this->GetClosestIndustry(ind_index); - if (mask & 0xFF0000) count = ClampTo(Industry::GetIndustryTypeCount(ind_index)); + if (mask & 0xFF0000) count = ClampTo(Industry::GetIndustryTypeCount(ind_index)); } else if (layout_filter == 0 && town_filter) { /* Count only those which match the same industry type and town */ std::unique_ptr &cache = this->town_location_distance_cache; @@ -259,7 +259,7 @@ uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(byte para /* Company info */ case 0x45: { - byte colours = 0; + uint8_t colours = 0; bool is_ai = false; const Company *c = Company::GetIfValid(this->industry->founder); @@ -324,7 +324,7 @@ uint32_t IndustriesScopeResolver::GetCountAndDistanceOfClosestInstance(byte para * 68 is the same as 67, but with a filtering on selected layout */ case 0x67: case 0x68: { - byte layout_filter = 0; + uint8_t layout_filter = 0; bool town_filter = false; if (variable == 0x68) { uint32_t reg = GetRegister(0x101); @@ -572,7 +572,7 @@ CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, siz ind.location.tile = tile; ind.location.w = 0; // important to mark the industry invalid ind.type = type; - ind.selected_layout = (byte)layout; + ind.selected_layout = (uint8_t)layout; ind.town = ClosestTownFromTile(tile, UINT_MAX); ind.random = initial_random_bits; ind.founder = founder; diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h index ef658b6e63..f478a01127 100644 --- a/src/newgrf_industries.h +++ b/src/newgrf_industries.h @@ -49,7 +49,7 @@ struct IndustriesScopeResolver : public ScopeResolver { uint32_t GetTriggers() const override; void StorePSA(uint pos, int32_t value) override; - uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout_filter, bool town_filter, uint32_t mask) const; + uint32_t GetCountAndDistanceOfClosestInstance(uint8_t param_setID, uint8_t layout_filter, bool town_filter, uint32_t mask) const; uint32_t GetClosestIndustry(IndustryType type) const; }; @@ -112,6 +112,6 @@ bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type); IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32_t grf_id); /* in newgrf_industrytiles.cpp*/ -uint32_t GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8, uint32_t mask); +uint32_t GetNearbyIndustryTileInformation(uint8_t parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8, uint32_t mask); #endif /* NEWGRF_INDUSTRIES_H */ diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 95e82a75ba..c6322a15a5 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -33,7 +33,7 @@ * @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8. * @return a construction of bits obeying the newgrf format */ -uint32_t GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8, uint32_t mask) +uint32_t GetNearbyIndustryTileInformation(uint8_t parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8, uint32_t mask) { if (parameter != 0) tile = GetNearbyTile(parameter, tile, signed_offsets); // only perform if it is required bool is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index); @@ -56,8 +56,8 @@ uint32_t GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, Indust */ uint32_t GetRelativePosition(TileIndex tile, TileIndex ind_tile) { - byte x = TileX(tile) - TileX(ind_tile); - byte y = TileY(tile) - TileY(ind_tile); + uint8_t x = TileX(tile) - TileX(ind_tile); + uint8_t y = TileY(tile) - TileY(ind_tile); return ((y & 0xF) << 20) | ((x & 0xF) << 16) | (y << 8) | x; } @@ -159,7 +159,7 @@ uint32_t IndustryTileResolverObject::GetDebugID() const return GetIndustryTileSpec(gfx)->grf_prop.local_id; } -static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage) +static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, uint8_t rnd_colour, uint8_t stage) { const DrawTileSprites *dts = group->ProcessRegisters(&stage); @@ -211,7 +211,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus /* Limit the building stage to the number of stages supplied. */ const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; - byte stage = GetIndustryConstructionStage(ti->tile); + uint8_t stage = GetIndustryConstructionStage(ti->tile); IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage); return true; } @@ -339,8 +339,8 @@ static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, I SetIndustryTriggers(tile, object.GetRemainingTriggers()); /* Rerandomise tile bits */ - byte new_random_bits = Random(); - byte random_bits = GetIndustryRandomBits(tile); + uint8_t new_random_bits = Random(); + uint8_t random_bits = GetIndustryRandomBits(tile); random_bits &= ~object.reseed[VSG_SCOPE_SELF]; random_bits |= new_random_bits & object.reseed[VSG_SCOPE_SELF]; SetIndustryRandomBits(tile, random_bits); diff --git a/src/newgrf_internal.h b/src/newgrf_internal.h index fc185324b1..288fb7a2ef 100644 --- a/src/newgrf_internal.h +++ b/src/newgrf_internal.h @@ -145,7 +145,7 @@ public: * @param numsets Number of sets to define. * @param numents Number of sprites per set to define. */ - void AddSpriteSets(byte feature, SpriteID first_sprite, uint first_set, uint numsets, uint numents) + void AddSpriteSets(uint8_t feature, SpriteID first_sprite, uint first_set, uint numsets, uint numents) { assert(feature < GSF_END); for (uint i = 0; i < numsets; i++) { @@ -161,7 +161,7 @@ public: * @return true if there are any valid sets. * @note Spritesets with zero sprites are valid to allow callback-failures. */ - bool HasValidSpriteSets(byte feature) const + bool HasValidSpriteSets(uint8_t feature) const { assert(feature < GSF_END); return !this->spritesets[feature].empty(); @@ -174,7 +174,7 @@ public: * @return true if the set is valid. * @note Spritesets with zero sprites are valid to allow callback-failures. */ - bool IsValidSpriteSet(byte feature, uint set) const + bool IsValidSpriteSet(uint8_t feature, uint set) const { assert(feature < GSF_END); return this->spritesets[feature].find(set) != this->spritesets[feature].end(); @@ -186,7 +186,7 @@ public: * @param set Set to query. * @return First sprite of the set. */ - SpriteID GetSprite(byte feature, uint set) const + SpriteID GetSprite(uint8_t feature, uint set) const { assert(IsValidSpriteSet(feature, set)); return this->spritesets[feature].find(set)->second.sprite; @@ -198,7 +198,7 @@ public: * @param set Set to query. * @return Number of sprites in the set. */ - uint GetNumEnts(byte feature, uint set) const + uint GetNumEnts(uint8_t feature, uint set) const { assert(IsValidSpriteSet(feature, set)); return this->spritesets[feature].find(set)->second.num_sprites; @@ -227,7 +227,7 @@ DECLARE_ENUM_AS_BIT_SET(VarAction2AdjustInferenceFlags) struct VarAction2TempStoreInferenceVarSource { DeterministicSpriteGroupAdjustType type; uint16_t variable; - byte shift_num; + uint8_t shift_num; uint32_t parameter; uint32_t and_mask; uint32_t add_val; @@ -280,7 +280,7 @@ inline void OptimiseVarAction2PreCheckAdjust(VarAction2OptimiseState &state, con struct VarAction2AdjustInfo { GrfSpecFeature feature; GrfSpecFeature scope_feature; - byte varsize; + uint8_t varsize; }; const SpriteGroup *PruneTargetSpriteGroup(const SpriteGroup *result); diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 0fd5471f60..d08be14a90 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -193,7 +193,7 @@ static uint32_t GetObjectIDAtOffset(TileIndex tile, uint32_t cur_grfid) * @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8. * @return a construction of bits obeying the newgrf format */ -static uint32_t GetNearbyObjectTileInformation(byte parameter, TileIndex tile, ObjectID index, bool grf_version8, uint32_t mask) +static uint32_t GetNearbyObjectTileInformation(uint8_t parameter, TileIndex tile, ObjectID index, bool grf_version8, uint32_t mask) { if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required bool is_same_object = (IsTileType(tile, MP_OBJECT) && GetObjectIndex(tile) == index); diff --git a/src/newgrf_optimiser.cpp b/src/newgrf_optimiser.cpp index b4195889df..e727553035 100644 --- a/src/newgrf_optimiser.cpp +++ b/src/newgrf_optimiser.cpp @@ -905,7 +905,7 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const VarAction2Ad std::vector *proc = _cur.GetInlinableGroupAdjusts(dsg, false); if (proc == nullptr) return false; - byte shift_num = adjust.shift_num; + uint8_t shift_num = adjust.shift_num; uint32_t and_mask = adjust.and_mask; // Initial value state is 0 diff --git a/src/newgrf_properties.h b/src/newgrf_properties.h index 9e697bf7b5..4d4a31a983 100644 --- a/src/newgrf_properties.h +++ b/src/newgrf_properties.h @@ -15,7 +15,7 @@ * Names are formatted as PROP__ * @todo Currently the list only contains properties which are used more than once in the code. I.e. they are available for callback 0x36. */ -enum PropertyID : byte { +enum PropertyID : uint8_t { PROP_VEHICLE_LOAD_AMOUNT = 0x07, ///< Loading speed PROP_TRAIN_SPEED = 0x09, ///< Max. speed: 1 unit = 1/1.6 mph = 1 km-ish/h diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index d817985324..07614e6e32 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -405,8 +405,8 @@ uint16_t GetAnimRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t } struct RoadStopAnimationFrameAnimationHelper { - static byte Get(BaseStation *st, TileIndex tile) { return st->GetRoadStopAnimationFrame(tile); } - static bool Set(BaseStation *st, TileIndex tile, byte frame) { return st->SetRoadStopAnimationFrame(tile, frame); } + static uint8_t Get(BaseStation *st, TileIndex tile) { return st->GetRoadStopAnimationFrame(tile); } + static bool Set(BaseStation *st, TileIndex tile, uint8_t frame) { return st->SetRoadStopAnimationFrame(tile, frame); } }; /** Helper class for animation control. */ @@ -641,7 +641,7 @@ int AllocateRoadStopSpecToStation(const RoadStopSpec *statspec, BaseStation *st, return i; } -void DeallocateRoadStopSpecFromStation(BaseStation *st, byte specindex) +void DeallocateRoadStopSpecFromStation(BaseStation *st, uint8_t specindex) { /* specindex of 0 (default) is never freeable */ if (specindex == 0) return; diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h index 6c8d3c3602..13e962a7f9 100644 --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -22,7 +22,7 @@ /** The maximum amount of roadstops a single GRF is allowed to add */ static const int NUM_ROADSTOPS_PER_GRF = 64000; -enum RoadStopClassID : byte { +enum RoadStopClassID : uint8_t { ROADSTOP_CLASS_BEGIN = 0, ///< The lowest valid value ROADSTOP_CLASS_DFLT = 0, ///< Default road stop class. ROADSTOP_CLASS_WAYP, ///< Waypoint class. @@ -43,7 +43,7 @@ enum RoadStopRandomTrigger { * Various different options for availability, restricting * the roadstop to be only for busses or for trucks. */ -enum RoadStopAvailabilityType : byte { +enum RoadStopAvailabilityType : uint8_t { ROADSTOPTYPE_PASSENGER, ///< This RoadStop is for passenger (bus) stops. ROADSTOPTYPE_FREIGHT, ///< This RoadStop is for freight (truck) stops. ROADSTOPTYPE_ALL, ///< This RoadStop is for both types of station road stops. @@ -55,7 +55,7 @@ enum RoadStopAvailabilityType : byte { * Different draw modes to disallow rendering of some parts of the stop * or road. */ -enum RoadStopDrawMode : byte { +enum RoadStopDrawMode : uint8_t { ROADSTOP_DRAW_MODE_NONE = 0, ROADSTOP_DRAW_MODE_ROAD = 1 << 0, ///< Bay stops: Draw the road itself ROADSTOP_DRAW_MODE_OVERLAY = 1 << 1, ///< Drive-through stops: Draw the road overlay, e.g. pavement @@ -76,8 +76,8 @@ enum RoadStopSpecFlags { }; enum RoadStopSpecIntlFlags { - RSIF_BRIDGE_HEIGHTS_SET, ///< byte bridge_height[6] is set. - RSIF_BRIDGE_DISALLOWED_PILLARS_SET, ///< byte bridge_disallowed_pillars[6] is set. + RSIF_BRIDGE_HEIGHTS_SET, ///< bridge_height[6] is set. + RSIF_BRIDGE_DISALLOWED_PILLARS_SET, ///< bridge_disallowed_pillars[6] is set. }; /** Scope resolver for road stops. */ @@ -157,8 +157,8 @@ struct RoadStopSpec { AnimationInfo animation; - byte bridge_height[6]; ///< Minimum height for a bridge above, 0 for none - byte bridge_disallowed_pillars[6]; ///< Disallowed pillar flags for a bridge above + uint8_t bridge_height[6]; ///< Minimum height for a bridge above, 0 for none + uint8_t bridge_disallowed_pillars[6]; ///< Disallowed pillar flags for a bridge above uint8_t build_cost_multiplier = 16; ///< Build cost multiplier per tile. uint8_t clear_cost_multiplier = 16; ///< Clear cost multiplier per tile. @@ -181,7 +181,7 @@ struct RoadStopSpec { }; template <> -struct EnumPropsT : MakeEnumPropsT {}; +struct EnumPropsT : MakeEnumPropsT {}; typedef NewGRFClass RoadStopClass; @@ -200,7 +200,7 @@ bool GetIfStopIsForType(const RoadStopSpec *roadstopspec, RoadStopType rs, RoadT const RoadStopSpec *GetRoadStopSpec(TileIndex t); int AllocateRoadStopSpecToStation(const RoadStopSpec *statspec, BaseStation *st, bool exec); -void DeallocateRoadStopSpecFromStation(BaseStation *st, byte specindex); +void DeallocateRoadStopSpecFromStation(BaseStation *st, uint8_t specindex); void StationUpdateRoadStopCachedTriggers(BaseStation *st); #endif /* NEWGRF_ROADSTATION_H */ diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index bd59d8bb3f..6443f807be 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -362,7 +362,7 @@ const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const ScopeResolver *scope = object.GetScope(this->var_scope, this->var_scope_count); if (object.callback == CBID_RANDOM_TRIGGER) { /* Handle triggers */ - byte match = this->triggers & object.waiting_triggers; + uint8_t match = this->triggers & object.waiting_triggers; bool res = (this->cmp_mode == RSG_CMP_ANY) ? (match != 0) : (match == this->triggers); if (res) { @@ -372,7 +372,7 @@ const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const } uint32_t mask = ((uint)this->groups.size() - 1) << this->lowest_randbit; - byte index = (scope->GetRandomBits() & mask) >> this->lowest_randbit; + uint8_t index = (scope->GetRandomBits() & mask) >> this->lowest_randbit; return SpriteGroup::Resolve(this->groups[index], object, false); } @@ -629,7 +629,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi if (var_scope == VSG_SCOPE_RELATIVE) { char *b = scope_buffer; b += seprintf(b, lastof(scope_buffer), "%s[%s, ", _sg_scope_names[var_scope], _sg_relative_scope_modes[GB(var_scope_count, 8, 2)]); - byte offset = GB(var_scope_count, 0, 8); + uint8_t offset = GB(var_scope_count, 0, 8); if (HasBit(var_scope_count, 15)) { b += seprintf(b, lastof(scope_buffer), "var 0x100]"); } else { diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index f6a2deb81a..f47d8d9a55 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -83,7 +83,7 @@ public: SpriteGroupFlags sg_flags = SGF_NONE; virtual SpriteID GetResult() const { return 0; } - virtual byte GetNumResults() const { return 0; } + virtual uint8_t GetNumResults() const { return 0; } virtual uint16_t GetCallbackResult() const { return CALLBACK_FAILED; } virtual void AnalyseCallbacks(AnalyseCallbackOperation &op) const {}; @@ -452,7 +452,7 @@ struct DeterministicSpriteGroupAdjust { DeterministicSpriteGroupAdjustOperation operation; DeterministicSpriteGroupAdjustType type; uint16_t variable; - byte shift_num; + uint8_t shift_num; DeterministicSpriteGroupAdjustFlags adjust_flags = DSGAF_NONE; uint32_t parameter; ///< Used for variables between 0x60 and 0x7F inclusive. uint32_t and_mask; @@ -529,9 +529,9 @@ struct RandomizedSpriteGroup : SpriteGroup { VarSpriteGroupScopeOffset var_scope_count; RandomizedSpriteGroupCompareMode cmp_mode; ///< Check for these triggers: - byte triggers; + uint8_t triggers; - byte lowest_randbit; ///< Look for this in the per-object randomized bitmask: + uint8_t lowest_randbit; ///< Look for this in the per-object randomized bitmask: std::vector groups; ///< Take the group with appropriate index: @@ -587,7 +587,7 @@ struct ResultSpriteGroup : SpriteGroup { * @param num_sprites The number of sprites per set. * @return A spritegroup representing the sprite number result. */ - ResultSpriteGroup(SpriteID sprite, byte num_sprites) : + ResultSpriteGroup(SpriteID sprite, uint8_t num_sprites) : SpriteGroup(SGT_RESULT), sprite(sprite), num_sprites(num_sprites) @@ -595,9 +595,9 @@ struct ResultSpriteGroup : SpriteGroup { } SpriteID sprite; - byte num_sprites; + uint8_t num_sprites; SpriteID GetResult() const override { return this->sprite; } - byte GetNumResults() const override { return this->num_sprites; } + uint8_t GetNumResults() const override { return this->num_sprites; } }; /** diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index a51ba6118a..670a829134 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -102,7 +102,7 @@ struct ETileArea : TileArea { * if centered, C/P start from the centre and c/p are not available. * @return Platform information in bit-stuffed format. */ -uint32_t GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, int y, bool centred) +uint32_t GetPlatformInfo(Axis axis, uint8_t tile, int platforms, int length, int x, int y, bool centred) { uint32_t retval = 0; @@ -142,7 +142,7 @@ uint32_t GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, */ static TileIndex FindRailStationEnd(TileIndex tile, TileIndexDiff delta, bool check_type, bool check_axis) { - byte orig_type = 0; + uint8_t orig_type = 0; Axis orig_axis = AXIS_X; StationID sid = GetStationIndex(tile); @@ -430,7 +430,7 @@ uint32_t StationScopeResolver::GetNearbyStationInfo(uint32_t parameter, StationS return this->st->GetNewGRFVariable(this->ro, variable, parameter, &(extra->available)); } -uint32_t Station::GetNewGRFVariable(const ResolverObject &object, uint16_t variable, byte parameter, bool *available) const +uint32_t Station::GetNewGRFVariable(const ResolverObject &object, uint16_t variable, uint8_t parameter, bool *available) const { switch (variable) { case 0x48: { // Accepted cargo types @@ -496,7 +496,7 @@ uint32_t Station::GetNewGRFVariable(const ResolverObject &object, uint16_t varia return UINT_MAX; } -uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &object, uint16_t variable, byte parameter, bool *available) const +uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &object, uint16_t variable, uint8_t parameter, bool *available) const { switch (variable) { case 0x48: return 0; // Accepted cargo types @@ -687,7 +687,7 @@ uint16_t GetStationCallback(CallbackID callback, uint32_t param1, uint32_t param * @param numtracks Number of platforms. * @return Succeeded or failed command. */ -CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, RailType rt, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks) +CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, RailType rt, const StationSpec *statspec, Axis axis, uint8_t plat_len, uint8_t numtracks) { TileIndexDiff diff = cur_tile - north_tile; Slope slope = GetTileSlope(cur_tile); @@ -757,7 +757,7 @@ int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exe * @param specindex Index of the custom station within the Station's spec list. * @return Indicates whether the StationSpec was deallocated. */ -void DeallocateSpecFromStation(BaseStation *st, byte specindex) +void DeallocateSpecFromStation(BaseStation *st, uint8_t specindex) { /* specindex of 0 (default) is never freeable */ if (specindex == 0) return; diff --git a/src/newgrf_station.h b/src/newgrf_station.h index f8ce650ae9..5f75e1477f 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -90,13 +90,13 @@ struct StationResolverObject : public ResolverObject { uint32_t GetDebugID() const override; }; -enum StationClassID : byte { +enum StationClassID : uint8_t { STAT_CLASS_BEGIN = 0, ///< the lowest valid value STAT_CLASS_DFLT = 0, ///< Default station class. STAT_CLASS_WAYP, ///< Waypoint class. STAT_CLASS_MAX = 255, ///< Maximum number of classes. }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Allow incrementing of StationClassID variables */ DECLARE_POSTFIX_INCREMENT(StationClassID) @@ -120,8 +120,8 @@ enum StationRandomTrigger { }; enum StationSpecIntlFlags { - SSIF_BRIDGE_HEIGHTS_SET, ///< byte bridge_height[8] is set. - SSIF_BRIDGE_DISALLOWED_PILLARS_SET, ///< byte bridge_disallowed_pillars[8] is set. + SSIF_BRIDGE_HEIGHTS_SET, ///< bridge_height[8] is set. + SSIF_BRIDGE_DISALLOWED_PILLARS_SET, ///< bridge_disallowed_pillars[8] is set. }; /** Station specification. */ @@ -145,12 +145,12 @@ struct StationSpec { * Bitmask of number of platforms available for the station. * 0..6 correspond to 1..7, while bit 7 corresponds to >7 platforms. */ - byte disallowed_platforms; + uint8_t disallowed_platforms; /** * Bitmask of platform lengths available for the station. * 0..6 correspond to 1..7, while bit 7 corresponds to >7 tiles long. */ - byte disallowed_lengths; + uint8_t disallowed_lengths; /** * Number of tile layouts. @@ -170,19 +170,19 @@ struct StationSpec { CargoTypes cargo_triggers; ///< Bitmask of cargo types which cause trigger re-randomizing - byte callback_mask; ///< Bitmask of station callbacks that have to be called + uint8_t callback_mask; ///< Bitmask of station callbacks that have to be called - byte flags; ///< Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size + uint8_t flags; ///< Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size - byte pylons; ///< Bitmask of base tiles (0 - 7) which should contain elrail pylons - byte wires; ///< Bitmask of base tiles (0 - 7) which should contain elrail wires - byte blocked; ///< Bitmask of base tiles (0 - 7) which are blocked to trains - byte bridge_height[8]; ///< Minimum height for a bridge above, 0 for none - byte bridge_disallowed_pillars[8]; ///< Disallowed pillar flags for a bridge above + uint8_t pylons; ///< Bitmask of base tiles (0 - 7) which should contain elrail pylons + uint8_t wires; ///< Bitmask of base tiles (0 - 7) which should contain elrail wires + uint8_t blocked; ///< Bitmask of base tiles (0 - 7) which are blocked to trains + uint8_t bridge_height[8]; ///< Minimum height for a bridge above, 0 for none + uint8_t bridge_disallowed_pillars[8]; ///< Disallowed pillar flags for a bridge above AnimationInfo animation; - byte internal_flags; ///< Bitmask of internal spec flags (StationSpecIntlFlags) + uint8_t internal_flags; ///< Bitmask of internal spec flags (StationSpecIntlFlags) /** * Custom platform layouts. @@ -192,7 +192,7 @@ struct StationSpec { * These can be sparsely populated, and the upper limit is not defined but * limited to 255. */ - std::vector>> layouts; + std::vector>> layouts; }; /** Struct containing information relating to station classes. */ @@ -201,18 +201,18 @@ typedef NewGRFClass StationClass; const StationSpec *GetStationSpec(TileIndex t); /* Evaluate a tile's position within a station, and return the result a bitstuffed format. */ -uint32_t GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, int y, bool centred); +uint32_t GetPlatformInfo(Axis axis, uint8_t tile, int platforms, int length, int x, int y, bool centred); SpriteID GetCustomStationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, RailType rt, uint32_t var10 = 0); SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info); uint16_t GetStationCallback(CallbackID callback, uint32_t param1, uint32_t param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, RailType rt); -CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, RailType rt, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks); +CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, RailType rt, const StationSpec *statspec, Axis axis, uint8_t plat_len, uint8_t numtracks); /* Allocate a StationSpec to a Station. This is called once per build operation. */ int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec); /* Deallocate a StationSpec from a Station. Called when removing a single station tile. */ -void DeallocateSpecFromStation(BaseStation *st, byte specindex); +void DeallocateSpecFromStation(BaseStation *st, uint8_t specindex); /* Draw representation of a station tile for GUI purposes. */ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station); diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index 80529c64ee..dc895aa6fb 100644 --- a/src/newgrf_storage.h +++ b/src/newgrf_storage.h @@ -33,7 +33,7 @@ enum PersistentStorageMode { */ struct BasePersistentStorageArray { uint32_t grfid; ///< GRFID associated to this persistent storage. A value of zero means "default". - byte feature; ///< NOSAVE: Used to identify in the owner of the array in debug output. + uint8_t feature; ///< NOSAVE: Used to identify in the owner of the array in debug output. TileIndex tile; ///< NOSAVE: Used to identify in the owner of the array in debug output. virtual ~BasePersistentStorageArray(); @@ -199,7 +199,7 @@ extern PersistentStoragePool _persistent_storage_pool; */ struct PersistentStorage : PersistentStorageArray, PersistentStoragePool::PoolItem<&_persistent_storage_pool> { /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - PersistentStorage(const uint32_t new_grfid, byte feature, TileIndex tile) + PersistentStorage(const uint32_t new_grfid, uint8_t feature, TileIndex tile) { this->grfid = new_grfid; this->feature = feature; diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index a4905111e1..11ccd9492a 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -79,7 +79,7 @@ struct GRFTextEntry { static std::vector _grf_text; -static byte _currentLangID = GRFLX_ENGLISH; ///< by default, english is used. +static uint8_t _currentLangID = GRFLX_ENGLISH; ///< by default, english is used. /** * Get the mapping from the NewGRF supplied ID to OpenTTD's internal ID. @@ -127,7 +127,7 @@ struct UnmappedChoiceList { int offset; ///< The offset for the plural/gender form. /** Mapping of NewGRF supplied ID to the different strings in the choice list. */ - std::map strings; + std::map strings; /** * Flush this choice list into the destination string. @@ -276,7 +276,7 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all continue; } } else { - c = (byte)*src++; + c = (uint8_t)*src++; } if (c == '\0') break; @@ -494,7 +494,7 @@ string_end: * @param langid The The language of the new text. * @param text_to_add The text to add to the list. */ -static void AddGRFTextToList(GRFTextList &list, byte langid, const std::string &text_to_add) +static void AddGRFTextToList(GRFTextList &list, uint8_t langid, const std::string &text_to_add) { /* Loop through all languages and see if we can replace a string */ for (auto &text : list) { @@ -517,7 +517,7 @@ static void AddGRFTextToList(GRFTextList &list, byte langid, const std::string & * @param text_to_add The text to add to the list. * @note All text-codes will be translated. */ -void AddGRFTextToList(GRFTextList &list, byte langid, uint32_t grfid, bool allow_newlines, const char *text_to_add) +void AddGRFTextToList(GRFTextList &list, uint8_t langid, uint32_t grfid, bool allow_newlines, const char *text_to_add) { AddGRFTextToList(list, langid, TranslateTTDPatchCodes(grfid, langid, allow_newlines, text_to_add)); } @@ -531,7 +531,7 @@ void AddGRFTextToList(GRFTextList &list, byte langid, uint32_t grfid, bool allow * @param text_to_add The text to add to the list. * @note All text-codes will be translated. */ -void AddGRFTextToList(GRFTextWrapper &list, byte langid, uint32_t grfid, bool allow_newlines, const char *text_to_add) +void AddGRFTextToList(GRFTextWrapper &list, uint8_t langid, uint32_t grfid, bool allow_newlines, const char *text_to_add) { if (!list) list.reset(new GRFTextList()); AddGRFTextToList(*list, langid, grfid, allow_newlines, text_to_add); @@ -552,7 +552,7 @@ void AddGRFTextToList(GRFTextWrapper &list, const std::string &text_to_add) /** * Add the new read string into our structure. */ -StringID AddGRFString(uint32_t grfid, uint16_t stringid, byte langid_to_add, bool new_scheme, bool allow_newlines, const char *text_to_add, StringID def_string) +StringID AddGRFString(uint32_t grfid, uint16_t stringid, uint8_t langid_to_add, bool new_scheme, bool allow_newlines, const char *text_to_add, StringID def_string) { /* When working with the old language scheme (grf_version is less than 7) and * English or American is among the set bits, simply add it as English in @@ -725,17 +725,17 @@ const char *GetGRFStringPtr(uint32_t stringid) * from strings.cpp:ReadLanguagePack * @param language_id iso code of current selection */ -void SetCurrentGrfLangID(byte language_id) +void SetCurrentGrfLangID(uint8_t language_id) { _currentLangID = language_id; } -byte GetCurrentGrfLangID() +uint8_t GetCurrentGrfLangID() { return _currentLangID; } -bool CheckGrfLangID(byte lang_id, byte grf_version) +bool CheckGrfLangID(uint8_t lang_id, uint8_t grf_version) { if (grf_version < 7) { switch (_currentLangID) { @@ -761,8 +761,8 @@ void CleanUpStrings() } struct TextRefStack { - std::array stack; - byte position; + std::array stack; + uint8_t position; const GRFFile *grffile; bool used; @@ -795,7 +795,7 @@ struct TextRefStack { /** Rotate the top four words down: W1, W2, W3, W4 -> W4, W1, W2, W3 */ void RotateTop4Words() { - byte tmp[2]; + uint8_t tmp[2]; for (int i = 0; i < 2; i++) tmp[i] = this->stack[this->position + i + 6]; for (int i = 5; i >= 0; i--) this->stack[this->position + i + 2] = this->stack[this->position + i]; for (int i = 0; i < 2; i++) this->stack[this->position + i] = tmp[i]; @@ -871,7 +871,7 @@ void RestoreTextRefStackBackup(struct TextRefStack *backup) * @param numEntries number of entries to copy from the registers * @param values values to copy onto the stack; if nullptr the temporary NewGRF registers will be used instead */ -void StartTextRefStackUsage(const GRFFile *grffile, byte numEntries, const uint32_t *values) +void StartTextRefStackUsage(const GRFFile *grffile, uint8_t numEntries, const uint32_t *values) { extern TemporaryStorageArray _temp_store; diff --git a/src/newgrf_text.h b/src/newgrf_text.h index a1bd184f41..342dd69bd8 100644 --- a/src/newgrf_text.h +++ b/src/newgrf_text.h @@ -22,7 +22,7 @@ static const char32_t NFO_UTF8_IDENTIFIER = 0x00DE; /** A GRF text with associated language ID. */ struct GRFText { - byte langid; ///< The language associated with this GRFText. + uint8_t langid; ///< The language associated with this GRFText. std::string text; ///< The actual (translated) text. }; @@ -31,7 +31,7 @@ typedef std::vector GRFTextList; /** Reference counted wrapper around a GRFText pointer. */ typedef std::shared_ptr GRFTextWrapper; -StringID AddGRFString(uint32_t grfid, uint16_t stringid, byte langid, bool new_scheme, bool allow_newlines, const char *text_to_add, StringID def_string); +StringID AddGRFString(uint32_t grfid, uint16_t stringid, uint8_t langid, bool new_scheme, bool allow_newlines, const char *text_to_add, StringID def_string); StringID GetGRFStringID(uint32_t grfid, StringID stringid); const char *GetGRFStringFromGRFText(const GRFTextList &text_list); const char *GetGRFStringFromGRFText(const GRFTextWrapper &text); @@ -39,15 +39,15 @@ const char *GetDefaultLangGRFStringFromGRFText(const GRFTextList &text_list); const char *GetDefaultLangGRFStringFromGRFText(const GRFTextWrapper &text); const char *GetGRFStringPtr(uint32_t stringid); void CleanUpStrings(); -void SetCurrentGrfLangID(byte language_id); +void SetCurrentGrfLangID(uint8_t language_id); std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool allow_newlines, const std::string &str, StringControlCode byte80 = SCC_NEWGRF_PRINT_WORD_STRING_ID); -void AddGRFTextToList(GRFTextList &list, byte langid, uint32_t grfid, bool allow_newlines, const char *text_to_add); -void AddGRFTextToList(GRFTextWrapper &list, byte langid, uint32_t grfid, bool allow_newlines, const char *text_to_add); +void AddGRFTextToList(GRFTextList &list, uint8_t langid, uint32_t grfid, bool allow_newlines, const char *text_to_add); +void AddGRFTextToList(GRFTextWrapper &list, uint8_t langid, uint32_t grfid, bool allow_newlines, const char *text_to_add); void AddGRFTextToList(GRFTextWrapper &list, const std::string &text_to_add); -bool CheckGrfLangID(byte lang_id, byte grf_version); +bool CheckGrfLangID(uint8_t lang_id, uint8_t grf_version); -void StartTextRefStackUsage(const struct GRFFile *grffile, byte numEntries, const uint32_t *values = nullptr); +void StartTextRefStackUsage(const struct GRFFile *grffile, uint8_t numEntries, const uint32_t *values = nullptr); void StopTextRefStackUsage(); bool UsingNewGRFTextStack(); struct TextRefStack *CreateTextRefStackBackup(); @@ -60,8 +60,8 @@ uint RemapNewGRFStringControlCode(uint scc, std::string *buffer, const char **st struct LanguageMap { /** Mapping between NewGRF and OpenTTD IDs. */ struct Mapping { - byte newgrf_id; ///< NewGRF's internal ID for a case/gender. - byte openttd_id; ///< OpenTTD's internal ID for a case/gender. + uint8_t newgrf_id; ///< NewGRF's internal ID for a case/gender. + uint8_t openttd_id; ///< OpenTTD's internal ID for a case/gender. }; /* We need a vector and can't use SmallMap due to the fact that for "setting" a diff --git a/src/newgrf_townname.cpp b/src/newgrf_townname.cpp index 56744f648e..89dfb550a3 100644 --- a/src/newgrf_townname.cpp +++ b/src/newgrf_townname.cpp @@ -47,11 +47,11 @@ void DelGRFTownName(uint32_t grfid) _grf_townnames.erase(std::find_if(std::begin(_grf_townnames), std::end(_grf_townnames), [&grfid](const GRFTownName &t){ return t.grfid == grfid; })); } -static void RandomPart(StringBuilder builder, const GRFTownName *t, uint32_t seed, byte id) +static void RandomPart(StringBuilder builder, const GRFTownName *t, uint32_t seed, uint8_t id) { assert(t != nullptr); for (const auto &partlist : t->partlists[id]) { - byte count = partlist.bitcount; + uint8_t count = partlist.bitcount; uint16_t maxprob = partlist.maxprob; uint32_t r = (GB(seed, partlist.bitstart, count) * maxprob) >> count; for (const auto &part : partlist.parts) { diff --git a/src/newgrf_townname.h b/src/newgrf_townname.h index 3fe44f0777..f5d1964a28 100644 --- a/src/newgrf_townname.h +++ b/src/newgrf_townname.h @@ -18,28 +18,28 @@ struct NamePart { std::string text; ///< If probability bit 7 is clear - byte id; ///< If probability bit 7 is set - byte prob; ///< The relative probability of the following name to appear in the bottom 7 bits. + uint8_t id; ///< If probability bit 7 is set + uint8_t prob; ///< The relative probability of the following name to appear in the bottom 7 bits. }; struct NamePartList { - byte bitstart; ///< Start of random seed bits to use. - byte bitcount; ///< Number of bits of random seed to use. + uint8_t bitstart; ///< Start of random seed bits to use. + uint8_t bitcount; ///< Number of bits of random seed to use. uint16_t maxprob; ///< Total probability of all parts. std::vector parts; ///< List of parts to choose from. }; struct TownNameStyle { StringID name; ///< String ID of this town name style. - byte id; ///< Index within partlist for this town name style. + uint8_t id; ///< Index within partlist for this town name style. - TownNameStyle(StringID name, byte id) : name(name), id(id) { } + TownNameStyle(StringID name, uint8_t id) : name(name), id(id) { } }; struct GRFTownName { static const uint MAX_LISTS = 128; ///< Maximum number of town name lists that can be defined per GRF. - uint32_t grfid; ///< GRF ID of NewGRF. + uint32_t grfid; ///< GRF ID of NewGRF. std::vector styles; ///< Style names defined by the Town Name NewGRF. std::vector partlists[MAX_LISTS]; ///< Lists of town name parts. }; diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 3819b30eaa..df8006af3e 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -1019,7 +1019,7 @@ void NewsLoop() /* no news item yet */ if (_total_news == 0) return; - static byte _last_clean_month = 0; + static uint8_t _last_clean_month = 0; if (_last_clean_month != EconTime::CurMonth()) { RemoveOldNewsItems(); diff --git a/src/news_type.h b/src/news_type.h index ae992d4e7c..d65b938e9d 100644 --- a/src/news_type.h +++ b/src/news_type.h @@ -20,7 +20,7 @@ /** * Type of news. */ -enum NewsType { +enum NewsType : uint8_t { NT_ARRIVAL_COMPANY, ///< First vehicle arrived for company NT_ARRIVAL_OTHER, ///< First vehicle arrived for competitor NT_ACCIDENT, ///< An accident or disaster has occurred @@ -49,7 +49,7 @@ enum NewsType { * You have to make sure, #ChangeVehicleNews catches the DParams of your message. * This is NOT ensured by the references. */ -enum NewsReferenceType { +enum NewsReferenceType : uint8_t { NR_NONE, ///< Empty reference NR_TILE, ///< Reference tile. Scroll to tile when clicking on the news. NR_VEHICLE, ///< Reference vehicle. Scroll to vehicle when clicking on the news. Delete news when vehicle is deleted. @@ -99,7 +99,7 @@ enum NewsDisplay { */ struct NewsTypeData { const char * const name; ///< Name - const byte age; ///< Maximum age of news items (in days) + const uint8_t age; ///< Maximum age of news items (in days) const SoundFx sound; ///< Sound /** @@ -108,7 +108,7 @@ struct NewsTypeData { * @param age The maximum age for these messages. * @param sound The sound to play. */ - NewsTypeData(const char *name, byte age, SoundFx sound) : + NewsTypeData(const char *name, uint8_t age, SoundFx sound) : name(name), age(age), sound(sound) diff --git a/src/object_base.h b/src/object_base.h index 016de3f2f6..51d473ca9e 100644 --- a/src/object_base.h +++ b/src/object_base.h @@ -26,8 +26,8 @@ struct Object : ObjectPool::PoolItem<&_object_pool> { Town *town; ///< Town the object is built in TileArea location; ///< Location of the object CalTime::Date build_date; ///< Date of construction - byte colour; ///< Colour of the object, for display purpose - byte view; ///< The view setting for this object + uint8_t colour; ///< Colour of the object, for display purpose + uint8_t view; ///< The view setting for this object /** Make sure the object isn't zeroed. */ Object() {} diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 0af347b374..be0f3b6a58 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -222,7 +222,7 @@ void UpdateCompanyHQ(TileIndex tile, uint score) { if (tile == INVALID_TILE) return; - byte val = 0; + uint8_t val = 0; if (score >= 170) val++; if (score >= 350) val++; if (score >= 520) val++; diff --git a/src/object_map.h b/src/object_map.h index 9fd034bb79..82939e3bcf 100644 --- a/src/object_map.h +++ b/src/object_map.h @@ -62,7 +62,7 @@ inline ObjectID GetObjectIndex(TileIndex t) * @pre IsTileType(t, MP_OBJECT) * @return The random bits. */ -inline byte GetObjectRandomBits(TileIndex t) +inline uint8_t GetObjectRandomBits(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_OBJECT), t); return _m[t].m3; @@ -188,7 +188,7 @@ inline void SetObjectHasViewportMapViewOverride(TileIndex t, bool map_view_overr * @param wc Water class for this object. * @param random Random data to store on the tile */ -inline void MakeObject(TileIndex t, Owner o, ObjectID index, WaterClass wc, byte random) +inline void MakeObject(TileIndex t, Owner o, ObjectID index, WaterClass wc, uint8_t random) { SetTileType(t, MP_OBJECT); SetTileOwner(t, o); diff --git a/src/openttd.cpp b/src/openttd.cpp index 0e2514bc15..e6ddc1d0e1 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -357,7 +357,7 @@ static void WriteSavegameInfo(const char *name) extern std::string _sl_xv_version_label; extern SaveLoadVersion _sl_xv_upstream_version; uint32_t last_ottd_rev = 0; - byte ever_modified = 0; + uint8_t ever_modified = 0; bool removed_newgrfs = false; GamelogInfo(_load_check_data.gamelog_actions, &last_ottd_rev, &ever_modified, &removed_newgrfs); diff --git a/src/openttd.h b/src/openttd.h index d3387ebca5..575bd42e8d 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -73,7 +73,7 @@ extern std::atomic _exit_game; extern bool _save_config; /** Modes of pausing we've got */ -enum PauseMode : byte { +enum PauseMode : uint8_t { PM_UNPAUSED = 0, ///< A normal unpaused game PM_PAUSED_NORMAL = 1 << 0, ///< A game normally paused PM_PAUSED_SAVELOAD = 1 << 1, ///< A game paused for saving/loading diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 2714fed430..d4e3e076d2 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -178,7 +178,7 @@ void Order::MakeLoading(bool ordered) * * @return true if the jump should be taken */ -bool Order::UpdateJumpCounter(byte percent, bool dry_run) +bool Order::UpdateJumpCounter(uint8_t percent, bool dry_run) { const int8_t jump_counter = this->GetJumpCounter(); if (dry_run) return jump_counter >= 0; @@ -3371,7 +3371,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v, Pro if (mode == PCO_DEFERRED) { _pco_deferred_original_percent_cond.insert({ ord, ord->GetJumpCounter() }); } - skip_order = ord->UpdateJumpCounter((byte)value, mode == PCO_DRY_RUN); + skip_order = ord->UpdateJumpCounter((uint8_t)value, mode == PCO_DRY_RUN); break; } case OCV_REMAINING_LIFETIME: skip_order = OrderConditionCompare(occ, std::max(DateDeltaToYearDelta(v->max_age - v->age + DAYS_IN_LEAP_YEAR - 1).base(), 0), value); break; diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 54cab1f523..20c1db63ed 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1383,7 +1383,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) st = in->neutral_station; } if (st != nullptr && IsInfraUsageAllowed(v->type, v->owner, st->owner)) { - byte facil; + uint8_t facil; switch (v->type) { case VEH_SHIP: facil = FACIL_DOCK; break; case VEH_TRAIN: facil = FACIL_TRAIN; break; diff --git a/src/order_type.h b/src/order_type.h index 8d2d36ebed..2ebd0d0bec 100644 --- a/src/order_type.h +++ b/src/order_type.h @@ -36,7 +36,7 @@ static const uint IMPLICIT_ORDER_ONLY_CAP = 32; static const int32_t INVALID_SCHEDULED_DISPATCH_OFFSET = INT32_MIN; /** Order types. It needs to be 8bits, because we save and load it as such */ -enum OrderType : byte { +enum OrderType : uint8_t { OT_BEGIN = 0, OT_NOTHING = 0, OT_GOTO_STATION = 1, @@ -55,12 +55,12 @@ enum OrderType : byte { OT_END }; -enum OrderSlotSubType : byte { +enum OrderSlotSubType : uint8_t { OSST_RELEASE = 0, OSST_TRY_ACQUIRE = 1, }; -enum OrderLabelSubType : byte { +enum OrderLabelSubType : uint8_t { OLST_TEXT = 0, OLST_DEPARTURES_VIA = 1, OLST_DEPARTURES_REMOVE_VIA = 2, @@ -213,7 +213,7 @@ enum OrderConditionComparator { /** * Enumeration for the data to set in #CmdModifyOrder. */ -enum ModifyOrderFlags { +enum ModifyOrderFlags : uint8_t { MOF_NON_STOP, ///< Passes an OrderNonStopFlags. MOF_STOP_LOCATION, ///< Passes an OrderStopLocation. MOF_UNLOAD, ///< Passes an OrderUnloadType. @@ -239,7 +239,7 @@ enum ModifyOrderFlags { MOF_DEPARTURES_SUBTYPE, ///< Change the label departures subtype MOF_END }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * Depot action to switch to when doing a #MOF_DEPOT_ACTION. @@ -293,7 +293,7 @@ enum OrderDispatchTagConditionBits { /** * Enumeration for the data to set in #CmdChangeTimetable. */ -enum ModifyTimetableFlags { +enum ModifyTimetableFlags : uint8_t { MTF_WAIT_TIME, ///< Set wait time. MTF_TRAVEL_TIME, ///< Set travel time. MTF_TRAVEL_SPEED, ///< Set max travel speed. @@ -303,11 +303,11 @@ enum ModifyTimetableFlags { MTF_ASSIGN_SCHEDULE, ///< Assign a dispatch schedule. MTF_END }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Clone actions. */ -enum CloneOptions { +enum CloneOptions : uint8_t { CO_SHARE = 0, CO_COPY = 1, CO_UNSHARE = 2 diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index c4564a4b94..21bd16753c 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -258,7 +258,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa) /* We only need the alpha channel, as we apply our own colour constants to the sprite. */ int pitch = Align(bb_width, 16); - byte *bmp = CallocT(bb_height * pitch); + uint8_t *bmp = CallocT(bb_height * pitch); CFAutoRelease context(CGBitmapContextCreate(bmp, bb_width, bb_height, 8, pitch, nullptr, kCGImageAlphaOnly)); /* Set antialias according to requirements. */ CGContextSetAllowsAntialiasing(context.get(), use_aa); @@ -294,7 +294,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa) GlyphEntry new_glyph; new_glyph.sprite = BlitterFactory::GetCurrentBlitter()->Encode(spritecollection, SimpleSpriteAlloc); - new_glyph.width = (byte)std::round(CTFontGetAdvancesForGlyphs(this->font.get(), kCTFontOrientationDefault, &glyph, nullptr, 1)); + new_glyph.width = (uint8_t)std::round(CTFontGetAdvancesForGlyphs(this->font.get(), kCTFontOrientationDefault, &glyph, nullptr, 1)); this->SetGlyphPtr(key, &new_glyph); return new_glyph.sprite; diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 2b0a58db24..b378e3f09a 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -310,11 +310,11 @@ static const char *GetAccessViolationTypeString(uint type) buffer += seprintf(buffer, last, "\n Bytes at instruction pointer:\n"); #ifdef _M_AMD64 - byte *b = (byte*)ep->ContextRecord->Rip; + uint8_t *b = (uint8_t*)ep->ContextRecord->Rip; #elif defined(_M_IX86) - byte *b = (byte*)ep->ContextRecord->Eip; + uint8_t *b = (uint8_t*)ep->ContextRecord->Eip; #elif defined(_M_ARM64) - byte *b = (byte*)ep->ContextRecord->Pc; + uint8_t *b = (uint8_t*)ep->ContextRecord->Pc; #endif for (int i = 0; i != 24; i++) { if (IsBadReadPtr(b, 1)) { diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index a2f0d4db0d..55424611f8 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -224,7 +224,7 @@ void Win32FontCache::ClearFontCache() if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) usererror("Font glyph is too large"); /* Call GetGlyphOutline again with size to actually render the glyph. */ - byte *bmp = AllocaM(byte, size); + uint8_t *bmp = AllocaM(uint8_t, size); GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, size, bmp, &mat); /* GDI has rendered the glyph, now we allocate a sprite and copy the image into it. */ @@ -339,11 +339,11 @@ static bool TryLoadFontFromFile(const std::string &font_name, LOGFONT &logfont) /* Try to query an array of LOGFONTs that describe the file. */ DWORD len = 0; if (GetFontResourceInfo(fontPath, &len, nullptr, 2) && len >= sizeof(LOGFONT)) { - LOGFONT *buf = (LOGFONT *)new byte[len]; + LOGFONT *buf = (LOGFONT *)new uint8_t[len]; if (GetFontResourceInfo(fontPath, &len, buf, 2)) { logfont = *buf; // Just use first entry. } - delete[](byte *)buf; + delete[](uint8_t *)buf; } } diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index f7f13d2685..ad2a51d3e3 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -32,7 +32,7 @@ enum KeyStateBits { KEYS_SHIFT, KEYS_CAPS }; -static byte _keystate = KEYS_NONE; +static uint8_t _keystate = KEYS_NONE; struct OskWindow : public Window { StringID caption; ///< the caption for this window. diff --git a/src/palette.cpp b/src/palette.cpp index cd875fe93c..0e289b62dd 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -25,7 +25,7 @@ Palette _cur_palette; std::mutex _cur_palette_mutex; -byte _colour_value[COLOUR_END] = { +uint8_t _colour_value[COLOUR_END] = { 133, // COLOUR_DARK_BLUE 99, // COLOUR_PALE_GREEN, 48, // COLOUR_PINK, @@ -212,8 +212,8 @@ void DoPaletteAnimations() /* Radio tower blinking */ { - byte i = (palette_animation_counter >> 1) & 0x7F; - byte v; + uint8_t i = (palette_animation_counter >> 1) & 0x7F; + uint8_t v; if (i < 0x3f) { v = 255; @@ -299,7 +299,7 @@ TextColour GetContrastColour(uint8_t background, uint8_t threshold) */ struct ColourGradients { - using ColourGradient = std::array; + using ColourGradient = std::array; static inline std::array gradient{}; }; @@ -310,7 +310,7 @@ struct ColourGradients * @param shade Shade level from 1 to 7. * @returns palette index of colour. */ -byte GetColourGradient(Colours colour, ColourShade shade) +uint8_t GetColourGradient(Colours colour, ColourShade shade) { return ColourGradients::gradient[colour % COLOUR_END][shade % SHADE_END]; } @@ -321,7 +321,7 @@ byte GetColourGradient(Colours colour, ColourShade shade) * @param shade Shade level from 1 to 7. * @param palette_index Palette index to set. */ -void SetColourGradient(Colours colour, ColourShade shade, byte palette_index) +void SetColourGradient(Colours colour, ColourShade shade, uint8_t palette_index) { assert(colour < COLOUR_END); assert(shade < SHADE_END); diff --git a/src/palette_func.h b/src/palette_func.h index b3d5923413..06e44e1bbe 100644 --- a/src/palette_func.h +++ b/src/palette_func.h @@ -37,7 +37,7 @@ inline bool IsValidColours(Colours colours) TextColour GetContrastColour(uint8_t background, uint8_t threshold = 128); -extern byte _colour_value[COLOUR_END]; +extern uint8_t _colour_value[COLOUR_END]; enum ColourShade : uint8_t { SHADE_BEGIN = 0, @@ -53,8 +53,8 @@ enum ColourShade : uint8_t { }; DECLARE_POSTFIX_INCREMENT(ColourShade) -byte GetColourGradient(Colours colour, ColourShade shade); -void SetColourGradient(Colours colour, ColourShade shade, byte palette_colour); +uint8_t GetColourGradient(Colours colour, ColourShade shade); +void SetColourGradient(Colours colour, ColourShade shade, uint8_t palette_colour); /** * Return the colour for a particular greyscale level. diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h index 7ba2b0288f..6b16f6cb28 100644 --- a/src/pathfinder/npf/aystar.h +++ b/src/pathfinder/npf/aystar.h @@ -149,14 +149,14 @@ struct AyStar { void *user_target; void *user_data; - byte loops_per_tick; ///< How many loops are there called before Main() gives control back to the caller. 0 = until done. - uint max_path_cost; ///< If the g-value goes over this number, it stops searching, 0 = infinite. - uint max_search_nodes; ///< The maximum number of nodes that will be expanded, 0 = infinite. + uint8_t loops_per_tick; ///< How many loops are there called before Main() gives control back to the caller. 0 = until done. + uint max_path_cost; ///< If the g-value goes over this number, it stops searching, 0 = infinite. + uint max_search_nodes; ///< The maximum number of nodes that will be expanded, 0 = infinite. /* These should be filled with the neighbours of a tile by * GetNeighbours */ AyStarNode neighbours[12]; - byte num_neighbours; + uint8_t num_neighbours; void Init(uint num_buckets); diff --git a/src/pathfinder/npf/queue.cpp b/src/pathfinder/npf/queue.cpp index 8864e5eefb..bbe1c878ee 100644 --- a/src/pathfinder/npf/queue.cpp +++ b/src/pathfinder/npf/queue.cpp @@ -217,7 +217,7 @@ void Hash::Init(Hash_HashProc *hash, uint num_buckets) this->hash = hash; this->size = 0; this->num_buckets = num_buckets; - this->buckets = (HashNode*)MallocT(num_buckets * (sizeof(*this->buckets) + sizeof(*this->buckets_in_use))); + this->buckets = (HashNode*)MallocT(num_buckets * (sizeof(*this->buckets) + sizeof(*this->buckets_in_use))); this->buckets_in_use = (bool*)(this->buckets + num_buckets); for (i = 0; i < num_buckets; i++) this->buckets_in_use[i] = false; } diff --git a/src/pathfinder/water_regions.cpp b/src/pathfinder/water_regions.cpp index 4f74104bce..91dcf716e1 100644 --- a/src/pathfinder/water_regions.cpp +++ b/src/pathfinder/water_regions.cpp @@ -27,7 +27,7 @@ using TWaterRegionTraversabilityBits = uint16_t; constexpr TWaterRegionPatchLabel FIRST_REGION_LABEL = 1; static_assert(sizeof(TWaterRegionTraversabilityBits) * 8 == WATER_REGION_EDGE_LENGTH); -static_assert(sizeof(TWaterRegionPatchLabel) == sizeof(byte)); // Important for the hash calculation. +static_assert(sizeof(TWaterRegionPatchLabel) == sizeof(uint8_t)); // Important for the hash calculation. static inline TrackBits GetWaterTracks(TileIndex tile) { return TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)); } static inline bool IsAqueductTile(TileIndex tile) { return IsBridgeTile(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER; } diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index d638f441af..46c2f5c163 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -412,7 +412,7 @@ public: /* Ocean/canal speed penalty. */ const ShipVehicleInfo *svi = ShipVehInfo(Yapf().GetVehicle()->engine_type); - byte speed_frac = (GetEffectiveWaterClass(n.GetTile()) == WATER_CLASS_SEA) ? svi->ocean_speed_frac : svi->canal_speed_frac; + uint8_t speed_frac = (GetEffectiveWaterClass(n.GetTile()) == WATER_CLASS_SEA) ? svi->ocean_speed_frac : svi->canal_speed_frac; if (speed_frac > 0) c += YAPF_TILE_LENGTH * (1 + tf->m_tiles_skipped) * speed_frac / (256 - speed_frac); /* Apply it. */ diff --git a/src/pbs.h b/src/pbs.h index 4b655f415b..2f6df3a0c6 100644 --- a/src/pbs.h +++ b/src/pbs.h @@ -45,7 +45,7 @@ struct PBSTileInfo { PBSTileInfo(TileIndex _t, Trackdir _td, bool _okay) : tile(_t), trackdir(_td), okay(_okay) {} }; -enum TrainReservationLookAheadItemType : byte { +enum TrainReservationLookAheadItemType : uint8_t { TRLIT_STATION = 0, ///< Station/waypoint TRLIT_REVERSE = 1, ///< Reverse behind signal TRLIT_TRACK_SPEED = 2, ///< Track or bridge speed limit diff --git a/src/programmable_signals.cpp b/src/programmable_signals.cpp index 05253841b1..9bcfe54afe 100644 --- a/src/programmable_signals.cpp +++ b/src/programmable_signals.cpp @@ -772,7 +772,7 @@ CommandCost CmdModifySignalInstruction(TileIndex tile, DoCommandFlag flags, uint case PSO_IF: { SignalIf *si = static_cast(insn); - byte act = GB(p2, 0, 1); + uint8_t act = GB(p2, 0, 1); if (act == 0) { // Set code SignalConditionCode code = (SignalConditionCode) GB(p2, 1, 8); if (code > PSC_MAX) diff --git a/src/programmable_signals.h b/src/programmable_signals.h index 26ba6a627c..af982a45da 100644 --- a/src/programmable_signals.h +++ b/src/programmable_signals.h @@ -64,7 +64,7 @@ enum SignalOpcode { PSO_END, PSO_INVALID = 0xFF }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Signal instruction base class. All instructions must derive from this. */ class SignalInstruction { diff --git a/src/rail.cpp b/src/rail.cpp index 365900e290..04c78cab77 100644 --- a/src/rail.cpp +++ b/src/rail.cpp @@ -20,21 +20,21 @@ /* XXX: Below 3 tables store duplicate data. Maybe remove some? */ /* Maps a trackdir to the bit that stores its status in the map arrays, in the * direction along with the trackdir */ -extern const byte _signal_along_trackdir[TRACKDIR_END] = { +extern const uint8_t _signal_along_trackdir[TRACKDIR_END] = { 0x8, 0x8, 0x8, 0x2, 0x4, 0x1, 0, 0, 0x4, 0x4, 0x4, 0x1, 0x8, 0x2 }; /* Maps a trackdir to the bit that stores its status in the map arrays, in the * direction against the trackdir */ -extern const byte _signal_against_trackdir[TRACKDIR_END] = { +extern const uint8_t _signal_against_trackdir[TRACKDIR_END] = { 0x4, 0x4, 0x4, 0x1, 0x8, 0x2, 0, 0, 0x8, 0x8, 0x8, 0x2, 0x4, 0x1 }; /* Maps a Track to the bits that store the status of the two signals that can * be present on the given track */ -extern const byte _signal_on_track[] = { +extern const uint8_t _signal_on_track[] = { 0xC, 0xC, 0xC, 0x3, 0xC, 0x3 }; diff --git a/src/rail.h b/src/rail.h index 05b1d95604..57d7a75a37 100644 --- a/src/rail.h +++ b/src/rail.h @@ -212,12 +212,12 @@ public: /** * Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations. */ - byte fallback_railtype; + uint8_t fallback_railtype; /** * Multiplier for curve maximum speed advantage */ - byte curve_speed; + uint8_t curve_speed; /** * Bit mask of rail type flags @@ -227,7 +227,7 @@ public: /** * Bit mask of rail type control flags */ - byte ctrl_flags; + uint8_t ctrl_flags; /** * Signal extra aspects @@ -267,7 +267,7 @@ public: /** * Colour on mini-map */ - byte map_colour; + uint8_t map_colour; /** * Introduction date. @@ -292,7 +292,7 @@ public: /** * The sorting order of this railtype for the toolbar dropdown. */ - byte sorting_order; + uint8_t sorting_order; /** * NewGRF providing the Action3 for the railtype. nullptr if not available. diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index d19a3e57d2..69cf1b4aa5 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -295,7 +295,7 @@ RailType AllocateRailType(RailTypeLabel label) return INVALID_RAILTYPE; } -static const byte _track_sloped_sprites[14] = { +static const uint8_t _track_sloped_sprites[14] = { 14, 15, 22, 13, 0, 21, 17, 12, 23, 0, 18, 20, @@ -1997,7 +1997,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin bool remove = HasBit(p2, 5); bool autofill = HasBit(p2, 6); bool minimise_gaps = HasBit(p2, 10); - byte signal_density = GB(p2, 24, 8); + uint8_t signal_density = GB(p2, 24, 8); uint8_t signal_style = GB(p2, 11, 4); bool allow_station = HasBit(p3, 0); @@ -2024,7 +2024,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin SignalType sigtype = Extract(p2); if (sigtype > SIGTYPE_LAST) return CMD_ERROR; - byte signals; + uint8_t signals; /* copy the signal-style of the first rail-piece if existing */ if (HasSignalOnTrack(tile, track)) { signals = GetPresentSignals(tile) & SignalOnTrack(track); @@ -2042,7 +2042,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin signals = IsPbsSignal(sigtype) ? SignalAlongTrackdir(trackdir) : SignalOnTrack(track); } - byte signal_dir = 0; + uint8_t signal_dir = 0; if (signals & SignalAlongTrackdir(trackdir)) SetBit(signal_dir, 0); if (signals & SignalAgainstTrackdir(trackdir)) SetBit(signal_dir, 1); @@ -3900,7 +3900,7 @@ void DrawTrackBits(TileInfo *ti, TrackBits track, RailType rt, RailGroundType rg DrawGroundSprite(image, pal, &(_halftile_sub_sprite[halftile_corner])); if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasReservedTracks(ti->tile, CornerToTrackBits(halftile_corner))) { - static const byte _corner_to_track_sprite[] = {3, 1, 2, 0}; + static const uint8_t _corner_to_track_sprite[] = {3, 1, 2, 0}; DrawGroundSprite(_corner_to_track_sprite[halftile_corner] + rti->base_sprites.single_n, PALETTE_CRASH, nullptr, 0, -(int)TILE_HEIGHT); } } @@ -3964,7 +3964,7 @@ void DrawTrackBits(TileInfo *ti, TrackBits track) static void DrawSignals(TileIndex tile, TrackBits rails, const RailTypeInfo *rti) { - auto MAYBE_DRAW_SIGNAL = [&](byte signalbit, SignalOffsets image, uint pos, Track track) { + auto MAYBE_DRAW_SIGNAL = [&](uint8_t signalbit, SignalOffsets image, uint pos, Track track) { if (IsSignalPresent(tile, signalbit)) DrawSingleSignal(tile, rti, track, GetSingleSignalState(tile, signalbit), image, pos); }; @@ -4185,7 +4185,7 @@ static Foundation GetFoundation_Track(TileIndex tile, Slope tileh) RailGroundType RailTrackToFence(TileIndex tile, TrackBits rail) { Owner owner = GetTileOwner(tile); - byte fences = 0; + uint8_t fences = 0; for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { static const TrackBits dir_to_trackbits[DIAGDIR_END] = {TRACK_BIT_3WAY_NE, TRACK_BIT_3WAY_SE, TRACK_BIT_3WAY_SW, TRACK_BIT_3WAY_NW}; @@ -4340,7 +4340,7 @@ static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, case RAIL_TILE_SIGNALS: { trackbits = GetTrackBits(tile); if (sub_mode & TTSSM_NO_RED_SIGNALS) break; - byte a = GetPresentSignals(tile); + uint8_t a = GetPresentSignals(tile); uint b = GetSignalStates(tile); b &= a; @@ -4601,8 +4601,8 @@ static void ChangeTileOwner_Track(TileIndex tile, Owner old_owner, Owner new_own } } -static const byte _fractcoords_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 }; -static const byte _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 }; +static const uint8_t _fractcoords_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 }; +static const uint8_t _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 }; static const int8_t _deltacoord_leaveoffset[8] = { -1, 0, 1, 0, /* x */ 0, 1, 0, -1 /* y */ @@ -4670,13 +4670,13 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int /* Calculate the point where the following wagon should be activated. */ int length = v->CalcNextVehicleOffset(); - byte fract_coord_leave = + uint8_t fract_coord_leave = ((_fractcoords_enter[dir] & 0x0F) + // x (length + 1) * _deltacoord_leaveoffset[dir]) + (((_fractcoords_enter[dir] >> 4) + // y ((length + 1) * _deltacoord_leaveoffset[dir + 4])) << 4); - byte fract_coord = (x & 0xF) + ((y & 0xF) << 4); + uint8_t fract_coord = (x & 0xF) + ((y & 0xF) << 4); if (_fractcoords_behind[dir] == fract_coord) { /* make sure a train is not entering the tile from behind */ diff --git a/src/rail_map.h b/src/rail_map.h index c2a2e58b66..367d6654a9 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -224,7 +224,7 @@ inline Track GetRailDepotTrack(TileIndex t) inline TrackBits GetRailReservationTrackBits(TileIndex t) { dbg_assert_tile(IsPlainRailTile(t), t); - byte track_b = GB(_m[t].m2, 8, 3); + uint8_t track_b = GB(_m[t].m2, 8, 3); Track track = (Track)(track_b - 1); // map array saves Track+1 if (track_b == 0) return TRACK_BIT_NONE; return (TrackBits)(TrackToTrackBits(track) | (HasBit(_m[t].m2, 11) ? TrackToTrackBits(TrackToOppositeTrack(track)) : 0)); @@ -243,7 +243,7 @@ inline void SetTrackReservation(TileIndex t, TrackBits b) dbg_assert(!TracksOverlap(b)); Track track = RemoveFirstTrack(&b); SB(_m[t].m2, 8, 3, track == INVALID_TRACK ? 0 : track + 1); - SB(_m[t].m2, 11, 1, (byte)(b != TRACK_BIT_NONE)); + SB(_m[t].m2, 11, 1, (uint8_t)(b != TRACK_BIT_NONE)); } /** @@ -300,7 +300,7 @@ inline bool HasDepotReservation(TileIndex t) inline void SetDepotReservation(TileIndex t, bool b) { dbg_assert_tile(IsRailDepot(t), t); - SB(_m[t].m5, 4, 1, (byte)b); + SB(_m[t].m5, 4, 1, (uint8_t)b); } /** @@ -317,14 +317,14 @@ inline TrackBits GetDepotReservationTrackBits(TileIndex t) inline SignalType GetSignalType(TileIndex t, Track track) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; return (SignalType)GB(_m[t].m2, pos, 3); } inline void SetSignalType(TileIndex t, Track track, SignalType s) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; SB(_m[t].m2, pos, 3, s); if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s); } @@ -362,8 +362,8 @@ inline bool IsOnewaySignal(TileIndex t, Track track) inline void CycleSignalSide(TileIndex t, Track track) { - byte sig; - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6; + uint8_t sig; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6; sig = GB(_m[t].m3, pos, 2); if (--sig == 0) sig = (IsPbsSignal(GetSignalType(t, track)) || _settings_game.vehicle.train_braking_model == TBM_REALISTIC) ? 2 : 3; @@ -372,13 +372,13 @@ inline void CycleSignalSide(TileIndex t, Track track) inline SignalVariant GetSignalVariant(TileIndex t, Track track) { - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3; return (SignalVariant)GB(_m[t].m2, pos, 1); } inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v) { - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3; SB(_m[t].m2, pos, 1, v); if (track == INVALID_TRACK) SB(_m[t].m2, 7, 1, v); } @@ -386,14 +386,14 @@ inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v) inline uint8_t GetSignalAspect(TileIndex t, Track track) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0; return GB(_me[t].m7, pos, 3); } inline void SetSignalAspect(TileIndex t, Track track, uint8_t aspect) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0; SB(_me[t].m7, pos, 3, aspect); } @@ -405,7 +405,7 @@ inline bool NonZeroSignalStylePossiblyOnTile(TileIndex t) inline uint8_t GetSignalStyle(TileIndex t, Track track) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; return GB(_me[t].m6, pos, 4); } @@ -424,21 +424,21 @@ inline uint8_t GetSignalStyleGeneric(TileIndex t, Track track) inline void SetSignalStyle(TileIndex t, Track track, uint8_t style) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; SB(_me[t].m6, pos, 4, style); } inline bool GetSignalAlwaysReserveThrough(TileIndex t, Track track) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6; return HasBit(_me[t].m7, pos); } inline void SetSignalAlwaysReserveThrough(TileIndex t, Track track, bool reserve_through) { dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t); - byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6; + uint8_t pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6; SB(_me[t].m7, pos, 1, reserve_through ? 1 : 0); } @@ -468,7 +468,7 @@ inline uint GetSignalStates(TileIndex tile) * @param signalbit the signal * @return the state of the signal */ -inline SignalState GetSingleSignalState(TileIndex t, byte signalbit) +inline SignalState GetSingleSignalState(TileIndex t, uint8_t signalbit) { return (SignalState)HasBit(GetSignalStates(t), signalbit); } @@ -499,7 +499,7 @@ inline uint GetPresentSignals(TileIndex tile) * @param signalbit the signal * @return true if and only if the signal is present */ -inline bool IsSignalPresent(TileIndex t, byte signalbit) +inline bool IsSignalPresent(TileIndex t, uint8_t signalbit) { return HasBit(GetPresentSignals(t), signalbit); } diff --git a/src/rail_type.h b/src/rail_type.h index e49e517810..96e3e593cf 100644 --- a/src/rail_type.h +++ b/src/rail_type.h @@ -24,7 +24,7 @@ static const RailTypeLabel RAILTYPE_LABEL_MAGLEV = 'MGLV'; * * This enumeration defines all 4 possible railtypes. */ -enum RailType : byte { +enum RailType : uint8_t { RAILTYPE_BEGIN = 0, ///< Used for iterations RAILTYPE_RAIL = 0, ///< Standard non-electric rails RAILTYPE_ELECTRIC = 1, ///< Electric rails @@ -37,7 +37,7 @@ enum RailType : byte { /** Allow incrementing of Track variables */ DECLARE_POSTFIX_INCREMENT(RailType) /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * The different railtypes we support, but then a bitmask of them. diff --git a/src/random_access_file.cpp b/src/random_access_file.cpp index 2dc5109321..ec7a710b3b 100644 --- a/src/random_access_file.cpp +++ b/src/random_access_file.cpp @@ -97,7 +97,7 @@ void RandomAccessFile::SeekTo(size_t pos, int mode) * Read a byte from the file. * @return Read byte. */ -byte RandomAccessFile::ReadByteIntl() +uint8_t RandomAccessFile::ReadByteIntl() { if (this->buffer == this->buffer_end) { this->buffer = this->buffer_start; @@ -116,7 +116,7 @@ byte RandomAccessFile::ReadByteIntl() */ uint16_t RandomAccessFile::ReadWordIntl() { - byte b = this->ReadByteIntl(); + uint8_t b = this->ReadByteIntl(); return (this->ReadByteIntl() << 8) | b; } diff --git a/src/random_access_file_type.h b/src/random_access_file_type.h index 54c2f6edae..807d0a3850 100644 --- a/src/random_access_file_type.h +++ b/src/random_access_file_type.h @@ -31,11 +31,11 @@ class RandomAccessFile { FILE *file_handle; ///< File handle of the open file. size_t pos; ///< Position in the file of the end of the read buffer. - byte *buffer; ///< Current position within the local buffer. - byte *buffer_end; ///< Last valid byte of buffer. - byte buffer_start[BUFFER_SIZE]; ///< Local buffer when read from file. + uint8_t *buffer; ///< Current position within the local buffer. + uint8_t *buffer_end; ///< Last valid byte of buffer. + uint8_t buffer_start[BUFFER_SIZE]; ///< Local buffer when read from file. - byte ReadByteIntl(); + uint8_t ReadByteIntl(); uint16_t ReadWordIntl(); uint32_t ReadDwordIntl(); @@ -52,7 +52,7 @@ public: size_t GetPos() const; void SeekTo(size_t pos, int mode); - inline byte ReadByte() + inline uint8_t ReadByte() { if (likely(this->buffer != this->buffer_end)) return *this->buffer++; return this->ReadByteIntl(); diff --git a/src/rev.cpp.in b/src/rev.cpp.in index 32d78b8fde..39d45b3c6b 100644 --- a/src/rev.cpp.in +++ b/src/rev.cpp.in @@ -70,14 +70,14 @@ const char _openttd_revision_year[] = "${REV_YEAR}"; * (compiling from sources without any version control software) * and 2 is for modified revision. */ -const byte _openttd_revision_modified = ${REV_MODIFIED}; +const uint8_t _openttd_revision_modified = ${REV_MODIFIED}; /** * Indicate whether this is a tagged version. * If this is non-0, then _openttd_revision is the name of the tag, * and the version is likely a beta, release candidate, or real release. */ -const byte _openttd_revision_tagged = ${REV_ISTAG}; +const uint8_t _openttd_revision_tagged = ${REV_ISTAG}; /** * To check compatibility of BaNaNaS content, this version string is used. diff --git a/src/rev.h b/src/rev.h index 48dabfb51e..ea8ff0e817 100644 --- a/src/rev.h +++ b/src/rev.h @@ -16,8 +16,8 @@ extern const char _openttd_build_date[]; extern const char _openttd_revision_hash[]; extern const char _openttd_revision_year[]; extern const char _openttd_build_configure_defines[]; -extern const byte _openttd_revision_modified; -extern const byte _openttd_revision_tagged; +extern const uint8_t _openttd_revision_modified; +extern const uint8_t _openttd_revision_tagged; extern const char _openttd_content_version[]; extern const uint32_t _openttd_newgrf_version; diff --git a/src/road.h b/src/road.h index 221458213f..f665aef9b1 100644 --- a/src/road.h +++ b/src/road.h @@ -192,7 +192,7 @@ public: /** * Colour on mini-map */ - byte map_colour; + uint8_t map_colour; /** * Introduction date. @@ -217,7 +217,7 @@ public: /** * The sorting order of this roadtype for the toolbar dropdown. */ - byte sorting_order; + uint8_t sorting_order; /** * NewGRF providing the Action3 for the roadtype. nullptr if not available. diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 2c533810d9..c9b4b5b832 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1872,8 +1872,8 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags) struct DrawRoadTileStruct { uint16_t image; - byte subcoord_x; - byte subcoord_y; + uint8_t subcoord_x; + uint8_t subcoord_y; }; #include "table/road_land.h" @@ -1907,7 +1907,7 @@ Foundation GetRoadFoundation(Slope tileh, RoadBits bits) return (bits == ROAD_X ? FOUNDATION_INCLINED_X : FOUNDATION_INCLINED_Y); } -const byte _road_sloped_sprites[14] = { +const uint8_t _road_sloped_sprites[14] = { 0, 0, 2, 0, 0, 1, 0, 0, 3, 0, 0, 0, @@ -2884,7 +2884,7 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td) * Given the direction the road depot is pointing, this is the direction the * vehicle should be travelling in in order to enter the depot. */ -static const byte _roadveh_enter_depot_dir[4] = { +static const uint8_t _roadveh_enter_depot_dir[4] = { TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_X_NE, TRACKDIR_Y_SE }; diff --git a/src/road_map.h b/src/road_map.h index 40b6f2d810..b41049dd8b 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -328,7 +328,7 @@ enum DisallowedRoadDirections : uint8_t { }; DECLARE_ENUM_AS_BIT_SET(DisallowedRoadDirections) /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * Gets the disallowed directions diff --git a/src/road_type.h b/src/road_type.h index 31ff734fcd..16728e69ec 100644 --- a/src/road_type.h +++ b/src/road_type.h @@ -32,7 +32,7 @@ enum RoadType : uint8_t { INVALID_ROADTYPE = 63, ///< flag for invalid roadtype }; DECLARE_POSTFIX_INCREMENT(RoadType) -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * The different roadtypes we support, but then a bitmask of them. @@ -71,6 +71,6 @@ enum RoadBits : uint8_t { ROAD_END = ROAD_ALL + 1, ///< Out-of-range roadbits, used for iterations }; DECLARE_ENUM_AS_BIT_SET(RoadBits) -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; #endif /* ROAD_TYPE_H */ diff --git a/src/roadstop_base.h b/src/roadstop_base.h index 7281fa9f7b..18e829f55a 100644 --- a/src/roadstop_base.h +++ b/src/roadstop_base.h @@ -74,7 +74,7 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> { void Rebuild(const RoadStop *rs, int side = -1); }; - byte status; ///< Current status of the Stop, @see RoadStopSatusFlag. Access using *Bay and *Busy functions. + uint8_t status; ///< Current status of the Stop, @see RoadStopSatusFlag. Access using *Bay and *Busy functions. TileIndex xy; ///< Position on the map struct RoadStop *next; ///< Next stop of the given type at this station diff --git a/src/roadveh.h b/src/roadveh.h index d3f8ecbc1e..c17bde0681 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -77,7 +77,7 @@ static const uint RVC_DRIVE_THROUGH_STOP_FRAME = 11; static const uint RVC_DEPOT_STOP_FRAME = 11; /** The number of ticks a vehicle has for overtaking. */ -static const byte RV_OVERTAKE_TIMEOUT = 35; +static const uint8_t RV_OVERTAKE_TIMEOUT = 35; /** Maximum segments of road vehicle path cache */ static const uint8_t RV_PATH_CACHE_SEGMENTS = 16; @@ -140,19 +140,19 @@ enum RoadVehicleFlags { * Buses, trucks and trams belong to this class. */ struct RoadVehicle final : public GroundVehicle { - byte state; ///< @see RoadVehicleStates - byte frame; + uint8_t state; ///< @see RoadVehicleStates + uint8_t frame; uint16_t blocked_ctr; - byte overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0. - byte overtaking_ctr; ///< The length of the current overtake attempt. + uint8_t overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0. + uint8_t overtaking_ctr; ///< The length of the current overtake attempt. std::unique_ptr cached_path; ///< Cached path. - RoadTypes compatible_roadtypes; ///< Roadtypes this consist is powered on. - uint16_t crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed - byte reverse_ctr; - byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service - uint8_t rvflags; ///< Road vehicle flags + RoadTypes compatible_roadtypes; ///< Roadtypes this consist is powered on. + uint16_t crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed + uint8_t reverse_ctr; + uint8_t critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service + uint8_t rvflags; ///< Road vehicle flags - RoadType roadtype; ///< Roadtype of this vehicle. + RoadType roadtype; ///< Roadtype of this vehicle. /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ RoadVehicle() : GroundVehicleBase() {} @@ -207,7 +207,7 @@ struct RoadVehicle final : public GroundVehicle { return RV_OVERTAKE_TIMEOUT + (this->gcache.cached_total_length / 2) - (VEHICLE_LENGTH / 2); } - void SetRoadVehicleOvertaking(byte overtaking); + void SetRoadVehicleOvertaking(uint8_t overtaking); inline RoadVehPathCache &GetOrCreatePathCache() { @@ -290,7 +290,7 @@ protected: // These functions should not be called outside acceleration code. * Allows to know the tractive effort value that this vehicle will use. * @return Tractive effort value from the engine. */ - inline byte GetTractiveEffort() const + inline uint8_t GetTractiveEffort() const { /* The tractive effort coefficient is in units of 1/256. */ return GetVehicleProperty(this, PROP_ROADVEH_TRACTIVE_EFFORT, RoadVehInfo(this->engine_type)->tractive_effort); @@ -300,7 +300,7 @@ protected: // These functions should not be called outside acceleration code. * Gets the area used for calculating air drag. * @return Area of the engine in m^2. */ - inline byte GetAirDragArea() const + inline uint8_t GetAirDragArea() const { return 6; } @@ -309,7 +309,7 @@ protected: // These functions should not be called outside acceleration code. * Gets the air drag coefficient of this vehicle. * @return Air drag value from the engine. */ - inline byte GetAirDrag() const + inline uint8_t GetAirDrag() const { return RoadVehInfo(this->engine_type)->air_drag; } diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 042239bce0..a372a3f7de 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1311,7 +1311,7 @@ found_best_track:; } struct RoadDriveEntry { - byte x, y; + uint8_t x, y; }; #include "table/roadveh_movement.h" @@ -1374,7 +1374,7 @@ static Trackdir FollowPreviousRoadVehicle(const RoadVehicle *v, const RoadVehicl return _road_reverse_table[entry_dir]; } - byte prev_state = prev->state; + uint8_t prev_state = prev->state; Trackdir dir; if (prev_state == RVSB_WORMHOLE || prev_state == RVSB_IN_DEPOT) { @@ -1594,7 +1594,7 @@ static void RoadVehCheckFinishOvertake(RoadVehicle *v) v->SetRoadVehicleOvertaking(0); } -inline byte IncreaseOvertakingCounter(RoadVehicle *v) +inline uint8_t IncreaseOvertakingCounter(RoadVehicle *v) { if (v->overtaking_ctr != 255) v->overtaking_ctr++; return v->overtaking_ctr; @@ -1692,7 +1692,7 @@ bool IndividualRoadVehicleController(RoadVehicle *v, const RoadVehicle *prev) if (u != nullptr) { u = u->First(); /* There is a vehicle in front overtake it if possible */ - byte old_overtaking = v->overtaking; + uint8_t old_overtaking = v->overtaking; if (v->overtaking == 0) RoadVehCheckOvertake(v, u); if (v->overtaking == old_overtaking) { v->cur_speed = u->cur_speed; @@ -1884,7 +1884,7 @@ again: TileIndex old_tile = v->tile; v->tile = tile; - v->state = (byte)dir; + v->state = (uint8_t)dir; v->frame = start_frame; RoadTramType rtt = GetRoadTramType(v->roadtype); if (GetRoadType(old_tile, rtt) != GetRoadType(tile, rtt)) { @@ -2003,7 +2003,7 @@ again: if (u != nullptr) { u = u->First(); /* There is a vehicle in front overtake it if possible */ - byte old_overtaking = v->overtaking; + uint8_t old_overtaking = v->overtaking; if (v->overtaking == 0) RoadVehCheckOvertake(v, u); if (v->overtaking == old_overtaking) v->cur_speed = u->cur_speed; @@ -2012,7 +2012,7 @@ again: v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile), false) && IsInfraTileUsageAllowed(VEH_ROAD, v->owner, v->tile) && !v->current_order.IsType(OT_LEAVESTATION) && GetRoadStopType(v->tile) == (v->IsBus() ? ROADSTOP_BUS : ROADSTOP_TRUCK)) { - byte cur_overtaking = IsRoadVehicleOnOtherSideOfRoad(v) ? RVSB_DRIVE_SIDE : 0; + uint8_t cur_overtaking = IsRoadVehicleOnOtherSideOfRoad(v) ? RVSB_DRIVE_SIDE : 0; if (cur_overtaking != v->overtaking) v->SetRoadVehicleOvertaking(cur_overtaking); Station *st = Station::GetByTile(v->tile); v->last_station_visited = st->index; @@ -2255,7 +2255,7 @@ void RoadVehicle::SetDestTile(TileIndex tile) this->dest_tile = tile; } -void RoadVehicle::SetRoadVehicleOvertaking(byte overtaking) +void RoadVehicle::SetRoadVehicleOvertaking(uint8_t overtaking) { if (IsInsideMM(this->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END)) RoadStop::GetByTile(this->tile, GetRoadStopType(this->tile))->Leave(this); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 6d68f6ddf8..338aba455d 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -203,7 +203,7 @@ static void UpdateExclusiveRights() */ } -static const byte convert_currency[] = { +static const uint8_t convert_currency[] = { 0, 1, 12, 8, 3, 10, 14, 19, 4, 5, 9, 11, 13, 6, 17, @@ -571,12 +571,12 @@ static uint FixVehicleInclination(Vehicle *v, Direction dir) case INVALID_DIR: break; default: NOT_REACHED(); } - byte entry_z = GetSlopePixelZ(entry_x, entry_y, true); + uint8_t entry_z = GetSlopePixelZ(entry_x, entry_y, true); /* Compute middle of the tile. */ int middle_x = (v->x_pos & ~TILE_UNIT_MASK) + TILE_SIZE / 2; int middle_y = (v->y_pos & ~TILE_UNIT_MASK) + TILE_SIZE / 2; - byte middle_z = GetSlopePixelZ(middle_x, middle_y, true); + uint8_t middle_z = GetSlopePixelZ(middle_x, middle_y, true); /* middle_z == entry_z, no height change. */ if (middle_z == entry_z) return 0; @@ -2610,7 +2610,7 @@ bool AfterLoadGame() } /* Use old layout randomizer code */ - byte layout = TileHash(TileX(t->xy), TileY(t->xy)) % 6; + uint8_t layout = TileHash(TileX(t->xy), TileY(t->xy)) % 6; switch (layout) { default: break; case 5: layout = 1; break; @@ -2838,8 +2838,8 @@ bool AfterLoadGame() /* Airport tile animation uses animation frame instead of other graphics id */ if (IsSavegameVersionBefore(SLV_137)) { struct AirportTileConversion { - byte old_start; - byte num_frames; + uint8_t old_start; + uint8_t num_frames; }; static const AirportTileConversion atc[] = { {31, 12}, // APT_RADAR_GRASS_FENCE_SW @@ -2855,7 +2855,7 @@ bool AfterLoadGame() for (TileIndex t = 0; t < map_size; t++) { if (IsAirportTile(t)) { StationGfx old_gfx = GetStationGfx(t); - byte offset = 0; + uint8_t offset = 0; for (uint i = 0; i < lengthof(atc); i++) { if (old_gfx < atc[i].old_start) { SetStationGfx(t, old_gfx - offset); @@ -3024,9 +3024,9 @@ bool AfterLoadGame() const DiagDirection vdir = DirToDiagDir(v->direction); /* Have we passed the visibility "switch" state already? */ - byte pos = (DiagDirToAxis(vdir) == AXIS_X ? v->x_pos : v->y_pos) & TILE_UNIT_MASK; - byte frame = (vdir == DIAGDIR_NE || vdir == DIAGDIR_NW) ? TILE_SIZE - 1 - pos : pos; - extern const byte _tunnel_visibility_frame[DIAGDIR_END]; + uint8_t pos = (DiagDirToAxis(vdir) == AXIS_X ? v->x_pos : v->y_pos) & TILE_UNIT_MASK; + uint8_t frame = (vdir == DIAGDIR_NE || vdir == DIAGDIR_NW) ? TILE_SIZE - 1 - pos : pos; + extern const uint8_t _tunnel_visibility_frame[DIAGDIR_END]; /* Should the vehicle be hidden or not? */ bool hidden; @@ -3074,7 +3074,7 @@ bool AfterLoadGame() bool loading = rv->current_order.IsType(OT_LOADING) || rv->current_order.IsType(OT_LEAVESTATION); if (HasBit(rv->state, RVS_IN_ROAD_STOP)) { - extern const byte _road_stop_stop_frame[]; + extern const uint8_t _road_stop_stop_frame[]; SB(rv->state, RVS_ENTERED_STOP, 1, loading || rv->frame > _road_stop_stop_frame[rv->state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)]); } else if (HasBit(rv->state, RVS_IN_DT_ROAD_STOP)) { SB(rv->state, RVS_ENTERED_STOP, 1, loading || rv->frame > RVC_DRIVE_THROUGH_STOP_FRAME); diff --git a/src/saveload/gamelog_sl.cpp b/src/saveload/gamelog_sl.cpp index 23ded67cab..477681c773 100644 --- a/src/saveload/gamelog_sl.cpp +++ b/src/saveload/gamelog_sl.cpp @@ -324,7 +324,7 @@ public: la->changes.clear(); if (IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY)) { - byte type; + uint8_t type; while ((type = SlReadByte()) != GLCT_NONE) { if (type >= GLCT_END) SlErrorCorrupt("Invalid gamelog change type"); GamelogChangeType ct = (GamelogChangeType)type; @@ -370,7 +370,7 @@ struct GLOGChunkHandler : ChunkHandler { const std::vector slt = SlCompatTableHeader(_gamelog_desc, _gamelog_sl_compat); if (IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY)) { - byte type; + uint8_t type; while ((type = SlReadByte()) != GLAT_NONE) { if (type >= GLAT_END) SlErrorCorrupt("Invalid gamelog action type"); diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp index 4f7993bab1..b6f6356c2a 100644 --- a/src/saveload/map_sl.cpp +++ b/src/saveload/map_sl.cpp @@ -75,7 +75,7 @@ struct MAPTChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -86,7 +86,7 @@ struct MAPTChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -102,7 +102,7 @@ struct MAPHChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -113,7 +113,7 @@ struct MAPHChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -129,7 +129,7 @@ struct MAPOChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -140,7 +140,7 @@ struct MAPOChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -186,7 +186,7 @@ struct M3LOChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -197,7 +197,7 @@ struct M3LOChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -213,7 +213,7 @@ struct M3HIChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -224,7 +224,7 @@ struct M3HIChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -240,7 +240,7 @@ struct MAP5ChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -251,7 +251,7 @@ struct MAP5ChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -267,7 +267,7 @@ struct MAPEChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); if (IsSavegameVersionBefore(SLV_42)) { @@ -291,7 +291,7 @@ struct MAPEChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); @@ -307,7 +307,7 @@ struct MAP7ChunkHandler : ChunkHandler { void Load() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -318,7 +318,7 @@ struct MAP7ChunkHandler : ChunkHandler { void Save() const override { - std::array buf; + std::array buf; TileIndex size = MapSize(); SlSetLength(size); diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp index 3bd3a679e6..b9a775766c 100644 --- a/src/saveload/misc_sl.cpp +++ b/src/saveload/misc_sl.cpp @@ -29,14 +29,14 @@ extern TileIndex _cur_tileloop_tile; extern TileIndex _aux_tileloop_tile; extern uint16_t _disaster_delay; -extern byte _trees_tick_ctr; +extern uint8_t _trees_tick_ctr; /* Keep track of current game position */ extern int _saved_scrollpos_x; extern int _saved_scrollpos_y; extern ZoomLevel _saved_scrollpos_zoom; -extern byte _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162. +extern uint8_t _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162. extern TimeoutTimer _new_competitor_timeout; namespace upstream_sl { diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 6f5d65a22b..2b5bd2168b 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -49,7 +49,7 @@ StringID RemapOldStringID(StringID s); std::string CopyFromOldName(StringID id); extern uint8_t SlSaveToTempBufferSetup(); -extern std::span SlSaveToTempBufferRestore(uint8_t state); +extern std::span SlSaveToTempBufferRestore(uint8_t state); extern void SlCopyBytesRead(void *ptr, size_t length); extern void SlCopyBytesWrite(void *ptr, size_t length); @@ -74,7 +74,7 @@ enum NeedLength { struct SaveLoadParams { SaveLoadAction action; ///< are we doing a save or a load atm. NeedLength need_length; ///< working in NeedLength (Autolength) mode? - byte block_mode; ///< ??? + uint8_t block_mode; ///< ??? size_t obj_len; ///< the length of the current object we are busy with int array_index, last_array_index; ///< in the case of an array, the current and last positions @@ -252,21 +252,21 @@ static void SlWriteSimpleGamma(size_t i) if (i >= (1 << 21)) { if (i >= (1 << 28)) { assert(i <= UINT32_MAX); // We can only support 32 bits for now. - SlWriteByte((byte)(0xF0)); - SlWriteByte((byte)(i >> 24)); + SlWriteByte((uint8_t)(0xF0)); + SlWriteByte((uint8_t)(i >> 24)); } else { - SlWriteByte((byte)(0xE0 | (i >> 24))); + SlWriteByte((uint8_t)(0xE0 | (i >> 24))); } - SlWriteByte((byte)(i >> 16)); + SlWriteByte((uint8_t)(i >> 16)); } else { - SlWriteByte((byte)(0xC0 | (i >> 16))); + SlWriteByte((uint8_t)(0xC0 | (i >> 16))); } - SlWriteByte((byte)(i >> 8)); + SlWriteByte((uint8_t)(i >> 8)); } else { - SlWriteByte((byte)(0x80 | (i >> 8))); + SlWriteByte((uint8_t)(0x80 | (i >> 8))); } } - SlWriteByte((byte)i); + SlWriteByte((uint8_t)i); } /** Return how many bytes used to encode a gamma value */ @@ -343,7 +343,7 @@ static uint8_t GetSavegameFileType(const SaveLoad &sld) */ static inline uint SlCalcConvMemLen(VarType conv) { - static const byte conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0}; + static const uint8_t conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0}; switch (GetVarMemType(conv)) { case SLE_VAR_STRB: @@ -364,9 +364,9 @@ static inline uint SlCalcConvMemLen(VarType conv) * @param conv VarType type of variable that is used for calculating the size * @return Return the size of this type in bytes */ -static inline byte SlCalcConvFileLen(VarType conv) +static inline uint8_t SlCalcConvFileLen(VarType conv) { - static const byte conv_file_size[] = {0, 1, 1, 2, 2, 4, 4, 8, 8, 2}; + static const uint8_t conv_file_size[] = {0, 1, 1, 2, 2, 4, 4, 8, 8, 2}; switch (GetVarFileType(conv)) { case SLE_FILE_STRING: @@ -534,7 +534,7 @@ int64_t ReadValue(const void *ptr, VarType conv) switch (GetVarMemType(conv)) { case SLE_VAR_BL: return (*(const bool *)ptr != 0); case SLE_VAR_I8: return *(const int8_t *)ptr; - case SLE_VAR_U8: return *(const byte *)ptr; + case SLE_VAR_U8: return *(const uint8_t *)ptr; case SLE_VAR_I16: return *(const int16_t *)ptr; case SLE_VAR_U16: return *(const uint16_t*)ptr; case SLE_VAR_I32: return *(const int32_t *)ptr; @@ -558,7 +558,7 @@ void WriteValue(void *ptr, VarType conv, int64_t val) switch (GetVarMemType(conv)) { case SLE_VAR_BL: *(bool *)ptr = (val != 0); break; case SLE_VAR_I8: *(int8_t *)ptr = val; break; - case SLE_VAR_U8: *(byte *)ptr = val; break; + case SLE_VAR_U8: *(uint8_t *)ptr = val; break; case SLE_VAR_I16: *(int16_t *)ptr = val; break; case SLE_VAR_U16: *(uint16_t*)ptr = val; break; case SLE_VAR_I32: *(int32_t *)ptr = val; break; @@ -606,7 +606,7 @@ static void SlSaveLoadConv(void *ptr, VarType conv) /* Read a value from the file */ switch (GetVarFileType(conv)) { case SLE_FILE_I8: x = (int8_t )SlReadByte(); break; - case SLE_FILE_U8: x = (byte )SlReadByte(); break; + case SLE_FILE_U8: x = (uint8_t )SlReadByte(); break; case SLE_FILE_I16: x = (int16_t )SlReadUint16(); break; case SLE_FILE_U16: x = (uint16_t)SlReadUint16(); break; case SLE_FILE_I32: x = (int32_t )SlReadUint32(); break; @@ -856,8 +856,8 @@ static void SlCopyInternal(void *object, size_t length, VarType conv) if (conv == SLE_INT8 || conv == SLE_UINT8) { SlCopyBytes(object, length); } else { - byte *a = (byte*)object; - byte mem_size = SlCalcConvMemLen(conv); + uint8_t *a = (uint8_t*)object; + uint8_t mem_size = SlCalcConvMemLen(conv); for (; length != 0; length --) { SlSaveLoadConv(a, conv); @@ -902,7 +902,7 @@ static inline size_t SlCalcArrayLen(size_t length, VarType conv) * Save/Load the length of the array followed by the array of SL_VAR elements. * @param array The array being manipulated * @param length The length of the array in elements - * @param conv VarType type of the atomic array (int, byte, uint64_t, etc.) + * @param conv VarType type of the atomic array (int, uint8_t, uint64_t, etc.) */ static void SlArray(void *array, size_t length, VarType conv) { @@ -1837,7 +1837,7 @@ void SlAutolength(AutolengthProc *proc, void *arg) _sl.need_length = NL_NONE; uint8_t state = SlSaveToTempBufferSetup(); proc(arg); - std::span result = SlSaveToTempBufferRestore(state); + std::span result = SlSaveToTempBufferRestore(state); _sl.need_length = NL_WANTLENGTH; SlSetLength(result.size()); SlCopyBytesWrite(result.data(), result.size()); @@ -1868,7 +1868,7 @@ void ChunkHandler::LoadCheck(size_t len) const */ static void SlLoadChunk(const ChunkHandler &ch) { - byte m = SlReadByte(); + uint8_t m = SlReadByte(); size_t len; size_t endoffs; @@ -1918,7 +1918,7 @@ static void SlLoadChunk(const ChunkHandler &ch) */ static void SlLoadCheckChunk(const ChunkHandler &ch) { - byte m = SlReadByte(); + uint8_t m = SlReadByte(); size_t len; size_t endoffs; diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 589051c897..50abc9804f 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -21,7 +21,7 @@ #include extern SaveLoadVersion _sl_version; -extern byte _sl_minor_version; +extern uint8_t _sl_minor_version; extern const SaveLoadVersion SAVEGAME_VERSION; extern const SaveLoadVersion MAX_LOAD_SAVEGAME_VERSION; @@ -265,7 +265,7 @@ enum VarTypes { typedef uint32_t VarType; /** Type of data saved. */ -enum SaveLoadType : byte { +enum SaveLoadType : uint8_t { SL_VAR = 0, ///< Save/load a variable. SL_REF = 1, ///< Save/load a reference. SL_STRUCT = 2, ///< Save/load a struct. @@ -861,7 +861,7 @@ inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t leng * @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked. * @return Savegame version is earlier than the specified version. */ -inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0) +inline bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor = 0) { return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor); } diff --git a/src/saveload/settings_sl.cpp b/src/saveload/settings_sl.cpp index 7941bb7528..af2527e9ac 100644 --- a/src/saveload/settings_sl.cpp +++ b/src/saveload/settings_sl.cpp @@ -145,7 +145,7 @@ static std::vector GetSettingsDesc(bool is_loading) } SaveLoadAddrProc *address_proc = [](void *base, size_t extra) -> void* { - return const_cast((const byte *)base + (ptrdiff_t)extra); + return const_cast((const uint8_t *)base + (ptrdiff_t)extra); }; saveloads.push_back({sd->name, new_cmd, new_type, sd->save.length, SL_MIN_VERSION, SL_MAX_VERSION, sd->save.size, address_proc, reinterpret_cast(sd->save.address), nullptr}); } diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index bdfcde552f..879af2722a 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -53,7 +53,7 @@ struct FlowSaveLoad { typedef std::pair StationCargoPair; static OldPersistentStorage _old_st_persistent_storage; -static byte _old_last_vehicle_type; +static uint8_t _old_last_vehicle_type; /** * Swap the temporary packets with the packets without specific destination in diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 7ccf816c1b..1328403085 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -111,7 +111,7 @@ static_assert(sizeof(BitmapInfoHeader) == 40); /** Format of palette data in BMP header */ struct RgbQuad { - byte blue, green, red, reserved; + uint8_t blue, green, red, reserved; }; static_assert(sizeof(RgbQuad) == 4); @@ -214,7 +214,7 @@ static bool MakeBMPImage(const char *name, ScreenshotCallback *callb, void *user /* Convert from 'native' 32bpp to BMP-like 24bpp. * Works for both big and little endian machines */ Colour *src = ((Colour *)buff) + n * w; - byte *dst = line; + uint8_t *dst = line; for (uint i = 0; i < w; i++) { dst[i * 3 ] = src[i].b; dst[i * 3 + 1] = src[i].g; @@ -432,21 +432,21 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user /** Definition of a PCX file header. */ struct PcxHeader { - byte manufacturer; - byte version; - byte rle; - byte bpp; + uint8_t manufacturer; + uint8_t version; + uint8_t rle; + uint8_t bpp; uint32_t unused; uint16_t xmax, ymax; uint16_t hdpi, vdpi; - byte pal_small[16 * 3]; - byte reserved; - byte planes; + uint8_t pal_small[16 * 3]; + uint8_t reserved; + uint8_t planes; uint16_t pitch; uint16_t cpal; uint16_t width; uint16_t height; - byte filler[54]; + uint8_t filler[54]; }; static_assert(sizeof(PcxHeader) == 128); @@ -521,7 +521,7 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user /* write them to pcx */ for (i = 0; i != n; i++) { const uint8_t *bufp = buff + i * w; - byte runchar = bufp[0]; + uint8_t runchar = bufp[0]; uint runcount = 1; uint j; @@ -573,7 +573,7 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user } /* Palette is word-aligned, copy it to a temporary byte array */ - byte tmp[256 * 3]; + uint8_t tmp[256 * 3]; for (uint i = 0; i < 256; i++) { tmp[i * 3 + 0] = palette[i].r; @@ -866,7 +866,7 @@ static bool MakeLargeWorldScreenshot(ScreenshotType t, uint32_t width = 0, uint3 */ static void HeightmapCallback(void *, void *buffer, uint y, uint, uint n) { - byte *buf = (byte *)buffer; + uint8_t *buf = (uint8_t *)buffer; while (n > 0) { TileIndex ti = TileXY(MapMaxX(), y); for (uint x = MapMaxX(); true; x--) { @@ -1121,7 +1121,7 @@ static Owner GetMinimapOwner(TileIndex tile) * @param tile The tile of which we would like to get the colour. * @return The color palette value */ -static byte GetTopographyValue(TileIndex tile) +static uint8_t GetTopographyValue(TileIndex tile) { const auto tile_type = GetTileType(tile); @@ -1216,7 +1216,7 @@ static byte GetTopographyValue(TileIndex tile) * @param tile The tile of which we would like to get the colour. * @return The color palette value */ -static byte GetIndustryValue(TileIndex tile) +static uint8_t GetIndustryValue(TileIndex tile) { const auto tile_type = GetTileType(tile); @@ -1278,7 +1278,7 @@ void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n uint col = (MapSizeX() - 1) - (i % pitch); TileIndex tile = TileXY(col, row); - byte val = colorCallback(tile); + uint8_t val = colorCallback(tile); uint32_t colour_buf = 0; colour_buf = (_cur_palette.palette[val].b << 0); @@ -1299,7 +1299,7 @@ void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n) { /* Fill with the company colours */ - byte owner_colours[OWNER_END + 1]; + uint8_t owner_colours[OWNER_END + 1]; for (const Company *c : Company::Iterate()) { owner_colours[c->index] = MKCOLOUR(GetColourGradient(c->colour, SHADE_LIGHT)); } @@ -1311,7 +1311,7 @@ static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch, owner_colours[OWNER_DEITY] = PC_DARK_GREY; // industry owner_colours[OWNER_END] = PC_BLACK; - MinimapScreenCallback(userdata, buf, y, pitch, n, [&](TileIndex tile) -> byte { + MinimapScreenCallback(userdata, buf, y, pitch, n, [&](TileIndex tile) -> uint8_t { return owner_colours[GetMinimapOwner(tile)]; }); } diff --git a/src/script/api/script_bridgelist.cpp b/src/script/api/script_bridgelist.cpp index bc78e7bf36..711ba609c3 100644 --- a/src/script/api/script_bridgelist.cpp +++ b/src/script/api/script_bridgelist.cpp @@ -16,14 +16,14 @@ ScriptBridgeList::ScriptBridgeList() { - for (byte j = 0; j < MAX_BRIDGES; j++) { + for (uint8_t j = 0; j < MAX_BRIDGES; j++) { if (ScriptBridge::IsValidBridge(j)) this->AddItem(j); } } ScriptBridgeList_Length::ScriptBridgeList_Length(SQInteger length) { - for (byte j = 0; j < MAX_BRIDGES; j++) { + for (uint8_t j = 0; j < MAX_BRIDGES; j++) { if (ScriptBridge::IsValidBridge(j)) { if (length >= ScriptBridge::GetMinLength(j) && length <= ScriptBridge::GetMaxLength(j)) this->AddItem(j); } diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp index 11ef8a1bf1..6efb7523a6 100644 --- a/src/script/api/script_company.cpp +++ b/src/script/api/script_company.cpp @@ -28,7 +28,7 @@ { if (company == COMPANY_SELF) { if (!::Company::IsValidID(_current_company)) return COMPANY_INVALID; - return (CompanyID)((byte)_current_company); + return (CompanyID)((uint8_t)_current_company); } return ::Company::IsValidID(company) ? company : COMPANY_INVALID; diff --git a/src/script/api/script_company.hpp b/src/script/api/script_company.hpp index 91c7f43cee..8b33fff92d 100644 --- a/src/script/api/script_company.hpp +++ b/src/script/api/script_company.hpp @@ -99,7 +99,7 @@ public: /** * Types of expenses. */ - enum ExpensesType : byte { + enum ExpensesType : uint8_t { EXPENSES_CONSTRUCTION = ::EXPENSES_CONSTRUCTION, ///< Construction costs. EXPENSES_NEW_VEHICLES = ::EXPENSES_NEW_VEHICLES, ///< New vehicles. EXPENSES_TRAIN_RUN = ::EXPENSES_TRAIN_RUN, ///< Running costs trains. diff --git a/src/script/api/script_goal.hpp b/src/script/api/script_goal.hpp index d956d75ba7..acd27e387d 100644 --- a/src/script/api/script_goal.hpp +++ b/src/script/api/script_goal.hpp @@ -36,7 +36,7 @@ public: /** * Goal types that can be given to a goal. */ - enum GoalType : byte { + enum GoalType : uint8_t { /* Note: these values represent part of the in-game GoalType enum */ GT_NONE = ::GT_NONE, ///< Destination is not linked. GT_TILE = ::GT_TILE, ///< Destination is a tile. diff --git a/src/script/api/script_industry.cpp b/src/script/api/script_industry.cpp index 483929c133..eb8d09b007 100644 --- a/src/script/api/script_industry.cpp +++ b/src/script/api/script_industry.cpp @@ -260,7 +260,7 @@ auto company_id = ::Industry::Get(industry_id)->exclusive_supplier; if (!::Company::IsValidID(company_id)) return ScriptCompany::COMPANY_INVALID; - return (ScriptCompany::CompanyID)((byte)company_id); + return (ScriptCompany::CompanyID)((uint8_t)company_id); } /* static */ bool ScriptIndustry::SetExclusiveSupplier(IndustryID industry_id, ScriptCompany::CompanyID company_id) @@ -280,7 +280,7 @@ auto company_id = ::Industry::Get(industry_id)->exclusive_consumer; if (!::Company::IsValidID(company_id)) return ScriptCompany::COMPANY_INVALID; - return (ScriptCompany::CompanyID)((byte)company_id); + return (ScriptCompany::CompanyID)((uint8_t)company_id); } /* static */ bool ScriptIndustry::SetExclusiveConsumer(IndustryID industry_id, ScriptCompany::CompanyID company_id) diff --git a/src/script/api/script_league.hpp b/src/script/api/script_league.hpp index 7da4074a27..d57e5a484a 100644 --- a/src/script/api/script_league.hpp +++ b/src/script/api/script_league.hpp @@ -42,7 +42,7 @@ public: /** * The type of a link. */ - enum LinkType : byte { + enum LinkType : uint8_t { LINK_NONE = ::LT_NONE, ///< No link LINK_TILE = ::LT_TILE, ///< Link a tile LINK_INDUSTRY = ::LT_INDUSTRY, ///< Link an industry diff --git a/src/script/api/script_rail.hpp b/src/script/api/script_rail.hpp index bb10a34728..190bf00f69 100644 --- a/src/script/api/script_rail.hpp +++ b/src/script/api/script_rail.hpp @@ -41,7 +41,7 @@ public: /** * Types of rail known to the game. */ - enum RailType : byte { + enum RailType : uint8_t { /* Note: these values represent part of the in-game static values */ RAILTYPE_INVALID = ::INVALID_RAILTYPE, ///< Invalid RailType. }; diff --git a/src/script/api/script_road.cpp b/src/script/api/script_road.cpp index fe6b8526a2..c7832be46d 100644 --- a/src/script/api/script_road.cpp +++ b/src/script/api/script_road.cpp @@ -284,13 +284,13 @@ static int32_t LookupWithBuildOnSlopes(::Slope slope, const Array<> &existing, i SLOPE_W, SLOPE_EW, SLOPE_SW, SLOPE_WSE, SLOPE_W, SLOPE_SW, SLOPE_EW, SLOPE_WSE, SLOPE_SW, SLOPE_WSE, SLOPE_WSE}; - static const byte base_rotates[] = {0, 0, 1, 0, 2, 0, 1, 0, 3, 3, 2, 3, 2, 2, 1}; + static const uint8_t base_rotates[] = {0, 0, 1, 0, 2, 0, 1, 0, 3, 3, 2, 3, 2, 2, 1}; if (slope >= (::Slope)lengthof(base_slopes)) { /* This slope is an invalid slope, so ignore it. */ return -1; } - byte base_rotate = base_rotates[slope]; + uint8_t base_rotate = base_rotates[slope]; slope = base_slopes[slope]; /* Some slopes don't need rotating, so return early when we know we do diff --git a/src/script/api/script_story_page.hpp b/src/script/api/script_story_page.hpp index 4e16876664..4213f5afe6 100644 --- a/src/script/api/script_story_page.hpp +++ b/src/script/api/script_story_page.hpp @@ -57,7 +57,7 @@ public: /** * Story page element types. */ - enum StoryPageElementType : byte { + enum StoryPageElementType : uint8_t { SPET_TEXT = ::SPET_TEXT, ///< An element that displays a block of text. SPET_LOCATION = ::SPET_LOCATION, ///< An element that displays a single line of text along with a button to view the referenced location. SPET_GOAL = ::SPET_GOAL, ///< An element that displays a goal. @@ -75,7 +75,7 @@ public: * Formatting and layout flags for story page buttons. * The SPBF_FLOAT_LEFT and SPBF_FLOAT_RIGHT flags can not be combined. */ - enum StoryPageButtonFlags : byte { + enum StoryPageButtonFlags : uint8_t { SPBF_NONE = ::SPBF_NONE, ///< No special formatting for button. SPBF_FLOAT_LEFT = ::SPBF_FLOAT_LEFT, ///< Button is placed to the left of the following paragraph. SPBF_FLOAT_RIGHT = ::SPBF_FLOAT_RIGHT, ///< Button is placed to the right of the following paragraph. @@ -84,7 +84,7 @@ public: /** * Mouse cursors usable by story page buttons. */ - enum StoryPageButtonCursor : byte { + enum StoryPageButtonCursor : uint8_t { SPBC_MOUSE = ::SPBC_MOUSE, SPBC_ZZZ = ::SPBC_ZZZ, SPBC_BUOY = ::SPBC_BUOY, @@ -146,7 +146,7 @@ public: * Colour codes usable for story page button elements. * Place a colour value in the lowest 8 bits of the \c reference parameter to the button. */ - enum StoryPageButtonColour : byte { + enum StoryPageButtonColour : uint8_t { SPBC_DARK_BLUE = ::COLOUR_DARK_BLUE, SPBC_PALE_GREEN = ::COLOUR_PALE_GREEN, SPBC_PINK = ::COLOUR_PINK, diff --git a/src/script/api/script_subsidy.cpp b/src/script/api/script_subsidy.cpp index 1ab0c0e7b9..667e4cdfe8 100644 --- a/src/script/api/script_subsidy.cpp +++ b/src/script/api/script_subsidy.cpp @@ -46,7 +46,7 @@ { if (!IsAwarded(subsidy_id)) return ScriptCompany::COMPANY_INVALID; - return (ScriptCompany::CompanyID)((byte)::Subsidy::Get(subsidy_id)->awarded); + return (ScriptCompany::CompanyID)((uint8_t)::Subsidy::Get(subsidy_id)->awarded); } /* static */ ScriptDate::Date ScriptSubsidy::GetExpireDate(SubsidyID subsidy_id) diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp index a62d7afbb7..79ec13f386 100644 --- a/src/script/api/script_tile.cpp +++ b/src/script/api/script_tile.cpp @@ -206,7 +206,7 @@ if (::IsTileType(tile, MP_HOUSE)) return ScriptCompany::COMPANY_INVALID; if (::IsTileType(tile, MP_INDUSTRY)) return ScriptCompany::COMPANY_INVALID; - return ScriptCompany::ResolveCompanyID((ScriptCompany::CompanyID)(byte)::GetTileOwner(tile)); + return ScriptCompany::ResolveCompanyID((ScriptCompany::CompanyID)(uint8_t)::GetTileOwner(tile)); } /* static */ bool ScriptTile::HasTransportType(TileIndex tile, TransportType transport_type) diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp index d314753e9d..48953b42e4 100644 --- a/src/script/api/script_town.cpp +++ b/src/script/api/script_town.cpp @@ -296,7 +296,7 @@ EnforcePrecondition(false, layout >= ROAD_LAYOUT_ORIGINAL && layout <= ROAD_LAYOUT_RANDOM); } else { /* The layout parameter is ignored for AIs when custom layouts is disabled. */ - layout = (RoadLayout) (byte)_settings_game.economy.town_layout; + layout = (RoadLayout) (uint8_t)_settings_game.economy.town_layout; } std::string text; diff --git a/src/script/api/script_types.hpp b/src/script/api/script_types.hpp index 86e13b7cb8..c1ded3c643 100644 --- a/src/script/api/script_types.hpp +++ b/src/script/api/script_types.hpp @@ -86,7 +86,7 @@ /* Define all types here, so we don't have to include the whole _type.h maze */ typedef uint BridgeType; ///< Internal name, not of any use for you. -typedef byte CargoID; ///< The ID of a cargo. +typedef uint8_t CargoID; ///< The ID of a cargo. class CommandCost; ///< The cost of a command. typedef uint16_t EngineID; ///< The ID of an engine. typedef uint16_t GoalID; ///< The ID of a goal. diff --git a/src/script/api/script_vehicle.cpp b/src/script/api/script_vehicle.cpp index 49395be173..84d8a7d4f5 100644 --- a/src/script/api/script_vehicle.cpp +++ b/src/script/api/script_vehicle.cpp @@ -352,7 +352,7 @@ if (!IsValidVehicle(vehicle_id)) return ScriptVehicle::VS_INVALID; const Vehicle *v = ::Vehicle::Get(vehicle_id); - byte vehstatus = v->vehstatus; + uint8_t vehstatus = v->vehstatus; if (vehstatus & ::VS_CRASHED) return ScriptVehicle::VS_CRASHED; if (v->breakdown_ctr != 0) return ScriptVehicle::VS_BROKEN; diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp index 5f4d206b48..a3d94b36a7 100644 --- a/src/script/script_instance.cpp +++ b/src/script/script_instance.cpp @@ -408,7 +408,7 @@ ScriptLogTypes::LogData &ScriptInstance::GetLogData() ScriptLog::Error("Maximum string length is 254 chars. No data saved."); return false; } - SlWriteByte((byte)len); + SlWriteByte((uint8_t)len); SlArray(const_cast(buf), len, SLE_CHAR); return true; } @@ -561,7 +561,7 @@ bool ScriptInstance::IsPaused() /* static */ bool ScriptInstance::LoadObjects(ScriptData *data) { - byte type = SlReadByte(); + uint8_t type = SlReadByte(); switch (type) { case SQSL_INT: { int64_t value; @@ -571,7 +571,7 @@ bool ScriptInstance::IsPaused() } case SQSL_STRING: { - byte len = SlReadByte(); + uint8_t len = SlReadByte(); static char buf[std::numeric_limits::max()]; SlArray(buf, len, SLE_CHAR); if (data != nullptr) data->push_back(StrMakeValid(std::string_view(buf, len))); @@ -586,7 +586,7 @@ bool ScriptInstance::IsPaused() } case SQSL_BOOL: { - byte sl_byte = SlReadByte(); + uint8_t sl_byte = SlReadByte(); if (data != nullptr) data->push_back((SQBool)(sl_byte != 0)); return true; } @@ -660,7 +660,7 @@ bool ScriptInstance::IsPaused() /* static */ void ScriptInstance::LoadEmpty() { - byte sl_byte = SlReadByte(); + uint8_t sl_byte = SlReadByte(); /* Check if there was anything saved at all. */ if (sl_byte == 0) return; @@ -674,7 +674,7 @@ bool ScriptInstance::IsPaused() return nullptr; } - byte sl_byte = SlReadByte(); + uint8_t sl_byte = SlReadByte(); /* Check if there was anything saved at all. */ if (sl_byte == 0) return nullptr; diff --git a/src/settings.cpp b/src/settings.cpp index fc5b286317..e8918be58b 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -367,7 +367,7 @@ static bool LoadIntList(const char *str, void *array, int nelems, VarType type) case SLE_VAR_BL: case SLE_VAR_I8: case SLE_VAR_U8: - for (i = 0; i != nitems; i++) ((byte*)array)[i] = items[i]; + for (i = 0; i != nitems; i++) ((uint8_t*)array)[i] = items[i]; break; case SLE_VAR_I16: @@ -398,7 +398,7 @@ static bool LoadIntList(const char *str, void *array, int nelems, VarType type) */ char *ListSettingDesc::FormatValue(char *buf, const char *last, const void *object) const { - const byte *p = static_cast(GetVariableAddress(object, this->save)); + const uint8_t *p = static_cast(GetVariableAddress(object, this->save)); int i, v = 0; for (i = 0; i != this->save.length; i++) { diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 2e7422f54b..faf1fc35bc 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -849,7 +849,7 @@ struct GameOptionsWindow : Window { case WID_GO_BASE_SFX_VOLUME: case WID_GO_BASE_MUSIC_VOLUME: { - byte &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; + uint8_t &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; if (ClickSliderWidget(this->GetWidget(widget)->GetCurrentRect(), pt, 0, INT8_MAX, vol)) { if (widget == WID_GO_BASE_MUSIC_VOLUME) { MusicDriver::GetInstance()->SetVolume(vol); @@ -1292,13 +1292,13 @@ struct SettingFilter { /** Data structure describing a single setting in a tab */ struct BaseSettingEntry { - byte flags; ///< Flags of the setting entry. @see SettingEntryFlags - byte level; ///< Nesting level of this setting entry + uint8_t flags; ///< Flags of the setting entry. @see SettingEntryFlags + uint8_t level; ///< Nesting level of this setting entry BaseSettingEntry() : flags(0), level(0) {} virtual ~BaseSettingEntry() = default; - virtual void Init(byte level = 0); + virtual void Init(uint8_t level = 0); virtual void FoldAll() {} virtual void UnFoldAll() {} virtual void ResetAll() = 0; @@ -1336,13 +1336,13 @@ struct SettingEntry : BaseSettingEntry { SettingEntry(const char *name); - void Init(byte level = 0) override; + void Init(uint8_t level = 0) override; void ResetAll() override; uint Length() const override; uint GetMaxHelpHeight(int maxw) override; bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; - void SetButtons(byte new_val); + void SetButtons(uint8_t new_val); bool IsGUIEditable() const; protected: @@ -1359,7 +1359,7 @@ struct CargoDestPerCargoSettingEntry : SettingEntry { CargoID cargo; CargoDestPerCargoSettingEntry(CargoID cargo, const IntSettingDesc *setting); - void Init(byte level = 0) override; + void Init(uint8_t level = 0) override; bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; protected: @@ -1388,7 +1388,7 @@ struct SettingsContainer { return item; } - void Init(byte level = 0); + void Init(uint8_t level = 0); void ResetAll(); void FoldAll(); void UnFoldAll(); @@ -1412,7 +1412,7 @@ struct SettingsPage : BaseSettingEntry, SettingsContainer { SettingsPage(StringID title); - void Init(byte level = 0) override; + void Init(uint8_t level = 0) override; void ResetAll() override; void FoldAll() override; void UnFoldAll() override; @@ -1437,7 +1437,7 @@ protected: * Initialization of a setting entry * @param level Page nesting level of this entry */ -void BaseSettingEntry::Init(byte level) +void BaseSettingEntry::Init(uint8_t level) { this->level = level; } @@ -1553,7 +1553,7 @@ SettingEntry::SettingEntry(const IntSettingDesc *setting) * Initialization of a setting entry * @param level Page nesting level of this entry */ -void SettingEntry::Init(byte level) +void SettingEntry::Init(uint8_t level) { BaseSettingEntry::Init(level); const SettingDesc *st = GetSettingFromName(this->name); @@ -1572,7 +1572,7 @@ void SettingEntry::ResetAll() * @param new_val New value for the button flags * @see SettingEntryFlags */ -void SettingEntry::SetButtons(byte new_val) +void SettingEntry::SetButtons(uint8_t new_val) { assert((new_val & ~SEF_BUTTONS_MASK) == 0); // Should not touch any flags outside the buttons this->flags = (this->flags & ~SEF_BUTTONS_MASK) | new_val; @@ -1768,7 +1768,7 @@ void SettingEntry::DrawSettingString(uint left, uint right, int y, bool highligh CargoDestPerCargoSettingEntry::CargoDestPerCargoSettingEntry(CargoID cargo, const IntSettingDesc *setting) : SettingEntry(setting), cargo(cargo) {} -void CargoDestPerCargoSettingEntry::Init(byte level) +void CargoDestPerCargoSettingEntry::Init(uint8_t level) { BaseSettingEntry::Init(level); } @@ -1808,7 +1808,7 @@ bool ConditionallyHiddenSettingEntry::UpdateFilterState(SettingFilter &filter, b * Initialization of an entire setting page * @param level Nesting level of this page (internal variable, do not provide a value for it when calling) */ -void SettingsContainer::Init(byte level) +void SettingsContainer::Init(uint8_t level) { for (auto &it : this->entries) { it->Init(level); @@ -1965,7 +1965,7 @@ SettingsPage::SettingsPage(StringID title) * Initialization of an entire setting page * @param level Nesting level of this page (internal variable, do not provide a value for it when calling) */ -void SettingsPage::Init(byte level) +void SettingsPage::Init(uint8_t level) { BaseSettingEntry::Init(level); SettingsContainer::Init(level + 1); @@ -3447,7 +3447,7 @@ void ShowGameSettings() * @param clickable_left is the left button clickable? * @param clickable_right is the right button clickable? */ -void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right) +void DrawArrowButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right) { int colour = GetColourGradient(button_colour, SHADE_DARKER); Dimension dim = NWidgetScrollbar::GetHorizontalDimension(); diff --git a/src/settings_gui.h b/src/settings_gui.h index 335dd65285..b0ad28862f 100644 --- a/src/settings_gui.h +++ b/src/settings_gui.h @@ -18,7 +18,7 @@ /** Height of setting buttons */ #define SETTING_BUTTON_HEIGHT ((int)NWidgetScrollbar::GetHorizontalDimension().height) -void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right); +void DrawArrowButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right); void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable); void DrawBoolButton(int x, int y, bool state, bool clickable); diff --git a/src/settings_type.h b/src/settings_type.h index 046b6aef0e..48a4daaf6b 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -368,11 +368,11 @@ struct SoundSettings { /** Settings related to music. */ struct MusicSettings { - byte playlist; ///< The playlist (number) to play - byte music_vol; ///< The requested music volume - byte effect_vol; ///< The requested effects volume - byte custom_1[33]; ///< The order of the first custom playlist - byte custom_2[33]; ///< The order of the second custom playlist + uint8_t playlist; ///< The playlist (number) to play + uint8_t music_vol; ///< The requested music volume + uint8_t effect_vol; ///< The requested effects volume + uint8_t custom_1[33]; ///< The order of the first custom playlist + uint8_t custom_2[33]; ///< The order of the second custom playlist bool playing; ///< Whether music is playing bool shuffle; ///< Whether to shuffle the music }; diff --git a/src/ship.h b/src/ship.h index 8e425c275e..f2b190c88a 100644 --- a/src/ship.h +++ b/src/ship.h @@ -32,13 +32,13 @@ static_assert((SHIP_PATH_CACHE_LENGTH & SHIP_PATH_CACHE_MASK) == 0, ""); // Must * All ships have this type. */ struct Ship final : public SpecializedVehicle { - TrackBits state; ///< The "track" the ship is following. - ShipPathCache cached_path; ///< Cached path. - Direction rotation; ///< Visible direction. - int16_t rotation_x_pos; ///< NOSAVE: X Position before rotation. - int16_t rotation_y_pos; ///< NOSAVE: Y Position before rotation. - uint8_t lost_count; ///< Count of number of failed pathfinder attempts - byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service + TrackBits state; ///< The "track" the ship is following. + ShipPathCache cached_path; ///< Cached path. + Direction rotation; ///< Visible direction. + int16_t rotation_x_pos; ///< NOSAVE: X Position before rotation. + int16_t rotation_y_pos; ///< NOSAVE: Y Position before rotation. + uint8_t lost_count; ///< Count of number of failed pathfinder attempts + uint8_t critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ Ship() : SpecializedVehicleBase() {} diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index a6c465d82d..3fedf2894e 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -553,8 +553,8 @@ static uint ShipAccelerate(Vehicle *v) const uint advance_speed = v->GetAdvanceSpeed(speed); const uint number_of_steps = (advance_speed + v->progress) / v->GetAdvanceDistance(); const uint remainder = (advance_speed + v->progress) % v->GetAdvanceDistance(); - dbg_assert(remainder <= std::numeric_limits::max()); - v->progress = static_cast(remainder); + dbg_assert(remainder <= std::numeric_limits::max()); + v->progress = static_cast(remainder); return number_of_steps; } @@ -647,8 +647,8 @@ static inline TrackBits GetAvailShipTracks(TileIndex tile, DiagDirection dir) /** Structure for ship sub-coordinate data for moving into a new tile via a Diagdir onto a Track. */ struct ShipSubcoordData { - byte x_subcoord; ///< New X sub-coordinate on the new tile - byte y_subcoord; ///< New Y sub-coordinate on the new tile + uint8_t x_subcoord; ///< New X sub-coordinate on the new tile + uint8_t y_subcoord; ///< New Y sub-coordinate on the new tile Direction dir; ///< New Direction to move in on the new track }; /** Ship sub-coordinate data for moving into a new tile via a Diagdir onto a Track. diff --git a/src/signal_func.h b/src/signal_func.h index 91741c0189..80003cdb86 100644 --- a/src/signal_func.h +++ b/src/signal_func.h @@ -44,9 +44,9 @@ extern bool _signal_sprite_oversized; * Maps a trackdir to the bit that stores its status in the map arrays, in the * direction along with the trackdir. */ -inline byte SignalAlongTrackdir(Trackdir trackdir) +inline uint8_t SignalAlongTrackdir(Trackdir trackdir) { - extern const byte _signal_along_trackdir[TRACKDIR_END]; + extern const uint8_t _signal_along_trackdir[TRACKDIR_END]; return _signal_along_trackdir[trackdir]; } @@ -54,9 +54,9 @@ inline byte SignalAlongTrackdir(Trackdir trackdir) * Maps a trackdir to the bit that stores its status in the map arrays, in the * direction against the trackdir. */ -inline byte SignalAgainstTrackdir(Trackdir trackdir) +inline uint8_t SignalAgainstTrackdir(Trackdir trackdir) { - extern const byte _signal_against_trackdir[TRACKDIR_END]; + extern const uint8_t _signal_against_trackdir[TRACKDIR_END]; return _signal_against_trackdir[trackdir]; } @@ -64,9 +64,9 @@ inline byte SignalAgainstTrackdir(Trackdir trackdir) * Maps a Track to the bits that store the status of the two signals that can * be present on the given track. */ -inline byte SignalOnTrack(Track track) +inline uint8_t SignalOnTrack(Track track) { - extern const byte _signal_on_track[TRACK_END]; + extern const uint8_t _signal_on_track[TRACK_END]; return _signal_on_track[track]; } diff --git a/src/signal_type.h b/src/signal_type.h index d55bc710fa..0fbffa59a9 100644 --- a/src/signal_type.h +++ b/src/signal_type.h @@ -16,14 +16,14 @@ #include "zoom_type.h" /** Variant of the signal, i.e. how does the signal look? */ -enum SignalVariant { +enum SignalVariant : uint8_t { SIG_ELECTRIC = 0, ///< Light signal SIG_SEMAPHORE = 1, ///< Old-fashioned semaphore signal }; /** Type of signal, i.e. how does the signal behave? */ -enum SignalType : byte { +enum SignalType : uint8_t { SIGTYPE_BLOCK = 0, ///< block signal SIGTYPE_ENTRY = 1, ///< presignal block entry SIGTYPE_EXIT = 2, ///< presignal block exit @@ -38,7 +38,7 @@ enum SignalType : byte { SIGTYPE_FIRST_PBS_SPRITE = SIGTYPE_PBS, }; /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Reference to a signal * diff --git a/src/sl/company_sl.cpp b/src/sl/company_sl.cpp index 61c42578ab..2de43fd73a 100644 --- a/src/sl/company_sl.cpp +++ b/src/sl/company_sl.cpp @@ -653,7 +653,7 @@ static void Save_PLYP() return; } - std::vector buffer = SlSaveToVector([]() { + std::vector buffer = SlSaveToVector([]() { SlWriteUint32((uint32_t)_network_company_server_id.size()); MemoryDumper::GetCurrent()->CopyBytes((const uint8_t *)_network_company_server_id.data(), _network_company_server_id.size()); diff --git a/src/sl/debug_sl.cpp b/src/sl/debug_sl.cpp index 6bfb1fe77b..7a474d34c8 100644 --- a/src/sl/debug_sl.cpp +++ b/src/sl/debug_sl.cpp @@ -22,7 +22,7 @@ static void Save_DBGL() if (_savegame_DBGL_data != nullptr) { size_t length = strlen(_savegame_DBGL_data); SlSetLength(length); - MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(_savegame_DBGL_data), length); + MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(_savegame_DBGL_data), length); } else { SlSetLength(0); } @@ -33,7 +33,7 @@ static void Load_DBGL() size_t length = SlGetFieldLength(); if (length) { _loadgame_DBGL_data.resize(length); - ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_loadgame_DBGL_data.data()), length); + ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_loadgame_DBGL_data.data()), length); } } @@ -46,7 +46,7 @@ static void Check_DBGL() size_t length = SlGetFieldLength(); if (length) { _load_check_data.debug_log_data.resize(length); - ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_load_check_data.debug_log_data.data()), length); + ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_load_check_data.debug_log_data.data()), length); } } @@ -57,9 +57,9 @@ static void Save_DBGC() const char footer[] = "*** openttd.cfg end ***\n"; if (_save_DBGC_data) { SlSetLength(lengthof(header) + _config_file_text.size() + lengthof(footer) - 2); - MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(header), lengthof(header) - 1); - MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(_config_file_text.data()), _config_file_text.size()); - MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(footer), lengthof(footer) - 1); + MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(header), lengthof(header) - 1); + MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(_config_file_text.data()), _config_file_text.size()); + MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(footer), lengthof(footer) - 1); } else { SlSetLength(0); } @@ -70,7 +70,7 @@ static void Load_DBGC() size_t length = SlGetFieldLength(); if (length) { _loadgame_DBGC_data.resize(length); - ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_loadgame_DBGC_data.data()), length); + ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_loadgame_DBGC_data.data()), length); } } @@ -83,7 +83,7 @@ static void Check_DBGC() size_t length = SlGetFieldLength(); if (length) { _load_check_data.debug_config_data.resize(length); - ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_load_check_data.debug_config_data.data()), length); + ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_load_check_data.debug_config_data.data()), length); } } diff --git a/src/sl/extended_ver_sl.cpp b/src/sl/extended_ver_sl.cpp index 708a0b7165..d026ce9d42 100644 --- a/src/sl/extended_ver_sl.cpp +++ b/src/sl/extended_ver_sl.cpp @@ -730,14 +730,14 @@ static void IgnoreWrongLengthExtraData(const SlxiSubChunkInfo *info, uint32_t le static void loadVL(const SlxiSubChunkInfo *info, uint32_t length) { _sl_xv_version_label.resize(length); - ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_sl_xv_version_label.data()), length); + ReadBuffer::GetCurrent()->CopyBytes(reinterpret_cast(_sl_xv_version_label.data()), length); DEBUG(sl, 2, "SLXI version label: %s", _sl_xv_version_label.c_str()); } static uint32_t saveVL(const SlxiSubChunkInfo *info, bool dry_run) { const size_t length = strlen(_openttd_revision); - if (!dry_run) MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(_openttd_revision), length); + if (!dry_run) MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast(_openttd_revision), length); return static_cast(length); } diff --git a/src/sl/gamelog_sl.cpp b/src/sl/gamelog_sl.cpp index 3de083efea..ecc1afd937 100644 --- a/src/sl/gamelog_sl.cpp +++ b/src/sl/gamelog_sl.cpp @@ -101,7 +101,7 @@ static void Load_GLOG_common(std::vector &gamelog_actions) { assert(gamelog_actions.empty()); - byte type; + uint8_t type; while ((type = SlReadByte()) != GLAT_NONE) { if (type >= GLAT_END) SlErrorCorrupt("Invalid gamelog action type"); GamelogActionType at = (GamelogActionType)type; diff --git a/src/sl/map_sl.cpp b/src/sl/map_sl.cpp index 7becc596eb..c0c9cf28c0 100644 --- a/src/sl/map_sl.cpp +++ b/src/sl/map_sl.cpp @@ -58,7 +58,7 @@ static const uint MAP_SL_BUF_SIZE = 4096; static void Load_MAPT() { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -99,7 +99,7 @@ static void Load_MAPH() return; } - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -110,7 +110,7 @@ static void Load_MAPH() static void Load_MAP1() { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -135,7 +135,7 @@ static void Load_MAP2() static void Load_MAP3() { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -146,7 +146,7 @@ static void Load_MAP3() static void Load_MAP4() { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -157,7 +157,7 @@ static void Load_MAP4() static void Load_MAP5() { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -168,7 +168,7 @@ static void Load_MAP5() static void Load_MAP6() { - std::array buf; + std::array buf; TileIndex size = MapSize(); if (IsSavegameVersionBefore(SLV_42)) { @@ -192,7 +192,7 @@ static void Load_MAP6() static void Load_MAP7() { - std::array buf; + std::array buf; TileIndex size = MapSize(); for (TileIndex i = 0; i != size;) { @@ -222,7 +222,7 @@ static void Load_WMAP() const TileIndex size = MapSize(); #if TTD_ENDIAN == TTD_LITTLE_ENDIAN - reader->CopyBytes((byte *) _m, size * 8); + reader->CopyBytes((uint8_t *) _m, size * 8); #else for (TileIndex i = 0; i != size; i++) { reader->CheckBytes(8); @@ -246,7 +246,7 @@ static void Load_WMAP() } } else if (_sl_xv_feature_versions[XSLFI_WHOLE_MAP_CHUNK] == 2) { #if TTD_ENDIAN == TTD_LITTLE_ENDIAN - reader->CopyBytes((byte *) _me, size * 4); + reader->CopyBytes((uint8_t *) _me, size * 4); #else for (TileIndex i = 0; i != size; i++) { reader->CheckBytes(4); @@ -273,8 +273,8 @@ static void Save_WMAP() SlSetLength(size * 12); #if TTD_ENDIAN == TTD_LITTLE_ENDIAN - dumper->CopyBytes((byte *) _m, size * 8); - dumper->CopyBytes((byte *) _me, size * 4); + dumper->CopyBytes((uint8_t *) _m, size * 8); + dumper->CopyBytes((uint8_t *) _me, size * 4); #else for (TileIndex i = 0; i != size; i++) { dumper->CheckBytes(8); diff --git a/src/sl/misc_sl.cpp b/src/sl/misc_sl.cpp index 484de97bbf..44cd01f2f6 100644 --- a/src/sl/misc_sl.cpp +++ b/src/sl/misc_sl.cpp @@ -30,7 +30,7 @@ extern TileIndex _cur_tileloop_tile; extern TileIndex _aux_tileloop_tile; extern uint16_t _disaster_delay; -extern byte _trees_tick_ctr; +extern uint8_t _trees_tick_ctr; extern uint64_t _aspect_cfg_hash; /* Keep track of current game position */ @@ -79,7 +79,7 @@ void ResetViewportAfterLoadGame() MarkWholeScreenDirty(); } -byte _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162. +uint8_t _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162. extern TimeoutTimer _new_competitor_timeout; static const NamedSaveLoad _date_desc[] = { diff --git a/src/sl/oldloader.cpp b/src/sl/oldloader.cpp index 0a64735f0e..f17fcd7b09 100644 --- a/src/sl/oldloader.cpp +++ b/src/sl/oldloader.cpp @@ -33,10 +33,10 @@ static inline OldChunkType GetOldChunkType(OldChunkType type) {return (OldCh static inline OldChunkType GetOldChunkVarType(OldChunkType type) {return (OldChunkType)(GB(type, 8, 8) << 8);} static inline OldChunkType GetOldChunkFileType(OldChunkType type) {return (OldChunkType)(GB(type, 16, 8) << 16);} -static inline byte CalcOldVarLen(OldChunkType type) +static inline uint8_t CalcOldVarLen(OldChunkType type) { - static const byte type_mem_size[] = {0, 1, 1, 2, 2, 4, 4, 8}; - byte length = GB(type, 8, 8); + static const uint8_t type_mem_size[] = {0, 1, 1, 2, 2, 4, 4, 8}; + uint8_t length = GB(type, 8, 8); assert(length != 0 && length < lengthof(type_mem_size)); return type_mem_size[length]; } @@ -46,7 +46,7 @@ static inline byte CalcOldVarLen(OldChunkType type) * Reads a byte from a file (do not call yourself, use ReadByte()) * */ -static byte ReadByteFromFile(LoadgameState *ls) +static uint8_t ReadByteFromFile(LoadgameState *ls) { /* To avoid slow reads, we read BUFFER_SIZE of bytes per time and just return a byte per time */ @@ -73,7 +73,7 @@ static byte ReadByteFromFile(LoadgameState *ls) * Reads a byte from the buffer and decompress if needed * */ -byte ReadByte(LoadgameState *ls) +uint8_t ReadByte(LoadgameState *ls) { /* Old savegames have a nice compression algorithm (RLE) which means that we have a chunk, which starts with a length @@ -109,7 +109,7 @@ byte ReadByte(LoadgameState *ls) */ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks) { - byte *base_ptr = (byte*)base; + uint8_t *base_ptr = (uint8_t*)base; for (const OldChunks *chunk = chunks; chunk->type != OC_END; chunk++) { if (((chunk->type & OC_TTD) && _savegame_type == SGT_TTO) || @@ -118,8 +118,8 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks) continue; } - byte *ptr = (byte*)chunk->ptr; - if (chunk->type & OC_DEREFERENCE_POINTER) ptr = *(byte**)ptr; + uint8_t *ptr = (uint8_t*)chunk->ptr; + if (chunk->type & OC_DEREFERENCE_POINTER) ptr = *(uint8_t**)ptr; for (uint i = 0; i < chunk->amount; i++) { /* Handle simple types */ diff --git a/src/sl/oldloader.h b/src/sl/oldloader.h index 62e08d7dad..7e3cbf323b 100644 --- a/src/sl/oldloader.h +++ b/src/sl/oldloader.h @@ -22,11 +22,11 @@ struct LoadgameState { uint chunk_size; bool decoding; - byte decode_char; + uint8_t decode_char; uint buffer_count; uint buffer_cur; - byte buffer[BUFFER_SIZE]; + uint8_t buffer[BUFFER_SIZE]; uint total_read; }; @@ -96,7 +96,7 @@ struct OldChunks { static_assert(sizeof(TileIndex) == 4); extern uint _bump_assert_value; -byte ReadByte(LoadgameState *ls); +uint8_t ReadByte(LoadgameState *ls); bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks); bool LoadTTDMain(LoadgameState *ls); @@ -104,7 +104,7 @@ bool LoadTTOMain(LoadgameState *ls); inline uint16_t ReadUint16(LoadgameState *ls) { - byte x = ReadByte(ls); + uint8_t x = ReadByte(ls); return x | ReadByte(ls) << 8; } diff --git a/src/sl/oldloader_sl.cpp b/src/sl/oldloader_sl.cpp index 2169a90224..b8b0fecc5b 100644 --- a/src/sl/oldloader_sl.cpp +++ b/src/sl/oldloader_sl.cpp @@ -42,7 +42,7 @@ static bool _read_ttdpatch_flags; ///< Have we (tried to) read TTDPatch extra flags? static uint16_t _old_extra_chunk_nums; ///< Number of extra TTDPatch chunks -static byte _old_vehicle_multiplier; ///< TTDPatch vehicle multiplier +static uint8_t _old_vehicle_multiplier; ///< TTDPatch vehicle multiplier void FixOldMapArray() { @@ -112,7 +112,7 @@ static void FixTTDDepots() #define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z) -static uint32_t RemapOldTownName(uint32_t townnameparts, byte old_town_name_type) +static uint32_t RemapOldTownName(uint32_t townnameparts, uint8_t old_town_name_type) { switch (old_town_name_type) { case 0: case 3: // English, American @@ -304,7 +304,7 @@ static bool FixTTOMapArray() case MP_TUNNELBRIDGE: if (HasBit(_m[t].m5, 7)) { // bridge - byte m5 = _m[t].m5; + uint8_t m5 = _m[t].m5; _m[t].m5 = m5 & 0xE1; // copy bits 7..5, 1 if (GB(m5, 1, 2) == 1) _m[t].m5 |= 0x02; // road bridge if (GB(m5, 1, 2) == 3) _m[t].m2 |= 0xA0; // monorail bridge -> tubular, steel bridge @@ -1284,7 +1284,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num) switch (v->type) { case VEH_TRAIN: { - static const byte spriteset_rail[] = { + static const uint8_t spriteset_rail[] = { 0, 2, 4, 4, 8, 10, 12, 14, 16, 18, 20, 22, 40, 42, 44, 46, 48, 52, 54, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140 @@ -1511,7 +1511,7 @@ static bool LoadOldMapPart1(LoadgameState *ls, int) _m[i].m4 = ReadByte(ls); } for (uint i = 0; i < OLD_MAP_SIZE / 4; i++) { - byte b = ReadByte(ls); + uint8_t b = ReadByte(ls); _me[i * 4 + 0].m6 = GB(b, 0, 2); _me[i * 4 + 1].m6 = GB(b, 2, 2); _me[i * 4 + 2].m6 = GB(b, 4, 2); @@ -1594,8 +1594,8 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int) extern TileIndex _cur_tileloop_tile; extern uint16_t _disaster_delay; -extern byte _trees_tick_ctr; -extern byte _age_cargo_skip_counter; // From misc_sl.cpp +extern uint8_t _trees_tick_ctr; +extern uint8_t _age_cargo_skip_counter; // From misc_sl.cpp extern uint8_t _old_diff_level; extern uint8_t _old_units; static const OldChunks main_chunk[] = { @@ -1816,7 +1816,7 @@ bool LoadTTOMain(LoadgameState *ls) _read_ttdpatch_flags = false; - std::array engines; // we don't want to call Engine constructor here + std::array engines; // we don't want to call Engine constructor here _old_engines = (Engine *)engines.data(); std::array vehnames; _old_vehicle_names = vehnames.data(); diff --git a/src/sl/saveload.cpp b/src/sl/saveload.cpp index 563bcf632f..890c872c41 100644 --- a/src/sl/saveload.cpp +++ b/src/sl/saveload.cpp @@ -86,7 +86,7 @@ FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop. uint32_t _ttdp_version; ///< version of TTDP savegame (if applicable) SaveLoadVersion _sl_version; ///< the major savegame version identifier -byte _sl_minor_version; ///< the minor savegame version, DO NOT USE! +uint8_t _sl_minor_version; ///< the minor savegame version, DO NOT USE! std::string _savegame_format; ///< how to compress savegames bool _do_autosave; ///< are we doing an autosave at the moment? @@ -169,14 +169,14 @@ void MemoryDumper::AllocateBuffer() if (this->saved_buf) { const size_t offset = this->buf - this->autolen_buf; const size_t size = (this->autolen_buf_end - this->autolen_buf) * 2; - this->autolen_buf = ReallocT(this->autolen_buf, size); + this->autolen_buf = ReallocT(this->autolen_buf, size); this->autolen_buf_end = this->autolen_buf + size; this->buf = this->autolen_buf + offset; this->bufe = this->autolen_buf_end; return; } this->FinaliseBlock(); - this->buf = MallocT(MEMORY_CHUNK_SIZE); + this->buf = MallocT(MEMORY_CHUNK_SIZE); this->blocks.emplace_back(this->buf); this->bufe = this->buf + MEMORY_CHUNK_SIZE; } @@ -209,7 +209,7 @@ void MemoryDumper::StartAutoLength() this->bufe = this->autolen_buf_end; } -std::span MemoryDumper::StopAutoLength() +std::span MemoryDumper::StopAutoLength() { assert(this->saved_buf != nullptr); auto res = std::span(this->autolen_buf, this->buf - this->autolen_buf); @@ -238,7 +238,7 @@ enum SaveLoadBlockFlags { struct SaveLoadParams { SaveLoadAction action; ///< are we doing a save or a load atm. NeedLength need_length; ///< working in NeedLength (Autolength) mode? - byte block_mode; ///< ??? + uint8_t block_mode; ///< ??? uint8_t block_flags; ///< block flags: SaveLoadBlockFlags bool error; ///< did an error occur or not @@ -248,7 +248,7 @@ struct SaveLoadParams { uint32_t current_chunk_id; ///< Current chunk ID - btree::btree_map chunk_block_modes; ///< Chunk block modes + btree::btree_map chunk_block_modes; ///< Chunk block modes std::unique_ptr dumper;///< Memory dumper to write the savegame to. std::shared_ptr sf; ///< Filter to write the savegame to. @@ -580,10 +580,10 @@ void ProcessAsyncSaveFinish() } /** - * Wrapper for reading a byte from the buffer. - * @return The read byte. + * Wrapper for reading a uint8_t from the buffer. + * @return The read uint8_t. */ -byte SlReadByte() +uint8_t SlReadByte() { return _sl.reader->ReadByte(); } @@ -617,10 +617,10 @@ uint64_t SlReadUint64() } /** - * Wrapper for writing a byte to the dumper. - * @param b The byte to write. + * Wrapper for writing a uint8_t to the dumper. + * @param b The uint8_t to write. */ -void SlWriteByte(byte b) +void SlWriteByte(uint8_t b) { _sl.dumper->WriteByte(b); } @@ -721,21 +721,21 @@ static void SlWriteSimpleGamma(size_t i) if (i >= (1 << 21)) { if (i >= (1 << 28)) { assert(i <= UINT32_MAX); // We can only support 32 bits for now. - SlWriteByte((byte)(0xF0)); - SlWriteByte((byte)(i >> 24)); + SlWriteByte((uint8_t)(0xF0)); + SlWriteByte((uint8_t)(i >> 24)); } else { - SlWriteByte((byte)(0xE0 | (i >> 24))); + SlWriteByte((uint8_t)(0xE0 | (i >> 24))); } - SlWriteByte((byte)(i >> 16)); + SlWriteByte((uint8_t)(i >> 16)); } else { - SlWriteByte((byte)(0xC0 | (i >> 16))); + SlWriteByte((uint8_t)(0xC0 | (i >> 16))); } - SlWriteByte((byte)(i >> 8)); + SlWriteByte((uint8_t)(i >> 8)); } else { - SlWriteByte((byte)(0x80 | (i >> 8))); + SlWriteByte((uint8_t)(0x80 | (i >> 8))); } } - SlWriteByte((byte)i); + SlWriteByte((uint8_t)i); } /** Return how many bytes used to encode a gamma value */ @@ -777,7 +777,7 @@ static inline uint SlGetArrayLength(size_t length) */ static inline uint SlCalcConvMemLen(VarType conv) { - static const byte conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0}; + static const uint8_t conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0}; switch (GetVarMemType(conv)) { case SLE_VAR_STRB: @@ -798,11 +798,11 @@ static inline uint SlCalcConvMemLen(VarType conv) * @param conv VarType type of variable that is used for calculating the size * @return Return the size of this type in bytes */ -static inline byte SlCalcConvFileLen(VarType conv) +static inline uint8_t SlCalcConvFileLen(VarType conv) { uint8_t type = GetVarFileType(conv); if (type == SLE_FILE_VEHORDERID) return SlXvIsFeaturePresent(XSLFI_MORE_VEHICLE_ORDERS) ? 2 : 1; - static const byte conv_file_size[] = {0, 1, 1, 2, 2, 4, 4, 8, 8, 2}; + static const uint8_t conv_file_size[] = {0, 1, 1, 2, 2, 4, 4, 8, 8, 2}; assert(type < lengthof(conv_file_size)); return conv_file_size[type]; } @@ -948,7 +948,7 @@ void SlSetLength(size_t length) */ static void SlCopyBytes(void *ptr, size_t length) { - byte *p = (byte *)ptr; + uint8_t *p = (uint8_t *)ptr; switch (_sl.action) { case SLA_LOAD_CHECK: @@ -964,12 +964,12 @@ static void SlCopyBytes(void *ptr, size_t length) void SlCopyBytesRead(void *p, size_t length) { - _sl.reader->CopyBytes((byte *)p, length); + _sl.reader->CopyBytes((uint8_t *)p, length); } void SlCopyBytesWrite(void *p, size_t length) { - _sl.dumper->CopyBytes((byte *)p, length); + _sl.dumper->CopyBytes((uint8_t *)p, length); } /** Get the length of the current object */ @@ -990,7 +990,7 @@ int64_t ReadValue(const void *ptr, VarType conv) switch (GetVarMemType(conv)) { case SLE_VAR_BL: return (*(const bool *)ptr != 0); case SLE_VAR_I8: return *(const int8_t *)ptr; - case SLE_VAR_U8: return *(const byte *)ptr; + case SLE_VAR_U8: return *(const uint8_t *)ptr; case SLE_VAR_I16: return *(const int16_t *)ptr; case SLE_VAR_U16: return *(const uint16_t*)ptr; case SLE_VAR_I32: return *(const int32_t *)ptr; @@ -1014,7 +1014,7 @@ void WriteValue(void *ptr, VarType conv, int64_t val) switch (GetVarMemType(conv)) { case SLE_VAR_BL: *(bool *)ptr = (val != 0); break; case SLE_VAR_I8: *(int8_t *)ptr = val; break; - case SLE_VAR_U8: *(byte *)ptr = val; break; + case SLE_VAR_U8: *(uint8_t *)ptr = val; break; case SLE_VAR_I16: *(int16_t *)ptr = val; break; case SLE_VAR_U16: *(uint16_t*)ptr = val; break; case SLE_VAR_I32: *(int32_t *)ptr = val; break; @@ -1065,7 +1065,7 @@ static void SlSaveLoadConvGeneric(void *ptr, VarType conv) /* Read a value from the file */ switch (GetVarFileType(conv)) { case SLE_FILE_I8: x = (int8_t )SlReadByte(); break; - case SLE_FILE_U8: x = (byte )SlReadByte(); break; + case SLE_FILE_U8: x = (uint8_t )SlReadByte(); break; case SLE_FILE_I16: x = (int16_t )SlReadUint16(); break; case SLE_FILE_U16: x = (uint16_t)SlReadUint16(); break; case SLE_FILE_I32: x = (int32_t )SlReadUint32(); break; @@ -1077,7 +1077,7 @@ static void SlSaveLoadConvGeneric(void *ptr, VarType conv) if (SlXvIsFeaturePresent(XSLFI_MORE_VEHICLE_ORDERS)) { x = (uint16_t)SlReadUint16(); } else { - VehicleOrderID id = (byte)SlReadByte(); + VehicleOrderID id = (uint8_t)SlReadByte(); x = (id == 0xFF) ? INVALID_VEH_ORDER_ID : id; } break; @@ -1307,7 +1307,7 @@ static inline size_t SlCalcArrayLen(size_t length, VarType conv) * Save/Load an array. * @param array The array being manipulated * @param length The length of the array in elements - * @param conv VarType type of the atomic array (int, byte, uint64_t, etc.) + * @param conv VarType type of the atomic array (int, uint8_t, uint64_t, etc.) */ void SlArray(void *array, size_t length, VarType conv) { @@ -1371,8 +1371,8 @@ void SlArray(void *array, size_t length, VarType conv) if (conv == SLE_INT8 || conv == SLE_UINT8) { SlCopyBytes(array, length); } else { - byte *a = (byte*)array; - byte mem_size = SlCalcConvMemLen(conv); + uint8_t *a = (uint8_t*)array; + uint8_t mem_size = SlCalcConvMemLen(conv); for (; length != 0; length --) { SlSaveLoadConv(a, conv); @@ -1837,7 +1837,7 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld) case SL_VARVEC: { const size_t size_len = SlCalcConvMemLen(sld.conv); switch (size_len) { - case 1: return SlCalcVarListLen>(GetVariableAddress(object, sld), 1); + case 1: return SlCalcVarListLen>(GetVariableAddress(object, sld), 1); case 2: return SlCalcVarListLen>(GetVariableAddress(object, sld), 2); case 4: return SlCalcVarListLen>(GetVariableAddress(object, sld), 4); case 8: return SlCalcVarListLen>(GetVariableAddress(object, sld), 8); @@ -1848,7 +1848,7 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld) default: NOT_REACHED(); } break; - case SL_WRITEBYTE: return 1; // a byte is logically of size 1 + case SL_WRITEBYTE: return 1; // a uint8_t is logically of size 1 case SL_VEH_INCLUDE: return SlCalcObjLength(object, GetVehicleDescription(VEH_END)); case SL_ST_INCLUDE: return SlCalcObjLength(object, GetBaseStationDescription()); default: NOT_REACHED(); @@ -1984,7 +1984,7 @@ bool SlObjectMemberGeneric(void *object, const SaveLoad &sld) case SL_VARVEC: { const size_t size_len = SlCalcConvMemLen(sld.conv); switch (size_len) { - case 1: SlVarList>(ptr, conv); break; + case 1: SlVarList>(ptr, conv); break; case 2: SlVarList>(ptr, conv); break; case 4: SlVarList>(ptr, conv); break; case 8: SlVarList>(ptr, conv); break; @@ -2366,7 +2366,7 @@ uint8_t SlSaveToTempBufferSetup() return (uint8_t) orig_need_length; } -std::span SlSaveToTempBufferRestore(uint8_t state) +std::span SlSaveToTempBufferRestore(uint8_t state) { NeedLength orig_need_length = (NeedLength)state; @@ -2396,7 +2396,7 @@ extern void SlConditionallySaveCompletion(const SlConditionallySaveState &state, } } -SlLoadFromBufferState SlLoadFromBufferSetup(const byte *buffer, size_t length) +SlLoadFromBufferState SlLoadFromBufferSetup(const uint8_t *buffer, size_t length) { assert(_sl.action == SLA_LOAD || _sl.action == SLA_LOAD_CHECK); @@ -2408,13 +2408,13 @@ SlLoadFromBufferState SlLoadFromBufferSetup(const byte *buffer, size_t length) ReadBuffer *reader = ReadBuffer::GetCurrent(); state.old_bufp = reader->bufp; state.old_bufe = reader->bufe; - reader->bufp = const_cast(buffer); - reader->bufe = const_cast(buffer) + length; + reader->bufp = const_cast(buffer); + reader->bufe = const_cast(buffer) + length; return state; } -void SlLoadFromBufferRestore(const SlLoadFromBufferState &state, const byte *buffer, size_t length) +void SlLoadFromBufferRestore(const SlLoadFromBufferState &state, const uint8_t *buffer, size_t length) { ReadBuffer *reader = ReadBuffer::GetCurrent(); if (reader->bufp != reader->bufe || reader->bufe != buffer + length) { @@ -2463,7 +2463,7 @@ static void SlLoadChunk(const ChunkHandler &ch) DEBUG(sl, 2, "Loading chunk %s", ChunkIDDumper()(ch.id)); - byte m = SlReadByte(); + uint8_t m = SlReadByte(); size_t len; size_t endoffs; @@ -2550,7 +2550,7 @@ static void SlLoadCheckChunk(const ChunkHandler *ch, uint32_t chunk_id) DEBUG(sl, 2, "Loading chunk %s", ChunkIDDumper()(chunk_id)); } - byte m = SlReadByte(); + uint8_t m = SlReadByte(); size_t len; size_t endoffs; @@ -2837,7 +2837,7 @@ struct FileReader : LoadFilter { this->file = nullptr; } - size_t Read(byte *buf, size_t size) override + size_t Read(uint8_t *buf, size_t size) override { /* We're in the process of shutting down, i.e. in "failure" mode. */ if (this->file == nullptr) return 0; @@ -2877,7 +2877,7 @@ struct FileWriter : SaveFilter { if (!this->temp_name.empty()) unlink(this->temp_name.c_str()); } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { /* We're in the process of shutting down, i.e. in "failure" mode. */ if (this->file == nullptr) return; @@ -2946,18 +2946,18 @@ struct LZOLoadFilter : LoadFilter { if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize decompressor"); } - size_t Read(byte *buf, size_t ssize) override + size_t Read(uint8_t *buf, size_t ssize) override { assert(ssize >= LZO_BUFFER_SIZE); /* Buffer size is from the LZO docs plus the chunk header size. */ - byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32_t) * 2]; + uint8_t out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32_t) * 2]; uint32_t tmp[2]; uint32_t size; lzo_uint len = ssize; /* Read header*/ - if (this->chain->Read((byte*)tmp, sizeof(tmp)) != sizeof(tmp)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE, "File read failed"); + if (this->chain->Read((uint8_t*)tmp, sizeof(tmp)) != sizeof(tmp)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE, "File read failed"); /* Check if size is bad */ ((uint32_t*)out)[0] = size = tmp[1]; @@ -2989,17 +2989,17 @@ struct LZOSaveFilter : SaveFilter { * @param chain The next filter in this chain. * @param compression_level The requested level of compression. */ - LZOSaveFilter(std::shared_ptr chain, byte compression_level) : SaveFilter(std::move(chain)) + LZOSaveFilter(std::shared_ptr chain, uint8_t compression_level) : SaveFilter(std::move(chain)) { if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor"); } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { const lzo_bytep in = buf; /* Buffer size is from the LZO docs plus the chunk header size. */ - byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32_t) * 2]; - byte wrkmem[LZO1X_1_MEM_COMPRESS]; + uint8_t out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32_t) * 2]; + uint8_t wrkmem[LZO1X_1_MEM_COMPRESS]; lzo_uint outlen; do { @@ -3033,7 +3033,7 @@ struct NoCompLoadFilter : LoadFilter { { } - size_t Read(byte *buf, size_t size) override + size_t Read(uint8_t *buf, size_t size) override { return this->chain->Read(buf, size); } @@ -3046,11 +3046,11 @@ struct NoCompSaveFilter : SaveFilter { * @param chain The next filter in this chain. * @param compression_level The requested level of compression. */ - NoCompSaveFilter(std::shared_ptr chain, byte compression_level) : SaveFilter(std::move(chain)) + NoCompSaveFilter(std::shared_ptr chain, uint8_t compression_level) : SaveFilter(std::move(chain)) { } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { this->chain->Write(buf, size); } @@ -3066,7 +3066,7 @@ struct NoCompSaveFilter : SaveFilter { /** Filter using Zlib compression. */ struct ZlibLoadFilter : LoadFilter { z_stream z; ///< Stream state we are reading from. - byte fread_buf[MEMORY_CHUNK_SIZE]; ///< Buffer for reading from the file. + uint8_t fread_buf[MEMORY_CHUNK_SIZE]; ///< Buffer for reading from the file. /** * Initialise this filter. @@ -3084,7 +3084,7 @@ struct ZlibLoadFilter : LoadFilter { inflateEnd(&this->z); } - size_t Read(byte *buf, size_t size) override + size_t Read(uint8_t *buf, size_t size) override { this->z.next_out = buf; this->z.avail_out = (uint)size; @@ -3110,14 +3110,14 @@ struct ZlibLoadFilter : LoadFilter { /** Filter using Zlib compression. */ struct ZlibSaveFilter : SaveFilter { z_stream z; ///< Stream state we are writing to. - byte buf[MEMORY_CHUNK_SIZE]; ///< output buffer + uint8_t buf[MEMORY_CHUNK_SIZE]; ///< output buffer /** * Initialise this filter. * @param chain The next filter in this chain. * @param compression_level The requested level of compression. */ - ZlibSaveFilter(std::shared_ptr chain, byte compression_level) : SaveFilter(std::move(chain)) + ZlibSaveFilter(std::shared_ptr chain, uint8_t compression_level) : SaveFilter(std::move(chain)) { memset(&this->z, 0, sizeof(this->z)); if (deflateInit(&this->z, compression_level) != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor"); @@ -3135,7 +3135,7 @@ struct ZlibSaveFilter : SaveFilter { * @param len Amount of bytes to write. * @param mode Mode for deflate. */ - void WriteLoop(byte *p, size_t len, int mode) + void WriteLoop(uint8_t *p, size_t len, int mode) { uint n; this->z.next_in = p; @@ -3163,7 +3163,7 @@ struct ZlibSaveFilter : SaveFilter { } while (this->z.avail_in || !this->z.avail_out); } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { this->WriteLoop(buf, size, 0); } @@ -3194,8 +3194,8 @@ static const lzma_stream _lzma_init = LZMA_STREAM_INIT; /** Filter without any compression. */ struct LZMALoadFilter : LoadFilter { - lzma_stream lzma; ///< Stream state that we are reading from. - byte fread_buf[MEMORY_CHUNK_SIZE]; ///< Buffer for reading from the file. + lzma_stream lzma; ///< Stream state that we are reading from. + uint8_t fread_buf[MEMORY_CHUNK_SIZE]; ///< Buffer for reading from the file. /** * Initialise this filter. @@ -3213,7 +3213,7 @@ struct LZMALoadFilter : LoadFilter { lzma_end(&this->lzma); } - size_t Read(byte *buf, size_t size) override + size_t Read(uint8_t *buf, size_t size) override { this->lzma.next_out = buf; this->lzma.avail_out = size; @@ -3238,14 +3238,14 @@ struct LZMALoadFilter : LoadFilter { /** Filter using LZMA compression. */ struct LZMASaveFilter : SaveFilter { lzma_stream lzma; ///< Stream state that we are writing to. - byte buf[MEMORY_CHUNK_SIZE]; ///< output buffer + uint8_t buf[MEMORY_CHUNK_SIZE]; ///< output buffer /** * Initialise this filter. * @param chain The next filter in this chain. * @param compression_level The requested level of compression. */ - LZMASaveFilter(std::shared_ptr chain, byte compression_level) : SaveFilter(std::move(chain)), lzma(_lzma_init) + LZMASaveFilter(std::shared_ptr chain, uint8_t compression_level) : SaveFilter(std::move(chain)), lzma(_lzma_init) { if (lzma_easy_encoder(&this->lzma, compression_level, LZMA_CHECK_CRC32) != LZMA_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor"); } @@ -3262,7 +3262,7 @@ struct LZMASaveFilter : SaveFilter { * @param len Amount of bytes to write. * @param action Action for lzma_code. */ - void WriteLoop(byte *p, size_t len, lzma_action action) + void WriteLoop(uint8_t *p, size_t len, lzma_action action) { size_t n; this->lzma.next_in = p; @@ -3282,7 +3282,7 @@ struct LZMASaveFilter : SaveFilter { } while (this->lzma.avail_in || !this->lzma.avail_out); } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { this->WriteLoop(buf, size, LZMA_RUN); } @@ -3307,7 +3307,7 @@ struct LZMASaveFilter : SaveFilter { /** Filter using ZSTD compression. */ struct ZSTDLoadFilter : LoadFilter { ZSTD_DCtx *zstd; ///< ZSTD decompression context - byte fread_buf[MEMORY_CHUNK_SIZE]; ///< Buffer for reading from the file + uint8_t fread_buf[MEMORY_CHUNK_SIZE]; ///< Buffer for reading from the file ZSTD_inBuffer input; ///< ZSTD input buffer for fread_buf /** @@ -3327,7 +3327,7 @@ struct ZSTDLoadFilter : LoadFilter { ZSTD_freeDCtx(this->zstd); } - size_t Read(byte *buf, size_t size) override + size_t Read(uint8_t *buf, size_t size) override { ZSTD_outBuffer output{buf, size, 0}; @@ -3351,14 +3351,14 @@ struct ZSTDLoadFilter : LoadFilter { /** Filter using ZSTD compression. */ struct ZSTDSaveFilter : SaveFilter { ZSTD_CCtx *zstd; ///< ZSTD compression context - byte buf[MEMORY_CHUNK_SIZE]; ///< output buffer + uint8_t buf[MEMORY_CHUNK_SIZE]; ///< output buffer /** * Initialise this filter. * @param chain The next filter in this chain. * @param compression_level The requested level of compression. */ - ZSTDSaveFilter(std::shared_ptr chain, byte compression_level) : SaveFilter(std::move(chain)) + ZSTDSaveFilter(std::shared_ptr chain, uint8_t compression_level) : SaveFilter(std::move(chain)) { this->zstd = ZSTD_createCCtx(); if (!this->zstd) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor"); @@ -3380,7 +3380,7 @@ struct ZSTDSaveFilter : SaveFilter { * @param len Amount of bytes to write. * @param mode Mode for ZSTD_compressStream2. */ - void WriteLoop(byte *p, size_t len, ZSTD_EndDirective mode) + void WriteLoop(uint8_t *p, size_t len, ZSTD_EndDirective mode) { ZSTD_inBuffer input{p, len, 0}; @@ -3396,7 +3396,7 @@ struct ZSTDSaveFilter : SaveFilter { } while (!finished); } - void Write(byte *buf, size_t size) override + void Write(uint8_t *buf, size_t size) override { this->WriteLoop(buf, size, ZSTD_e_continue); } @@ -3414,7 +3414,7 @@ struct ZSTDSaveFilter : SaveFilter { ************* END OF CODE ***************** *******************************************/ -enum SaveLoadFormatFlags : byte { +enum SaveLoadFormatFlags : uint8_t { SLF_NONE = 0, SLF_NO_THREADED_LOAD = 1 << 0, ///< Unsuitable for threaded loading SLF_REQUIRES_ZSTD = 1 << 1, ///< Automatic selection requires the zstd flag @@ -3426,12 +3426,12 @@ struct SaveLoadFormat { const char *name; ///< name of the compressor/decompressor (debug-only) uint32_t tag; ///< the 4-letter tag by which it is identified in the savegame - std::shared_ptr (*init_load)(std::shared_ptr chain); ///< Constructor for the load filter. - std::shared_ptr (*init_write)(std::shared_ptr chain, byte compression); ///< Constructor for the save filter. + std::shared_ptr (*init_load)(std::shared_ptr chain); ///< Constructor for the load filter. + std::shared_ptr (*init_write)(std::shared_ptr chain, uint8_t compression); ///< Constructor for the save filter. - byte min_compression; ///< the minimum compression level of this format - byte default_compression; ///< the default compression level of this format - byte max_compression; ///< the maximum compression level of this format + uint8_t min_compression; ///< the minimum compression level of this format + uint8_t default_compression; ///< the default compression level of this format + uint8_t max_compression; ///< the maximum compression level of this format SaveLoadFormatFlags flags; ///< flags }; @@ -3483,7 +3483,7 @@ static const SaveLoadFormat _saveload_formats[] = { * @param compression_level Output for telling what compression level we want. * @return Pointer to SaveLoadFormat struct giving all characteristics of this type of savegame */ -static const SaveLoadFormat *GetSavegameFormat(const std::string &full_name, byte *compression_level, SaveModeFlags flags) +static const SaveLoadFormat *GetSavegameFormat(const std::string &full_name, uint8_t *compression_level, SaveModeFlags flags) { const SaveLoadFormat *def = lastof(_saveload_formats); @@ -3606,14 +3606,14 @@ static void SaveFileError() static SaveOrLoadResult SaveFileToDisk(bool threaded) { try { - byte compression; + uint8_t compression; const SaveLoadFormat *fmt = GetSavegameFormat(_savegame_format, &compression, _sl.save_flags); DEBUG(sl, 3, "Using compression format: %s, level: %u", fmt->name, compression); /* We have written our stuff to memory, now write it to file! */ uint32_t hdr[2] = { fmt->tag, TO_BE32((uint32_t) (SAVEGAME_VERSION | SAVEGAME_VERSION_EXT) << 16) }; - _sl.sf->Write((byte*)hdr, sizeof(hdr)); + _sl.sf->Write((uint8_t*)hdr, sizeof(hdr)); _sl.sf = fmt->init_write(_sl.sf, compression); _sl.dumper->Flush(*(_sl.sf)); @@ -3724,7 +3724,7 @@ struct ThreadedLoadFilter : LoadFilter { uint count_ready = 0; size_t read_offsets[BUFFER_COUNT]; size_t read_counts[BUFFER_COUNT]; - byte read_buf[MEMORY_CHUNK_SIZE * BUFFER_COUNT]; ///< Buffers for reading from source. + uint8_t read_buf[MEMORY_CHUNK_SIZE * BUFFER_COUNT]; ///< Buffers for reading from source. bool no_thread = false; bool have_exception = false; @@ -3788,7 +3788,7 @@ struct ThreadedLoadFilter : LoadFilter { } } - size_t Read(byte *buf, size_t size) override + size_t Read(uint8_t *buf, size_t size) override { if (this->no_thread) return this->chain->Read(buf, size); @@ -3846,7 +3846,7 @@ static SaveOrLoadResult DoLoad(std::shared_ptr reader, bool load_che }); uint32_t hdr[2]; - if (_sl.lf->Read((byte*)hdr, sizeof(hdr)) != sizeof(hdr)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE); + if (_sl.lf->Read((uint8_t*)hdr, sizeof(hdr)) != sizeof(hdr)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE); SaveLoadVersion original_sl_version = SL_MIN_VERSION; @@ -4332,7 +4332,7 @@ SaveLoadVersion GeneralUpstreamChunkLoadInfo::GetLoadVersion() { extern SaveLoadVersion _sl_xv_upstream_version; - byte block_mode = _sl.chunk_block_modes[_sl.current_chunk_id]; + uint8_t block_mode = _sl.chunk_block_modes[_sl.current_chunk_id]; return (block_mode == CH_TABLE || block_mode == CH_SPARSE_TABLE) ? _sl_xv_upstream_version : _sl_version; } diff --git a/src/sl/saveload.h b/src/sl/saveload.h index 905b2b2739..ac2000aec9 100644 --- a/src/sl/saveload.h +++ b/src/sl/saveload.h @@ -56,7 +56,7 @@ enum SavegameType { SGT_INVALID = 0xFF, ///< broken savegame (used internally) }; -enum SaveModeFlags : byte { +enum SaveModeFlags : uint8_t { SMF_NONE = 0, SMF_NET_SERVER = 1 << 0, ///< Network server save SMF_ZSTD_OK = 1 << 1, ///< Zstd OK @@ -275,7 +275,7 @@ using upstream_sl::MakeConditionallyUpstreamChunkHandler; using upstream_sl::MakeSaveUpstreamFeatureConditionalLoadUpstreamChunkHandler; struct NullStruct { - byte null; + uint8_t null; }; /** A table of ChunkHandler entries. */ @@ -905,10 +905,10 @@ inline constexpr void *SlVarWrapper(void* ptr) * @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked. * @return Savegame version is earlier than the specified version. */ -inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0) +inline bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor = 0) { extern SaveLoadVersion _sl_version; - extern byte _sl_minor_version; + extern uint8_t _sl_minor_version; return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor); } @@ -971,7 +971,7 @@ inline void *GetVariableAddress(const void *object, const SaveLoad &sld) /* Everything else should be a non-null pointer. */ assert(object != nullptr); #endif - return const_cast((const byte *)object + (ptrdiff_t)sld.address); + return const_cast((const uint8_t *)object + (ptrdiff_t)sld.address); } int64_t ReadValue(const void *ptr, VarType conv); @@ -992,10 +992,10 @@ size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt); * @return Span of the saved data, in the autolength temp buffer */ template -std::span SlSaveToTempBuffer(F proc) +std::span SlSaveToTempBuffer(F proc) { extern uint8_t SlSaveToTempBufferSetup(); - extern std::span SlSaveToTempBufferRestore(uint8_t state); + extern std::span SlSaveToTempBufferRestore(uint8_t state); uint8_t state = SlSaveToTempBufferSetup(); proc(); @@ -1011,7 +1011,7 @@ std::span SlSaveToTempBuffer(F proc) template std::vector SlSaveToVector(F proc) { - std::span result = SlSaveToTempBuffer(proc); + std::span result = SlSaveToTempBuffer(proc); return std::vector(result.begin(), result.end()); } @@ -1040,8 +1040,8 @@ bool SlConditionallySave(F proc) struct SlLoadFromBufferState { size_t old_obj_len; - byte *old_bufp; - byte *old_bufe; + uint8_t *old_bufp; + uint8_t *old_bufe; }; /** @@ -1049,10 +1049,10 @@ struct SlLoadFromBufferState { * @param proc The callback procedure that is called */ template -void SlLoadFromBuffer(const byte *buffer, size_t length, F proc) +void SlLoadFromBuffer(const uint8_t *buffer, size_t length, F proc) { - extern SlLoadFromBufferState SlLoadFromBufferSetup(const byte *buffer, size_t length); - extern void SlLoadFromBufferRestore(const SlLoadFromBufferState &state, const byte *buffer, size_t length); + extern SlLoadFromBufferState SlLoadFromBufferSetup(const uint8_t *buffer, size_t length); + extern void SlLoadFromBufferRestore(const SlLoadFromBufferState &state, const uint8_t *buffer, size_t length); SlLoadFromBufferState state = SlLoadFromBufferSetup(buffer, length); proc(); diff --git a/src/sl/saveload_buffer.h b/src/sl/saveload_buffer.h index a8c8e71755..1e18790f30 100644 --- a/src/sl/saveload_buffer.h +++ b/src/sl/saveload_buffer.h @@ -26,11 +26,11 @@ static const size_t MEMORY_CHUNK_SIZE = 128 * 1024; /** A buffer for reading (and buffering) savegame data. */ struct ReadBuffer { - byte buf[MEMORY_CHUNK_SIZE]; ///< Buffer we're going to read from. - byte *bufp; ///< Location we're at reading the buffer. - byte *bufe; ///< End of the buffer we can read from. + uint8_t buf[MEMORY_CHUNK_SIZE]; ///< Buffer we're going to read from. + uint8_t *bufp; ///< Location we're at reading the buffer. + uint8_t *bufe; ///< End of the buffer we can read from. std::shared_ptr reader; ///< The filter used to actually read. - size_t read; ///< The amount of read bytes so far from the filter. + size_t read; ///< The amount of read bytes so far from the filter. /** * Initialise our variables. @@ -47,7 +47,7 @@ struct ReadBuffer { inline void SkipBytes(size_t bytes) { - byte *b = this->bufp + bytes; + uint8_t *b = this->bufp + bytes; if (likely(b <= this->bufe)) { this->bufp = b; } else { @@ -55,12 +55,12 @@ struct ReadBuffer { } } - inline byte RawReadByte() + inline uint8_t RawReadByte() { return *this->bufp++; } - inline byte ReadByte() + inline uint8_t ReadByte() { if (unlikely(this->bufp == this->bufe)) { this->AcquireBytes(); @@ -69,7 +69,7 @@ struct ReadBuffer { return RawReadByte(); } - inline byte PeekByte() + inline uint8_t PeekByte() { if (unlikely(this->bufp == this->bufe)) { this->AcquireBytes(); @@ -120,7 +120,7 @@ struct ReadBuffer { #endif } - inline void CopyBytes(byte *ptr, size_t length) + inline void CopyBytes(uint8_t *ptr, size_t length) { while (length) { if (unlikely(this->bufp == this->bufe)) { @@ -134,7 +134,7 @@ struct ReadBuffer { } } - inline void CopyBytes(std::span buffer) + inline void CopyBytes(std::span buffer) { this->CopyBytes(buffer.data(), buffer.size()); } @@ -153,10 +153,10 @@ struct ReadBuffer { /** Container for dumping the savegame (quickly) to memory. */ struct MemoryDumper { struct BufferInfo { - byte *data; + uint8_t *data; size_t size = 0; - BufferInfo(byte *d) : data(d) {} + BufferInfo(uint8_t *d) : data(d) {} ~BufferInfo() { free(this->data); } BufferInfo(const BufferInfo &) = delete; @@ -164,19 +164,19 @@ struct MemoryDumper { }; std::vector blocks; ///< Buffer with blocks of allocated memory. - byte *buf = nullptr; ///< Buffer we're going to write to. - byte *bufe = nullptr; ///< End of the buffer we write to. + uint8_t *buf = nullptr; ///< Buffer we're going to write to. + uint8_t *bufe = nullptr; ///< End of the buffer we write to. size_t completed_block_bytes = 0; ///< Total byte count of completed blocks. - byte *autolen_buf = nullptr; - byte *autolen_buf_end = nullptr; - byte *saved_buf = nullptr; - byte *saved_bufe = nullptr; + uint8_t *autolen_buf = nullptr; + uint8_t *autolen_buf_end = nullptr; + uint8_t *saved_buf = nullptr; + uint8_t *saved_bufe = nullptr; MemoryDumper() { const size_t size = 8192; - this->autolen_buf = CallocT(size); + this->autolen_buf = CallocT(size); this->autolen_buf_end = this->autolen_buf + size; } @@ -199,7 +199,7 @@ struct MemoryDumper { * Write a single byte into the dumper. * @param b The byte to write. */ - inline void WriteByte(byte b) + inline void WriteByte(uint8_t b) { /* Are we at the end of this chunk? */ if (unlikely(this->buf == this->bufe)) { @@ -209,7 +209,7 @@ struct MemoryDumper { *this->buf++ = b; } - inline void CopyBytes(const byte *ptr, size_t length) + inline void CopyBytes(const uint8_t *ptr, size_t length) { while (length) { if (unlikely(this->buf == this->bufe)) { @@ -223,12 +223,12 @@ struct MemoryDumper { } } - inline void CopyBytes(std::span buffer) + inline void CopyBytes(std::span buffer) { this->CopyBytes(buffer.data(), buffer.size()); } - inline void RawWriteByte(byte b) + inline void RawWriteByte(uint8_t b) { *this->buf++ = b; } @@ -277,7 +277,7 @@ struct MemoryDumper { void Flush(SaveFilter &writer); size_t GetSize() const; void StartAutoLength(); - std::span StopAutoLength(); + std::span StopAutoLength(); bool IsAutoLengthActive() const { return this->saved_buf != nullptr; } }; diff --git a/src/sl/saveload_common.h b/src/sl/saveload_common.h index 6780b5ac9d..8647f47514 100644 --- a/src/sl/saveload_common.h +++ b/src/sl/saveload_common.h @@ -418,8 +418,8 @@ enum SaveLoadVersion : uint16_t { SL_CHILLPP_233 = 233, }; -byte SlReadByte(); -void SlWriteByte(byte b); +uint8_t SlReadByte(); +void SlWriteByte(uint8_t b); int SlReadUint16(); uint32_t SlReadUint32(); diff --git a/src/sl/saveload_filter.h b/src/sl/saveload_filter.h index 7d75082e45..84bb56bbcb 100644 --- a/src/sl/saveload_filter.h +++ b/src/sl/saveload_filter.h @@ -34,7 +34,7 @@ struct LoadFilter { * @param len The number of bytes to read. * @return The number of actually read bytes. */ - virtual size_t Read(byte *buf, size_t len) = 0; + virtual size_t Read(uint8_t *buf, size_t len) = 0; /** * Reset this filter to read from the beginning of the file. @@ -78,7 +78,7 @@ struct SaveFilter { * @param buf The bytes to write. * @param len The number of bytes to write. */ - virtual void Write(byte *buf, size_t len) = 0; + virtual void Write(uint8_t *buf, size_t len) = 0; /** * Prepare everything to finish writing the savegame. @@ -95,7 +95,7 @@ struct SaveFilter { * @param compression_level The requested level of compression. * @tparam T The type of save filter to create. */ -template std::shared_ptr CreateSaveFilter(std::shared_ptr chain, byte compression_level) +template std::shared_ptr CreateSaveFilter(std::shared_ptr chain, uint8_t compression_level) { return std::make_shared(chain, compression_level); } diff --git a/src/sl/saveload_types.h b/src/sl/saveload_types.h index 53125b637f..835c9ba286 100644 --- a/src/sl/saveload_types.h +++ b/src/sl/saveload_types.h @@ -121,7 +121,7 @@ enum SaveLoadTypes { SL_VARVEC = 14, ///< Save/load a primitive type vector. }; -typedef byte SaveLoadType; ///< Save/load type. @see SaveLoadTypes +typedef uint8_t SaveLoadType; ///< Save/load type. @see SaveLoadTypes /** SaveLoad type struct. Do NOT use this directly but use the SLE_ macros defined just below! */ struct SaveLoad { diff --git a/src/sl/signal_sl.cpp b/src/sl/signal_sl.cpp index 38fe75b4d5..f82a940066 100644 --- a/src/sl/signal_sl.cpp +++ b/src/sl/signal_sl.cpp @@ -15,7 +15,7 @@ #include "saveload.h" #include "saveload_buffer.h" -typedef std::vector Buffer; +typedef std::vector Buffer; // Variable length integers are stored in Variable Length Quantity // format (http://en.wikipedia.org/wiki/Variable-length_quantity) @@ -25,18 +25,18 @@ static void WriteVLI(Buffer &b, uint i) uint lsmask = 0x7F; uint msmask = ~0x7F; while(i & msmask) { - byte part = (i & lsmask) | 0x80; + uint8_t part = (i & lsmask) | 0x80; b.push_back(part); i >>= 7; } - b.push_back((byte) i); + b.push_back((uint8_t) i); } static uint ReadVLI() { uint shift = 0; uint val = 0; - byte b; + uint8_t b; b = SlReadByte(); while(b & 0x80) { diff --git a/src/sl/station_sl.cpp b/src/sl/station_sl.cpp index ab9b34057d..523228a21c 100644 --- a/src/sl/station_sl.cpp +++ b/src/sl/station_sl.cpp @@ -22,7 +22,7 @@ #include "../safeguards.h" -static byte _old_last_vehicle_type; +static uint8_t _old_last_vehicle_type; static uint8_t _num_specs; static uint8_t _num_roadstop_specs; static uint32_t _num_roadstop_custom_tiles; diff --git a/src/sl/strings_sl.cpp b/src/sl/strings_sl.cpp index 3ac00ca0e1..6ac548a178 100644 --- a/src/sl/strings_sl.cpp +++ b/src/sl/strings_sl.cpp @@ -69,7 +69,7 @@ std::string CopyFromOldName(StringID id) std::ostringstream tmp; std::ostreambuf_iterator strto(tmp); for (; *strfrom != '\0'; strfrom++) { - char32_t c = (byte)*strfrom; + char32_t c = (uint8_t)*strfrom; /* Map from non-ISO8859-15 characters to UTF-8. */ switch (c) { diff --git a/src/sl/vehicle_sl.cpp b/src/sl/vehicle_sl.cpp index 3dcd4d6bcd..da21a06b6e 100644 --- a/src/sl/vehicle_sl.cpp +++ b/src/sl/vehicle_sl.cpp @@ -257,7 +257,7 @@ static void CheckValidVehicles() } } -extern byte _age_cargo_skip_counter; // From misc_sl.cpp +extern uint8_t _age_cargo_skip_counter; // From misc_sl.cpp static std::vector _load_invalid_vehicles_to_delete; @@ -1279,7 +1279,7 @@ struct train_venc { uint16_t cached_veh_weight; uint16_t cached_uncapped_decel; uint8_t cached_deceleration; - byte user_def_data; + uint8_t user_def_data; int16_t cached_curve_speed_mod; uint16_t cached_max_curve_speed; }; diff --git a/src/slope_func.h b/src/slope_func.h index 36f391f131..ed888dcdd8 100644 --- a/src/slope_func.h +++ b/src/slope_func.h @@ -414,7 +414,7 @@ inline Foundation SpecialRailFoundation(Corner corner) */ inline uint SlopeToSpriteOffset(Slope s) { - extern const byte _slope_to_sprite_offset[32]; + extern const uint8_t _slope_to_sprite_offset[32]; return _slope_to_sprite_offset[s]; } diff --git a/src/slope_type.h b/src/slope_type.h index b05bb7d484..fa67d073d6 100644 --- a/src/slope_type.h +++ b/src/slope_type.h @@ -45,7 +45,7 @@ enum Corner { * slopes would mean that it is not a steep slope as halftile * slopes only span one height level. */ -enum Slope { +enum Slope : uint8_t { SLOPE_FLAT = 0x00, ///< a flat tile SLOPE_W = 0x01, ///< the west corner of the tile is raised SLOPE_S = 0x02, ///< the south corner of the tile is raised diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index f47dc1f78b..0681e20d8c 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -622,7 +622,7 @@ static inline uint32_t GetSmallMapOwnerPixels(TileIndex tile, TileType t) } /** Vehicle colours in #SMT_VEHICLES mode. Indexed by #VehicleType. */ -static const byte _vehicle_type_colours[6] = { +static const uint8_t _vehicle_type_colours[6] = { PC_RED, PC_YELLOW, PC_LIGHT_BLUE, PC_WHITE, PC_BLACK, PC_RED }; @@ -885,7 +885,7 @@ void SmallMapWindow::DrawVehicles(const DrawPixelInfo *dpi, Blitter *blitter) co if (!IsInsideMM(y, -this->ui_zoom + 1, dpi->height)) continue; // y is out of bounds. /* Calculate pointer to pixel and the colour */ - byte colour = (this->map_type == SMT_VEHICLES) ? _vehicle_type_colours[v->type] : PC_WHITE; + uint8_t colour = (this->map_type == SMT_VEHICLES) ? _vehicle_type_colours[v->type] : PC_WHITE; /* And draw either one or two pixels depending on clipping */ auto min_i = std::max(0, -y); diff --git a/src/smallmap_gui.h b/src/smallmap_gui.h index 78d2d63489..66c52ef352 100644 --- a/src/smallmap_gui.h +++ b/src/smallmap_gui.h @@ -23,7 +23,7 @@ static const int NUM_NO_COMPANY_ENTRIES = 4; ///< Number of entries in the owner legend that are not companies. /** Mapping of tile type to importance of the tile (higher number means more interesting to show). */ -static const byte _tiletype_importance[] = { +static const uint8_t _tiletype_importance[] = { 2, // MP_CLEAR 8, // MP_RAILWAY 7, // MP_ROAD @@ -66,7 +66,7 @@ struct LegendAndColour { }; /** Types of legends in the #WID_SM_LEGEND widget. */ -enum SmallMapType : byte { +enum SmallMapType : uint8_t { SMT_CONTOUR, SMT_VEHICLES, SMT_INDUSTRY, diff --git a/src/sortlist_type.h b/src/sortlist_type.h index a2439fee3f..10de135f6c 100644 --- a/src/sortlist_type.h +++ b/src/sortlist_type.h @@ -30,12 +30,12 @@ DECLARE_ENUM_AS_BIT_SET(SortListFlags) /** Data structure describing how to show the list (what sort direction and criteria). */ struct Listing { bool order; ///< Ascending/descending - byte criteria; ///< Sorting criteria + uint8_t criteria; ///< Sorting criteria }; /** Data structure describing what to show in the list (filter criteria). */ struct Filtering { bool state; ///< Filter on/off - byte criteria; ///< Filtering criteria + uint8_t criteria; ///< Filtering criteria }; /** diff --git a/src/sound.cpp b/src/sound.cpp index 9faeb7c18c..09ec395c4d 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -207,10 +207,10 @@ static void StartSound(SoundID sound_id, float pan, uint volume) } -static const byte _vol_factor_by_zoom[] = {255, 255, 255, 190, 134, 87, 10, 1, 1, 1}; +static const uint8_t _vol_factor_by_zoom[] = {255, 255, 255, 190, 134, 87, 10, 1, 1, 1}; static_assert(lengthof(_vol_factor_by_zoom) == ZOOM_LVL_END); -static const byte _sound_base_vol[] = { +static const uint8_t _sound_base_vol[] = { 128, 90, 128, 128, 128, 128, 128, 128, 128, 90, 90, 128, 128, 128, 128, 128, 128, 128, 128, 80, 128, 128, 128, 128, @@ -223,7 +223,7 @@ static const byte _sound_base_vol[] = { 90, }; -static const byte _sound_idx[] = { +static const uint8_t _sound_idx[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, diff --git a/src/sound_type.h b/src/sound_type.h index 7113da9947..aa841059a9 100644 --- a/src/sound_type.h +++ b/src/sound_type.h @@ -19,7 +19,7 @@ struct SoundEntry { uint8_t channels; uint8_t volume; uint8_t priority; - byte grf_container_ver; ///< NewGRF container version if the sound is from a NewGRF. + uint8_t grf_container_ver; ///< NewGRF container version if the sound is from a NewGRF. }; /** diff --git a/src/sprite.h b/src/sprite.h index 9c6c1bca64..fe55acc1c6 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -26,9 +26,9 @@ struct DrawTileSeqStruct { int8_t delta_x; ///< \c 0x80 is sequence terminator int8_t delta_y; int8_t delta_z; ///< \c 0x80 identifies child sprites - byte size_x; - byte size_y; - byte size_z; + uint8_t size_x; + uint8_t size_y; + uint8_t size_z; PalSpriteID image; /** Make this struct a sequence terminator. */ @@ -40,13 +40,13 @@ struct DrawTileSeqStruct { /** Check whether this is a sequence terminator. */ bool IsTerminator() const { - return (byte)this->delta_x == 0x80; + return (uint8_t)this->delta_x == 0x80; } /** Check whether this is a parent sprite with a boundingbox. */ bool IsParentSprite() const { - return (byte)this->delta_z != 0x80; + return (uint8_t)this->delta_z != 0x80; } }; @@ -67,12 +67,12 @@ struct DrawTileSprites { struct DrawBuildingsTileStruct { PalSpriteID ground; PalSpriteID building; - byte subtile_x; - byte subtile_y; - byte width; - byte height; - byte dz; - byte draw_proc; // this allows to specify a special drawing procedure. + uint8_t subtile_x; + uint8_t subtile_y; + uint8_t width; + uint8_t height; + uint8_t dz; + uint8_t draw_proc; // this allows to specify a special drawing procedure. }; /** Iterate through all DrawTileSeqStructs in DrawTileSprites. */ diff --git a/src/spritecache.cpp b/src/spritecache.cpp index d72eeebd7d..d1f2573ca7 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -102,7 +102,7 @@ static void *AllocSprite(size_t mem_req); * @param num the amount of sprites to skip * @return true if the data could be correctly skipped. */ -bool SkipSpriteData(SpriteFile &file, byte type, uint16_t num) +bool SkipSpriteData(SpriteFile &file, uint8_t type, uint16_t num) { if (type & 2) { file.SkipBytes(num); @@ -454,9 +454,9 @@ static void *ReadRecolourSprite(SpriteFile &file, uint num) * number of recolour sprites that are 17 bytes that only exist in DOS * GRFs which are the same as 257 byte recolour sprites, but with the last * 240 bytes zeroed. */ - byte *dest = (byte *)AllocSprite(RECOLOUR_SPRITE_SIZE); + uint8_t *dest = (uint8_t *)AllocSprite(RECOLOUR_SPRITE_SIZE); - auto read_data = [&](byte *targ) { + auto read_data = [&](uint8_t *targ) { file.ReadBlock(targ, std::min(num, RECOLOUR_SPRITE_SIZE)); if (num > RECOLOUR_SPRITE_SIZE) { file.SkipBytes(num - RECOLOUR_SPRITE_SIZE); @@ -464,7 +464,7 @@ static void *ReadRecolourSprite(SpriteFile &file, uint num) }; if (file.NeedsPaletteRemap()) { - byte *dest_tmp = AllocaM(byte, RECOLOUR_SPRITE_SIZE); + uint8_t *dest_tmp = AllocaM(uint8_t, RECOLOUR_SPRITE_SIZE); /* Only a few recolour sprites are less than 257 bytes */ if (num < RECOLOUR_SPRITE_SIZE) memset(dest_tmp, 0, RECOLOUR_SPRITE_SIZE); @@ -490,7 +490,7 @@ static const char *GetSpriteTypeName(SpriteType type) "recolour", // SpriteType::Recolour }; - return sprite_types[static_cast(type)]; + return sprite_types[static_cast(type)]; } /** @@ -564,7 +564,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty s->missing_zoom_levels = 0; SpriteLoader::CommonPixel *src = sprite[ZOOM_LVL_NORMAL].data; - byte *dest = s->data; + uint8_t *dest = s->data; while (num-- > 0) { *dest++ = src->m; src++; @@ -648,10 +648,10 @@ void ReadGRFSpriteOffsets(SpriteFile &file) prev_id = id; uint length = file.ReadDword(); if (length > 0) { - byte colour = file.ReadByte() & SCC_MASK; + uint8_t colour = file.ReadByte() & SCC_MASK; length--; if (length > 0) { - byte zoom = file.ReadByte(); + uint8_t zoom = file.ReadByte(); length--; if (colour != 0) { static const ZoomLevel zoom_lvl_map[6] = {ZOOM_LVL_OUT_4X, ZOOM_LVL_NORMAL, ZOOM_LVL_OUT_2X, ZOOM_LVL_OUT_8X, ZOOM_LVL_OUT_16X, ZOOM_LVL_OUT_32X}; @@ -686,7 +686,7 @@ bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id) /* Read sprite header. */ uint32_t num = file.GetContainerVersion() >= 2 ? file.ReadDword() : file.ReadWord(); if (num == 0) return false; - byte grf_type = file.ReadByte(); + uint8_t grf_type = file.ReadByte(); SpriteType type; void *data = nullptr; @@ -909,7 +909,7 @@ static void *AllocSprite(size_t mem_req) */ void *SimpleSpriteAlloc(size_t size) { - return MallocT(size); + return MallocT(size); } /** @@ -929,7 +929,7 @@ static void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, S return GetRawSprite(sprite, sc->GetType(), UINT8_MAX, allocator); } - byte warning_level = sc->GetWarned() ? 6 : 0; + uint8_t warning_level = sc->GetWarned() ? 6 : 0; sc->SetWarned(true); DEBUG(sprite, warning_level, "Tried to load %s sprite #%d as a %s sprite. Probable cause: NewGRF interference", GetSpriteTypeName(available), sprite, GetSpriteTypeName(requested)); @@ -1025,7 +1025,7 @@ uint32_t GetSpriteMainColour(SpriteID sprite_id, PaletteID palette_id) SpriteCache *sc = GetSpriteCache(sprite_id); if (sc->GetType() != SpriteType::Normal) return 0; - const byte * const remap = (palette_id == PAL_NONE ? nullptr : GetNonSprite(GB(palette_id, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1); + const uint8_t * const remap = (palette_id == PAL_NONE ? nullptr : GetNonSprite(GB(palette_id, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1); SpriteFile &file = *sc->file; size_t file_pos = sc->file_pos; diff --git a/src/spritecache.h b/src/spritecache.h index 7df1476355..8198fb9d66 100644 --- a/src/spritecache.h +++ b/src/spritecache.h @@ -25,7 +25,7 @@ struct Sprite { uint32_t lru; ///< Sprite cache LRU of this sprite structure. uint8_t missing_zoom_levels; ///< Bitmask of zoom levels missing in data Sprite *next = nullptr; ///< Next sprite structure, this is the only member which may be changed after the sprite has been inserted in the sprite cache - byte data[]; ///< Sprite data. + uint8_t data[]; ///< Sprite data. }; /* @@ -58,10 +58,10 @@ inline const Sprite *GetSprite(SpriteID sprite, SpriteType type, uint8_t zoom_le return (Sprite*)GetRawSprite(sprite, type, zoom_levels); } -inline const byte *GetNonSprite(SpriteID sprite, SpriteType type) +inline const uint8_t *GetNonSprite(SpriteID sprite, SpriteType type) { dbg_assert(type == SpriteType::Recolour); - return (byte*)GetRawSprite(sprite, type, UINT8_MAX); + return (uint8_t*)GetRawSprite(sprite, type, UINT8_MAX); } void GfxInitSpriteMem(); @@ -74,7 +74,7 @@ SpriteFile &OpenCachedSpriteFile(const std::string &filename, Subdirectory subdi void ReadGRFSpriteOffsets(SpriteFile &file); size_t GetGRFSpriteOffset(uint32_t id); bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id); -bool SkipSpriteData(SpriteFile &file, byte type, uint16_t num); +bool SkipSpriteData(SpriteFile &file, uint8_t type, uint16_t num); void DupSprite(SpriteID old_spr, SpriteID new_spr); uint32_t GetSpriteMainColour(SpriteID sprite_id, PaletteID palette_id); @@ -89,9 +89,9 @@ public: return (const Sprite*)(this->cache.find(sprite | (static_cast(type) << 29))->second); } - inline const byte *GetRecolourSprite(SpriteID sprite) const + inline const uint8_t *GetRecolourSprite(SpriteID sprite) const { - return (const byte*)(this->cache.find(sprite | (static_cast(SpriteType::Recolour) << 29))->second); + return (const uint8_t*)(this->cache.find(sprite | (static_cast(SpriteType::Recolour) << 29))->second); } void Clear() diff --git a/src/spritecache_internal.h b/src/spritecache_internal.h index 7beb139814..2e161ed5eb 100644 --- a/src/spritecache_internal.h +++ b/src/spritecache_internal.h @@ -38,7 +38,7 @@ public: void Allocate(uint32_t size) { - this->ptr.reset(MallocT(size)); + this->ptr.reset(MallocT(size)); this->size = size; } diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp index d3031d6718..db5bfc75b8 100644 --- a/src/spriteloader/grf.cpp +++ b/src/spriteloader/grf.cpp @@ -22,7 +22,7 @@ #include "../safeguards.h" -extern const byte _palmap_w2d[]; +extern const uint8_t _palmap_w2d[]; /** * We found a corrupted sprite. This means that the sprite itself @@ -34,7 +34,7 @@ extern const byte _palmap_w2d[]; */ static bool WarnCorruptSprite(const SpriteFile &file, size_t file_pos, int line) { - static byte warning_level = 0; + static uint8_t warning_level = 0; if (warning_level == 0) { SetDParamStr(0, file.GetSimplifiedFilename()); ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, WL_ERROR); @@ -57,7 +57,7 @@ static bool WarnCorruptSprite(const SpriteFile &file, size_t file_pos, int line) * @param container_format Container format of the GRF this sprite is in. * @return True if the sprite was successfully loaded. */ -bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, int64_t num, byte type, ZoomLevel zoom_lvl, byte colour_fmt, byte container_format) +bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, int64_t num, uint8_t type, ZoomLevel zoom_lvl, uint8_t colour_fmt, uint8_t container_format) { /* * Original sprite height was max 255 pixels, with 4x extra zoom => 1020 pixels. @@ -68,8 +68,8 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f */ if (num < 0 || num > 64 * 1024 * 1024) return WarnCorruptSprite(file, file_pos, __LINE__); - std::unique_ptr dest_orig(new byte[num]); - byte *dest = dest_orig.get(); + std::unique_ptr dest_orig(new uint8_t[num]); + uint8_t *dest = dest_orig.get(); const int64_t dest_size = num; /* Read the file, which has some kind of compression */ @@ -165,7 +165,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f if (colour_fmt & SCC_PAL) { switch (sprite_type) { case SpriteType::Normal: data->m = file.NeedsPaletteRemap() ? _palmap_w2d[*dest] : *dest; break; - case SpriteType::Font: data->m = std::min(*dest, 2u); break; + case SpriteType::Font: data->m = std::min(*dest, 2u); break; default: data->m = *dest; break; } /* Magic blue. */ @@ -183,7 +183,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f } if (dest_size > sprite_size) { - static byte warning_level = 0; + static uint8_t warning_level = 0; DEBUG(sprite, warning_level, "Ignoring " OTTD_PRINTF64 " unused extra bytes from the sprite from %s at position %i", dest_size - sprite_size, file.GetSimplifiedFilename().c_str(), (int)file_pos); warning_level = 6; } @@ -191,7 +191,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f dest = dest_orig.get(); for (int i = 0; i < sprite->width * sprite->height; i++) { - byte *pixel = &dest[i * bpp]; + uint8_t *pixel = &dest[i * bpp]; if (colour_fmt & SCC_RGB) { sprite->data[i].r = *pixel++; @@ -202,7 +202,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f if (colour_fmt & SCC_PAL) { switch (sprite_type) { case SpriteType::Normal: sprite->data[i].m = file.NeedsPaletteRemap() ? _palmap_w2d[*pixel] : *pixel; break; - case SpriteType::Font: sprite->data[i].m = std::min(*pixel, 2u); break; + case SpriteType::Font: sprite->data[i].m = std::min(*pixel, 2u); break; default: sprite->data[i].m = *pixel; break; } /* Magic blue. */ @@ -225,7 +225,7 @@ uint8_t LoadSpriteV1(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, s /* Read the size and type */ int num = file.ReadWord(); - byte type = file.ReadByte(); + uint8_t type = file.ReadByte(); /* Type 0xFF indicates either a colourmap or some other non-sprite info; we do not handle them here */ if (type == 0xFF) return 0; @@ -311,13 +311,13 @@ uint8_t LoadSpriteV2(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, s do { int64_t num = file.ReadDword(); size_t start_pos = file.GetPos(); - byte type = file.ReadByte(); + uint8_t type = file.ReadByte(); /* Type 0xFF indicates either a colourmap or some other non-sprite info; we do not handle them here. */ if (type == 0xFF) return 0; - byte colour = type & SCC_MASK; - byte zoom = file.ReadByte(); + uint8_t colour = type & SCC_MASK; + uint8_t zoom = file.ReadByte(); bool is_wanted_colour_depth = (colour != 0 && (load_32bpp ? colour != SCC_PAL : colour == SCC_PAL)); bool is_wanted_zoom_lvl; diff --git a/src/spriteloader/grf.hpp b/src/spriteloader/grf.hpp index 868cb01577..119b312f49 100644 --- a/src/spriteloader/grf.hpp +++ b/src/spriteloader/grf.hpp @@ -14,9 +14,9 @@ /** Sprite loader for graphics coming from a (New)GRF. */ class SpriteLoaderGrf final : public SpriteLoader { - byte container_ver; + uint8_t container_ver; public: - SpriteLoaderGrf(byte container_ver) : container_ver(container_ver) {} + SpriteLoaderGrf(uint8_t container_ver) : container_ver(container_ver) {} uint8_t LoadSprite(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, uint count, uint16_t control_flags, uint8_t zoom_levels) override; }; diff --git a/src/spriteloader/sprite_file.cpp b/src/spriteloader/sprite_file.cpp index be7160628b..e5a701ecba 100644 --- a/src/spriteloader/sprite_file.cpp +++ b/src/spriteloader/sprite_file.cpp @@ -11,13 +11,13 @@ #include "sprite_file_type.hpp" /** Signature of a container version 2 GRF. */ -extern const byte _grf_cont_v2_sig[8] = {'G', 'R', 'F', 0x82, 0x0D, 0x0A, 0x1A, 0x0A}; +extern const uint8_t _grf_cont_v2_sig[8] = {'G', 'R', 'F', 0x82, 0x0D, 0x0A, 0x1A, 0x0A}; /** * Get the container version of the currently opened GRF file. * @return Container version of the GRF file or 0 if the file is corrupt/no GRF file. */ -static byte GetGRFContainerVersion(SpriteFile &file) +static uint8_t GetGRFContainerVersion(SpriteFile &file) { size_t pos = file.GetPos(); diff --git a/src/spriteloader/sprite_file_type.hpp b/src/spriteloader/sprite_file_type.hpp index 7820d33058..8b5866deec 100644 --- a/src/spriteloader/sprite_file_type.hpp +++ b/src/spriteloader/sprite_file_type.hpp @@ -27,7 +27,7 @@ DECLARE_ENUM_AS_BIT_SET(SpriteFileFlags) class SpriteFile : public RandomAccessFile { size_t content_begin; ///< The begin of the content of the sprite file, i.e. after the container metadata. bool palette_remap; ///< Whether or not a remap of the palette is required for this file. - byte container_version; ///< Container format of the sprite file. + uint8_t container_version; ///< Container format of the sprite file. public: SpriteFileFlags flags = SFF_NONE; @@ -46,7 +46,7 @@ public: * Get the version number of container type used by the file. * @return The version. */ - byte GetContainerVersion() const { return this->container_version; } + uint8_t GetContainerVersion() const { return this->container_version; } /** * Seek to the begin of the content, i.e. the position just after the container version has been determined. diff --git a/src/station.cpp b/src/station.cpp index b95209ef43..a416ba258c 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -186,7 +186,7 @@ void BaseStation::PostDestructor(size_t) InvalidateWindowData(WC_SELECT_STATION, 0, 0); } -bool BaseStation::SetRoadStopTileData(TileIndex tile, byte data, bool animation) +bool BaseStation::SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation) { for (RoadStopTileData &tile_data : this->custom_roadstop_tile_data) { if (tile_data.tile == tile) { diff --git a/src/station_base.h b/src/station_base.h index 75e36435e9..630c84fe87 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -586,18 +586,18 @@ struct GoodsEntry { max_waiting_cargo(0) {} - byte status; ///< Status of this cargo, see #GoodsEntryStatus. + uint8_t status; ///< Status of this cargo, see #GoodsEntryStatus. /** * Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo. * The unit used is STATION_RATING_TICKS. * This does not imply there was any cargo to load. */ - byte time_since_pickup; + uint8_t time_since_pickup; - byte last_vehicle_type; + uint8_t last_vehicle_type; - byte rating; ///< %Station rating for this cargo. + uint8_t rating; ///< %Station rating for this cargo. /** * Maximum speed (up to 255) of the last vehicle that tried to load this cargo. @@ -608,15 +608,15 @@ struct GoodsEntry { * - Ships: 0.5 * km-ish/h * - Aircraft: 8 * mph */ - byte last_speed; + uint8_t last_speed; /** * Age in years (up to 255) of the last vehicle that tried to load this cargo. * This does not imply there was any cargo to load. */ - byte last_age; + uint8_t last_age; - byte amount_fract; ///< Fractional part of the amount in the cargo list + uint8_t amount_fract; ///< Fractional part of the amount in the cargo list std::unique_ptr data; @@ -723,8 +723,8 @@ struct Airport : public TileArea { Airport() : TileArea(INVALID_TILE, 0, 0) {} uint64_t flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32 - byte type; ///< Type of this airport, @see AirportTypes - byte layout; ///< Airport layout number. + uint8_t type; ///< Type of this airport, @see AirportTypes + uint8_t layout; ///< Airport layout number. Direction rotation; ///< How this airport is rotated. PersistentStorage *psa; ///< Persistent storage for NewGRF airports. @@ -899,8 +899,8 @@ public: StationHadVehicleOfType had_vehicle_of_type; - byte time_since_load; - byte time_since_unload; + uint8_t time_since_load; + uint8_t time_since_unload; std::vector loading_vehicles; GoodsEntry goods[NUM_CARGO]; ///< Goods at this station @@ -967,7 +967,7 @@ public: bool IsWithinRangeOfDockingTile(TileIndex tile, uint max_distance) const; - uint32_t GetNewGRFVariable(const ResolverObject &object, uint16_t variable, byte parameter, bool *available) const override; + uint32_t GetNewGRFVariable(const ResolverObject &object, uint16_t variable, uint8_t parameter, bool *available) const override; void GetTileArea(TileArea *ta, StationType type) const override; }; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 473ac6bce3..8792804c31 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -918,7 +918,7 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z return cost; } -CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, byte layout, TileIndex northern_bridge_end, TileIndex southern_bridge_end, int bridge_height, +CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, uint8_t layout, TileIndex northern_bridge_end, TileIndex southern_bridge_end, int bridge_height, BridgeType bridge_type, TransportType bridge_transport_type) { assert(layout < 8); @@ -960,7 +960,7 @@ CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statsp } } -CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, byte layout) +CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, uint8_t layout) { if (!IsBridgeAbove(tile)) return CommandCost(); @@ -1017,7 +1017,7 @@ CommandCost IsRoadStopBridgeAboveOK(TileIndex tile, const RoadStopSpec *spec, bo * @param numtracks Number of platforms. * @return The cost in case of success, or an error code if it failed. */ -static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector &affected_vehicles, StationClassID spec_class, uint16_t spec_index, byte plat_len, byte numtracks) +static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector &affected_vehicles, StationClassID spec_class, uint16_t spec_index, uint8_t plat_len, uint8_t numtracks) { CommandCost cost(EXPENSES_CONSTRUCTION); int allowed_z = -1; @@ -1294,7 +1294,7 @@ CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta) return CommandCost(); } -static inline byte *CreateSingle(byte *layout, int n) +static inline uint8_t *CreateSingle(uint8_t *layout, int n) { int i = n; do *layout++ = 0; while (--i); @@ -1302,7 +1302,7 @@ static inline byte *CreateSingle(byte *layout, int n) return layout; } -static inline byte *CreateMulti(byte *layout, int n, byte b) +static inline uint8_t *CreateMulti(uint8_t *layout, int n, uint8_t b) { int i = n; do *layout++ = b; while (--i); @@ -1320,7 +1320,7 @@ static inline byte *CreateMulti(byte *layout, int n, byte b) * @param plat_len The length of the platforms. * @param statspec The specification of the station to (possibly) get the layout from. */ -void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec) +void GetStationLayout(uint8_t *layout, uint numtracks, uint plat_len, const StationSpec *statspec) { if (statspec != nullptr && statspec->layouts.size() >= plat_len && statspec->layouts[plat_len - 1].size() >= numtracks && @@ -1478,11 +1478,11 @@ static void RestoreTrainReservation(Train *v) CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32_t p1, uint32_t p2, uint64_t p3, const char *text, const CommandAuxiliaryBase *aux_data) { /* Unpack parameters */ - RailType rt = Extract(p1); - Axis axis = Extract(p1); - byte numtracks = GB(p1, 8, 8); - byte plat_len = GB(p1, 16, 8); - bool adjacent = HasBit(p1, 24); + RailType rt = Extract(p1); + Axis axis = Extract(p1); + uint8_t numtracks = GB(p1, 8, 8); + uint8_t plat_len = GB(p1, 16, 8); + bool adjacent = HasBit(p1, 24); StationClassID spec_class = Extract(p2); uint16_t spec_index = GB(p3, 0, 16); @@ -1529,12 +1529,12 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32_ const StationSpec *statspec = StationClass::Get(spec_class)->GetSpec(spec_index); TileIndexDiff tile_delta = (axis == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1)); - byte *layout_ptr = AllocaM(byte, numtracks * plat_len); + uint8_t *layout_ptr = AllocaM(uint8_t, numtracks * plat_len); GetStationLayout(layout_ptr, numtracks, plat_len, statspec); { TileIndex tile_track = tile_org; - byte *check_layout_ptr = layout_ptr; + uint8_t *check_layout_ptr = layout_ptr; for (uint i = 0; i < numtracks; i++) { TileIndex tile = tile_track; for (uint j = 0; j < plat_len; j++) { @@ -1588,7 +1588,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32_ if (flags & DC_EXEC) { - byte numtracks_orig; + uint8_t numtracks_orig; Track track; st->train_station = new_location; @@ -1612,7 +1612,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32_ TileIndex tile = tile_track; int w = plat_len; do { - byte layout = *layout_ptr++; + uint8_t layout = *layout_ptr++; if (IsRailStationTile(tile) && HasStationReservation(tile)) { /* Check for trains having a reservation for this tile. */ Train *v = GetTrainForReservation(tile, AxisToTrack(GetRailStationAxis(tile))); @@ -1631,7 +1631,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32_ /* Remove animation if overbuilding */ DeleteAnimatedTile(tile); - byte old_specindex = HasStationTileRail(tile) ? GetCustomStationSpecIndex(tile) : 0; + uint8_t old_specindex = HasStationTileRail(tile) ? GetCustomStationSpecIndex(tile) : 0; MakeRailStation(tile, st->owner, st->index, axis, layout & ~1, rt); /* Free the spec if we overbuild something */ if (old_specindex != specindex) DeallocateSpecFromStation(st, old_specindex); @@ -2722,8 +2722,8 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui bool reuse = (station_to_join != NEW_STATION); if (!reuse) station_to_join = INVALID_STATION; bool distant_join = (station_to_join != INVALID_STATION); - byte airport_type = GB(p1, 0, 8); - byte layout = GB(p1, 8, 8); + uint8_t airport_type = GB(p1, 0, 8); + uint8_t layout = GB(p1, 8, 8); if (distant_join && (!_settings_game.station.distant_join_stations || !Station::IsValidID(station_to_join))) return CMD_ERROR; @@ -3026,8 +3026,8 @@ static const TileIndexDiffC _dock_tileoffs_chkaround[] = { { 0, 0}, { 0, -1} }; -static const byte _dock_w_chk[4] = { 2, 1, 2, 1 }; -static const byte _dock_h_chk[4] = { 1, 2, 1, 2 }; +static const uint8_t _dock_w_chk[4] = { 2, 1, 2, 1 }; +static const uint8_t _dock_h_chk[4] = { 1, 2, 1, 2 }; /** * Build a dock/haven. @@ -3261,7 +3261,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags) #include "table/station_land.h" -const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx) +const DrawTileSprites *GetStationTileLayout(StationType st, uint8_t gfx) { return &_station_display_datas[st][gfx]; } @@ -4113,9 +4113,9 @@ static bool StationHandleBigTick(BaseStation *st) return true; } -static inline void byte_inc_sat(byte *p) +static inline void byte_inc_sat(uint8_t *p) { - byte b = *p + 1; + uint8_t b = *p + 1; if (b != 0) *p = b; } @@ -4236,7 +4236,7 @@ int GetVehicleAgeRating(const GoodsEntry *ge) { int rating = 0; - const byte age = ge->last_age; + const uint8_t age = ge->last_age; if (age < 30) rating += 10; if (age < 20) rating += 10; @@ -4617,7 +4617,7 @@ static void StationHandleSmallTick(BaseStation *st) { if ((st->facilities & FACIL_WAYPOINT) != 0 || !st->IsInUse()) return; - byte b = st->delete_ctr + 1; + uint8_t b = st->delete_ctr + 1; if (b >= STATION_RATING_TICKS) b = 0; st->delete_ctr = b; diff --git a/src/station_func.h b/src/station_func.h index 60ddd129b8..208c34457d 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -33,7 +33,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg); CargoTypes GetAcceptanceMask(const Station *st); CargoTypes GetEmptyMask(const Station *st); -const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); +const DrawTileSprites *GetStationTileLayout(StationType st, uint8_t gfx); void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); bool HasStationInUse(StationID station, bool include_company, CompanyID company); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 11dabdd67f..b07fb1b131 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -213,7 +213,7 @@ void CheckRedrawWaypointCoverage(Window *w, bool is_road) * @param amount Cargo amount * @param rating ratings data for that particular cargo */ -static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, byte rating) +static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, uint8_t rating) { static const uint units_full = 576; ///< number of units to show station as 'full' static const uint rating_full = 224; ///< rating needed so it is shown as 'full' @@ -261,7 +261,7 @@ protected: /* Runtime saved values */ struct FilterState { Listing last_sorting; - byte facilities; ///< types of stations of interest + uint8_t facilities; ///< types of stations of interest bool include_no_rating; ///< Whether we should include stations with no cargo rating. CargoTypes cargoes; ///< bitmap of cargo types to include }; @@ -375,8 +375,8 @@ protected: /** Sort stations by their rating */ static bool StationRatingMaxSorter(const Station * const &a, const Station * const &b, const CargoTypes &cargo_filter) { - byte maxr1 = 0; - byte maxr2 = 0; + uint8_t maxr1 = 0; + uint8_t maxr2 = 0; for (CargoID j : SetCargoBitIterator(cargo_filter)) { if (a->goods[j].HasRating()) maxr1 = std::max(maxr1, a->goods[j].rating); @@ -389,8 +389,8 @@ protected: /** Sort stations by their rating */ static bool StationRatingMinSorter(const Station * const &a, const Station * const &b, const CargoTypes &cargo_filter) { - byte minr1 = 255; - byte minr2 = 255; + uint8_t minr1 = 255; + uint8_t minr2 = 255; for (CargoID j : SetCargoBitIterator(cargo_filter)) { if (a->goods[j].HasRating()) minr1 = std::min(minr1, a->goods[j].rating); @@ -400,7 +400,7 @@ protected: return minr1 > minr2; } - static void PrepareStationVehiclesCallingSorter(byte facilities) + static void PrepareStationVehiclesCallingSorter(uint8_t facilities) { station_vehicle_calling_counts.clear(); @@ -960,7 +960,7 @@ enum SortOrder { class CargoDataEntry; -enum class CargoSortType : byte { +enum class CargoSortType : uint8_t { AsGrouping, ///< by the same principle the entries are being grouped Count, ///< by amount of cargo StationString, ///< by station name @@ -1579,7 +1579,7 @@ struct StationViewWindow : public Window { this->vscroll->SetCount(cargo.GetNumChildren()); // update scrollbar - byte have_veh_types = 0; + uint8_t have_veh_types = 0; IterateOrderRefcountMapForDestinationID(st->index, [&](CompanyID cid, OrderType order_type, VehicleType veh_type, uint32_t refcount) { SetBit(have_veh_types, veh_type); return true; diff --git a/src/station_map.h b/src/station_map.h index d693ba4fed..da02fbd068 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -17,7 +17,7 @@ #include "rail.h" #include "road.h" -typedef byte StationGfx; ///< Index of station graphics. @see _station_display_datas +typedef uint8_t StationGfx; ///< Index of station graphics. @see _station_display_datas /** * Get StationID from a tile @@ -643,7 +643,7 @@ inline bool IsCustomStationSpecIndex(TileIndex t) * @param specindex The new spec. * @pre HasStationTileRail(t) */ -inline void SetCustomStationSpecIndex(TileIndex t, byte specindex) +inline void SetCustomStationSpecIndex(TileIndex t, uint8_t specindex) { dbg_assert_tile(HasStationTileRail(t), t); _m[t].m4 = specindex; @@ -679,7 +679,7 @@ inline bool IsCustomRoadStopSpecIndex(TileIndex t) * @param specindex The new spec. * @pre IsAnyRoadStopTile(t) */ -inline void SetCustomRoadStopSpecIndex(TileIndex t, byte specindex) +inline void SetCustomRoadStopSpecIndex(TileIndex t, uint8_t specindex) { dbg_assert_tile(IsAnyRoadStopTile(t), t); SB(_me[t].m8, 0, 6, specindex); @@ -703,7 +703,7 @@ inline uint GetCustomRoadStopSpecIndex(TileIndex t) * @param random_bits The random bits. * @pre IsTileType(t, MP_STATION) */ -inline void SetStationTileRandomBits(TileIndex t, byte random_bits) +inline void SetStationTileRandomBits(TileIndex t, uint8_t random_bits) { dbg_assert_tile(IsTileType(t, MP_STATION), t); SB(_m[t].m3, 4, 4, random_bits); @@ -715,7 +715,7 @@ inline void SetStationTileRandomBits(TileIndex t, byte random_bits) * @pre IsTileType(t, MP_STATION) * @return The random bits for this station tile. */ -inline byte GetStationTileRandomBits(TileIndex t) +inline uint8_t GetStationTileRandomBits(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_STATION), t); return GB(_m[t].m3, 4, 4); @@ -730,7 +730,7 @@ inline byte GetStationTileRandomBits(TileIndex t) * @param section the StationGfx to be used for this tile * @param wc The water class of the station */ -inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byte section, WaterClass wc = WATER_CLASS_INVALID) +inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, uint8_t section, WaterClass wc = WATER_CLASS_INVALID) { SetTileType(t, MP_STATION); SetTileOwner(t, o); @@ -755,7 +755,7 @@ inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byt * @param section the StationGfx to be used for this tile * @param rt the railtype of this tile */ -inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt) +inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt) { MakeStation(t, o, sid, STATION_RAIL, section + a); SetRailType(t, rt); @@ -771,7 +771,7 @@ inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte se * @param section the StationGfx to be used for this tile * @param rt the railtype of this tile */ -inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt) +inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt) { MakeStation(t, o, sid, STATION_WAYPOINT, section + a); SetRailType(t, rt); @@ -824,7 +824,7 @@ inline void MakeDriveThroughRoadStop(TileIndex t, Owner station, Owner road, Own * @param section the StationGfx to be used for this tile * @param wc the type of water on this tile */ -inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section, WaterClass wc) +inline void MakeAirport(TileIndex t, Owner o, StationID sid, uint8_t section, WaterClass wc) { MakeStation(t, o, sid, STATION_AIRPORT, section, wc); } diff --git a/src/station_type.h b/src/station_type.h index 01d67d8bd5..9af8820e4f 100644 --- a/src/station_type.h +++ b/src/station_type.h @@ -45,13 +45,13 @@ enum StationType { }; /** Types of RoadStops */ -enum RoadStopType { +enum RoadStopType : uint8_t { ROADSTOP_BUS, ///< A standard stop for buses ROADSTOP_TRUCK, ///< A standard stop for trucks }; /** The facilities a station might be having */ -enum StationFacility : byte { +enum StationFacility : uint8_t { FACIL_NONE = 0, ///< The station has no facilities at all FACIL_TRAIN = 1 << 0, ///< Station with train station FACIL_TRUCK_STOP = 1 << 1, ///< Station with truck stops @@ -63,7 +63,7 @@ enum StationFacility : byte { DECLARE_ENUM_AS_BIT_SET(StationFacility) /** The vehicles that may have visited a station */ -enum StationHadVehicleOfType : byte { +enum StationHadVehicleOfType : uint8_t { HVOT_NONE = 0, ///< Station has seen no vehicles HVOT_TRAIN = 1 << 1, ///< Station has seen a train HVOT_BUS = 1 << 2, ///< Station has seen a bus @@ -88,7 +88,7 @@ enum CatchmentArea { MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled }; -enum StationDelivery : byte { +enum StationDelivery : uint8_t { SD_NEAREST_FIRST = 0, ///< Station delivers cargo only to the nearest accepting industry SD_BALANCED = 1 ///< Station delivers cargo equally among accepting industries }; diff --git a/src/stdafx.h b/src/stdafx.h index 071875baa6..1c25bd208a 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -304,8 +304,6 @@ #define debug_inline inline #endif -typedef uint8_t byte; - /* This is already defined in unix, but not in QNX Neutrino (6.x) or Cygwin. */ #if (!defined(UNIX) && !defined(__HAIKU__)) || defined(__QNXNTO__) || defined(__CYGWIN__) typedef unsigned int uint; diff --git a/src/story.cpp b/src/story.cpp index 0d92002c9b..35b283b80d 100644 --- a/src/story.cpp +++ b/src/story.cpp @@ -179,7 +179,7 @@ bool StoryPageButtonData::ValidateColour() const bool StoryPageButtonData::ValidateFlags() const { - byte flags = GB(this->referenced_id, 24, 8); + uint8_t flags = GB(this->referenced_id, 24, 8); /* Don't allow float left and right together */ if ((flags & SPBF_FLOAT_LEFT) && (flags & SPBF_FLOAT_RIGHT)) return false; /* Don't allow undefined flags */ @@ -196,7 +196,7 @@ bool StoryPageButtonData::ValidateCursor() const /** Verity that the data stored a valid VehicleType value */ bool StoryPageButtonData::ValidateVehicleType() const { - byte vehtype = GB(this->referenced_id, 16, 8); + uint8_t vehtype = GB(this->referenced_id, 16, 8); return vehtype == VEH_INVALID || vehtype < VEH_COMPANY_END; } diff --git a/src/story_base.h b/src/story_base.h index adf540d4ba..8a78506220 100644 --- a/src/story_base.h +++ b/src/story_base.h @@ -27,7 +27,7 @@ extern uint32_t _story_page_next_sort_value; /* * Each story page element is one of these types. */ -enum StoryPageElementType : byte { +enum StoryPageElementType : uint8_t { SPET_TEXT = 0, ///< A text element. SPET_LOCATION, ///< An element that references a tile along with a one-line text. SPET_GOAL, ///< An element that references a goal. @@ -39,10 +39,10 @@ enum StoryPageElementType : byte { }; /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Flags available for buttons */ -enum StoryPageButtonFlags : byte { +enum StoryPageButtonFlags : uint8_t { SPBF_NONE = 0, SPBF_FLOAT_LEFT = 1 << 0, SPBF_FLOAT_RIGHT = 1 << 1, @@ -50,7 +50,7 @@ enum StoryPageButtonFlags : byte { DECLARE_ENUM_AS_BIT_SET(StoryPageButtonFlags) /** Mouse cursors usable by story page buttons. */ -enum StoryPageButtonCursor : byte { +enum StoryPageButtonCursor : uint8_t { SPBC_MOUSE, SPBC_ZZZ, SPBC_BUOY, @@ -111,7 +111,7 @@ enum StoryPageButtonCursor : byte { }; /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * Checks if a StoryPageButtonCursor value is valid. diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 81fa7264da..1de2fdc83a 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -422,7 +422,7 @@ struct LanguageFileWriter : LanguageWriter, FileWriter { void WriteHeader(const LanguagePackHeader *header) override { - this->Write((const byte *)header, sizeof(*header)); + this->Write((const uint8_t *)header, sizeof(*header)); } void Finalise() override @@ -433,7 +433,7 @@ struct LanguageFileWriter : LanguageWriter, FileWriter { this->FileWriter::Finalise(); } - void Write(const byte *buffer, size_t length) override + void Write(const uint8_t *buffer, size_t length) override { if (length == 0) return; if (fwrite(buffer, sizeof(*buffer), length, this->fh) != length) { diff --git a/src/strgen/strgen.h b/src/strgen/strgen.h index 0c79a141de..2e6b12206d 100644 --- a/src/strgen/strgen.h +++ b/src/strgen/strgen.h @@ -136,7 +136,7 @@ struct LanguageWriter { * @param buffer The buffer to write. * @param length The amount of byte to write. */ - virtual void Write(const byte *buffer, size_t length) = 0; + virtual void Write(const uint8_t *buffer, size_t length) = 0; /** * Finalise writing the file. diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp index 34fcc80eb2..e4eca51ab3 100644 --- a/src/strgen/strgen_base.cpp +++ b/src/strgen/strgen_base.cpp @@ -170,12 +170,12 @@ static ParsedCommandStruct _cur_pcs; static int _cur_argidx; /** The buffer for writing a single string. */ -struct Buffer : std::vector { +struct Buffer : std::vector { /** * Convenience method for adding a byte. * @param value The value to add. */ - void AppendByte(byte value) + void AppendByte(uint8_t value) { this->push_back(value); } @@ -313,7 +313,7 @@ static int TranslateArgumentIdx(int arg, int offset = 0); static void EmitWordList(Buffer *buffer, const char * const *words, uint nw) { buffer->AppendByte(nw); - for (uint i = 0; i < nw; i++) buffer->AppendByte((byte)strlen(words[i]) + 1); + for (uint i = 0; i < nw; i++) buffer->AppendByte((uint8_t)strlen(words[i]) + 1); for (uint i = 0; i < nw; i++) { for (uint j = 0; words[i][j] != '\0'; j++) buffer->AppendByte(words[i][j]); buffer->AppendByte(0); @@ -943,7 +943,7 @@ void LanguageWriter::WriteLength(uint length) buffer[offs++] = (length >> 8) | 0xC0; } buffer[offs++] = length & 0xFF; - this->Write((byte*)buffer, offs); + this->Write((uint8_t*)buffer, offs); } /** @@ -1020,7 +1020,7 @@ void LanguageWriter::WriteLang(const StringData &data) * <0x9E> * Each LEN is printed using 2 bytes in big endian order. */ buffer.AppendUtf8(SCC_SWITCH_CASE); - buffer.AppendByte((byte)ls->translated_cases.size()); + buffer.AppendByte((uint8_t)ls->translated_cases.size()); /* Write each case */ for (const Case &c : ls->translated_cases) { diff --git a/src/string.cpp b/src/string.cpp index 3d738d8399..19ef869d1b 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -210,7 +210,7 @@ const char *str_fix_scc_encoded(char *str, const char *last) * @param data Array to format * @return Converted string. */ -std::string FormatArrayAsHex(std::span data, bool upper_case) +std::string FormatArrayAsHex(std::span data, bool upper_case) { std::string hex_output; hex_output.resize(data.size() * 2); diff --git a/src/string_func.h b/src/string_func.h index c48d3571af..edb27d8f00 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -41,7 +41,7 @@ int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) std::string CDECL stdstr_fmt(const char *str, ...) WARN_FORMAT(1, 2); std::string stdstr_vfmt(const char *str, va_list va) WARN_FORMAT(1, 0); -std::string FormatArrayAsHex(std::span data, bool upper_case = false); +std::string FormatArrayAsHex(std::span data, bool upper_case = false); char *StrMakeValidInPlace(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK) NOACCESS(2); [[nodiscard]] std::string StrMakeValid(std::string_view str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK); diff --git a/src/strings.cpp b/src/strings.cpp index 1a48248060..c9c0776cf3 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -708,11 +708,11 @@ static int DeterminePluralForm(int64_t count, int plural_form) static const char *ParseStringChoice(const char *b, uint form, StringBuilder builder) { /* {Length of each string} {each string} */ - uint n = (byte)*b++; + uint n = (uint8_t)*b++; uint pos, i, mypos = 0; for (i = pos = 0; i != n; i++) { - uint len = (byte)*b++; + uint len = (uint8_t)*b++; if (i == form) mypos = pos; pos += len; } @@ -1310,7 +1310,7 @@ static void FormatString(StringBuilder builder, const char *str_arg, StringParam case SCC_GENDER_LIST: { // {G 0 Der Die Das} /* First read the meta data from the language file. */ - size_t offset = orig_offset + (byte)*str++; + size_t offset = orig_offset + (uint8_t)*str++; int gender = 0; if (!dry_run && args.GetTypeAtOffset(offset) != 0) { /* Now we need to figure out what text to resolve, i.e. @@ -1333,7 +1333,7 @@ static void FormatString(StringBuilder builder, const char *str_arg, StringParam const char *s = buffer.c_str(); char32_t c = Utf8Consume(&s); /* Does this string have a gender, if so, set it */ - if (c == SCC_GENDER_INDEX) gender = (byte)s[0]; + if (c == SCC_GENDER_INDEX) gender = (uint8_t)s[0]; } str = ParseStringChoice(str, gender, builder); break; @@ -1353,30 +1353,30 @@ static void FormatString(StringBuilder builder, const char *str_arg, StringParam case SCC_PLURAL_LIST: { // {P} int plural_form = *str++; // contains the plural form for this string - size_t offset = orig_offset + (byte)*str++; + size_t offset = orig_offset + (uint8_t)*str++; int64_t v = args.GetParam(offset); // contains the number that determines plural str = ParseStringChoice(str, DeterminePluralForm(v, plural_form), builder); break; } case SCC_ARG_INDEX: { // Move argument pointer - args.SetOffset(orig_offset + (byte)*str++); + args.SetOffset(orig_offset + (uint8_t)*str++); break; } case SCC_SET_CASE: { // {SET_CASE} /* This is a pseudo command, it's outputted when someone does {STRING.ack} * The modifier is added to all subsequent GetStringWithArgs that accept the modifier. */ - next_substr_case_index = (byte)*str++; + next_substr_case_index = (uint8_t)*str++; break; } case SCC_SWITCH_CASE: { // {Used to implement case switching} /* <0x9E> * Each LEN is printed using 2 bytes in big endian order. */ - uint num = (byte)*str++; + uint num = (uint8_t)*str++; while (num) { - if ((byte)str[0] == case_index) { + if ((uint8_t)str[0] == case_index) { /* Found the case, adjust str pointer and continue */ str += 3; break; @@ -2330,17 +2330,17 @@ bool ReadLanguagePack(const LanguageMetadata *lang) /* Fill offsets */ char *s = lang_pack->data; - len = (byte)*s++; + len = (uint8_t)*s++; for (uint i = 0; i < count; i++) { if (s + len >= end) return false; if (len >= 0xC0) { - len = ((len & 0x3F) << 8) + (byte)*s++; + len = ((len & 0x3F) << 8) + (uint8_t)*s++; if (s + len >= end) return false; } offs[i] = s; s += len; - len = (byte)*s; + len = (uint8_t)*s; *s++ = '\0'; // zero terminate the string } @@ -2440,7 +2440,7 @@ const char *GetCurrentLocale(const char *param); * @param newgrflangid NewGRF languages ID to check. * @return The language's metadata, or nullptr if it is not known. */ -const LanguageMetadata *GetLanguage(byte newgrflangid) +const LanguageMetadata *GetLanguage(uint8_t newgrflangid) { for (const LanguageMetadata &lang : _languages) { if (newgrflangid == lang.newgrflangid) return ⟨ diff --git a/src/subsidy_type.h b/src/subsidy_type.h index cc5435ad87..2f613c4e90 100644 --- a/src/subsidy_type.h +++ b/src/subsidy_type.h @@ -13,7 +13,7 @@ #include "core/enum_type.hpp" /** What part of a subsidy is something? */ -enum PartOfSubsidy : byte { +enum PartOfSubsidy : uint8_t { POS_NONE = 0, ///< nothing POS_SRC = 1 << 0, ///< bit 0 set -> town/industry is source of subsidised path POS_DST = 1 << 1, ///< bit 1 set -> town/industry is destination of subsidised path diff --git a/src/table/airport_movement.h b/src/table/airport_movement.h index c1c0cab878..a25171e299 100644 --- a/src/table/airport_movement.h +++ b/src/table/airport_movement.h @@ -16,10 +16,10 @@ * Finite sTate mAchine --> FTA */ struct AirportFTAbuildup { - byte position; ///< The position that an airplane is at. - byte heading; ///< The current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.). - uint64_t block;///< The block this position is on on the airport (st->airport.flags). - byte next; ///< Next position from this position. + uint8_t position; ///< The position that an airplane is at. + uint8_t heading; ///< The current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.). + uint64_t block; ///< The block this position is on on the airport (st->airport.flags). + uint8_t next; ///< Next position from this position. }; /////////////////////////////////////////////////////////////////////// @@ -407,7 +407,7 @@ static const AirportMovingData _airport_moving_data_oilrig[9] = { /////////////////////////////////////////////////////////////////////// /////**********Movement Machine on Airports*********************/////// -static const byte _airport_entries_dummy[] = {0, 1, 2, 3}; +static const uint8_t _airport_entries_dummy[] = {0, 1, 2, 3}; static const AirportFTAbuildup _airport_fta_dummy[] = { { 0, TO_ALL, 0, 3}, { 1, TO_ALL, 0, 0}, @@ -419,8 +419,8 @@ static const AirportFTAbuildup _airport_fta_dummy[] = { /* First element of terminals array tells us how many depots there are (to know size of array) * this may be changed later when airports are moved to external file */ static const HangarTileTable _airport_depots_country[] = { {{3, 0}, DIR_SE, 0} }; -static const byte _airport_terminal_country[] = {1, 2}; -static const byte _airport_entries_country[] = {16, 15, 18, 17}; +static const uint8_t _airport_terminal_country[] = {1, 2}; +static const uint8_t _airport_entries_country[] = {16, 15, 18, 17}; static const AirportFTAbuildup _airport_fta_country[] = { { 0, HANGAR, NOTHING_block, 1 }, { 1, TERMGROUP, AIRPORT_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TERM1, TERM1_block, 2 }, { 1, TERM2, 0, 4 }, { 1, HELITAKEOFF, 0, 19 }, { 1, TO_ALL, 0, 6 }, @@ -451,8 +451,8 @@ static const AirportFTAbuildup _airport_fta_country[] = { }; static const HangarTileTable _airport_depots_commuter[] = { {{4, 0}, DIR_SE, 0} }; -static const byte _airport_terminal_commuter[] = { 1, 3 }; -static const byte _airport_entries_commuter[] = {22, 21, 24, 23}; +static const uint8_t _airport_terminal_commuter[] = { 1, 3 }; +static const uint8_t _airport_entries_commuter[] = {22, 21, 24, 23}; static const AirportFTAbuildup _airport_fta_commuter[] = { { 0, HANGAR, NOTHING_block, 1 }, { 0, HELITAKEOFF, TAXIWAY_BUSY_block, 1 }, { 0, TO_ALL, 0, 1 }, { 1, TERMGROUP, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TAKEOFF, 0, 11 }, { 1, TERM1, TAXIWAY_BUSY_block, 10 }, { 1, TERM2, TAXIWAY_BUSY_block, 10 }, { 1, TERM3, TAXIWAY_BUSY_block, 10 }, { 1, HELIPAD1, TAXIWAY_BUSY_block, 10 }, { 1, HELIPAD2, TAXIWAY_BUSY_block, 10 }, { 1, HELITAKEOFF, TAXIWAY_BUSY_block, 37 }, { 1, TO_ALL, 0, 0 }, @@ -502,8 +502,8 @@ static const AirportFTAbuildup _airport_fta_commuter[] = { }; static const HangarTileTable _airport_depots_city[] = { {{5, 0}, DIR_SE, 0} }; -static const byte _airport_terminal_city[] = { 1, 3 }; -static const byte _airport_entries_city[] = {26, 29, 27, 28}; +static const uint8_t _airport_terminal_city[] = { 1, 3 }; +static const uint8_t _airport_entries_city[] = {26, 29, 27, 28}; static const AirportFTAbuildup _airport_fta_city[] = { { 0, HANGAR, NOTHING_block, 1 }, { 0, TAKEOFF, OUT_WAY_block, 1 }, { 0, TO_ALL, 0, 1 }, { 1, TERMGROUP, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TERM2, 0, 6 }, { 1, TERM3, 0, 6 }, { 1, TO_ALL, 0, 7 }, // for all else, go to 7 @@ -543,8 +543,8 @@ static const AirportFTAbuildup _airport_fta_city[] = { }; static const HangarTileTable _airport_depots_metropolitan[] = { {{5, 0}, DIR_SE, 0} }; -static const byte _airport_terminal_metropolitan[] = { 1, 3 }; -static const byte _airport_entries_metropolitan[] = {20, 19, 22, 21}; +static const uint8_t _airport_terminal_metropolitan[] = { 1, 3 }; +static const uint8_t _airport_entries_metropolitan[] = {20, 19, 22, 21}; static const AirportFTAbuildup _airport_fta_metropolitan[] = { { 0, HANGAR, NOTHING_block, 1 }, { 1, TERMGROUP, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TERM2, 0, 6 }, { 1, TERM3, 0, 6 }, { 1, TO_ALL, 0, 7 }, // for all else, go to 7 @@ -582,8 +582,8 @@ static const AirportFTAbuildup _airport_fta_metropolitan[] = { }; static const HangarTileTable _airport_depots_international[] = { {{0, 3}, DIR_SE, 0}, {{6, 1}, DIR_SE, 1} }; -static const byte _airport_terminal_international[] = { 2, 3, 3 }; -static const byte _airport_entries_international[] = { 38, 37, 40, 39 }; +static const uint8_t _airport_terminal_international[] = { 2, 3, 3 }; +static const uint8_t _airport_entries_international[] = { 38, 37, 40, 39 }; static const AirportFTAbuildup _airport_fta_international[] = { { 0, HANGAR, NOTHING_block, 2 }, { 0, TERMGROUP, TERM_GROUP1_block, 0 }, { 0, TERMGROUP, TERM_GROUP2_ENTER1_block, 1 }, { 0, HELITAKEOFF, AIRPORT_ENTRANCE_block, 2 }, { 0, TO_ALL, 0, 2 }, { 1, HANGAR, NOTHING_block, 3 }, { 1, TERMGROUP, HANGAR2_AREA_block, 1 }, { 1, HELITAKEOFF, HANGAR2_AREA_block, 3 }, { 1, TO_ALL, 0, 3 }, @@ -649,8 +649,8 @@ static const AirportFTAbuildup _airport_fta_international[] = { /* intercontinental */ static const HangarTileTable _airport_depots_intercontinental[] = { {{0, 5}, DIR_SE, 0}, {{8, 4}, DIR_SE, 1} }; -static const byte _airport_terminal_intercontinental[] = { 2, 4, 4 }; -static const byte _airport_entries_intercontinental[] = { 44, 43, 46, 45 }; +static const uint8_t _airport_terminal_intercontinental[] = { 2, 4, 4 }; +static const uint8_t _airport_entries_intercontinental[] = { 44, 43, 46, 45 }; static const AirportFTAbuildup _airport_fta_intercontinental[] = { { 0, HANGAR, NOTHING_block, 2 }, { 0, TERMGROUP, HANGAR1_AREA_block | TERM_GROUP1_block, 0 }, { 0, TERMGROUP, HANGAR1_AREA_block | TERM_GROUP1_block, 1 }, { 0, TAKEOFF, HANGAR1_AREA_block | TERM_GROUP1_block, 2 }, { 0, TO_ALL, 0, 2 }, { 1, HANGAR, NOTHING_block, 3 }, { 1, TERMGROUP, HANGAR2_AREA_block, 1 }, { 1, TERMGROUP, HANGAR2_AREA_block, 0 }, { 1, TO_ALL, 0, 3 }, @@ -742,7 +742,7 @@ static const AirportFTAbuildup _airport_fta_intercontinental[] = { /* heliports, oilrigs don't have depots */ -static const byte _airport_entries_heliport[] = { 7, 7, 7, 7 }; +static const uint8_t _airport_entries_heliport[] = { 7, 7, 7, 7 }; static const AirportFTAbuildup _airport_fta_heliport[] = { { 0, HELIPAD1, HELIPAD1_block, 1 }, { 1, HELITAKEOFF, NOTHING_block, 0 }, // takeoff @@ -761,7 +761,7 @@ static const AirportFTAbuildup _airport_fta_heliport[] = { /* helidepots */ static const HangarTileTable _airport_depots_helidepot[] = { {{1, 0}, DIR_SE, 0} }; -static const byte _airport_entries_helidepot[] = { 4, 4, 4, 4 }; +static const uint8_t _airport_entries_helidepot[] = { 4, 4, 4, 4 }; static const AirportFTAbuildup _airport_fta_helidepot[] = { { 0, HANGAR, NOTHING_block, 1 }, { 1, TERMGROUP, HANGAR2_AREA_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, HELIPAD1, HELIPAD1_block, 14 }, { 1, HELITAKEOFF, 0, 15 }, { 1, TO_ALL, 0, 0 }, @@ -790,7 +790,7 @@ static const AirportFTAbuildup _airport_fta_helidepot[] = { /* helistation */ static const HangarTileTable _airport_depots_helistation[] = { {{0, 0}, DIR_SE, 0} }; -static const byte _airport_entries_helistation[] = { 25, 25, 25, 25 }; +static const uint8_t _airport_entries_helistation[] = { 25, 25, 25, 25 }; static const AirportFTAbuildup _airport_fta_helistation[] = { { 0, HANGAR, NOTHING_block, 8 }, { 0, HELIPAD1, 0, 1 }, { 0, HELIPAD2, 0, 1 }, { 0, HELIPAD3, 0, 1 }, { 0, HELITAKEOFF, 0, 1 }, { 0, TO_ALL, 0, 0 }, { 1, TERMGROUP, HANGAR2_AREA_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, HELITAKEOFF, 0, 3 }, { 1, TO_ALL, 0, 4 }, diff --git a/src/table/clear_land.h b/src/table/clear_land.h index bc6718c6b5..3101e27040 100644 --- a/src/table/clear_land.h +++ b/src/table/clear_land.h @@ -18,28 +18,28 @@ static const SpriteID _landscape_clear_sprites_rough[8] = { SPR_FLAT_ROUGH_LAND_2, }; -static const byte _fence_mod_by_tileh_sw[32] = { +static const uint8_t _fence_mod_by_tileh_sw[32] = { 0, 2, 4, 0, 0, 2, 4, 0, 0, 2, 4, 0, 0, 2, 4, 0, 0, 2, 4, 0, 0, 2, 4, 4, 0, 2, 4, 2, 0, 2, 4, 0, }; -static const byte _fence_mod_by_tileh_se[32] = { +static const uint8_t _fence_mod_by_tileh_se[32] = { 1, 1, 5, 5, 3, 3, 1, 1, 1, 1, 5, 5, 3, 3, 1, 1, 1, 1, 5, 5, 3, 3, 1, 5, 1, 1, 5, 5, 3, 3, 3, 1, }; -static const byte _fence_mod_by_tileh_ne[32] = { +static const uint8_t _fence_mod_by_tileh_ne[32] = { 0, 0, 0, 0, 4, 4, 4, 4, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 2, 2, 2, 2, 0, 2, 4, 0, }; -static const byte _fence_mod_by_tileh_nw[32] = { +static const uint8_t _fence_mod_by_tileh_nw[32] = { 1, 5, 1, 5, 1, 5, 1, 5, 3, 1, 3, 1, 3, 1, 3, 1, 1, 5, 1, 5, 1, 5, 1, 5, diff --git a/src/table/darklight_colours.h b/src/table/darklight_colours.h index aa9c6d8093..bd4203c6a3 100644 --- a/src/table/darklight_colours.h +++ b/src/table/darklight_colours.h @@ -9,7 +9,7 @@ * @file darklight_colours.h The colour tables to lighten and darken. */ -static const byte _lighten_colour[] = { +static const uint8_t _lighten_colour[] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, // 0 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x0F, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x0F, // 1 @@ -29,7 +29,7 @@ static const byte _lighten_colour[] = { 0xE8, 0xF1, 0xF2, 0xF3, 0xF4, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x0F, 0xFC, 0xFD, 0xFF, // F }; -static const byte _darken_colour[] = { +static const uint8_t _darken_colour[] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, // 0 0x02, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x02, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, // 1 diff --git a/src/table/elrail_data.h b/src/table/elrail_data.h index 5b14eb2de3..33dd53493f 100644 --- a/src/table/elrail_data.h +++ b/src/table/elrail_data.h @@ -40,7 +40,7 @@ enum TileSource { static const uint NUM_TRACKS_AT_PCP = 6; /** Which PPPs are possible at all on a given PCP */ -static const byte AllowedPPPonPCP[DIAGDIR_END] = { +static const uint8_t AllowedPPPonPCP[DIAGDIR_END] = { 1 << DIR_N | 1 << DIR_E | 1 << DIR_SE | 1 << DIR_S | 1 << DIR_W | 1 << DIR_NW, 1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W, 1 << DIR_N | 1 << DIR_E | 1 << DIR_SE | 1 << DIR_S | 1 << DIR_W | 1 << DIR_NW, @@ -52,7 +52,7 @@ static const byte AllowedPPPonPCP[DIAGDIR_END] = { * the following system is used: if you rotate the PCP so that it is in the * north, the eastern PPP belongs to the tile. */ -static const byte OwnedPPPonPCP[DIAGDIR_END] = { +static const uint8_t OwnedPPPonPCP[DIAGDIR_END] = { 1 << DIR_SE | 1 << DIR_S | 1 << DIR_SW | 1 << DIR_W, 1 << DIR_N | 1 << DIR_SW | 1 << DIR_W | 1 << DIR_NW, 1 << DIR_N | 1 << DIR_NE | 1 << DIR_E | 1 << DIR_NW, @@ -76,7 +76,7 @@ static const DiagDirection PCPpositions[TRACK_END][2] = { * which are not on either end of the track are fully preferred. * @see PCPpositions */ -static const byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { +static const uint8_t PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { { // X 1 << DIR_NE | 1 << DIR_SE | 1 << DIR_NW, // NE PCP_NOT_ON_TRACK, // SE @@ -119,7 +119,7 @@ static const byte PreferredPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { * so there are certain tiles which we ignore. A straight line is found if * we have exactly two PPPs. */ -static const byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { +static const uint8_t IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { { // Ignore group 1, X and Y tracks { // X even, Y even IGNORE_NONE, @@ -194,7 +194,7 @@ static const byte IgnoredPCP[NUM_IGNORE_GROUPS][TLG_END][DIAGDIR_END] = { #undef NO_IGNORE /** Which pylons can definitely NOT be built */ -static const byte DisallowedPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { +static const uint8_t DisallowedPPPofTrackAtPCP[TRACK_END][DIAGDIR_END] = { {1 << DIR_SW | 1 << DIR_NE, 0, 1 << DIR_SW | 1 << DIR_NE, 0 }, // X {0, 1 << DIR_NW | 1 << DIR_SE, 0, 1 << DIR_NW | 1 << DIR_SE}, // Y {1 << DIR_W | 1 << DIR_E, 0, 0, 1 << DIR_W | 1 << DIR_E }, // UPPER diff --git a/src/table/industry_land.h b/src/table/industry_land.h index c0c50fa7d5..a8cae114c7 100644 --- a/src/table/industry_land.h +++ b/src/table/industry_land.h @@ -17,9 +17,9 @@ */ struct DrawIndustryAnimationStruct { int x; ///< coordinate x of the first image offset - byte image_1; ///< image offset 1 - byte image_2; ///< image offset 2 - byte image_3; ///< image offset 3 + uint8_t image_1; ///< image offset 1 + uint8_t image_2; ///< image offset 2 + uint8_t image_3; ///< image offset 3 }; /** @@ -27,8 +27,8 @@ struct DrawIndustryAnimationStruct { * industries animations */ struct DrawIndustryCoordinates { - byte x; ///< coordinate x of the pair - byte y; ///< coordinate y of the pair + uint8_t x; ///< coordinate x of the pair + uint8_t y; ///< coordinate y of the pair }; /** @@ -924,7 +924,7 @@ static const DrawIndustryAnimationStruct _industry_anim_offs_toys[] = { #undef MD /* this is ONLY used for Toffee Quarry*/ -static const byte _industry_anim_offs_toffee[] = { +static const uint8_t _industry_anim_offs_toffee[] = { 255, 0, 0, 0, 2, 4, 6, 8, 10, 9, 7, 5, 3, 1, 255, 0, 0, 0, 2, 4, 6, 8, 10, 9, 7, 5, 3, 1, 255, 0, @@ -935,7 +935,7 @@ static const byte _industry_anim_offs_toffee[] = { }; /* this is ONLY used for the Bubble Generator*/ -static const byte _industry_anim_offs_bubbles[] = { +static const uint8_t _industry_anim_offs_bubbles[] = { 68, 69, 71, 74, 77, 80, 83, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 85, 84, 83, 82, 81, 80, 79, 78, diff --git a/src/table/palette_convert.h b/src/table/palette_convert.h index 0a3e3d4a4e..2a4ed36dda 100644 --- a/src/table/palette_convert.h +++ b/src/table/palette_convert.h @@ -8,7 +8,7 @@ /** @file palette_convert.h Translation tables from one GRF to another GRF. */ /** Converting from the Windows palette to the DOS palette */ -extern const byte _palmap_w2d[] = { +extern const uint8_t _palmap_w2d[] = { 0, 1, 2, 3, 4, 5, 6, 7, // 0..7 8, 9, 10, 11, 12, 13, 14, 15, // 8..15 16, 17, 18, 19, 20, 21, 22, 23, // 16..23 @@ -44,7 +44,7 @@ extern const byte _palmap_w2d[] = { }; /** Converting from the DOS palette to the Windows palette */ -static const byte _palmap_d2w[] = { +static const uint8_t _palmap_d2w[] = { 0, 215, 216, 136, 88, 106, 32, 33, // 0..7 40, 245, 10, 11, 12, 13, 14, 15, // 8..15 16, 17, 18, 19, 20, 21, 22, 23, // 16..23 diff --git a/src/table/roadveh_movement.h b/src/table/roadveh_movement.h index bb4c5df3b2..809a973ee8 100644 --- a/src/table/roadveh_movement.h +++ b/src/table/roadveh_movement.h @@ -1084,7 +1084,7 @@ static const RoadDriveEntry * const _road_road_drive_data[] = { }; /** Table of road stop stop frames, when to stop at a road stop. */ -extern const byte _road_stop_stop_frame[] = { +extern const uint8_t _road_stop_stop_frame[] = { /* Duplicated left and right because of "entered stop" bit */ 20, 20, 16, 16, 20, 20, 16, 16, 19, 19, 15, 15, 19, 19, 15, 15, diff --git a/src/table/string_colours.h b/src/table/string_colours.h index 3af980bae4..cc6347d56b 100644 --- a/src/table/string_colours.h +++ b/src/table/string_colours.h @@ -8,7 +8,7 @@ /** @file string_colours.h The colour translation of GRF's strings. */ /** Colour mapping for #TextColour. */ -static const byte _string_colourmap[17] = { +static const uint8_t _string_colourmap[17] = { 150, // TC_BLUE 12, // TC_SILVER 189, // TC_GOLD diff --git a/src/table/train_cmd.h b/src/table/train_cmd.h index f9419990b9..3a7b00a60b 100644 --- a/src/table/train_cmd.h +++ b/src/table/train_cmd.h @@ -22,7 +22,7 @@ static const SpriteID _engine_sprite_base[] = { /* For how many directions do we have sprites? (8 or 4; if 4, the other 4 * directions are symmetric. */ -static const byte _engine_sprite_and[] = { +static const uint8_t _engine_sprite_and[] = { 7, 7, 7, 7, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 3, 7, 3, 7, 7, 7, @@ -36,7 +36,7 @@ static const byte _engine_sprite_and[] = { }; /* Non-zero for multihead trains. */ -static const byte _engine_sprite_add[] = { +static const uint8_t _engine_sprite_add[] = { 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, @@ -50,7 +50,7 @@ static const byte _engine_sprite_add[] = { }; -static const byte _wagon_full_adder[] = { +static const uint8_t _wagon_full_adder[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/table/tree_land.h b/src/table/tree_land.h index e1e36bee6f..767a9742a4 100644 --- a/src/table/tree_land.h +++ b/src/table/tree_land.h @@ -12,8 +12,8 @@ #include "../sprite.h" -static const byte _tree_base_by_landscape[4] = {0, 12, 20, 32}; -static const byte _tree_count_by_landscape[4] = {12, 8, 12, 9}; +static const uint8_t _tree_base_by_landscape[4] = {0, 12, 20, 32}; +static const uint8_t _tree_count_by_landscape[4] = {12, 8, 12, 9}; #define MAX_TREE_COUNT_BY_LANDSCAPE 12 struct TreePos { diff --git a/src/table/unicode.h b/src/table/unicode.h index c8eeba6e7f..82bda7221c 100644 --- a/src/table/unicode.h +++ b/src/table/unicode.h @@ -9,10 +9,10 @@ struct DefaultUnicodeMapping { char32_t code; ///< Unicode value - byte key; ///< Character index of sprite + uint8_t key; ///< Character index of sprite }; -static const byte CLRA = 0; ///< Identifier to clear all glyphs at this codepoint +static const uint8_t CLRA = 0; ///< Identifier to clear all glyphs at this codepoint /* Default unicode mapping table for sprite based glyphs. * This table allows us use unicode characters even though the glyphs don't diff --git a/src/tbtr_template_vehicle.h b/src/tbtr_template_vehicle.h index e3efedebd7..e979ac3a60 100644 --- a/src/tbtr_template_vehicle.h +++ b/src/tbtr_template_vehicle.h @@ -103,9 +103,9 @@ public: EngineID engine_type; ///< The type of engine used for this vehicle. CargoID cargo_type; ///< type of cargo this vehicle is carrying uint16_t cargo_cap; ///< total capacity - byte cargo_subtype; + uint8_t cargo_subtype; - byte subtype; + uint8_t subtype; RailType railtype; VehicleID index; diff --git a/src/tbtr_template_vehicle_func.cpp b/src/tbtr_template_vehicle_func.cpp index 27eaaa8216..70adb4367a 100644 --- a/src/tbtr_template_vehicle_func.cpp +++ b/src/tbtr_template_vehicle_func.cpp @@ -398,7 +398,7 @@ void TransferCargoForTrain(Train *old_veh, Train *new_head) assert(new_head->IsPrimaryVehicle() || new_head->IsFreeWagon()); const CargoID cargo_type = old_veh->cargo_type; - const byte cargo_subtype = old_veh->cargo_subtype; + const uint8_t cargo_subtype = old_veh->cargo_subtype; // how much cargo has to be moved (if possible) uint remainingAmount = old_veh->cargo.TotalCount(); diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 141469eca6..9e8493b82d 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -456,7 +456,7 @@ Window *ShowTerraformToolbar(Window *link) return w; } -static byte _terraform_size = 1; +static uint8_t _terraform_size = 1; /** * Raise/Lower a bigger chunk of land at the same time in the editor. When diff --git a/src/tests/string_func.cpp b/src/tests/string_func.cpp index 526c8f443a..e0ea052cbc 100644 --- a/src/tests/string_func.cpp +++ b/src/tests/string_func.cpp @@ -339,9 +339,9 @@ TEST_CASE("StrEndsWithIgnoreCase - std::string_view") TEST_CASE("FormatArrayAsHex") { - CHECK(FormatArrayAsHex(std::array{}) == ""); - CHECK(FormatArrayAsHex(std::array{0x12}) == "12"); - CHECK(FormatArrayAsHex(std::array{0x13, 0x38, 0x42, 0xAF}) == "133842af"); + CHECK(FormatArrayAsHex(std::array{}) == ""); + CHECK(FormatArrayAsHex(std::array{0x12}) == "12"); + CHECK(FormatArrayAsHex(std::array{0x13, 0x38, 0x42, 0xAF}) == "133842af"); } TEST_CASE("ConvertHexToBytes") diff --git a/src/textbuf.cpp b/src/textbuf.cpp index c4c4be6053..e3981c9aa2 100644 --- a/src/textbuf.cpp +++ b/src/textbuf.cpp @@ -179,7 +179,7 @@ bool Textbuf::InsertString(const char *str, bool marked, const char *caret, cons for (const char *ptr = str; (c = Utf8Consume(&ptr)) != '\0';) { if (!IsValidChar(c, this->afilter)) break; - byte len = Utf8CharLen(c); + uint8_t len = Utf8CharLen(c); if (this->bytes + bytes + len > this->max_bytes) break; if (this->chars + chars + 1 > this->max_chars) break; diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index 479f29484d..d51aba4b70 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -666,10 +666,10 @@ void TextfileWindow::ScrollToLine(size_t line) * When decompressing fails, *bufp is set to nullptr and *sizep to 0. The * compressed buffer passed in is still freed in this case. */ -static void Gunzip(byte **bufp, size_t *sizep) +static void Gunzip(uint8_t **bufp, size_t *sizep) { static const int BLOCKSIZE = 8192; - byte *buf = nullptr; + uint8_t *buf = nullptr; size_t alloc_size = 0; z_stream z; int res; @@ -722,10 +722,10 @@ static void Gunzip(byte **bufp, size_t *sizep) * When decompressing fails, *bufp is set to nullptr and *sizep to 0. The * compressed buffer passed in is still freed in this case. */ -static void Xunzip(byte **bufp, size_t *sizep) +static void Xunzip(uint8_t **bufp, size_t *sizep) { static const int BLOCKSIZE = 8192; - byte *buf = nullptr; + uint8_t *buf = nullptr; size_t alloc_size = 0; lzma_stream z = LZMA_STREAM_INIT; int res; @@ -796,12 +796,12 @@ static void Xunzip(byte **bufp, size_t *sizep) #if defined(WITH_ZLIB) /* In-place gunzip */ - if (std::string_view(textfile).ends_with(".gz")) Gunzip((byte**)&buf, &filesize); + if (std::string_view(textfile).ends_with(".gz")) Gunzip((uint8_t**)&buf, &filesize); #endif #if defined(WITH_LIBLZMA) /* In-place xunzip */ - if (std::string_view(textfile).ends_with(".xz")) Xunzip((byte**)&buf, &filesize); + if (std::string_view(textfile).ends_with(".xz")) Xunzip((uint8_t**)&buf, &filesize); #endif if (buf == nullptr) return; diff --git a/src/tgp.cpp b/src/tgp.cpp index 93e59e220b..2e9174d0d3 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -581,7 +581,7 @@ static void HeightMapCurves(uint level) float factor = sqrt((float)_height_map.size_x / (float)_height_map.size_y); uint sx = Clamp((int)(((1 << level) * factor) + 0.5), 1, 128); uint sy = Clamp((int)(((1 << level) / factor) + 0.5), 1, 128); - byte *c = AllocaM(byte, static_cast(sx) * sy); + uint8_t *c = AllocaM(uint8_t, static_cast(sx) * sy); for (uint i = 0; i < sx * sy; i++) { c[i] = Random() % lengthof(curve_maps); @@ -882,7 +882,7 @@ static void HeightMapNormalize() HeightMapAdjustWaterLevel(water_percent, h_max_new); - byte water_borders = _settings_game.construction.freeform_edges ? _settings_game.game_creation.water_borders : 0xF; + uint8_t water_borders = _settings_game.construction.freeform_edges ? _settings_game.game_creation.water_borders : 0xF; if (water_borders == BORDERS_RANDOM) water_borders = GB(Random(), 0, 4); HeightMapCoastLines(water_borders); diff --git a/src/tile_map.h b/src/tile_map.h index 6bb5f50a43..342a9b6141 100644 --- a/src/tile_map.h +++ b/src/tile_map.h @@ -251,7 +251,7 @@ inline TropicZone GetTropicZone(TileIndex tile) * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION) * @return frame number */ -inline byte GetAnimationFrame(TileIndex t) +inline uint8_t GetAnimationFrame(TileIndex t) { dbg_assert_msg(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION), "tile: 0x%X (%d)", t, GetTileType(t)); return _me[t].m7; @@ -263,7 +263,7 @@ inline byte GetAnimationFrame(TileIndex t) * @param frame the new frame number * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION) */ -inline void SetAnimationFrame(TileIndex t, byte frame) +inline void SetAnimationFrame(TileIndex t, uint8_t frame) { dbg_assert_msg(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION), "tile: 0x%X (%d)", t, GetTileType(t)); _me[t].m7 = frame; diff --git a/src/tilehighlight_type.h b/src/tilehighlight_type.h index 46b91a257f..10423fb79c 100644 --- a/src/tilehighlight_type.h +++ b/src/tilehighlight_type.h @@ -60,14 +60,14 @@ struct TileHighlightData { Point new_size; ///< New value for \a size; used to determine whether to redraw the selection. Point new_offs; ///< New value for \a offs; used to determine whether to redraw the selection. Point new_outersize; ///< New value for \a outersize; used to determine whether to redraw the selection. - byte dirty; ///< Whether the build station window needs to redraw due to the changed selection. + uint8_t dirty; ///< Whether the build station window needs to redraw due to the changed selection. Point selstart; ///< The location where the dragging started. Point selend; ///< The location where the drag currently ends. Point selstart2; ///< The location where the second segment of a polyline track starts. Point selend2; ///< The location where the second segment of a polyline track ends. HighLightStyle dir2; ///< Direction of the second segment of a polyline track, HT_DIR_END if second segment is not selected. HT_LINE drawstyle. - byte sizelimit; ///< Whether the selection is limited in length, and what the maximum length is. + uint8_t sizelimit; ///< Whether the selection is limited in length, and what the maximum length is. HighLightStyle drawstyle; ///< Lower bits 0-3 are reserved for detailed highlight information. HighLightStyle next_drawstyle; ///< Queued, but not yet drawn style. diff --git a/src/town.h b/src/town.h index bf4e216bb8..b1f88e2eb0 100644 --- a/src/town.h +++ b/src/town.h @@ -82,10 +82,10 @@ struct Town : TownPool::PoolItem<&_town_pool> { TinyString name; ///< Custom town name. If empty, the town was not renamed and uses the generated name. mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the town, if not using a custom town name - byte flags; ///< See #TownFlags. + uint8_t flags; ///< See #TownFlags. - byte override_flags; ///< Bitmask of enabled flag overrides. See #TownSettingOverrideFlags. - byte override_values; ///< Bitmask of flag override values. See #TownSettingOverrideFlags. + uint8_t override_flags; ///< Bitmask of enabled flag overrides. See #TownSettingOverrideFlags. + uint8_t override_values; ///< Bitmask of flag override values. See #TownSettingOverrideFlags. TownTunnelMode build_tunnels; ///< If/when towns are allowed to build road tunnels (if TSOF_OVERRIDE_BUILD_TUNNELS set in override_flags) uint8_t max_road_slope; ///< Maximum number of consecutive sloped road tiles which towns are allowed to build (if TSOF_OVERRIDE_BUILD_INCLINED_ROADS set in override_flags) @@ -110,7 +110,7 @@ struct Town : TownPool::PoolItem<&_town_pool> { std::string text; ///< General text with additional information. - inline byte GetPercentTransported(CargoID cid) const + inline uint8_t GetPercentTransported(CargoID cid) const { if (!IsValidCargoID(cid)) return 0; return this->supplied[cid].old_act * 256 / (this->supplied[cid].old_max + 1); @@ -123,8 +123,8 @@ struct Town : TownPool::PoolItem<&_town_pool> { uint16_t grow_counter; ///< counter to count when to grow, value is smaller than or equal to growth_rate uint16_t growth_rate; ///< town growth rate - byte fund_buildings_months; ///< fund buildings program in action? - byte road_build_months; ///< fund road reconstruction in action? + uint8_t fund_buildings_months; ///< fund buildings program in action? + uint8_t road_build_months; ///< fund road reconstruction in action? bool larger_town; ///< if this is a larger town and should grow more quickly TownLayout layout; ///< town specific road layout @@ -299,7 +299,7 @@ enum TownActions { }; DECLARE_ENUM_AS_BIT_SET(TownActions) -extern const byte _town_action_costs[TACT_COUNT]; +extern const uint8_t _town_action_costs[TACT_COUNT]; extern TownID _new_town_id; /** diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 32ce9d06c4..00a3babd71 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1458,7 +1458,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi std::bitset tried; uint n = MAX_BRIDGES; - byte bridge_type = RandomRange(n); + uint8_t bridge_type = RandomRange(n); for (;;) { /* Can we actually build the bridge? */ @@ -2387,12 +2387,12 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint3 if (ret.Failed()) return ret; } - static const byte price_mult[][TSZ_RANDOM + 1] = {{ 15, 25, 40, 25 }, { 20, 35, 55, 35 }}; + static const uint8_t price_mult[][TSZ_RANDOM + 1] = {{ 15, 25, 40, 25 }, { 20, 35, 55, 35 }}; /* multidimensional arrays have to have defined length of non-first dimension */ static_assert(lengthof(price_mult[0]) == 4); CommandCost cost(EXPENSES_OTHER, _price[PR_BUILD_TOWN]); - byte mult = price_mult[city][size]; + uint8_t mult = price_mult[city][size]; cost.MultiplyCost(mult); @@ -2616,7 +2616,7 @@ static Town *CreateRandomTown(uint attempts, uint32_t townnameparts, TownSize si return nullptr; } -static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, normal, high +static const uint8_t _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, normal, high /** * Generate a number of towns with a given layout. @@ -2725,7 +2725,7 @@ HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile) * @param random_bits Random bits for newgrf houses to use. * @pre The house can be built here. */ -static inline void ClearMakeHouseTile(TileIndex tile, Town *t, byte counter, byte stage, HouseID type, byte random_bits) +static inline void ClearMakeHouseTile(TileIndex tile, Town *t, uint8_t counter, uint8_t stage, HouseID type, uint8_t random_bits) { [[maybe_unused]] CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_TOWN, CMD_LANDSCAPE_CLEAR); assert(cc.Succeeded()); @@ -2748,7 +2748,7 @@ static inline void ClearMakeHouseTile(TileIndex tile, Town *t, byte counter, byt * @param random_bits Random bits for newgrf houses to use. * @pre The house can be built here. */ -static void MakeTownHouse(TileIndex tile, Town *t, byte counter, byte stage, HouseID type, byte random_bits) +static void MakeTownHouse(TileIndex tile, Town *t, uint8_t counter, uint8_t stage, HouseID type, uint8_t random_bits) { BuildingFlags size = HouseSpec::Get(type)->building_flags; @@ -3005,7 +3005,7 @@ static CommandCost CheckCanBuildHouse(HouseID house, const Town *t, bool manual) * @param house house type * @param random_bits random bits for the house */ -static void DoBuildHouse(Town *t, TileIndex tile, HouseID house, byte random_bits) +static void DoBuildHouse(Town *t, TileIndex tile, HouseID house, uint8_t random_bits) { t->cache.num_houses++; @@ -3018,8 +3018,8 @@ static void DoBuildHouse(Town *t, TileIndex tile, HouseID house, byte random_bit t->stadium_count++; } - byte construction_counter = 0; - byte construction_stage = 0; + uint8_t construction_counter = 0; + uint8_t construction_stage = 0; if (_generating_world || _game_mode == GM_EDITOR) { uint32_t r = Random(); @@ -3062,7 +3062,7 @@ CommandCost CmdBuildHouse(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint HouseID house = GB(p1, 0, 16); Town *t = Town::Get(GB(p1, 16, 16)); if (t == nullptr) return CMD_ERROR; - byte random_bits = GB(p2, 0, 8); + uint8_t random_bits = GB(p2, 0, 8); int max_z = GetTileMaxZ(tile); bool above_snowline = (_settings_game.game_creation.landscape == LT_ARCTIC) && (max_z > HighestSnowLine()); @@ -3158,7 +3158,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile) tile = FindPlaceForTownHouseAroundTile(tile, t, house); if (tile == INVALID_TILE) continue; - byte random_bits = Random(); + uint8_t random_bits = Random(); /* Check if GRF allows this house */ if (!HouseAllowsConstruction(house, tile, t, random_bits)) continue; @@ -3597,7 +3597,7 @@ CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint * Factor in the cost of each town action. * @see TownActions */ -const byte _town_action_costs[TACT_COUNT] = { +const uint8_t _town_action_costs[TACT_COUNT] = { 2, 4, 9, 35, 48, 53, 117, 175 }; diff --git a/src/town_map.h b/src/town_map.h index 007fb33977..d458808b2b 100644 --- a/src/town_map.h +++ b/src/town_map.h @@ -90,7 +90,7 @@ inline bool LiftHasDestination(TileIndex t) * @param t the tile * @param dest new destination */ -inline void SetLiftDestination(TileIndex t, byte dest) +inline void SetLiftDestination(TileIndex t, uint8_t dest) { SetBit(_me[t].m7, 0); SB(_me[t].m7, 1, 3, dest); @@ -101,7 +101,7 @@ inline void SetLiftDestination(TileIndex t, byte dest) * @param t the tile * @return destination */ -inline byte GetLiftDestination(TileIndex t) +inline uint8_t GetLiftDestination(TileIndex t) { return GB(_me[t].m7, 1, 3); } @@ -122,7 +122,7 @@ inline void HaltLift(TileIndex t) * @param t the tile * @return position, from 0 to 36 */ -inline byte GetLiftPosition(TileIndex t) +inline uint8_t GetLiftPosition(TileIndex t) { return GB(_me[t].m6, 2, 6); } @@ -132,7 +132,7 @@ inline byte GetLiftPosition(TileIndex t) * @param t the tile * @param pos position, from 0 to 36 */ -inline void SetLiftPosition(TileIndex t, byte pos) +inline void SetLiftPosition(TileIndex t, uint8_t pos) { SB(_me[t].m6, 2, 6, pos); } @@ -180,10 +180,10 @@ inline void SetHouseCompleted(TileIndex t, bool status) * @pre IsTileType(t, MP_HOUSE) * @return the building stage of the house */ -inline byte GetHouseBuildingStage(TileIndex t) +inline uint8_t GetHouseBuildingStage(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); - return IsHouseCompleted(t) ? (byte)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2); + return IsHouseCompleted(t) ? (uint8_t)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2); } /** @@ -192,7 +192,7 @@ inline byte GetHouseBuildingStage(TileIndex t) * @pre IsTileType(t, MP_HOUSE) * @return the construction stage of the house */ -inline byte GetHouseConstructionTick(TileIndex t) +inline uint8_t GetHouseConstructionTick(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); return IsHouseCompleted(t) ? 0 : GB(_m[t].m5, 0, 3); @@ -259,7 +259,7 @@ inline CalTime::Year GetHouseAge(TileIndex t) * @param random the new random bits * @pre IsTileType(t, MP_HOUSE) */ -inline void SetHouseRandomBits(TileIndex t, byte random) +inline void SetHouseRandomBits(TileIndex t, uint8_t random) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); _m[t].m1 = random; @@ -272,7 +272,7 @@ inline void SetHouseRandomBits(TileIndex t, byte random) * @pre IsTileType(t, MP_HOUSE) * @return random bits */ -inline byte GetHouseRandomBits(TileIndex t) +inline uint8_t GetHouseRandomBits(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); return _m[t].m1; @@ -285,7 +285,7 @@ inline byte GetHouseRandomBits(TileIndex t) * @param triggers the activated triggers * @pre IsTileType(t, MP_HOUSE) */ -inline void SetHouseTriggers(TileIndex t, byte triggers) +inline void SetHouseTriggers(TileIndex t, uint8_t triggers) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); SB(_m[t].m3, 0, 5, triggers); @@ -298,7 +298,7 @@ inline void SetHouseTriggers(TileIndex t, byte triggers) * @pre IsTileType(t, MP_HOUSE) * @return triggers */ -inline byte GetHouseTriggers(TileIndex t) +inline uint8_t GetHouseTriggers(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); return GB(_m[t].m3, 0, 5); @@ -310,7 +310,7 @@ inline byte GetHouseTriggers(TileIndex t) * @pre IsTileType(t, MP_HOUSE) * @return time remaining */ -inline byte GetHouseProcessingTime(TileIndex t) +inline uint8_t GetHouseProcessingTime(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); return GB(_me[t].m6, 2, 6); @@ -322,7 +322,7 @@ inline byte GetHouseProcessingTime(TileIndex t) * @param time the time to be set * @pre IsTileType(t, MP_HOUSE) */ -inline void SetHouseProcessingTime(TileIndex t, byte time) +inline void SetHouseProcessingTime(TileIndex t, uint8_t time) { dbg_assert_tile(IsTileType(t, MP_HOUSE), t); SB(_me[t].m6, 2, 6, time); @@ -349,7 +349,7 @@ inline void DecHouseProcessingTime(TileIndex t) * @param random_bits required for newgrf houses * @pre IsTileType(t, MP_CLEAR) */ -inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits) +inline void MakeHouseTile(TileIndex t, TownID tid, uint8_t counter, uint8_t stage, HouseID type, uint8_t random_bits) { dbg_assert_tile(IsTileType(t, MP_CLEAR), t); diff --git a/src/town_type.h b/src/town_type.h index 256c7d45a4..cc1f166476 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -19,7 +19,7 @@ struct Town; typedef std::vector TownList; /** Supported initial town sizes */ -enum TownSize { +enum TownSize : uint8_t { TSZ_SMALL, ///< Small town. TSZ_MEDIUM, ///< Medium town. TSZ_LARGE, ///< Large town. @@ -27,7 +27,7 @@ enum TownSize { TSZ_END, ///< Number of available town sizes. }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; DECLARE_ENUM_AS_ADDABLE(TownSize) enum Ratings { @@ -81,7 +81,7 @@ enum Ratings { }; /** Town Layouts. It needs to be 8bits, because we save and load it as such */ -enum TownLayout : byte { +enum TownLayout : uint8_t { TL_BEGIN = 0, TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads) TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads) @@ -92,11 +92,11 @@ enum TownLayout : byte { NUM_TLS, ///< Number of town layouts }; -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; DECLARE_ENUM_AS_ADDABLE(TownLayout) /** Town founding setting values. It needs to be 8bits, because we save and load it as such */ -enum TownFounding : byte { +enum TownFounding : uint8_t { TF_BEGIN = 0, ///< Used for iterations and limit testing TF_FORBIDDEN = 0, ///< Forbidden TF_ALLOWED, ///< Allowed @@ -105,7 +105,7 @@ enum TownFounding : byte { }; /** Town cargo generation modes */ -enum TownCargoGenMode : byte { +enum TownCargoGenMode : uint8_t { TCGM_BEGIN = 0, TCGM_ORIGINAL = 0, ///< Original algorithm (quadratic cargo by population) TCGM_BITCOUNT, ///< Bit-counted algorithm (normal distribution from individual house population) @@ -134,7 +134,7 @@ struct TransportedCargoStat { /** Town allow tunnel building setting values. It needs to be 8bits, because we save and load it as such */ -enum TownTunnelMode : byte { +enum TownTunnelMode : uint8_t { TTM_BEGIN = 0, ///< Used for iterations and limit testing TTM_FORBIDDEN = 0, ///< Forbidden TTM_OBSTRUCTION_ONLY, ///< Allowed only for tunnels under obstructions diff --git a/src/townname.cpp b/src/townname.cpp index b1e2e4f486..1a64e6b5d3 100644 --- a/src/townname.cpp +++ b/src/townname.cpp @@ -162,7 +162,7 @@ bool GenerateTownName(Randomizer &randomizer, uint32_t *townnameparts, TownNames * @param seed seed * @return seed transformed to a number from given range */ -static inline uint32_t SeedChance(byte shift_by, int max, uint32_t seed) +static inline uint32_t SeedChance(uint8_t shift_by, int max, uint32_t seed) { return (GB(seed, shift_by, 16) * max) >> 16; } @@ -175,7 +175,7 @@ static inline uint32_t SeedChance(byte shift_by, int max, uint32_t seed) * @param seed seed * @return seed transformed to a number from given range */ -static inline uint32_t SeedModChance(byte shift_by, int max, uint32_t seed) +static inline uint32_t SeedModChance(uint8_t shift_by, int max, uint32_t seed) { /* This actually gives *MUCH* more even distribution of the values * than SeedChance(), which is absolutely horrible in that. If @@ -198,7 +198,7 @@ static inline uint32_t SeedModChance(byte shift_by, int max, uint32_t seed) * @param bias minimum value that can be returned * @return seed transformed to a number from given range */ -static inline int32_t SeedChanceBias(byte shift_by, int max, uint32_t seed, int bias) +static inline int32_t SeedChanceBias(uint8_t shift_by, int max, uint32_t seed, int bias) { return SeedChance(shift_by, max + bias, seed) - bias; } diff --git a/src/townname_type.h b/src/townname_type.h index 0562bc6803..4eb9fa9d00 100644 --- a/src/townname_type.h +++ b/src/townname_type.h @@ -35,7 +35,7 @@ struct TownNameParams { * Initializes this struct from language ID * @param town_name town name 'language' ID */ - TownNameParams(byte town_name) + TownNameParams(uint8_t town_name) { bool grf = town_name >= BUILTIN_TOWNNAME_GENERATOR_COUNT; this->grfid = grf ? GetGRFTownNameId(town_name - BUILTIN_TOWNNAME_GENERATOR_COUNT) : 0; diff --git a/src/tracerestrict.cpp b/src/tracerestrict.cpp index 3d505c08b6..c4428dd3a7 100644 --- a/src/tracerestrict.cpp +++ b/src/tracerestrict.cpp @@ -249,7 +249,7 @@ void TraceRestrictProgram::Execute(const Train* v, const TraceRestrictProgramInp /* Only for use with TRPISP_PBS_RES_END_ACQ_DRY and TRPAUF_PBS_RES_END_SIMULATE */ static TraceRestrictSlotTemporaryState pbs_res_end_acq_dry_slot_temporary_state; - byte have_previous_signal = 0; + uint8_t have_previous_signal = 0; TileIndex previous_signal_tile[3]; size_t size = this->items.size(); diff --git a/src/track_type.h b/src/track_type.h index ef59906da4..e6563c5f5a 100644 --- a/src/track_type.h +++ b/src/track_type.h @@ -16,7 +16,7 @@ * These are used to specify a single track. * Can be translated to a trackbit with TrackToTrackbit */ -enum Track : byte { +enum Track : uint8_t { TRACK_BEGIN = 0, ///< Used for iterations TRACK_X = 0, ///< Track along the x-axis (north-east to south-west) TRACK_Y = 1, ///< Track along the y-axis (north-west to south-east) @@ -31,11 +31,11 @@ enum Track : byte { /** Allow incrementing of Track variables */ DECLARE_POSTFIX_INCREMENT(Track) /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Bitfield corresponding to Track */ -enum TrackBits : byte { +enum TrackBits : uint8_t { TRACK_BIT_NONE = 0U, ///< No track TRACK_BIT_X = 1U << TRACK_X, ///< X-axis track TRACK_BIT_Y = 1U << TRACK_Y, ///< Y-axis track @@ -69,7 +69,7 @@ DECLARE_ENUM_AS_BIT_SET(TrackBits) * reversing track dirs are not considered to be 'valid' except in a small * corner in the road vehicle controller. */ -enum Trackdir : byte { +enum Trackdir : uint8_t { TRACKDIR_BEGIN = 0, ///< Used for iterations TRACKDIR_X_NE = 0, ///< X-axis and direction to north-east TRACKDIR_Y_SE = 1, ///< Y-axis and direction to south-east @@ -94,7 +94,7 @@ enum Trackdir : byte { /** Allow incrementing of Trackdir variables */ DECLARE_POSTFIX_INCREMENT(Trackdir) /** Define basic enum properties */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** * Enumeration of bitmasks for the TrackDirs diff --git a/src/train.h b/src/train.h index 313bdaa96c..4017b29a74 100644 --- a/src/train.h +++ b/src/train.h @@ -51,7 +51,7 @@ enum VehicleRailFlags { }; /** Modes for ignoring signals. */ -enum TrainForceProceeding : byte { +enum TrainForceProceeding : uint8_t { TFP_NONE = 0, ///< Normal operation. TFP_STUCK = 1, ///< Proceed till next signal, but ignore being stuck till then. This includes force leaving depots. TFP_SIGNAL = 2, ///< Ignore next signal, after the signal ignore being stuck. @@ -76,7 +76,7 @@ enum RealisticBrakingConstants { RBC_BRAKE_POWER_PER_LENGTH = 15000, ///< Additional power-based brake force per unit of train length (excludes maglevs) }; -byte FreightWagonMult(CargoID cargo); +uint8_t FreightWagonMult(CargoID cargo); void CheckTrainsLengths(); @@ -97,7 +97,7 @@ inline int GetTrainRealisticBrakingTargetDecelerationLimit(int acceleration_type } /** Flags for TrainCache::cached_tflags */ -enum TrainCacheFlags : byte { +enum TrainCacheFlags : uint8_t { TCF_NONE = 0, ///< No flags TCF_TILT = 0x01, ///< Train can tilt; feature provides a bonus in curves. TCF_RL_BRAKING = 0x02, ///< Train realistic braking (movement physics) in effect for this vehicle @@ -119,7 +119,7 @@ struct TrainCache { uint16_t cached_uncapped_decel; ///< Uncapped cached deceleration for realistic braking lookahead purposes uint8_t cached_deceleration; ///< Cached deceleration for realistic braking lookahead purposes - byte user_def_data; ///< Cached property 0x25. Can be set by Callback 0x36. + uint8_t user_def_data; ///< Cached property 0x25. Can be set by Callback 0x36. int16_t cached_curve_speed_mod; ///< curve speed modifier of the entire train uint16_t cached_max_curve_speed; ///< max consist speed limited by curves @@ -142,7 +142,7 @@ struct Train final : public GroundVehicle { RailTypes compatible_railtypes; TrainForceProceeding force_proceed; - byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service + uint8_t critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service /** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */ uint16_t wait_counter; @@ -402,7 +402,7 @@ protected: // These functions should not be called outside acceleration code. * Allows to know the tractive effort value that this vehicle will use. * @return Tractive effort value from the engine. */ - inline byte GetTractiveEffort() const + inline uint8_t GetTractiveEffort() const { return GetVehicleProperty(this, PROP_TRAIN_TRACTIVE_EFFORT, RailVehInfo(this->engine_type)->tractive_effort); } @@ -411,7 +411,7 @@ protected: // These functions should not be called outside acceleration code. * Gets the area used for calculating air drag. * @return Area of the engine in m^2. */ - inline byte GetAirDragArea() const + inline uint8_t GetAirDragArea() const { /* Air drag is higher in tunnels due to the limited cross-section. */ return (this->track & TRACK_BIT_WORMHOLE && this->vehstatus & VS_HIDDEN) ? 28 : 14; @@ -421,7 +421,7 @@ protected: // These functions should not be called outside acceleration code. * Gets the air drag coefficient of this vehicle. * @return Air drag value from the engine. */ - inline byte GetAirDrag() const + inline uint8_t GetAirDrag() const { return RailVehInfo(this->engine_type)->air_drag; } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index b0eb87be1e..9f14afb082 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -144,8 +144,8 @@ inline void ClearLookAheadIfInvalid(Train *v) if (v->lookahead != nullptr && !ValidateLookAhead(v)) v->lookahead.reset(); } -static const byte _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; -static const byte _vehicle_initial_y_fract[4] = { 8, 4, 8, 10}; +static const uint8_t _vehicle_initial_x_fract[4] = {10, 8, 4, 8}; +static const uint8_t _vehicle_initial_y_fract[4] = { 8, 4, 8, 10}; template <> bool IsValidImageIndex(uint8_t image_index) @@ -159,7 +159,7 @@ bool IsValidImageIndex(uint8_t image_index) * @param cargo Cargo type to get multiplier for * @return Cargo weight multiplier */ -byte FreightWagonMult(CargoID cargo) +uint8_t FreightWagonMult(CargoID cargo) { if (!CargoSpec::Get(cargo)->is_freight) return 1; return _settings_game.vehicle.freight_trains; @@ -3793,7 +3793,7 @@ void FreeTrainTrackReservation(Train *v, TileIndex origin, Trackdir orig_td) } } -static const byte _initial_tile_subcoord[6][4][3] = { +static const uint8_t _initial_tile_subcoord[6][4][3] = { {{ 15, 8, 1 }, { 0, 0, 0 }, { 0, 8, 5 }, { 0, 0, 0 }}, {{ 0, 0, 0 }, { 8, 0, 3 }, { 0, 0, 0 }, { 8, 15, 7 }}, {{ 0, 0, 0 }, { 7, 0, 2 }, { 0, 7, 6 }, { 0, 0, 0 }}, @@ -4916,10 +4916,10 @@ static inline bool CheckCompatibleRail(const Train *v, TileIndex tile, DiagDirec /** Data structure for storing engine speed changes of an acceleration type. */ struct AccelerationSlowdownParams { - byte small_turn; ///< Speed change due to a small turn. - byte large_turn; ///< Speed change due to a large turn. - byte z_up; ///< Fraction to remove when moving up. - byte z_down; ///< Fraction to add when moving down. + uint8_t small_turn; ///< Speed change due to a small turn. + uint8_t large_turn; ///< Speed change due to a large turn. + uint8_t z_up; ///< Fraction to remove when moving up. + uint8_t z_down; ///< Fraction to add when moving down. }; /** Speed update fractions for each acceleration type. */ @@ -5594,7 +5594,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse) } if (old_direction != v->direction) notify_direction_changed(old_direction, v->direction); DiagDirection dir = GetTunnelBridgeDirection(gp.old_tile); - const byte *b = _initial_tile_subcoord[AxisToTrack(DiagDirToAxis(dir))][dir]; + const uint8_t *b = _initial_tile_subcoord[AxisToTrack(DiagDirToAxis(dir))][dir]; gp.x = (gp.x & ~0xF) | b[0]; gp.y = (gp.y & ~0xF) | b[1]; } @@ -5780,7 +5780,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse) chosen_track == TRACK_BIT_LEFT || chosen_track == TRACK_BIT_RIGHT); /* Update XY to reflect the entrance to the new tile, and select the direction to use */ - const byte *b = _initial_tile_subcoord[FindFirstBit(chosen_track)][enterdir]; + const uint8_t *b = _initial_tile_subcoord[FindFirstBit(chosen_track)][enterdir]; gp.x = (gp.x & ~0xF) | b[0]; gp.y = (gp.y & ~0xF) | b[1]; Direction chosen_dir = (Direction)b[2]; diff --git a/src/train_gui.cpp b/src/train_gui.cpp index bc59348346..643edc9308 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -228,7 +228,7 @@ static void TrainDetailsCargoTab(const CargoSummaryItem *item, int left, int rig * @param right The right most coordinate to draw * @param y The y coordinate */ -static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte line_number) +static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, uint8_t line_number) { const RailVehicleInfo *rvi = RailVehInfo(v->engine_type); bool show_speed = !UsesWagonOverride(v) && (_settings_game.vehicle.wagon_speed_limits || rvi->railveh_type != RAILVEH_WAGON); @@ -425,7 +425,7 @@ void DrawTrainDetails(const Train *v, const Rect &r, int vscroll_pos, uint16_t v if (det_tab != TDW_TAB_TOTALS) { Direction dir = rtl ? DIR_E : DIR_W; int x = rtl ? r.right : r.left; - byte line_number = 0; + uint8_t line_number = 0; for (; v != nullptr && vscroll_pos > -vscroll_cap; v = v->GetNextVehicle()) { GetCargoSummaryOfArticulatedVehicle(v, _cargo_summary); diff --git a/src/transparency.h b/src/transparency.h index feff3f805c..cc1bf6d6e2 100644 --- a/src/transparency.h +++ b/src/transparency.h @@ -42,8 +42,8 @@ extern TransparencyOptionBits _transparency_lock_base; extern TransparencyOptionBits _transparency_opt_extra; extern TransparencyOptionBits _transparency_lock_extra; extern TransparencyOptionBits _invisibility_opt; -extern byte _display_opt; -extern byte _extra_display_opt; +extern uint8_t _display_opt; +extern uint8_t _extra_display_opt; void PreTransparencyOptionSave(); void PostTransparencyOptionLoad(); diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 2b21d13556..57a5da78ff 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -27,8 +27,8 @@ TransparencyOptionBits _transparency_lock_base; ///< " TransparencyOptionBits _transparency_opt_extra; ///< " TransparencyOptionBits _transparency_lock_extra; ///< " TransparencyOptionBits _invisibility_opt; ///< The bits that should be invisible. -byte _display_opt; ///< What do we want to draw/do? -byte _extra_display_opt; +uint8_t _display_opt; ///< What do we want to draw/do? +uint8_t _extra_display_opt; void PreTransparencyOptionSave() { diff --git a/src/transport_type.h b/src/transport_type.h index ffe3f81dff..957e472b16 100644 --- a/src/transport_type.h +++ b/src/transport_type.h @@ -16,7 +16,7 @@ typedef uint16_t UnitID; /** Available types of transport */ -enum TransportType { +enum TransportType : uint8_t { /* These constants are for now linked to the representation of bridges * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. * In an ideal world, these constants would be used everywhere when @@ -32,6 +32,6 @@ enum TransportType { INVALID_TRANSPORT = 0xff, ///< Sentinel for invalid transport types. }; /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; #endif /* TRANSPORT_TYPE_H */ diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 2225c08bec..c7fde81040 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -51,7 +51,7 @@ enum ExtraTreePlacement { }; /** Determines when to consider building more trees. */ -byte _trees_tick_ctr; +uint8_t _trees_tick_ctr; 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. @@ -240,7 +240,7 @@ static void PlaceTree(TileIndex tile, uint32_t r) TreeType tree = GetRandomTreeType(tile, GB(r, 24, 8)); if (tree != TREE_INVALID) { - PlantTreesOnTile(tile, tree, GB(r, 22, 2), std::min(GB(r, 16, 3), 6)); + PlantTreesOnTile(tile, tree, GB(r, 22, 2), std::min(GB(r, 16, 3), 6)); MarkTileDirtyByTile(tile); /* Rerandomize ground, if neither snow nor shore */ @@ -550,7 +550,7 @@ CommandCost CmdPlantTree(TileIndex end_tile, DoCommandFlag flags, uint32_t p1, u { StringID msg = INVALID_STRING_ID; CommandCost cost(EXPENSES_OTHER); - const byte tree_to_plant = GB(p1, 0, 8); // We cannot use Extract as min and max are climate specific. + const uint8_t tree_to_plant = GB(p1, 0, 8); // We cannot use Extract as min and max are climate specific. if (p2 >= MapSize()) return CMD_ERROR; /* Check the tree type within the current climate */ @@ -685,7 +685,7 @@ CommandCost CmdPlantTree(TileIndex end_tile, DoCommandFlag flags, uint32_t p1, u } struct TreeListEnt : PalSpriteID { - byte x, y; + uint8_t x, y; }; static void DrawTile_Trees(TileInfo *ti, DrawTileProcParams params) @@ -1056,7 +1056,7 @@ uint DecrementTreeCounter() if (scaled_map_size >= 256) return scaled_map_size >> 8; /* byte underflow */ - byte old_trees_tick_ctr = _trees_tick_ctr; + uint8_t old_trees_tick_ctr = _trees_tick_ctr; _trees_tick_ctr -= scaled_map_size; return old_trees_tick_ctr <= _trees_tick_ctr ? 1 : 0; } diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index 95e1894574..f18c836ca1 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -251,13 +251,13 @@ public: */ static std::unique_ptr MakeTreeTypeButtons() { - const byte type_base = _tree_base_by_landscape[_settings_game.game_creation.landscape]; - const byte type_count = _tree_count_by_landscape[_settings_game.game_creation.landscape]; + const uint8_t type_base = _tree_base_by_landscape[_settings_game.game_creation.landscape]; + const uint8_t type_count = _tree_count_by_landscape[_settings_game.game_creation.landscape]; /* Toyland has 9 tree types, which look better in 3x3 than 4x3 */ const int num_columns = type_count == 9 ? 3 : 4; const int num_rows = CeilDiv(type_count, num_columns); - byte cur_type = type_base; + uint8_t cur_type = type_base; auto vstack = std::make_unique(NC_EQUALSIZE); vstack->SetPIP(0, 1, 0); diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index f321bd9ce4..9bbd18f1e4 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -70,7 +70,7 @@ extern void DrawTrackBits(TileInfo *ti, TrackBits track); extern void DrawRoadBitsTunnelBridge(TileInfo *ti); extern const RoadBits _invalid_tileh_slopes_road[2][15]; -extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, byte layout, TileIndex northern_bridge_end, TileIndex southern_bridge_end, int bridge_height, +extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, uint8_t layout, TileIndex northern_bridge_end, TileIndex southern_bridge_end, int bridge_height, BridgeType bridge_type, TransportType bridge_transport_type); extern CommandCost IsRoadStopBridgeAboveOK(TileIndex tile, const RoadStopSpec *spec, bool drive_through, DiagDirection entrance, @@ -3076,7 +3076,7 @@ static void PrepareToEnterBridge(T *gv) * frame on a tile, so the sound is played shortly after entering the tunnel * tile, while the vehicle is still visible. */ -static const byte TUNNEL_SOUND_FRAME = 1; +static const uint8_t TUNNEL_SOUND_FRAME = 1; /** * Frame when a vehicle should be hidden in a tunnel with a certain direction. @@ -3086,9 +3086,9 @@ static const byte TUNNEL_SOUND_FRAME = 1; * When leaving a tunnel, show the vehicle when it is one frame further * to the 'outside', i.e. at (TILE_SIZE-1) - (frame) + 1 */ -extern const byte _tunnel_visibility_frame[DIAGDIR_END] = {12, 8, 8, 12}; +extern const uint8_t _tunnel_visibility_frame[DIAGDIR_END] = {12, 8, 8, 12}; -extern const byte _tunnel_turnaround_pre_visibility_frame[DIAGDIR_END] = {31, 27, 27, 31}; +extern const uint8_t _tunnel_turnaround_pre_visibility_frame[DIAGDIR_END] = {31, 27, 27, 31}; static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y) { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index b89e817a76..68dd5bd824 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2161,7 +2161,7 @@ void DecreaseVehicleValue(Vehicle *v) /** The chances for the different types of vehicles to suffer from different types of breakdowns * The chance for a given breakdown type n is _breakdown_chances[vehtype][n] - _breakdown_chances[vehtype][n-1] */ -static const byte _breakdown_chances[4][4] = { +static const uint8_t _breakdown_chances[4][4] = { { //Trains: 25, ///< 10% chance for BREAKDOWN_CRITICAL. 51, ///< 10% chance for BREAKDOWN_EM_STOP. @@ -2201,15 +2201,15 @@ void DetermineBreakdownType(Vehicle *v, uint32_t r) { v->breakdown_severity = 40; //only used by aircraft (321 km/h) return; } - byte rand = GB(r, 8, 8); - const byte *breakdown_type_chance = _breakdown_chances[v->type]; + uint8_t rand = GB(r, 8, 8); + const uint8_t *breakdown_type_chance = _breakdown_chances[v->type]; if (v->type == VEH_AIRCRAFT) { if (rand <= breakdown_type_chance[BREAKDOWN_AIRCRAFT_SPEED]) { v->breakdown_type = BREAKDOWN_AIRCRAFT_SPEED; /* all speed values here are 1/8th of the real max speed in km/h */ - byte max_speed = std::max(1, std::min(v->vcache.cached_max_speed >> 3, 255)); - byte min_speed = std::max(1, std::min(15 + (max_speed >> 2), v->vcache.cached_max_speed >> 4)); + uint8_t max_speed = std::max(1, std::min(v->vcache.cached_max_speed >> 3, 255)); + uint8_t min_speed = std::max(1, std::min(15 + (max_speed >> 2), v->vcache.cached_max_speed >> 4)); v->breakdown_severity = min_speed + (((v->reliability + GB(r, 16, 16)) * (max_speed - min_speed)) >> 17); } else if (rand <= breakdown_type_chance[BREAKDOWN_AIRCRAFT_DEPOT]) { v->breakdown_type = BREAKDOWN_AIRCRAFT_DEPOT; @@ -2248,7 +2248,7 @@ void DetermineBreakdownType(Vehicle *v, uint32_t r) { (v->type == VEH_SHIP) ? GetVehicleProperty(v, PROP_SHIP_SPEED, ShipVehInfo(v->engine_type)->max_speed ) : GetVehicleProperty(v, PROP_AIRCRAFT_SPEED, AircraftVehInfo(v->engine_type)->max_speed); - byte min_speed = std::min(41, max_speed >> 2); + uint8_t min_speed = std::min(41, max_speed >> 2); /* we use the min() function here because we want to use the real value of max_speed for the min_speed calculation */ max_speed = std::min(max_speed, 255); v->breakdown_severity = Clamp((max_speed * rand2) >> 16, min_speed, max_speed); @@ -3027,7 +3027,7 @@ UnitID GetFreeUnitNumber(VehicleType type) * @return true if there is any reason why you may build * the infrastructure for the given vehicle type */ -bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype) +bool CanBuildVehicleInfrastructure(VehicleType type, uint8_t subtype) { assert(IsCompanyBuildableVehicleType(type)); @@ -3170,7 +3170,7 @@ LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_ * @param ignore_group Ignore group overrides. * @return livery to use */ -const Livery *GetEngineLivery(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v, byte livery_setting, bool ignore_group) +const Livery *GetEngineLivery(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v, uint8_t livery_setting, bool ignore_group) { const Company *c = Company::Get(company); LiveryScheme scheme = LS_DEFAULT; @@ -4111,7 +4111,7 @@ void Vehicle::UpdateVisualEffect(bool allow_power_change) const Engine *e = this->GetEngine(); /* Evaluate properties */ - byte visual_effect; + uint8_t visual_effect; switch (e->type) { case VEH_TRAIN: visual_effect = e->u.rail.visual_effect; break; case VEH_ROAD: visual_effect = e->u.road.visual_effect; break; diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 9286d82061..9c3b3a69ea 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -157,8 +157,8 @@ struct VehicleCache { uint16_t cached_cargo_age_period; ///< Number of ticks before carried cargo is aged. uint16_t cached_image_curvature; ///< Cached neighbour curvature, see: VCF_IMAGE_CURVATURE - byte cached_vis_effect; ///< Visual effect to show (see #VisualEffect) - byte cached_veh_flags; ///< Vehicle cache flags (see #VehicleCacheFlags) + uint8_t cached_vis_effect; ///< Visual effect to show (see #VisualEffect) + uint8_t cached_veh_flags; ///< Vehicle cache flags (see #VehicleCacheFlags) }; /** Sprite sequence for a vehicle part. */ @@ -357,9 +357,9 @@ public: Vehicle *hash_tile_prev; ///< NOSAVE: Previous vehicle in the tile location hash. TileIndex hash_tile_current = INVALID_TILE; ///< NOSAVE: current tile used for tile location hash. - byte breakdown_severity; ///< severity of the breakdown. Note that lower means more severe - byte breakdown_type; ///< Type of breakdown - byte breakdown_chance_factor; ///< Improved breakdowns: current multiplier for breakdown_chance * 128, used for head vehicle only + uint8_t breakdown_severity; ///< severity of the breakdown. Note that lower means more severe + uint8_t breakdown_type; ///< Type of breakdown + uint8_t breakdown_chance_factor; ///< Improved breakdowns: current multiplier for breakdown_chance * 128, used for head vehicle only Owner owner; ///< Which company owns the vehicle? SpriteID colourmap; ///< NOSAVE: cached colour mapping @@ -373,10 +373,10 @@ public: CalTime::Date date_of_last_service_newgrf; ///< Last date the vehicle had a service at a depot, unchanged by the date cheat to protect against unsafe NewGRF behavior. uint16_t reliability; ///< Reliability. uint16_t reliability_spd_dec; ///< Reliability decrease speed. - byte breakdown_ctr; ///< Counter for managing breakdown events. @see Vehicle::HandleBreakdown - byte breakdown_delay; ///< Counter for managing breakdown length. - byte breakdowns_since_last_service; ///< Counter for the amount of breakdowns. - byte breakdown_chance; ///< Current chance of breakdowns. + uint8_t breakdown_ctr; ///< Counter for managing breakdown events. @see Vehicle::HandleBreakdown + uint8_t breakdown_delay; ///< Counter for managing breakdown length. + uint8_t breakdowns_since_last_service; ///< Counter for the amount of breakdowns. + uint8_t breakdown_chance; ///< Current chance of breakdowns. int32_t x_pos; ///< x coordinate. int32_t y_pos; ///< y coordinate. @@ -388,32 +388,32 @@ public: * 0xfd == custom sprite, 0xfe == custom second head sprite * 0xff == reserved for another custom sprite */ - byte spritenum; + uint8_t spritenum; UnitID unitnumber; ///< unit number, for display purposes only VehicleSpriteSeq sprite_seq; ///< Vehicle appearance. Rect16 sprite_seq_bounds; - byte x_extent; ///< x-extent of vehicle bounding box - byte y_extent; ///< y-extent of vehicle bounding box - byte z_extent; ///< z-extent of vehicle bounding box + uint8_t x_extent; ///< x-extent of vehicle bounding box + uint8_t y_extent; ///< y-extent of vehicle bounding box + uint8_t z_extent; ///< z-extent of vehicle bounding box int8_t x_bb_offs; ///< x offset of vehicle bounding box int8_t y_bb_offs; ///< y offset of vehicle bounding box int8_t x_offs; ///< x offset for vehicle sprite int8_t y_offs; ///< y offset for vehicle sprite - byte progress; ///< The percentage (if divided by 256) this vehicle already crossed the tile unit. + uint8_t progress; ///< The percentage (if divided by 256) this vehicle already crossed the tile unit. TextEffectID fill_percent_te_id; ///< a text-effect id to a loading indicator object uint16_t load_unload_ticks; ///< Ticks to wait before starting next cycle. uint16_t cur_speed; ///< current speed - byte subspeed; ///< fractional speed - byte acceleration; ///< used by train & aircraft + uint8_t subspeed; ///< fractional speed + uint8_t acceleration; ///< used by train & aircraft uint32_t motion_counter; ///< counter to occasionally play a vehicle sound. (Also used as virtual train client ID). uint16_t random_bits; ///< Bits used for randomized variational spritegroups. - byte waiting_triggers; ///< Triggers to be yet matched before rerandomizing the random bits. + uint8_t waiting_triggers; ///< Triggers to be yet matched before rerandomizing the random bits. - byte cargo_subtype; ///< Used for livery refits (NewGRF variations) + uint8_t cargo_subtype; ///< Used for livery refits (NewGRF variations) StationID last_station_visited; ///< The last station we stopped at. StationID last_loading_station; ///< Last station the vehicle has stopped at and could possibly leave from with any cargo loaded. (See VF_LAST_LOAD_ST_SEP). @@ -425,13 +425,13 @@ public: uint16_t cargo_age_counter; ///< Ticks till cargo is aged next. int8_t trip_occupancy; ///< NOSAVE: Occupancy of vehicle of the current trip (updated after leaving a station). - byte day_counter; ///< Increased by one for each day - byte tick_counter; ///< Increased by one for each tick + uint8_t day_counter; ///< Increased by one for each day + uint8_t tick_counter; ///< Increased by one for each tick uint8_t order_occupancy_average; ///< NOSAVE: order occupancy average. 0 = invalid, 1 = n/a, 16-116 = 0-100% uint16_t running_ticks; ///< Number of ticks this vehicle was not stopped this day - byte vehstatus; ///< Status - byte subtype; ///< subtype (Filled with values from #AircraftSubType/#DisasterSubType/#EffectVehicleType/#GroundVehicleSubtypeFlags) + uint8_t vehstatus; ///< Status + uint8_t subtype; ///< subtype (Filled with values from #AircraftSubType/#DisasterSubType/#EffectVehicleType/#GroundVehicleSubtypeFlags) GroupID group_id; ///< Index of group Pool array Order current_order; ///< The current order (+ status, like: loading) diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index c952373c2f..bef81d461d 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -76,7 +76,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engin CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **v); CommandCost CmdBuildShip (TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **v); CommandCost CmdBuildAircraft (TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **v); -static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed); +static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, uint8_t new_subtype, bool *auto_refit_allowed); /** * Build a vehicle. @@ -295,7 +295,7 @@ CommandCost CmdSellVirtualVehicle(TileIndex tile, DoCommandFlag flags, uint32_t * @param[out] auto_refit_allowed The refit is allowed as an auto-refit. * @return Price for refitting */ -static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed) +static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID new_cid, uint8_t new_subtype, bool *auto_refit_allowed) { /* Prepare callback param with info about the new cargo type. */ const Engine *e = Engine::Get(engine_type); @@ -327,7 +327,7 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne * @param[out] auto_refit_allowed The refit is allowed as an auto-refit. * @return Price for refitting */ -static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed) +static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, uint8_t new_subtype, bool *auto_refit_allowed) { ExpensesType expense_type; const Engine *e = Engine::Get(engine_type); @@ -369,7 +369,7 @@ struct RefitResult { Vehicle *v; ///< Vehicle to refit uint capacity; ///< New capacity of vehicle uint mail_capacity; ///< New mail capacity of aircraft - byte subtype; ///< cargo subtype to refit to + uint8_t subtype; ///< cargo subtype to refit to }; /** @@ -384,7 +384,7 @@ struct RefitResult { * @param auto_refit Refitting is done as automatic refitting outside a depot. * @return Refit cost. */ -static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8_t num_vehicles, CargoID new_cid, byte new_subtype, DoCommandFlag flags, bool auto_refit) +static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8_t num_vehicles, CargoID new_cid, uint8_t new_subtype, DoCommandFlag flags, bool auto_refit) { CommandCost cost(v->GetExpenseType(false)); uint total_capacity = 0; @@ -402,7 +402,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8_t num_vehicles std::vector refit_result; v->InvalidateNewGRFCacheOfChain(); - byte actual_subtype = new_subtype; + uint8_t actual_subtype = new_subtype; for (; v != nullptr; v = (only_this ? nullptr : v->Next())) { /* Reset actual_subtype for every new vehicle */ if (!v->IsArticulatedPart()) actual_subtype = new_subtype; @@ -428,7 +428,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8_t num_vehicles /* Back up the vehicle's cargo type */ CargoID temp_cid = v->cargo_type; - byte temp_subtype = v->cargo_subtype; + uint8_t temp_subtype = v->cargo_subtype; if (refittable) { v->cargo_type = new_cid; v->cargo_subtype = actual_subtype; @@ -560,7 +560,7 @@ CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui /* Check cargo */ CargoID new_cid = GB(p2, 0, 8); - byte new_subtype = GB(p2, 8, 8); + uint8_t new_subtype = GB(p2, 8, 8); if (new_cid >= NUM_CARGO) return CMD_ERROR; /* For aircraft there is always only one. */ @@ -1622,7 +1622,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui assert(w != nullptr); /* Find out what's the best sub type */ - byte subtype = GetBestFittingSubType(v, w, v->cargo_type); + uint8_t subtype = GetBestFittingSubType(v, w, v->cargo_type); if (w->cargo_type != v->cargo_type || w->cargo_subtype != subtype) { CommandCost cost = DoCommand(0, w->index, v->cargo_type | 1U << 25 | (subtype << 8), flags, GetCmdRefitVeh(v)); if (cost.Succeeded()) total_cost.AddCost(cost); diff --git a/src/vehicle_func.h b/src/vehicle_func.h index d878670003..02cd8d2674 100644 --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -126,7 +126,7 @@ void VehicleLengthChanged(const Vehicle *u); void ResetVehicleHash(); void ResetVehicleColourMap(); -byte GetBestFittingSubType(const Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type); +uint8_t GetBestFittingSubType(const Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type); void ViewportAddVehicles(DrawPixelInfo *dpi, bool update_vehicles); void ViewportMapDrawVehicles(DrawPixelInfo *dpi, Viewport *vp); @@ -153,7 +153,7 @@ UnitID GetFreeUnitNumber(VehicleType type); void VehicleEnterDepot(Vehicle *v); -bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype = 0); +bool CanBuildVehicleInfrastructure(VehicleType type, uint8_t subtype = 0); /** Position information of a vehicle after it moved */ struct GetNewVehiclePosResult { @@ -194,7 +194,7 @@ inline bool IsCompanyBuildableVehicleType(const BaseVehicle *v) } LiveryScheme GetEngineLiveryScheme(EngineID engine_type, EngineID parent_engine_type, const Vehicle *v); -const struct Livery *GetEngineLivery(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v, byte livery_setting, bool ignore_group = false); +const struct Livery *GetEngineLivery(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v, uint8_t livery_setting, bool ignore_group = false); SpriteID GetEnginePalette(EngineID engine_type, CompanyID company); SpriteID GetVehiclePalette(const Vehicle *v); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 591bedf25b..64a11beece 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -504,7 +504,7 @@ static const uint MAX_REFIT_CYCLE = 256; * @param dest_cargo_type Destination cargo type. * @return the best sub type */ -byte GetBestFittingSubType(const Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type) +uint8_t GetBestFittingSubType(const Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type) { v_from = v_from->GetFirstEnginePart(); v_for = v_for->GetFirstEnginePart(); @@ -518,7 +518,7 @@ byte GetBestFittingSubType(const Vehicle *v_from, Vehicle *v_for, CargoID dest_c include(subtypes, GetCargoSubtypeText(v_from)); } - byte ret_refit_cyc = 0; + uint8_t ret_refit_cyc = 0; bool success = false; if (!subtypes.empty()) { /* Check whether any articulated part is refittable to 'dest_cargo_type' with a subtype listed in 'subtypes' */ @@ -528,7 +528,7 @@ byte GetBestFittingSubType(const Vehicle *v_from, Vehicle *v_for, CargoID dest_c if (!HasBit(e->info.refit_mask, dest_cargo_type) && v->cargo_type != dest_cargo_type) continue; CargoID old_cargo_type = v->cargo_type; - byte old_cargo_subtype = v->cargo_subtype; + uint8_t old_cargo_subtype = v->cargo_subtype; /* Set the 'destination' cargo */ v->cargo_type = dest_cargo_type; @@ -578,7 +578,7 @@ const Vehicle *GetMostSeverelyBrokenEngine(const Train *v) { assert(v->IsFrontEngine()); const Vehicle *w = v; - byte most_severe_type = 255; + uint8_t most_severe_type = 255; for (const Vehicle *u = v; u != nullptr; u = u->Next()) { if (u->breakdown_ctr == 1) { if (u->breakdown_type < most_severe_type) { @@ -595,7 +595,7 @@ const Vehicle *GetMostSeverelyBrokenEngine(const Train *v) /** Option to refit a vehicle chain */ struct RefitOption { CargoID cargo; ///< Cargo to refit to - byte subtype; ///< Subcargo to use + uint8_t subtype; ///< Subcargo to use StringID string; ///< GRF-local String to display for the cargo /** @@ -726,7 +726,7 @@ struct RefitWindow : public Window { if (v->type == VEH_SHIP && this->num_vehicles == 1 && v->index != this->selected_vehicle) continue; const Engine *e = v->GetEngine(); CargoTypes cmask = e->info.refit_mask; - byte callback_mask = e->info.callback_mask; + uint8_t callback_mask = e->info.callback_mask; /* Skip this engine if it does not carry anything */ if (!e->CanCarryCargo()) continue; @@ -754,7 +754,7 @@ struct RefitWindow : public Window { /* Make a note of the original cargo type. It has to be * changed to test the cargo & subtype... */ CargoID temp_cargo = v->cargo_type; - byte temp_subtype = v->cargo_subtype; + uint8_t temp_subtype = v->cargo_subtype; v->cargo_type = cid; @@ -1994,7 +1994,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int /* company colour stripe along vehicle description row */ if (_settings_client.gui.show_vehicle_list_company_colour && v->owner != this->vli.company) { - byte ccolour = 0; + uint8_t ccolour = 0; Company *c = Company::Get(v->owner); if (c != nullptr) { ccolour = GetColourGradient(c->colour, SHADE_LIGHTER); @@ -3230,7 +3230,7 @@ struct VehicleDetailsWindow : Window { tr.top += GetCharacterHeight(FS_NORMAL); /* Draw breakdown & reliability */ - byte total_engines = 0; + uint8_t total_engines = 0; if (v->type == VEH_TRAIN) { /* we want to draw the average reliability and total number of breakdowns */ uint32_t total_reliability = 0; diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h index 4d1cc2b4cd..a122107707 100644 --- a/src/vehicle_gui.h +++ b/src/vehicle_gui.h @@ -22,7 +22,7 @@ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit = false, bool is_virtual_train = false); /** The tabs in the train details window */ -enum TrainDetailsWindowTabs : byte { +enum TrainDetailsWindowTabs : uint8_t { TDW_TAB_CARGO = 0, ///< Tab with cargo carried by the vehicles TDW_TAB_INFO, ///< Tab with name and value of the vehicles TDW_TAB_CAPACITY, ///< Tab with cargo capacity of the vehicles diff --git a/src/vehicle_gui_base.h b/src/vehicle_gui_base.h index b3d7f30da4..20c3da5755 100644 --- a/src/vehicle_gui_base.h +++ b/src/vehicle_gui_base.h @@ -67,7 +67,7 @@ struct GUIVehicleGroup { typedef GUIList GUIVehicleGroupList; struct BaseVehicleListWindow : public Window { - enum GroupBy : byte { + enum GroupBy : uint8_t { GB_NONE, GB_SHARED_ORDERS, @@ -82,7 +82,7 @@ public: CompanyID own_company; ///< Company ID used for own_vehicles GUIVehicleGroupList vehgroups; ///< List of (groups of) vehicles. This stores iterators of `vehicles`, and should be rebuilt if `vehicles` is structurally changed. Listing *sorting; ///< Pointer to the vehicle type related sorting. - byte unitnumber_digits; ///< The number of digits of the highest unit number. + uint8_t unitnumber_digits; ///< The number of digits of the highest unit number. Scrollbar *vscroll; VehicleListIdentifier vli; ///< Identifier of the vehicle list we want to currently show. VehicleID vehicle_sel; ///< Selected vehicle @@ -131,7 +131,7 @@ public: void SortVehicleList(); void CountOwnVehicles(); void BuildVehicleList(); - void SetCargoFilter(byte index); + void SetCargoFilter(uint8_t index); void SetCargoFilterArray(); void FilterVehicleList(); StringID GetCargoFilterLabel(CargoID cid) const; diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 99cf1f7f09..d1c97248c7 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -18,7 +18,7 @@ typedef uint32_t VehicleID; static const int GROUND_ACCELERATION = 9800; ///< Acceleration due to gravity, 9.8 m/s^2 /** Available vehicle types. It needs to be 8bits, because we save and load it as such */ -enum VehicleType : byte { +enum VehicleType : uint8_t { VEH_BEGIN, VEH_TRAIN = VEH_BEGIN, ///< %Train vehicle type. @@ -36,7 +36,7 @@ enum VehicleType : byte { }; DECLARE_POSTFIX_INCREMENT(VehicleType) /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; DECLARE_ENUM_AS_ADDABLE(VehicleType) struct Vehicle; diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp index c89e4b1626..5bf1bdfc9a 100644 --- a/src/vehiclelist.cpp +++ b/src/vehiclelist.cpp @@ -23,7 +23,7 @@ */ uint32_t VehicleListIdentifier::Pack() const { - byte c = this->company == OWNER_NONE ? 0xF : (byte)this->company; + uint8_t c = this->company == OWNER_NONE ? 0xF : (uint8_t)this->company; assert(c < (1 << 4)); assert(this->vtype < (1 << 2)); assert(this->index < (1 << 20)); @@ -40,7 +40,7 @@ uint32_t VehicleListIdentifier::Pack() const */ bool VehicleListIdentifier::UnpackIfValid(uint32_t data) { - byte c = GB(data, 28, 4); + uint8_t c = GB(data, 28, 4); this->company = c == 0xF ? OWNER_NONE : (CompanyID)c; this->type = (VehicleListType)GB(data, 23, 3); this->vtype = (VehicleType)GB(data, 26, 2); diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 0e1349ff93..52eea85d08 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -199,7 +199,7 @@ static bool CreateMainSurface(uint w, uint h) _allegro_screen = create_bitmap_ex(bpp, screen->cr - screen->cl, screen->cb - screen->ct); _screen.width = _allegro_screen->w; _screen.height = _allegro_screen->h; - _screen.pitch = ((byte*)screen->line[1] - (byte*)screen->line[0]) / (bpp / 8); + _screen.pitch = ((uint8_t*)screen->line[1] - (uint8_t*)screen->line[0]) / (bpp / 8); _screen.dst_ptr = _allegro_screen->line[0]; /* Initialise the screen so we don't blit garbage to the screen */ @@ -246,8 +246,8 @@ std::vector VideoDriver_Allegro::GetListOfMonitorRefreshRates() struct AllegroVkMapping { uint16_t vk_from; - byte vk_count; - byte map_to; + uint8_t vk_count; + uint8_t map_to; }; #define AS(x, z) {x, 0, z} diff --git a/src/video/cocoa/cocoa_keys.h b/src/video/cocoa/cocoa_keys.h index dff4f881a9..2c658ce4c5 100644 --- a/src/video/cocoa/cocoa_keys.h +++ b/src/video/cocoa/cocoa_keys.h @@ -134,7 +134,7 @@ struct CocoaVkMapping { unsigned short vk_from; - byte map_to; + uint8_t map_to; }; #define AS(x, z) {x, z} diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index 59e4b99c2e..20f65005e5 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -108,7 +108,7 @@ const char *VideoDriver_Dedicated::Start(const StringList &) this->UpdateAutoResolution(); int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); - _dedicated_video_mem = (bpp == 0) ? nullptr : MallocT(static_cast(_cur_resolution.width) * _cur_resolution.height * (bpp / 8)); + _dedicated_video_mem = (bpp == 0) ? nullptr : MallocT(static_cast(_cur_resolution.width) * _cur_resolution.height * (bpp / 8)); _screen.width = _screen.pitch = _cur_resolution.width; _screen.height = _cur_resolution.height; diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index 13a12a6ce7..d5e9bd2421 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -196,8 +196,8 @@ static bool IsOpenGLExtensionSupported(const char *extension) return false; } -static byte _gl_major_ver = 0; ///< Major OpenGL version. -static byte _gl_minor_ver = 0; ///< Minor OpenGL version. +static uint8_t _gl_major_ver = 0; ///< Major OpenGL version. +static uint8_t _gl_minor_ver = 0; ///< Minor OpenGL version. /** * Check if the current OpenGL version is equal or higher than a given one. @@ -206,7 +206,7 @@ static byte _gl_minor_ver = 0; ///< Minor OpenGL version. * @pre OpenGL was initialized. * @return True if the OpenGL version is equal or higher than the requested one. */ -bool IsOpenGLVersionAtLeast(byte major, byte minor) +bool IsOpenGLVersionAtLeast(uint8_t major, uint8_t minor) { return (_gl_major_ver > major) || (_gl_major_ver == major && _gl_minor_ver >= minor); } @@ -947,10 +947,10 @@ bool OpenGLBackend::Resize(int w, int h, bool force) } } else if (bpp == 8) { if (_glClearBufferSubData != nullptr) { - byte b = 0; + uint8_t b = 0; _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_R8, 0, line_pixel_count, GL_RED, GL_UNSIGNED_BYTE, &b); } else { - ClearPixelBuffer(line_pixel_count, 0); + ClearPixelBuffer(line_pixel_count, 0); } } @@ -978,10 +978,10 @@ bool OpenGLBackend::Resize(int w, int h, bool force) /* Initialize buffer as 0 == no remap. */ if (_glClearBufferSubData != nullptr) { - byte b = 0; + uint8_t b = 0; _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_R8, 0, line_pixel_count, GL_RED, GL_UNSIGNED_BYTE, &b); } else { - ClearPixelBuffer(line_pixel_count, 0); + ClearPixelBuffer(line_pixel_count, 0); } _glBindTexture(GL_TEXTURE_2D, this->anim_texture); diff --git a/src/video/opengl.h b/src/video/opengl.h index 36e8794f21..50685b270c 100644 --- a/src/video/opengl.h +++ b/src/video/opengl.h @@ -19,7 +19,7 @@ typedef void (*OGLProc)(); typedef OGLProc (*GetOGLProcAddressProc)(const char *proc); -bool IsOpenGLVersionAtLeast(byte major, byte minor); +bool IsOpenGLVersionAtLeast(uint8_t major, uint8_t minor); const char *FindStringInExtensionList(const char *string, const char *substring); class OpenGLSprite; diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 04d5a366d5..1460792cc0 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -57,9 +57,9 @@ bool VideoDriver_Win32Base::ClaimMousePointer() } struct Win32VkMapping { - byte vk_from; - byte vk_count; - byte map_to; + uint8_t vk_from; + uint8_t vk_count; + uint8_t map_to; }; #define AS(x, z) {x, 0, z} diff --git a/src/viewport.cpp b/src/viewport.cpp index 264dcbbc8c..e222345a1e 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -309,7 +309,7 @@ struct ViewportDrawerDynamic { TransparencyOptionBits transparency_opt; TransparencyOptionBits invisibility_opt; - const byte *pal2trsp_remap_ptr = nullptr; + const uint8_t *pal2trsp_remap_ptr = nullptr; SpritePointerHolder sprite_data; @@ -435,7 +435,7 @@ bool _draw_dirty_blocks = false; std::atomic _dirty_block_colour; static VpSpriteSorter _vp_sprite_sorter = nullptr; -const byte *_pal2trsp_remap_ptr = nullptr; +const uint8_t *_pal2trsp_remap_ptr = nullptr; static RailSnapMode _rail_snap_mode = RSM_NO_SNAP; ///< Type of rail track snapping (polyline tool). static LineSnapPoints _tile_snap_points; ///< Tile to which a rail track will be snapped to (polyline tool). @@ -495,7 +495,7 @@ static void FillViewportCoverageRect() using ScrollViewportPixelCacheGenericFillRegion = void (*)(Viewport *vp, int x, int y, int width, int height); -static bool ScrollViewportPixelCacheGeneric(Viewport *vp, std::vector &cache, int offset_x, int offset_y, uint pixel_width, ScrollViewportPixelCacheGenericFillRegion fill_region) +static bool ScrollViewportPixelCacheGeneric(Viewport *vp, std::vector &cache, int offset_x, int offset_y, uint pixel_width, ScrollViewportPixelCacheGenericFillRegion fill_region) { if (cache.empty()) return false; if (abs(offset_x) >= vp->width || abs(offset_y) >= vp->height) return true; @@ -2448,7 +2448,7 @@ void ViewportDrawDirtyBlocks(const DrawPixelInfo *dpi, bool increment_colour) dst = dpi->dst_ptr; - byte bo = UnScaleByZoom(dpi->left + dpi->top, dpi->zoom) & 1; + uint8_t bo = UnScaleByZoom(dpi->left + dpi->top, dpi->zoom) & 1; do { for (int i = (bo ^= 1); i < right; i += 2) blitter->SetPixel(dst, i, 0, (uint8_t)colour); dst = blitter->MoveTo(dst, 0, 1); @@ -5836,7 +5836,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t /* In the case of an area we can determine whether we were dragging south or * east by checking the X-coordinates of the tiles */ - byte style_t = (byte)(TileX(end_tile) > TileX(start_tile)); + uint8_t style_t = (uint8_t)(TileX(end_tile) > TileX(start_tile)); start_tile = TileAdd(start_tile, ToTileIndexDiff(heightdiff_area_by_dir[style_t])); end_tile = TileAdd(end_tile, ToTileIndexDiff(heightdiff_area_by_dir[2 + style_t])); [[fallthrough]]; @@ -5870,7 +5870,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t if (swap && distance == 0) style = flip_style_direction[style]; /* Use lookup table for start-tile based on HighLightStyle direction */ - byte style_t = style * 2; + uint8_t style_t = style * 2; dbg_assert(style_t < lengthof(heightdiff_line_by_dir) - 13); h0 = TileHeight(TileAdd(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t]))); uint ht = TileHeight(TileAdd(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t + 1]))); diff --git a/src/viewport_type.h b/src/viewport_type.h index d2476b9722..e652b75ad7 100644 --- a/src/viewport_type.h +++ b/src/viewport_type.h @@ -64,9 +64,9 @@ struct Viewport { uint64_t last_overlay_rebuild_counter = 0; uint64_t last_plan_update_number = 0; ViewPortMapDrawVehiclesCache map_draw_vehicles_cache; - std::vector land_pixel_cache; - std::vector overlay_pixel_cache; - std::vector plan_pixel_cache; + std::vector land_pixel_cache; + std::vector overlay_pixel_cache; + std::vector plan_pixel_cache; uint GetDirtyBlockWidthShift() const { return this->GetDirtyBlockShift(); } uint GetDirtyBlockHeightShift() const { return this->GetDirtyBlockShift(); } @@ -209,7 +209,7 @@ enum ViewportDragDropSelectionProcess { /** * Target of the viewport scrolling GS method */ -enum ViewportScrollTarget { +enum ViewportScrollTarget : uint8_t { VST_EVERYONE, ///< All players VST_COMPANY, ///< All players in specific company VST_CLIENT, ///< Single player @@ -223,7 +223,7 @@ enum FoundationPart { FOUNDATION_PART_END }; -enum ViewportMarkDirtyFlags : byte { +enum ViewportMarkDirtyFlags : uint8_t { VMDF_NONE = 0, VMDF_NOT_MAP_MODE = 0x1, VMDF_NOT_MAP_MODE_NON_VEG = 0x2, diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index c4a485389b..98436b66aa 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -958,7 +958,7 @@ void DrawShoreTile(Slope tileh) { /* Converts the enum Slope into an offset based on SPR_SHORE_BASE. * This allows to calculate the proper sprite to display for this Slope */ - static const byte tileh_to_shoresprite[32] = { + static const uint8_t tileh_to_shoresprite[32] = { 0, 1, 2, 3, 4, 16, 6, 7, 8, 9, 17, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 10, 15, 0, }; diff --git a/src/water_map.h b/src/water_map.h index c3926d6892..bad1de85ac 100644 --- a/src/water_map.h +++ b/src/water_map.h @@ -44,14 +44,14 @@ enum WaterTileType { }; /** classes of water (for #WATER_TILE_CLEAR water tile type). */ -enum WaterClass { +enum WaterClass : uint8_t { WATER_CLASS_SEA, ///< Sea. WATER_CLASS_CANAL, ///< Canal. WATER_CLASS_RIVER, ///< River. WATER_CLASS_INVALID, ///< Used for industry tiles on land (also for oilrig if newgrf says so). }; /** Helper information for extract tool. */ -template <> struct EnumPropsT : MakeEnumPropsT {}; +template <> struct EnumPropsT : MakeEnumPropsT {}; /** Sections of the water depot. */ enum DepotPart { @@ -317,7 +317,7 @@ inline DiagDirection GetLockDirection(TileIndex t) * @return The part. * @pre IsTileType(t, MP_WATER) && IsLock(t) */ -inline byte GetLockPart(TileIndex t) +inline uint8_t GetLockPart(TileIndex t) { dbg_assert_tile(IsLock(t), t); return GB(_m[t].m5, WBL_LOCK_PART_BEGIN, WBL_LOCK_PART_COUNT); @@ -329,7 +329,7 @@ inline byte GetLockPart(TileIndex t) * @return Random bits of the tile. * @pre IsTileType(t, MP_WATER) */ -inline byte GetWaterTileRandomBits(TileIndex t) +inline uint8_t GetWaterTileRandomBits(TileIndex t) { dbg_assert_tile(IsTileType(t, MP_WATER), t); return _m[t].m4; diff --git a/src/waypoint_base.h b/src/waypoint_base.h index 54c5c18d9e..753a99108a 100644 --- a/src/waypoint_base.h +++ b/src/waypoint_base.h @@ -43,7 +43,7 @@ struct Waypoint final : SpecializedStation { return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index; } - uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint16_t variable, byte parameter, bool *available) const override; + uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint16_t variable, uint8_t parameter, bool *available) const override; void GetTileArea(TileArea *ta, StationType type) const override; diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 5859a66539..7d38744b54 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -177,10 +177,10 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID * return CommandCost(); } -extern void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec); +extern void GetStationLayout(uint8_t *layout, uint numtracks, uint plat_len, const StationSpec *statspec); extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp, bool is_road); extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta); -extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, byte layout); +extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, uint8_t layout); /** * Convert existing rail to waypoint. Eg build a waypoint station over @@ -205,8 +205,8 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint { /* Unpack parameters */ Axis axis = Extract(p1); - byte width = GB(p1, 8, 8); - byte height = GB(p1, 16, 8); + uint8_t width = GB(p1, 8, 8); + uint8_t height = GB(p1, 16, 8); bool adjacent = HasBit(p1, 24); StationClassID spec_class = Extract(p2); @@ -219,7 +219,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint if (spec_index >= StationClass::Get(spec_class)->GetSpecCount()) return CMD_ERROR; /* The number of parts to build */ - byte count = axis == AXIS_X ? height : width; + uint8_t count = axis == AXIS_X ? height : width; if ((axis == AXIS_X ? width : height) != 1) return CMD_ERROR; if (count == 0 || count > _settings_game.station.station_spread) return CMD_ERROR; @@ -231,7 +231,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint if (distant_join && (!_settings_game.station.distant_join_stations || !Waypoint::IsValidID(station_to_join))) return CMD_ERROR; const StationSpec *spec = StationClass::Get(spec_class)->GetSpec(spec_index); - byte *layout_ptr = AllocaM(byte, count); + uint8_t *layout_ptr = AllocaM(uint8_t, count); if (spec == nullptr) { /* The layout must be 0 for the 'normal' waypoints by design. */ memset(layout_ptr, 0, count); @@ -306,12 +306,12 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint wp->UpdateVirtCoord(); - byte map_spec_index = AllocateSpecToStation(spec, wp, true); + uint8_t map_spec_index = AllocateSpecToStation(spec, wp, true); Company *c = Company::Get(wp->owner); for (int i = 0; i < count; i++) { TileIndex tile = start_tile + i * offset; - byte old_specindex = HasStationTileRail(tile) ? GetCustomStationSpecIndex(tile) : 0; + uint8_t old_specindex = HasStationTileRail(tile) ? GetCustomStationSpecIndex(tile) : 0; if (!HasStationTileRail(tile)) c->infrastructure.station++; bool reserved = IsTileType(tile, MP_RAILWAY) ? HasBit(GetRailReservationTrackBits(tile), AxisToTrack(axis)) : @@ -361,8 +361,8 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint CommandCost CmdBuildRoadWaypoint(TileIndex start_tile, DoCommandFlag flags, uint32_t p1, uint32_t p2, uint64_t p3, const char *text, const CommandAuxiliaryBase *aux_data) { StationID station_to_join = GB(p2, 16, 16); - byte width = GB(p1, 0, 8); - byte height = GB(p1, 8, 8); + uint8_t width = GB(p1, 0, 8); + uint8_t height = GB(p1, 8, 8); bool adjacent = HasBit(p1, 16); Axis axis = Extract(p1); @@ -376,7 +376,7 @@ CommandCost CmdBuildRoadWaypoint(TileIndex start_tile, DoCommandFlag flags, uint const RoadStopSpec *spec = RoadStopClass::Get(spec_class)->GetSpec(spec_index); /* The number of parts to build */ - byte count = axis == AXIS_X ? height : width; + uint8_t count = axis == AXIS_X ? height : width; if ((axis == AXIS_X ? width : height) != 1) return CMD_ERROR; if (count == 0 || count > _settings_game.station.station_spread) return CMD_ERROR; @@ -455,7 +455,7 @@ CommandCost CmdBuildRoadWaypoint(TileIndex start_tile, DoCommandFlag flags, uint wp->UpdateVirtCoord(); - byte map_spec_index = AllocateRoadStopSpecToStation(spec, wp, true); + uint8_t map_spec_index = AllocateRoadStopSpecToStation(spec, wp, true); /* Check every tile in the area. */ for (TileIndex cur_tile : roadstop_area) { diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 195e6c0c93..d80214a261 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -44,7 +44,7 @@ struct DropdownWindow : Window { Rect wi_rect; ///< Rect of the button that opened the dropdown. DropDownList list; ///< List with dropdown menu items. int selected_result; ///< Result value of the selected item in the list. - byte click_delay = 0; ///< Timer to delay selection. + uint8_t click_delay = 0; ///< Timer to delay selection. bool drag_mode = true; DropDownModeFlags mode_flags; ///< Mode flags. int scrolling = 0; ///< If non-zero, auto-scroll the item list (one time). diff --git a/src/widgets/slider_func.h b/src/widgets/slider_func.h index 7de929512c..47cbcd1fab 100644 --- a/src/widgets/slider_func.h +++ b/src/widgets/slider_func.h @@ -18,7 +18,7 @@ void DrawSliderWidget(Rect r, int min_value, int max_value, int value, const std::map &labels); bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, int &value); -inline bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, byte &value) +inline bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, uint8_t &value) { int tmp_value = value; if (!ClickSliderWidget(r, pt, min_value, max_value, tmp_value)) return false; diff --git a/src/window.cpp b/src/window.cpp index 60427dc6e1..794bf7a41b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -80,7 +80,7 @@ Point _cursorpos_drag_start; int _scrollbar_start_pos; int _scrollbar_size; -byte _scroller_click_timeout = 0; +uint8_t _scroller_click_timeout = 0; Window *_scrolling_viewport; ///< A viewport is being scrolled with the mouse. Rect _scrolling_viewport_bound; ///< A viewport is being scrolled with the mouse, the overlay currently covers this viewport rectangle. @@ -1968,7 +1968,7 @@ void ResetWindowSystem() static void DecreaseWindowCounters() { - static byte hundredth_tick_timeout = 100; + static uint8_t hundredth_tick_timeout = 100; if (_scroller_click_timeout != 0) _scroller_click_timeout--; if (hundredth_tick_timeout != 0) hundredth_tick_timeout--; diff --git a/src/window_gui.h b/src/window_gui.h index 9294d52793..733a01d0ba 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -1103,7 +1103,7 @@ extern Point _cursorpos_drag_start; extern int _scrollbar_start_pos; extern int _scrollbar_size; -extern byte _scroller_click_timeout; +extern uint8_t _scroller_click_timeout; extern Window *_scrolling_viewport; extern Rect _scrolling_viewport_bound; diff --git a/src/zoom_type.h b/src/zoom_type.h index 68898dbf90..dd9c5fb593 100644 --- a/src/zoom_type.h +++ b/src/zoom_type.h @@ -16,7 +16,7 @@ static uint const ZOOM_LVL_SHIFT = 2; static int const ZOOM_LVL_BASE = 1 << ZOOM_LVL_SHIFT; /** All zoom levels we know. */ -enum ZoomLevel : byte { +enum ZoomLevel : uint8_t { /* Our possible zoom-levels */ ZOOM_LVL_BEGIN = 0, ///< Begin for iteration. ZOOM_LVL_NORMAL = 0, ///< The normal zoom level.