Change: Increase object/station/roadstop class limit. (#12094)

The class limit is arbitrary and not stored in game state.

This change prevents all entities in classes after the 255th class from being dumped into the first class.
This commit is contained in:
Peter Nelson 2024-04-09 23:16:20 +01:00 committed by GitHub
parent df8eeb1b10
commit 1773c5b810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 18 deletions

View File

@ -45,10 +45,10 @@ static const uint8_t OBJECT_SIZE_1X1 = 0x11; ///< The value of a NewGRF's size p
void ResetObjects();
/** Class IDs for objects. */
enum ObjectClassID : uint8_t {
OBJECT_CLASS_BEGIN = 0, ///< The lowest valid value
OBJECT_CLASS_MAX = 0xFF, ///< Maximum number of classes.
INVALID_OBJECT_CLASS = 0xFF, ///< Class for the less fortunate.
enum ObjectClassID : uint16_t {
OBJECT_CLASS_BEGIN = 0, ///< The lowest valid value
OBJECT_CLASS_MAX = UINT16_MAX, ///< Maximum number of classes.
INVALID_OBJECT_CLASS = UINT16_MAX, ///< Class for the less fortunate.
};
/** Allow incrementing of ObjectClassID variables */
DECLARE_POSTFIX_INCREMENT(ObjectClassID)

View File

@ -22,11 +22,11 @@
/** The maximum amount of roadstops a single GRF is allowed to add */
static const int NUM_ROADSTOPS_PER_GRF = UINT16_MAX - 1;
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 (unimplemented: this is reserved for future use with road waypoints).
ROADSTOP_CLASS_MAX = 255, ///< Maximum number of classes.
enum RoadStopClassID : uint16_t {
ROADSTOP_CLASS_BEGIN = 0, ///< The lowest valid value
ROADSTOP_CLASS_DFLT = 0, ///< Default road stop class.
ROADSTOP_CLASS_WAYP, ///< Waypoint class (unimplemented: this is reserved for future use with road waypoints).
ROADSTOP_CLASS_MAX = UINT16_MAX, ///< Maximum number of classes.
};
DECLARE_POSTFIX_INCREMENT(RoadStopClassID)

View File

@ -80,11 +80,11 @@ struct StationResolverObject : public ResolverObject {
uint32_t GetDebugID() const override;
};
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.
enum StationClassID : uint16_t {
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
STAT_CLASS_DFLT = 0, ///< Default station class.
STAT_CLASS_WAYP, ///< Waypoint class.
STAT_CLASS_MAX = UINT16_MAX, ///< Maximum number of classes.
};
/** Allow incrementing of StationClassID variables */

View File

@ -14,7 +14,7 @@
#include "road_type.h"
#include "command_type.h"
enum RoadStopClassID : uint8_t;
enum RoadStopClassID : uint16_t;
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt);
void UpdateNearestTownForRoadTiles(bool invalidate);

View File

@ -13,8 +13,8 @@
#include "command_type.h"
#include "station_type.h"
enum StationClassID : uint8_t;
enum RoadStopClassID : uint8_t;
enum StationClassID : uint16_t;
enum RoadStopClassID : uint16_t;
extern Town *AirportGetNearestTown(const struct AirportSpec *as, Direction rotation, TileIndex tile, TileIterator &&it, uint &mindist);
extern uint8_t GetAirportNoiseLevelForDistance(const struct AirportSpec *as, uint distance);

View File

@ -13,7 +13,7 @@
#include "command_type.h"
#include "station_type.h"
enum StationClassID : uint8_t;
enum StationClassID : uint16_t;
CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis axis, uint8_t width, uint8_t height, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent);
CommandCost CmdRemoveFromRailWaypoint(DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail);