src/newgrf.cpp
changeset 7183 a7182cc3a8ea
parent 7182 3cce857179f9
child 7217 ff5b3c502e84
equal deleted inserted replaced
7182:3cce857179f9 7183:a7182cc3a8ea
  4768 			if (hs->enabled && hs->min_date == 1930) hs->min_date = 0;
  4768 			if (hs->enabled && hs->min_date == 1930) hs->min_date = 0;
  4769 		}
  4769 		}
  4770 	}
  4770 	}
  4771 }
  4771 }
  4772 
  4772 
       
  4773 /** Add all new industries to the industry array. Industry properties can be set at any
       
  4774  * time in the GRF file, so we can only add a industry spec to the industry array
       
  4775  * after the file has finished loading. */
       
  4776 static void FinaliseIndustriesArray()
       
  4777 {
       
  4778 	for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
       
  4779 		if (file->industryspec != NULL) {
       
  4780 			for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
       
  4781 				IndustrySpec *indsp = file->industryspec[i];
       
  4782 
       
  4783 				if (indsp != NULL  && indsp->enabled) {
       
  4784 					_industry_mngr.SetEntitySpec(indsp);
       
  4785 					_loaded_newgrf_features.has_newindustries = true;
       
  4786 				}
       
  4787 			}
       
  4788 		}
       
  4789 
       
  4790 		if (file->indtspec != NULL) {
       
  4791 			for (int i = 0; i < NUM_INDUSTRYTILES; i++) {
       
  4792 				IndustryTileSpec *indtsp = file->indtspec[i];
       
  4793 				if (indtsp != NULL) {
       
  4794 					_industile_mngr.SetEntitySpec(indtsp);
       
  4795 				}
       
  4796 			}
       
  4797 		}
       
  4798 	}
       
  4799 }
  4773 
  4800 
  4774 /** Each cargo string needs to be mapped from TTDPatch to OpenTTD string IDs.
  4801 /** Each cargo string needs to be mapped from TTDPatch to OpenTTD string IDs.
  4775  * This is done after loading so that strings from Action 4 will be mapped
  4802  * This is done after loading so that strings from Action 4 will be mapped
  4776  * properly. */
  4803  * properly. */
  4777 static void MapNewCargoStrings()
  4804 static void MapNewCargoStrings()
  4974 	InitDepotWindowBlockSizes();
  5001 	InitDepotWindowBlockSizes();
  4975 
  5002 
  4976 	/* Add all new houses to the house array. */
  5003 	/* Add all new houses to the house array. */
  4977 	FinaliseHouseArray();
  5004 	FinaliseHouseArray();
  4978 
  5005 
       
  5006 	/* Add all new industries to the industry array. */
       
  5007 	FinaliseIndustriesArray();
       
  5008 
  4979 	/* Create dynamic list of industry legends for smallmap_gui.cpp */
  5009 	/* Create dynamic list of industry legends for smallmap_gui.cpp */
  4980 	BuildIndustriesLegend();
  5010 	BuildIndustriesLegend();
  4981 
  5011 
  4982 	/* Map cargo strings. This is a separate step because cargos are
  5012 	/* Map cargo strings. This is a separate step because cargos are
  4983 	 * loaded before strings... */
  5013 	 * loaded before strings... */