mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-25 16:35:59 +00:00
Codechange: use static_cast/to_underlying when converting Direction
This commit is contained in:
committed by
Peter Nelson
parent
0e0e8056a7
commit
356ca9c6d9
@@ -813,7 +813,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
|
||||
case 0x1C: return v->y_pos;
|
||||
case 0x1D: return GB(v->y_pos, 8, 8);
|
||||
case 0x1E: return v->z_pos;
|
||||
case 0x1F: return object->rotor_in_gui ? DIR_W : v->direction; // for rotors the spriteset contains animation frames, so NewGRF need a different way to tell the helicopter orientation.
|
||||
case 0x1F: return to_underlying(object->rotor_in_gui ? Direction::W : v->direction); // for rotors the spriteset contains animation frames, so NewGRF need a different way to tell the helicopter orientation.
|
||||
case 0x20: break; // not implemented
|
||||
case 0x21: break; // not implemented
|
||||
case 0x22: break; // not implemented
|
||||
@@ -1120,7 +1120,7 @@ static void GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction d
|
||||
const auto *group = object.Resolve<ResultSpriteGroup>();
|
||||
int32_t reg100 = sprite_stack ? object.GetRegister(0x100) : 0;
|
||||
if (group != nullptr && group->num_sprites != 0) {
|
||||
result->seq[result->count].sprite = group->sprite + (direction % group->num_sprites);
|
||||
result->seq[result->count].sprite = group->sprite + (to_underlying(direction) % group->num_sprites);
|
||||
result->seq[result->count].pal = GB(reg100, 0, 16); // zero means default recolouring
|
||||
result->count++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user