src/industry_gui.cpp
branchcustombridgeheads
changeset 5650 aefc131bf5ce
parent 5649 55c8267c933f
child 5852 cb3f71b16e1a
equal deleted inserted replaced
5649:55c8267c933f 5650:aefc131bf5ce
    14 #include "command.h"
    14 #include "command.h"
    15 #include "viewport.h"
    15 #include "viewport.h"
    16 #include "industry.h"
    16 #include "industry.h"
    17 #include "town.h"
    17 #include "town.h"
    18 #include "variables.h"
    18 #include "variables.h"
       
    19 #include "helpers.hpp"
    19 
    20 
    20 const byte _build_industry_types[4][12] = {
    21 const byte _build_industry_types[4][12] = {
    21 	{  1,  2,  4,  6,  8,  0,  3,  5,  9, 11, 18 },
    22 	{  1,  2,  4,  6,  8,  0,  3,  5,  9, 11, 18 },
    22 	{  1, 14,  4, 13,  7,  0,  3,  9, 11, 15 },
    23 	{  1, 14,  4, 13,  7,  0,  3,  9, 11, 15 },
    23 	{ 25, 13,  4, 23, 22, 11, 17, 10, 24, 19, 20, 21 },
    24 	{ 25, 13,  4, 23, 22, 11, 17, 10, 24, 19, 20, 21 },
   557 
   558 
   558 	/* Don't attempt a sort if there are no industries */
   559 	/* Don't attempt a sort if there are no industries */
   559 	if (GetNumIndustries() == 0) return;
   560 	if (GetNumIndustries() == 0) return;
   560 
   561 
   561 	/* Create array for sorting */
   562 	/* Create array for sorting */
   562 	_industry_sort = realloc((void *)_industry_sort, (GetMaxIndustryIndex() + 1) * sizeof(_industry_sort[0]));
   563 	ReallocT(&_industry_sort, GetMaxIndustryIndex() + 1);
   563 	if (_industry_sort == NULL) error("Could not allocate memory for the industry-sorting-list");
   564 	if (_industry_sort == NULL) error("Could not allocate memory for the industry-sorting-list");
   564 
   565 
   565 	FOR_ALL_INDUSTRIES(i) _industry_sort[n++] = i;
   566 	FOR_ALL_INDUSTRIES(i) _industry_sort[n++] = i;
   566 
   567 
   567 	_num_industry_sort = n;
   568 	_num_industry_sort = n;