src/newgrf_industries.cpp
branchnoai
changeset 11126 72d4c9314c72
parent 10920 e33442a2b239
equal deleted inserted replaced
11111:1b984dab8cec 11126:72d4c9314c72
   133 	return 0xFF << 8 | indtsp->grf_prop.subst_id; // so just give him the substitute
   133 	return 0xFF << 8 | indtsp->grf_prop.subst_id; // so just give him the substitute
   134 }
   134 }
   135 
   135 
   136 static uint32 GetClosestIndustry(TileIndex tile, IndustryType type, const Industry *current)
   136 static uint32 GetClosestIndustry(TileIndex tile, IndustryType type, const Industry *current)
   137 {
   137 {
   138 	uint32 best_dist = MAX_UVALUE(uint32);
   138 	uint32 best_dist = UINT32_MAX;
   139 	const Industry *i;
   139 	const Industry *i;
   140 	FOR_ALL_INDUSTRIES(i) {
   140 	FOR_ALL_INDUSTRIES(i) {
   141 		if (i->type != type || i == current) continue;
   141 		if (i->type != type || i == current) continue;
   142 
   142 
   143 		best_dist = min(best_dist, DistanceManhattan(tile, i->xy));
   143 		best_dist = min(best_dist, DistanceManhattan(tile, i->xy));
   156  */
   156  */
   157 static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout_filter, const Industry *current)
   157 static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout_filter, const Industry *current)
   158 {
   158 {
   159 	uint32 GrfID = GetRegister(0x100);  ///< Get the GRFID of the definition to look for in register 100h
   159 	uint32 GrfID = GetRegister(0x100);  ///< Get the GRFID of the definition to look for in register 100h
   160 	IndustryType ind_index;
   160 	IndustryType ind_index;
   161 	uint32 closest_dist = MAX_UVALUE(uint32);
   161 	uint32 closest_dist = UINT32_MAX;
   162 	byte count = 0;
   162 	byte count = 0;
   163 
   163 
   164 	/* Determine what will be the industry type to look for */
   164 	/* Determine what will be the industry type to look for */
   165 	switch (GrfID) {
   165 	switch (GrfID) {
   166 		case 0:  // this is a default industry type
   166 		case 0:  // this is a default industry type