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();
|
||||
rs->cls_id = RoadStopClass::Allocate(BSWAP32(classid));
|
||||
rs->spec_id = id + i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -308,25 +308,15 @@ bool Convert8bitBooleanCallback(const struct GRFFile *grffile, uint16_t cbid, ui
|
|||
*/
|
||||
template <size_t Tcnt>
|
||||
struct GRFFilePropsBase {
|
||||
GRFFilePropsBase() : local_id(0), grffile(nullptr)
|
||||
{
|
||||
/* The lack of some compilers to provide default constructors complying to the specs
|
||||
* 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
|
||||
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
|
||||
std::array<const struct SpriteGroup *, Tcnt> spritegroup{}; ///< pointers to the different sprites of the entity
|
||||
};
|
||||
|
||||
/** Data related to the handling of grf files. */
|
||||
struct GRFFileProps : GRFFilePropsBase<1> {
|
||||
/** Set all default data constructor for the props. */
|
||||
GRFFileProps(uint16_t subst_id = 0) :
|
||||
GRFFilePropsBase<1>(), subst_id(subst_id), override(subst_id)
|
||||
{
|
||||
}
|
||||
constexpr GRFFileProps(uint16_t subst_id = 0) : subst_id(subst_id), override(subst_id) {}
|
||||
|
||||
uint16_t subst_id;
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
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) {
|
||||
const Engine *e = Engine::Get(engine_type);
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,6 @@ struct RoadStopSpec {
|
|||
*/
|
||||
GRFFilePropsBase<NUM_CARGO + 3> grf_prop;
|
||||
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
|
||||
|
||||
RoadStopAvailabilityType stop_type = ROADSTOPTYPE_ALL;
|
||||
|
|
|
@ -839,7 +839,7 @@ public:
|
|||
*/
|
||||
void ScrollTowards(size_type position)
|
||||
{
|
||||
if (position < this->GetPosition()) {
|
||||
if (position <= this->GetPosition()) {
|
||||
/* scroll up to the item */
|
||||
this->SetPosition(position);
|
||||
} else if (position >= this->GetPosition() + this->GetCapacity()) {
|
||||
|
|
Loading…
Reference in New Issue