MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetCustomStationFoundationRelocation

Function GetCustomStationFoundationRelocation

src/newgrf_station.cpp:646–657  ·  view source on GitHub ↗

* Resolve the sprites for custom station foundations. * @param statspec Station spec * @param st Station * @param tile Station tile being drawn * @param layout Spritelayout as returned by previous callback * @param edge_info Information about northern tile edges; whether they need foundations or merge into adjacent tile's foundations. * @return First sprite of a set of foundation sprites for

Source from the content-addressed store, hash-verified

644 * @return First sprite of a set of foundation sprites for various slopes, or 0 if default foundations shall be drawn.
645 */
646SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info)
647{
648 /* callback_param1 == 2 means we are resolving the foundation sprites. */
649 StationResolverObject object(statspec, st, tile, CBID_NO_CALLBACK, 2, layout | (edge_info << 16));
650
651 const auto *group = object.Resolve<ResultSpriteGroup>();
652 /* Note: SpriteGroup::Resolve zeroes all registers, so register 0x100 is initialised to 0. (compatibility) */
653 uint32_t offset = static_cast<uint32_t>(object.GetRegister(0x100));
654 if (group == nullptr || group->num_sprites <= offset) return 0;
655
656 return group->sprite + offset;
657}
658
659
660uint16_t GetStationCallback(CallbackID callback, uint32_t param1, uint32_t param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, std::span<int32_t> regs100)

Callers 1

Calls 1

GetRegisterMethod · 0.80

Tested by

no test coverage detected