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

Function GetRoadVehIcon

src/roadveh_cmd.cpp:104–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static void GetRoadVehIcon(EngineID engine, EngineImageType image_type, VehicleSpriteSeq *result)
105{
106 const Engine *e = Engine::Get(engine);
107 uint8_t spritenum = e->VehInfo<RoadVehicleInfo>().image_index;
108
109 if (IsCustomVehicleSpriteNum(spritenum)) {
110 GetCustomVehicleIcon(engine, DIR_W, image_type, result);
111 if (result->IsValid()) return;
112
113 spritenum = e->original_image_index;
114 }
115
116 assert(IsValidImageIndex<VEH_ROAD>(spritenum));
117 result->Set(DIR_W + _roadveh_images[spritenum]);
118}
119
120void RoadVehicle::GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const
121{

Callers 2

DrawRoadVehEngineFunction · 0.85
GetRoadVehSpriteSizeFunction · 0.85

Calls 4

IsCustomVehicleSpriteNumFunction · 0.85
GetCustomVehicleIconFunction · 0.85
IsValidMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected