|
@@ -5,25 +5,25 @@
|
|
|
* 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.
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
/** @file newgrf_industries.cpp Handling of NewGRF industries. */
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "debug.h"
|
|
|
#include "tile_type.h"
|
|
|
#include "strings_type.h"
|
|
|
#include "company_type.h"
|
|
|
#include "industry_map.h"
|
|
|
#include "industry.h"
|
|
|
#include "newgrf.h"
|
|
|
#include "newgrf_industries.h"
|
|
|
#include "newgrf_commons.h"
|
|
|
#include "newgrf_text.h"
|
|
|
#include "newgrf_town.h"
|
|
|
#include "window_func.h"
|
|
|
#include "town.h"
|
|
|
#include "company_base.h"
|
|
|
#include "command_func.h"
|
|
|
#include "gui.h"
|
|
|
#include "strings_func.h"
|
|
|
|
|
@@ -233,33 +233,33 @@ uint32 IndustryGetVariable(const Resolve
|
|
|
|
|
|
return industry->founder | (is_ai ? 0x10000 : 0) | (colours << 24);
|
|
|
}
|
|
|
|
|
|
case 0x46: return industry->construction_date; // Date when built - long format - (in days)
|
|
|
|
|
|
/* Get industry ID at offset param */
|
|
|
case 0x60: return GetIndustryIDAtOffset(GetNearbyTile(parameter, industry->xy), industry);
|
|
|
|
|
|
/* Get random tile bits at offset param */
|
|
|
case 0x61:
|
|
|
tile = GetNearbyTile(parameter, tile);
|
|
|
return (IsTileType(tile, MP_INDUSTRY) && GetIndustryByTile(tile) == industry) ? GetIndustryRandomBits(tile) : 0;
|
|
|
return (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == industry) ? GetIndustryRandomBits(tile) : 0;
|
|
|
|
|
|
/* Land info of nearby tiles */
|
|
|
case 0x62: return GetNearbyIndustryTileInformation(parameter, tile, INVALID_INDUSTRY);
|
|
|
|
|
|
/* Animation stage of nearby tiles */
|
|
|
case 0x63:
|
|
|
tile = GetNearbyTile(parameter, tile);
|
|
|
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryByTile(tile) == industry) {
|
|
|
if (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == industry) {
|
|
|
return GetIndustryAnimationState(tile);
|
|
|
}
|
|
|
return 0xFFFFFFFF;
|
|
|
|
|
|
/* Distance of nearest industry of given type */
|
|
|
case 0x64: return GetClosestIndustry(tile, MapNewGRFIndustryType(parameter, indspec->grf_prop.grffile->grfid), industry);
|
|
|
/* Get town zone and Manhattan distance of closest town */
|
|
|
case 0x65: return GetTownRadiusGroup(industry->town, tile) << 16 | min(DistanceManhattan(tile, industry->town->xy), 0xFFFF);
|
|
|
/* Get square of Euclidian distance of closes town */
|
|
|
case 0x66: return GetTownRadiusGroup(industry->town, tile) << 16 | min(DistanceSquare(tile, industry->town->xy), 0xFFFF);
|
|
|
|
|
|
/* Count of industry, distance of closest instance
|