Update to 1.10.0-beta2
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
@@ -146,6 +144,8 @@ Industry::~Industry()
|
||||
* Also we must not decrement industry counts in that case. */
|
||||
if (this->location.w == 0) return;
|
||||
|
||||
const bool has_neutral_station = this->neutral_station != nullptr;
|
||||
|
||||
TILE_AREA_LOOP(tile_cur, this->location) {
|
||||
if (IsTileType(tile_cur, MP_INDUSTRY)) {
|
||||
if (GetIndustryIndex(tile_cur) == this->index) {
|
||||
@@ -159,7 +159,7 @@ Industry::~Industry()
|
||||
}
|
||||
}
|
||||
|
||||
if (this->neutral_station != nullptr) {
|
||||
if (has_neutral_station) {
|
||||
/* Remove possible docking tiles */
|
||||
TILE_AREA_LOOP(tile_cur, this->location) {
|
||||
ClearDockingTilesCheckingNeighbours(tile_cur);
|
||||
@@ -1203,8 +1203,7 @@ void OnTick_Industry()
|
||||
|
||||
if (_game_mode == GM_EDITOR) return;
|
||||
|
||||
Industry *i;
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
for (Industry *i : Industry::Iterate()) {
|
||||
ProduceIndustryGoods(i);
|
||||
}
|
||||
}
|
||||
@@ -1391,8 +1390,7 @@ static CommandCost FindTownForIndustry(TileIndex tile, int type, Town **t)
|
||||
|
||||
if (_settings_game.economy.multiple_industry_per_town) return CommandCost();
|
||||
|
||||
const Industry *i;
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
for (const Industry *i : Industry::Iterate()) {
|
||||
if (i->type == (byte)type && i->town == *t) {
|
||||
*t = nullptr;
|
||||
return_cmd_error(STR_ERROR_ONLY_ONE_ALLOWED_PER_TOWN);
|
||||
@@ -1629,11 +1627,11 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags,
|
||||
static CommandCost CheckIfFarEnoughFromConflictingIndustry(TileIndex tile, int type)
|
||||
{
|
||||
const IndustrySpec *indspec = GetIndustrySpec(type);
|
||||
const Industry *i = nullptr;
|
||||
|
||||
/* On a large map with many industries, it may be faster to check an area. */
|
||||
static const int dmax = 14;
|
||||
if (Industry::GetNumItems() > (size_t) (dmax * dmax * 2)) {
|
||||
const Industry* i = nullptr;
|
||||
TileArea tile_area = TileArea(tile, 1, 1).Expand(dmax);
|
||||
TILE_AREA_LOOP(atile, tile_area) {
|
||||
if (GetTileType(atile) == MP_INDUSTRY) {
|
||||
@@ -1651,7 +1649,7 @@ static CommandCost CheckIfFarEnoughFromConflictingIndustry(TileIndex tile, int t
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
for (const Industry *i : Industry::Iterate()) {
|
||||
/* Within 14 tiles from another industry is considered close */
|
||||
if (DistanceMax(tile, i->location.tile) > 14) continue;
|
||||
|
||||
@@ -2504,9 +2502,8 @@ static int WhoCanServiceIndustry(Industry *ind)
|
||||
{
|
||||
if (ind->stations_near.size() == 0) return 0; // No stations found at all => nobody services
|
||||
|
||||
const Vehicle *v;
|
||||
int result = 0;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
for (const Vehicle *v : Vehicle::Iterate()) {
|
||||
/* Is it worthwhile to try this vehicle? */
|
||||
if (v->owner != _local_company && result != 0) continue;
|
||||
|
||||
@@ -2833,8 +2830,7 @@ void IndustryMonthlyLoop()
|
||||
|
||||
_industry_builder.MonthlyLoop();
|
||||
|
||||
Industry *i;
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
for (Industry *i : Industry::Iterate()) {
|
||||
UpdateIndustryStatistics(i);
|
||||
if (i->prod_level == PRODLEVEL_CLOSURE) {
|
||||
delete i;
|
||||
|
||||
Reference in New Issue
Block a user