* Forbids engine \a eid to be used by a company \a company. * @param eid The engine to disable. * @param company The company to forbid using the engine. */
| 856 | * @param company The company to forbid using the engine. |
| 857 | */ |
| 858 | static void DisableEngineForCompany(EngineID eid, CompanyID company) |
| 859 | { |
| 860 | Engine *e = Engine::Get(eid); |
| 861 | Company *c = Company::Get(company); |
| 862 | |
| 863 | e->company_avail.Reset(company); |
| 864 | if (e->type == VEH_TRAIN) { |
| 865 | c->avail_railtypes = GetCompanyRailTypes(c->index); |
| 866 | } else if (e->type == VEH_ROAD) { |
| 867 | c->avail_roadtypes = GetCompanyRoadTypes(c->index); |
| 868 | } |
| 869 | |
| 870 | if (company == _local_company) { |
| 871 | ClearLastVariant(e->index, e->type); |
| 872 | AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type); |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | /** |
| 877 | * Company \a company accepts engine \a eid for preview. |
no test coverage detected