mirror of https://github.com/OpenTTD/OpenTTD
Fix: Bug where highlight would stay if you click multiple times on the open infrastructure button. Show owned road on level crossings
parent
804557721c
commit
fb44f5a074
|
@ -2175,6 +2175,15 @@ static void ShowCompanyInfrastructure(CompanyID company)
|
||||||
{
|
{
|
||||||
if (!Company::IsValidID(company)) return;
|
if (!Company::IsValidID(company)) return;
|
||||||
AllocateWindowDescFront<CompanyInfrastructureWindow>(&_company_infrastructure_desc, company);
|
AllocateWindowDescFront<CompanyInfrastructureWindow>(&_company_infrastructure_desc, company);
|
||||||
|
|
||||||
|
/* Check if already open then move up in the order */
|
||||||
|
auto to_moveup_in_order = std::find(_viewport_infrastructure_window_order.begin(), _viewport_infrastructure_window_order.end(), company);
|
||||||
|
|
||||||
|
/* Cautious error checking */
|
||||||
|
if (to_moveup_in_order != _viewport_infrastructure_window_order.end()) {
|
||||||
|
_viewport_infrastructure_window_order.erase(to_moveup_in_order);
|
||||||
|
}
|
||||||
|
|
||||||
_viewport_infrastructure_window_order.push_back(company);
|
_viewport_infrastructure_window_order.push_back(company);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1042,12 +1042,19 @@ static TileHighlightType GetTileHighlightType(TileIndex t)
|
||||||
if (!_viewport_infrastructure_window_order.empty()) {
|
if (!_viewport_infrastructure_window_order.empty()) {
|
||||||
switch (GetTileType(t)) {
|
switch (GetTileType(t)) {
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
/* Edge case of company owned tramway on non-company owned tile */
|
/* Edge case of company owned tramway on non-company owned road/rail tile */
|
||||||
if (IsTileType(t, MP_ROAD) && !IsRoadDepot(t) && HasTileRoadType(t, RTT_TRAM)) {
|
if (!IsRoadDepot(t) && HasTileRoadType(t, RTT_TRAM)) {
|
||||||
if (IsRoadOwner(t, RTT_TRAM, _viewport_infrastructure_window_order.back())) {
|
if (IsRoadOwner(t, RTT_TRAM, _viewport_infrastructure_window_order.back())) {
|
||||||
return THT_WHITE;
|
return THT_WHITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Edge case of company owned road on non-company owned rail tile */
|
||||||
|
if (!IsRoadDepot(t) && HasTileRoadType(t, RTT_ROAD)) {
|
||||||
|
if (IsRoadOwner(t, RTT_ROAD, _viewport_infrastructure_window_order.back())) {
|
||||||
|
return THT_WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
|
|
Loading…
Reference in New Issue