mirror of https://github.com/OpenTTD/OpenTTD.git
Compare commits
4 Commits
0b2819ec83
...
78dac32d5d
Author | SHA1 | Date |
---|---|---|
Peter Nelson | 78dac32d5d | |
Peter Nelson | bf8de188ec | |
Peter Nelson | 72c55128d2 | |
Peter Nelson | a66b4f33d1 |
|
@ -4846,7 +4846,6 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, ByteR
|
||||||
|
|
||||||
uint32_t classid = buf->ReadDWord();
|
uint32_t classid = buf->ReadDWord();
|
||||||
rs->cls_id = RoadStopClass::Allocate(BSWAP32(classid));
|
rs->cls_id = RoadStopClass::Allocate(BSWAP32(classid));
|
||||||
rs->spec_id = id + i;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,25 +308,15 @@ bool Convert8bitBooleanCallback(const struct GRFFile *grffile, uint16_t cbid, ui
|
||||||
*/
|
*/
|
||||||
template <size_t Tcnt>
|
template <size_t Tcnt>
|
||||||
struct GRFFilePropsBase {
|
struct GRFFilePropsBase {
|
||||||
GRFFilePropsBase() : local_id(0), grffile(nullptr)
|
uint16_t local_id = 0; ///< id defined by the grf file for this entity
|
||||||
{
|
const struct GRFFile *grffile = nullptr; ///< grf file that introduced this entity
|
||||||
/* The lack of some compilers to provide default constructors complying to the specs
|
std::array<const struct SpriteGroup *, Tcnt> spritegroup{}; ///< pointers to the different sprites of the entity
|
||||||
* requires us to zero the stuff ourself. */
|
|
||||||
memset(spritegroup, 0, sizeof(spritegroup));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t local_id; ///< id defined by the grf file for this entity
|
|
||||||
const struct GRFFile *grffile; ///< grf file that introduced this entity
|
|
||||||
const struct SpriteGroup *spritegroup[Tcnt]; ///< pointer to the different sprites of the entity
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Data related to the handling of grf files. */
|
/** Data related to the handling of grf files. */
|
||||||
struct GRFFileProps : GRFFilePropsBase<1> {
|
struct GRFFileProps : GRFFilePropsBase<1> {
|
||||||
/** Set all default data constructor for the props. */
|
/** Set all default data constructor for the props. */
|
||||||
GRFFileProps(uint16_t subst_id = 0) :
|
constexpr GRFFileProps(uint16_t subst_id = 0) : subst_id(subst_id), override(subst_id) {}
|
||||||
GRFFilePropsBase<1>(), subst_id(subst_id), override(subst_id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t subst_id;
|
uint16_t subst_id;
|
||||||
uint16_t override; ///< id of the entity been replaced by
|
uint16_t override; ///< id of the entity been replaced by
|
||||||
|
|
|
@ -53,7 +53,7 @@ const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, Eng
|
||||||
void SetCustomEngineSprites(EngineID engine, uint8_t cargo, const SpriteGroup *group)
|
void SetCustomEngineSprites(EngineID engine, uint8_t cargo, const SpriteGroup *group)
|
||||||
{
|
{
|
||||||
Engine *e = Engine::Get(engine);
|
Engine *e = Engine::Get(engine);
|
||||||
assert(cargo < lengthof(e->grf_prop.spritegroup));
|
assert(cargo < std::size(e->grf_prop.spritegroup));
|
||||||
|
|
||||||
if (e->grf_prop.spritegroup[cargo] != nullptr) {
|
if (e->grf_prop.spritegroup[cargo] != nullptr) {
|
||||||
GrfMsg(6, "SetCustomEngineSprites: engine {} cargo {} already has group -- replacing", engine, cargo);
|
GrfMsg(6, "SetCustomEngineSprites: engine {} cargo {} already has group -- replacing", engine, cargo);
|
||||||
|
@ -1062,7 +1062,7 @@ VehicleResolverObject::VehicleResolverObject(EngineID engine_type, const Vehicle
|
||||||
if (this->root_spritegroup == nullptr) {
|
if (this->root_spritegroup == nullptr) {
|
||||||
const Engine *e = Engine::Get(engine_type);
|
const Engine *e = Engine::Get(engine_type);
|
||||||
CargoID cargo = v != nullptr ? v->cargo_type : SpriteGroupCargo::SG_PURCHASE;
|
CargoID cargo = v != nullptr ? v->cargo_type : SpriteGroupCargo::SG_PURCHASE;
|
||||||
assert(cargo < lengthof(e->grf_prop.spritegroup));
|
assert(cargo < std::size(e->grf_prop.spritegroup));
|
||||||
this->root_spritegroup = e->grf_prop.spritegroup[cargo] != nullptr ? e->grf_prop.spritegroup[cargo] : e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT];
|
this->root_spritegroup = e->grf_prop.spritegroup[cargo] != nullptr ? e->grf_prop.spritegroup[cargo] : e->grf_prop.spritegroup[SpriteGroupCargo::SG_DEFAULT];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,6 @@ struct RoadStopSpec {
|
||||||
*/
|
*/
|
||||||
GRFFilePropsBase<NUM_CARGO + 3> grf_prop;
|
GRFFilePropsBase<NUM_CARGO + 3> grf_prop;
|
||||||
RoadStopClassID cls_id; ///< The class to which this spec belongs.
|
RoadStopClassID cls_id; ///< The class to which this spec belongs.
|
||||||
int spec_id; ///< The ID of this spec inside the class.
|
|
||||||
StringID name; ///< Name of this stop
|
StringID name; ///< Name of this stop
|
||||||
|
|
||||||
RoadStopAvailabilityType stop_type = ROADSTOPTYPE_ALL;
|
RoadStopAvailabilityType stop_type = ROADSTOPTYPE_ALL;
|
||||||
|
|
|
@ -839,7 +839,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void ScrollTowards(size_type position)
|
void ScrollTowards(size_type position)
|
||||||
{
|
{
|
||||||
if (position < this->GetPosition()) {
|
if (position <= this->GetPosition()) {
|
||||||
/* scroll up to the item */
|
/* scroll up to the item */
|
||||||
this->SetPosition(position);
|
this->SetPosition(position);
|
||||||
} else if (position >= this->GetPosition() + this->GetCapacity()) {
|
} else if (position >= this->GetPosition() + this->GetCapacity()) {
|
||||||
|
|
Loading…
Reference in New Issue