industry_gui.cpp File Reference

GUIs related to industries. More...

#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
#include "command_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "industry.h"
#include "town.h"
#include "variables.h"
#include "cheat_type.h"
#include "newgrf.h"
#include "newgrf_industries.h"
#include "newgrf_text.h"
#include "strings_func.h"
#include "map_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 "table/strings.h"
#include "table/sprites.h"

Go to the source code of this file.

Data Structures

class  BuildIndustryWindow
class  IndustryViewWindow
class  IndustryDirectoryWindow
 The list of industries. More...

Typedefs

typedef GUIList< const Industry * > GUIIndustryList

Enumerations

enum  CargoSuffixType { CST_FUND, CST_VIEW, CST_DIR }
enum  DynamicPlaceIndustriesWidgets {
  DPIW_CLOSEBOX = 0, DPIW_CAPTION, DPIW_MATRIX_WIDGET, DPIW_SCROLLBAR,
  DPIW_INFOPANEL, DPIW_FUND_WIDGET, DPIW_RESIZE_WIDGET
}
 Names of the widgets of the dynamic place industries gui.
enum  IndustryViewWidgets {
  IVW_CLOSEBOX = 0, IVW_CAPTION, IVW_STICKY, IVW_BACKGROUND,
  IVW_VIEWPORT, IVW_INFO, IVW_GOTO, IVW_SPACER,
  IVW_RESIZE
}
 Names of the widgets of the view industry gui.
enum  IndustryDirectoryWidgets {
  IDW_CLOSEBOX = 0, IDW_CAPTION, IDW_STICKY, IDW_DROPDOWN_ORDER,
  IDW_DROPDOWN_CRITERIA, IDW_SPACER, IDW_INDUSTRY_LIST, IDW_SCROLLBAR,
  IDW_RESIZE
}
 Names of the widgets of the industry directory gui.

Functions

static StringID GetCargoSuffix (uint cargo, CargoSuffixType cst, Industry *ind, IndustryType ind_type, const IndustrySpec *indspec)
 Gets the string to display after the cargo name (using callback 37).
void ShowBuildIndustryWindow ()
static void UpdateIndustryProduction (Industry *i)
static bool IsProductionMinimum (const Industry *i, int pt)
static bool IsProductionMaximum (const Industry *i, int pt)
static bool IsProductionAlterable (const Industry *i)
void ShowIndustryViewWindow (int industry)
void ShowIndustryDirectory ()

Variables

bool _ignore_restrictions
static const Widget _build_industry_widgets []
 Widget definition of the dynamic place industries gui.
static const WindowDesc _build_industry_desc (WDP_AUTO, WDP_AUTO, 170, 212, 170, 212, WC_BUILD_INDUSTRY, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_RESIZABLE|WDF_CONSTRUCTION, _build_industry_widgets)
 Window definition of the dynamic place industries gui.
static const Widget _industry_view_widgets []
 Widget definition of the view industy gui.
static const WindowDesc _industry_view_desc (WDP_AUTO, WDP_AUTO, 260, 120, 260, 120, WC_INDUSTRY_VIEW, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_STICKY_BUTTON|WDF_RESIZABLE, _industry_view_widgets)
 Window definition of the view industy gui.
static const Widget _industry_directory_widgets []
 Widget definition of the industy directory gui.
static const WindowDesc _industry_directory_desc (WDP_AUTO, WDP_AUTO, 428, 190, 428, 190, WC_INDUSTRY_DIRECTORY, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_STICKY_BUTTON|WDF_RESIZABLE, _industry_directory_widgets)
 Window definition of the industy directory gui.


Detailed Description

GUIs related to industries.

Definition in file industry_gui.cpp.


Function Documentation

static StringID GetCargoSuffix ( uint  cargo,
CargoSuffixType  cst,
Industry ind,
IndustryType  ind_type,
const IndustrySpec indspec 
) [static]

Gets the string to display after the cargo name (using callback 37).

Parameters:
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
cst the cargo suffix type (for which window is it requested)
ind the industry (NULL if in fund window)
ind_type the industry type
indspec the industry spec
Returns:
the string to display

Definition at line 55 of file industry_gui.cpp.

References IndustrySpec::callback_flags, CBID_INDUSTRY_CARGO_SUFFIX, CBM_IND_CARGO_SUFFIX, GB(), GetGRFStringID(), IndustrySpec::grf_prop, GRFFileProps::grffile, HasBit(), INVALID_TILE, and Industry::xy.

Referenced by IndustryDirectoryWindow::OnPaint().


Variable Documentation

const Widget _build_industry_widgets[] [static]

Initial value:

 {
{   WWT_CLOSEBOX,    RESIZE_NONE,  COLOUR_DARK_GREEN,     0,    10,     0,    13, STR_00C5,                       STR_018B_CLOSE_WINDOW},            
{    WWT_CAPTION,   RESIZE_RIGHT,  COLOUR_DARK_GREEN,    11,   169,     0,    13, STR_0314_FUND_NEW_INDUSTRY,     STR_018C_WINDOW_TITLE_DRAG_THIS},  
{     WWT_MATRIX,      RESIZE_RB,  COLOUR_DARK_GREEN,     0,   157,    14,   118, 0x801,                          STR_INDUSTRY_SELECTION_HINT},      
{  WWT_SCROLLBAR,     RESIZE_LRB,  COLOUR_DARK_GREEN,   158,   169,    14,   118, 0x0,                            STR_0190_SCROLL_BAR_SCROLLS_LIST}, 
{      WWT_PANEL,     RESIZE_RTB,  COLOUR_DARK_GREEN,     0,   169,   119,   199, 0x0,                            STR_NULL},                         
{    WWT_TEXTBTN,     RESIZE_RTB,  COLOUR_DARK_GREEN,     0,   157,   200,   211, STR_FUND_NEW_INDUSTRY,          STR_NULL},                         
{  WWT_RESIZEBOX,    RESIZE_LRTB,  COLOUR_DARK_GREEN,   158,   169,   200,   211, 0x0,                            STR_RESIZE_BUTTON},                
{   WIDGETS_END},
}
Widget definition of the dynamic place industries gui.

Definition at line 76 of file industry_gui.cpp.

Initial value:

 {
{   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_BROWN,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},             
{    WWT_CAPTION,  RESIZE_RIGHT,  COLOUR_BROWN,    11,   415,     0,    13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},   
{  WWT_STICKYBOX,     RESIZE_LR,  COLOUR_BROWN,   416,   427,     0,    13, 0x0,                     STR_STICKY_BUTTON},                 

{    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_BROWN,     0,    80,    14,    25, STR_SORT_BY,             STR_SORT_ORDER_TIP},                
{   WWT_DROPDOWN,   RESIZE_NONE,  COLOUR_BROWN,    81,   243,    14,    25, 0x0,                     STR_SORT_CRITERIA_TIP},             
{      WWT_PANEL,  RESIZE_RIGHT,  COLOUR_BROWN,   244,   415,    14,    25, 0x0,                     STR_NULL},                          

{      WWT_PANEL,     RESIZE_RB,  COLOUR_BROWN,     0,   415,    26,   189, 0x0,                     STR_INDUSTRYDIR_LIST_CAPTION},      
{  WWT_SCROLLBAR,    RESIZE_LRB,  COLOUR_BROWN,   416,   427,    14,   177, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST},  
{  WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_BROWN,   416,   427,   178,   189, 0x0,                     STR_RESIZE_BUTTON},                 
{   WIDGETS_END},
}
Widget definition of the industy directory gui.

Definition at line 702 of file industry_gui.cpp.

const Widget _industry_view_widgets[] [static]

Initial value:

 {
{   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_CREAM,     0,    10,     0,    13, STR_00C5,          STR_018B_CLOSE_WINDOW},            
{    WWT_CAPTION,  RESIZE_RIGHT,  COLOUR_CREAM,    11,   247,     0,    13, STR_4801,          STR_018C_WINDOW_TITLE_DRAG_THIS},  
{  WWT_STICKYBOX,     RESIZE_LR,  COLOUR_CREAM,   248,   259,     0,    13, 0x0,               STR_STICKY_BUTTON},                
{      WWT_PANEL,     RESIZE_RB,  COLOUR_CREAM,     0,   259,    14,   105, 0x0,               STR_NULL},                         
{      WWT_INSET,     RESIZE_RB,  COLOUR_CREAM,     2,   257,    16,   103, 0x0,               STR_NULL},                         
{      WWT_PANEL,    RESIZE_RTB,  COLOUR_CREAM,     0,   259,   106,   107, 0x0,               STR_NULL},                         
{ WWT_PUSHTXTBTN,     RESIZE_TB,  COLOUR_CREAM,     0,   129,   108,   119, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON}, 
{      WWT_PANEL,    RESIZE_RTB,  COLOUR_CREAM,   130,   247,   108,   119, 0x0,               STR_NULL},                         
{  WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_CREAM,   248,   259,   108,   119, 0x0,               STR_RESIZE_BUTTON},                
{   WIDGETS_END},
}
Widget definition of the view industy gui.

Definition at line 662 of file industry_gui.cpp.


Generated on Sun Sep 13 08:19:24 2009 for OpenTTD by  doxygen 1.5.6