/*
 * This file is part of the OpenGFX+ Industries NewGRF.
 * OpenGFX+ Industries 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 or - upon your discretion - any later version.
 * OpenGFX+ Industries 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 OpenGFX+ Industries. If not, see <http://www.gnu.org/licenses/>.
 */

/* This NewGRF currently does not work properly in toyland
 * climate. Disable it in that case
 */

if (climate == CLIMATE_TOYLAND) {
	error(FATAL, string(STR_ERR_NO_TOYLAND));
}



/* Define a better tree for the forest, 
 * depending on the NewGRF loaded
 */

#define default_tree_base 1709
#define ogfxtrees_tree_base 1716
#define stolentrees_tree_base 1709

#define default_tree_base_tropical 1870
#define ogfxtrees_tree_base_tropical 1870
#define stolentrees_tree_base_tropical 1870

#define tree_base_sprite param[30]
tree_base_sprite = (climate == CLIMATE_TROPICAL) ? default_tree_base_tropical : default_tree_base;

/* OpenGFX+ Trees uses different tree sprites. Choose another
 * one which looks better as forest tree sprite
 */
if (grf_future_status("\46\72\78\06")) {
	tree_base_sprite = (climate == CLIMATE_TROPICAL) ? ogfxtrees_tree_base_tropical : ogfxtrees_tree_base;
}

/* Stolen Trees also looks better with another sprite */
if (grf_future_status("\4D\66\6F\01")) {
	tree_base_sprite = (climate == CLIMATE_TROPICAL) ? stolentrees_tree_base_tropical : stolentrees_tree_base;
}

 
/* Check for the presence of other industry sets
 * We're incompatible with these
 */

/* Oil wells decreaser */
if (grf_future_status("\53\5A\13\44")) {
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Oil wells decrease neutralizer");
}

/* FIRS */
if (grf_future_status("\F1\25\00\05") || // version 0.1.x
	grf_future_status("\F1\25\00\04") || // version 0.2.x
	grf_future_status("\F1\25\00\20") || // version 0.3.x
	grf_future_status("\F1\25\00\12")) { // versions >= 0.4.0
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "FIRS");
}

/* ECS */
if (grf_future_status("\4D\65\6F\91") || // ECS town vector
	grf_future_status("\4D\65\6F\92") || // ECS basic vector
	grf_future_status("\4D\65\6F\94") || // ECS machinery vector
	grf_future_status("\4D\65\6F\95") || // ECS wood vector
	grf_future_status("\4D\65\6F\96") || // ECS construction vector
	grf_future_status("\4D\65\6F\97") || // ECS agricultural vector
	grf_future_status("\4D\65\6F\98") || // ECS basic vector for arctic
	grf_future_status("\4D\65\6F\9B") || // ECS construction vector by Pikka
	grf_future_status("\4D\65\6F\9C") || // ECS chemical vector II
	grf_future_status("\4D\65\6F\9F")) { // ECS basic vector II
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "ECS");
}

/* Manual industries */
if (grf_future_status("\66\72\4D\49")) { // nightly r-5
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Manual industries");
}

/* YETI */
if (grf_future_status("\56\42\03\03")) { // versions 0.0.5, 0.0.9, 0.1.0
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Yeti");
}

/* Manpower industries */
if (grf_future_status("\4D\63\4D\69")) { // version 1.4
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Manpower OpenGfx+Industries");
}

/* "Experts" NewGRFs */
if (grf_future_status("\45\48\01\01") || // Experts hard industries 0.4
	grf_future_status("\45\58\01\02")) { // Ex's city builder 0.3
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "'Experts' NewGRFs");
}

/* Luukland's City Builders NewGRFs */
if (grf_future_status("\53\4B\05\01") || // version 1.3
	grf_future_status("\4A\53\0A\02")) { // version 1.4
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Luukland City Builder");
}

/* OpenGFX Industries (old pre OpenGFX stuff) */
if (grf_future_status("\52\57\13\05")) {
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "OpenGFX newIndustries");
}

/* PBI */
if (grf_future_status("\44\44\06\02")) {
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Pikka's Basic Industries");
}

/* Nearby station names */
if (grf_future_status("\41\4C\01\01")) {
	error(FATAL, string(STR_ERR_INCOMPATIBLE_NEWGRF), "Station's name from nearby industries");
}

/* TTRS */
ENABLE_TTRS_COMPATIBILITY = 0;
if (grf_future_status("\56\43\00\01")) { // version 3.1.1
    error(NOTICE, string(STR_WARNING_TTRS_COMPATIBILITY));
	ENABLE_TTRS_COMPATIBILITY = 1;
}
