See: https://github.com/OpenTTD/OpenTTD/issues/9935 (cherry picked from commit c3f55d53405af04bfe928d9e1a815e06c187ca50)