Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Recompute road/railtype availability after disabling the engine #8872

Merged
merged 1 commit into from Mar 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/engine.cpp
Expand Up @@ -747,8 +747,14 @@ static void EnableEngineForCompany(EngineID eid, CompanyID company)
static void DisableEngineForCompany(EngineID eid, CompanyID company)
{
Engine *e = Engine::Get(eid);
Company *c = Company::Get(company);

ClrBit(e->company_avail, company);
if (e->type == VEH_TRAIN) {
c->avail_railtypes = GetCompanyRailtypes(c->index);
} else if (e->type == VEH_ROAD) {
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
}

if (company == _local_company) {
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
Expand Down