From 280dce95435091a2c0dc2f0a40dad197b71ffcfe Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 17 Sep 2023 17:42:34 +0100 Subject: [PATCH] Codechange: Reorder CargoSpec to reduce alignment padding. --- src/cargotype.h | 4 ++-- src/table/cargo_const.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargotype.h b/src/cargotype.h index 788a73046b..8173a646d0 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -54,12 +54,13 @@ static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invali /** Specification of a cargo type. */ struct CargoSpec { - uint8_t bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. CargoLabel label; ///< Unique label of the cargo type. + uint8_t bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. uint8_t legend_colour; uint8_t rating_colour; uint8_t weight; ///< Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). uint16_t multiplier{0x100}; ///< Capacity multiplier for vehicles. (8 fractional bits) + uint16_t classes; ///< Classes of this cargo type. @see CargoClass int32_t initial_payment; ///< Initial payment rate before inflation is applied. uint8_t transit_periods[2]; @@ -75,7 +76,6 @@ struct CargoSpec { SpriteID sprite; ///< Icon to display this cargo type, may be \c 0xFFF (which means to resolve an action123 chain). - uint16_t classes; ///< Classes of this cargo type. @see CargoClass const struct GRFFile *grffile; ///< NewGRF where #group belongs to. const struct SpriteGroup *group; diff --git a/src/table/cargo_const.h b/src/table/cargo_const.h index 55e9aa2c24..9d5c4ef0fe 100644 --- a/src/table/cargo_const.h +++ b/src/table/cargo_const.h @@ -44,9 +44,9 @@ * @param classes Classes of this cargo type. @see CargoClass */ #define MK(bt, label, colour, weight, mult, ip, td1, td2, freight, te, str_plural, str_singular, str_volume, classes) \ - {bt, label, colour, colour, weight, mult, ip, {td1, td2}, freight, te, 0, \ + {label, bt, colour, colour, weight, mult, classes, ip, {td1, td2}, freight, te, 0, \ MK_STR_CARGO_PLURAL(str_plural), MK_STR_CARGO_SINGULAR(str_singular), str_volume, MK_STR_QUANTITY(str_plural), MK_STR_ABBREV(str_plural), \ - MK_SPRITE(str_plural), classes, nullptr, nullptr, 0} + MK_SPRITE(str_plural), nullptr, nullptr, 0} /** Cargo types available by default. */ static const CargoSpec _default_cargo[] = {