|
|
/* $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.
|
|
|
* 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 industry_gui.cpp GUIs related to industries. */
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "openttd.h"
|
|
|
#include "gui.h"
|
|
|
#include "sound_func.h"
|
|
|
#include "window_func.h"
|
|
|
#include "textbuf_gui.h"
|
|
|
#include "command_func.h"
|
|
|
#include "viewport_func.h"
|
|
|
#include "gfx_func.h"
|
|
|
#include "industry.h"
|
|
|
#include "town.h"
|
|
|
#include "cheat_type.h"
|
|
|
#include "newgrf.h"
|
|
|
#include "newgrf_industries.h"
|
|
|
#include "newgrf_text.h"
|
|
|
#include "newgrf_debug.h"
|
|
|
#include "strings_func.h"
|
|
|
#include "company_func.h"
|
|
|
#include "tilehighlight_func.h"
|
|
|
#include "string_func.h"
|
|
|
#include "sortlist_type.h"
|
|
|
#include "widgets/dropdown_func.h"
|
|
|
#include "company_base.h"
|
|
|
#include "core/geometry_func.hpp"
|
|
|
#include "core/random_func.hpp"
|
|
|
#include "core/backup_type.hpp"
|
|
|
#include "genworld.h"
|
|
|
#include "smallmap_gui.h"
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
#include "table/sprites.h"
|
|
|
|
|
|
bool _ignore_restrictions;
|
|
|
uint64 _displayed_industries; ///< Communication from the industry chain window to the smallmap window about what industries to display.
|
|
|
|
|
|
assert_compile(NUM_INDUSTRYTYPES <= 64); // Make sure all industry types fit in _displayed_industries.
|
|
|
|
|
|
/** Cargo suffix type (for which window is it requested) */
|
|
|
enum CargoSuffixType {
|
|
|
CST_FUND, ///< Fund-industry window
|
|
|
CST_VIEW, ///< View-industry window
|
|
|
CST_DIR, ///< Industry-directory window
|
|
|
};
|
|
|
|
|
|
static void ShowIndustryCargoesWindow(IndustryType id);
|
|
|
|
|
|
/**
|
|
|
* Gets the string to display after the cargo name (using callback 37)
|
|
|
* @param cargo the cargo for which the suffix is requested
|
|
|
* - 00 - first accepted cargo type
|
|
|
* - 01 - second accepted cargo type
|
|
|
* - 02 - third accepted cargo type
|
|
|
* - 03 - first produced cargo type
|
|
|
* - 04 - second produced cargo type
|
|
|
* @param cst the cargo suffix type (for which window is it requested). @see CargoSuffixType
|
|
|
* @param ind the industry (NULL if in fund window)
|
|
|
* @param ind_type the industry type
|
|
|
* @param indspec the industry spec
|
|
|
* @param suffix is filled with the string to display
|
|
|
* @param suffix_last lastof(suffix)
|
|
|
*/
|