mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Be consistent with how company masks are set to all.
parent
08977828cc
commit
65e0b0dcb7
|
@ -675,7 +675,7 @@ void StartupOneEngine(Engine *e, Date aging_date, uint32 seed)
|
||||||
e->intro_date = ei->base_intro <= ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro;
|
e->intro_date = ei->base_intro <= ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro;
|
||||||
if (e->intro_date <= _date) {
|
if (e->intro_date <= _date) {
|
||||||
e->age = (aging_date - e->intro_date) >> 5;
|
e->age = (aging_date - e->intro_date) >> 5;
|
||||||
e->company_avail = (CompanyMask)-1;
|
e->company_avail = MAX_UVALUE(CompanyMask);
|
||||||
e->flags |= ENGINE_AVAILABLE;
|
e->flags |= ENGINE_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ static void AcceptEnginePreview(EngineID eid, CompanyID company, int recursion_d
|
||||||
Engine *e = Engine::Get(eid);
|
Engine *e = Engine::Get(eid);
|
||||||
|
|
||||||
e->preview_company = INVALID_COMPANY;
|
e->preview_company = INVALID_COMPANY;
|
||||||
e->preview_asked = (CompanyMask)-1;
|
e->preview_asked = MAX_UVALUE(CompanyMask);
|
||||||
|
|
||||||
EnableEngineForCompany(eid, company);
|
EnableEngineForCompany(eid, company);
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ void EnginesDailyLoop()
|
||||||
e->preview_company = GetPreviewCompany(e);
|
e->preview_company = GetPreviewCompany(e);
|
||||||
|
|
||||||
if (e->preview_company == INVALID_COMPANY) {
|
if (e->preview_company == INVALID_COMPANY) {
|
||||||
e->preview_asked = (CompanyMask)-1;
|
e->preview_asked = MAX_UVALUE(CompanyMask);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1028,7 +1028,7 @@ static void NewVehicleAvailable(Engine *e)
|
||||||
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
|
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
|
||||||
|
|
||||||
/* Now available for all companies */
|
/* Now available for all companies */
|
||||||
e->company_avail = (CompanyMask)-1;
|
e->company_avail = MAX_UVALUE(CompanyMask);
|
||||||
|
|
||||||
/* Do not introduce new rail wagons */
|
/* Do not introduce new rail wagons */
|
||||||
if (IsWagon(index)) return;
|
if (IsWagon(index)) return;
|
||||||
|
|
|
@ -286,7 +286,7 @@ RoadTypes ExistingRoadTypes(CompanyID c)
|
||||||
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
|
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
|
||||||
|
|
||||||
/* Check whether available for all potential companies */
|
/* Check whether available for all potential companies */
|
||||||
if (e->company_avail != (CompanyMask)-1) continue;
|
if (e->company_avail != MAX_UVALUE(CompanyMask)) continue;
|
||||||
|
|
||||||
known_roadtypes |= GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes;
|
known_roadtypes |= GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2011,15 +2011,15 @@ bool AfterLoadGame()
|
||||||
|
|
||||||
/* More companies ... */
|
/* More companies ... */
|
||||||
for (Company *c : Company::Iterate()) {
|
for (Company *c : Company::Iterate()) {
|
||||||
if (c->bankrupt_asked == 0xFF) c->bankrupt_asked = 0xFFFF;
|
if (c->bankrupt_asked == 0xFF) c->bankrupt_asked = MAX_UVALUE(CompanyMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Engine *e : Engine::Iterate()) {
|
for (Engine *e : Engine::Iterate()) {
|
||||||
if (e->company_avail == 0xFF) e->company_avail = 0xFFFF;
|
if (e->company_avail == 0xFF) e->company_avail = MAX_UVALUE(CompanyMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Town *t : Town::Iterate()) {
|
for (Town *t : Town::Iterate()) {
|
||||||
if (t->have_ratings == 0xFF) t->have_ratings = 0xFFFF;
|
if (t->have_ratings == 0xFF) t->have_ratings = MAX_UVALUE(CompanyMask);
|
||||||
for (uint i = 8; i != MAX_COMPANIES; i++) t->ratings[i] = RATING_INITIAL;
|
for (uint i = 8; i != MAX_COMPANIES; i++) t->ratings[i] = RATING_INITIAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ struct ENGNChunkHandler : ChunkHandler {
|
||||||
* Just cancel any previews. */
|
* Just cancel any previews. */
|
||||||
e->flags &= ~4; // ENGINE_OFFER_WINDOW_OPEN
|
e->flags &= ~4; // ENGINE_OFFER_WINDOW_OPEN
|
||||||
e->preview_company = INVALID_COMPANY;
|
e->preview_company = INVALID_COMPANY;
|
||||||
e->preview_asked = (CompanyMask)-1;
|
e->preview_asked = MAX_UVALUE(CompanyMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,7 @@ static bool FixTTOEngines()
|
||||||
/* Make sure for example monorail and maglev are available when they should be */
|
/* Make sure for example monorail and maglev are available when they should be */
|
||||||
if (_date >= e->intro_date && HasBit(e->info.climates, 0)) {
|
if (_date >= e->intro_date && HasBit(e->info.climates, 0)) {
|
||||||
e->flags |= ENGINE_AVAILABLE;
|
e->flags |= ENGINE_AVAILABLE;
|
||||||
e->company_avail = (CompanyMask)0xFF;
|
e->company_avail = MAX_UVALUE(CompanyMask);
|
||||||
e->age = _date > e->intro_date ? (_date - e->intro_date) / 30 : 0;
|
e->age = _date > e->intro_date ? (_date - e->intro_date) / 30 : 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -438,7 +438,7 @@ static bool FixTTOEngines()
|
||||||
* if at least one of them was available. */
|
* if at least one of them was available. */
|
||||||
for (uint j = 0; j < lengthof(tto_to_ttd); j++) {
|
for (uint j = 0; j < lengthof(tto_to_ttd); j++) {
|
||||||
if (tto_to_ttd[j] == i && _old_engines[j].company_avail != 0) {
|
if (tto_to_ttd[j] == i && _old_engines[j].company_avail != 0) {
|
||||||
e->company_avail = (CompanyMask)0xFF;
|
e->company_avail = MAX_UVALUE(CompanyMask);
|
||||||
e->flags |= ENGINE_AVAILABLE;
|
e->flags |= ENGINE_AVAILABLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ static bool FixTTOEngines()
|
||||||
}
|
}
|
||||||
|
|
||||||
e->preview_company = INVALID_COMPANY;
|
e->preview_company = INVALID_COMPANY;
|
||||||
e->preview_asked = (CompanyMask)-1;
|
e->preview_asked = MAX_UVALUE(CompanyMask);
|
||||||
e->preview_wait = 0;
|
e->preview_wait = 0;
|
||||||
e->name = std::string{};
|
e->name = std::string{};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue