|
@@ -703,8 +703,7 @@ void StartupEngines()
|
|
|
}
|
|
|
|
|
|
/* Update the bitmasks for the vehicle lists */
|
|
|
Company *c;
|
|
|
FOR_ALL_COMPANIES(c) {
|
|
|
for (Company *c : Company::Iterate()) {
|
|
|
c->avail_railtypes = GetCompanyRailtypes(c->index);
|
|
|
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
|
|
}
|
|
@@ -763,8 +762,7 @@ static CompanyID GetPreviewCompany(Engin
|
|
|
CargoTypes cargomask = e->type != VEH_TRAIN ? GetUnionOfArticulatedRefitMasks(e->index, true) : ALL_CARGOTYPES;
|
|
|
|
|
|
int32 best_hist = -1;
|
|
|
const Company *c;
|
|
|
FOR_ALL_COMPANIES(c) {
|
|
|
for (const Company *c : Company::Iterate()) {
|
|
|
if (c->block_preview == 0 && !HasBit(e->preview_asked, c->index) &&
|
|
|
c->old_economy[0].performance_history > best_hist) {
|
|
|
|
|
@@ -806,8 +804,7 @@ static bool IsVehicleTypeDisabled(Vehicl
|
|
|
/** Daily check to offer an exclusive engine preview to the companies. */
|
|
|
void EnginesDailyLoop()
|
|
|
{
|
|
|
Company *c;
|
|
|
FOR_ALL_COMPANIES(c) {
|
|
|
for (Company *c : Company::Iterate()) {
|
|
|
c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes, _date);
|
|
|
c->avail_roadtypes = AddDateIntroducedRoadTypes(c->avail_roadtypes, _date);
|
|
|
}
|
|
@@ -908,13 +905,12 @@ CommandCost CmdWantEnginePreview(TileInd
|
|
|
static void NewVehicleAvailable(Engine *e)
|
|
|
{
|
|
|
Vehicle *v;
|
|
|
Company *c;
|
|
|
EngineID index = e->index;
|
|
|
|
|
|
/* In case the company didn't build the vehicle during the intro period,
|
|
|
* prevent that company from getting future intro periods for a while. */
|
|
|
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) {
|
|
|
FOR_ALL_COMPANIES(c) {
|
|
|
for (Company *c : Company::Iterate()) {
|
|
|
uint block_preview = c->block_preview;
|
|
|
|
|
|
if (!HasBit(e->company_avail, c->index)) continue;
|
|
@@ -948,11 +944,11 @@ static void NewVehicleAvailable(Engine *
|
|
|
/* maybe make another rail type available */
|
|
|
RailType railtype = e->u.rail.railtype;
|
|
|
assert(railtype < RAILTYPE_END);
|
|
|
FOR_ALL_COMPANIES(c) c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes | GetRailTypeInfo(e->u.rail.railtype)->introduces_railtypes, _date);
|
|
|
for (Company *c : Company::Iterate()) c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes | GetRailTypeInfo(e->u.rail.railtype)->introduces_railtypes, _date);
|
|
|
} else if (e->type == VEH_ROAD) {
|
|
|
/* maybe make another road type available */
|
|
|
assert(e->u.road.roadtype < ROADTYPE_END);
|
|
|
FOR_ALL_COMPANIES(c) c->avail_roadtypes = AddDateIntroducedRoadTypes(c->avail_roadtypes | GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes, _date);
|
|
|
for (Company* c : Company::Iterate()) c->avail_roadtypes = AddDateIntroducedRoadTypes(c->avail_roadtypes | GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes, _date);
|
|
|
}
|
|
|
|
|
|
/* Only broadcast event if AIs are able to build this vehicle type. */
|